ð Bug
Images grabbed with mss need to be converted to RGB before being fed as input to torch's models
However the proposed solution to do this conversion to RGB does not work img2 = cv2.imread('bus.jpg')[:, :, ::-1]
Instead, this has to be used:
result = model(cv2.cvtColor(scr, cv2.COLOR_BGR2RGB), size=400)
To Reproduce (REQUIRED)
Input:
See full code and resolution on SO
Output:
result.show() outputting a non-normal color channel image, with dramatically reduced model accuracy of course (since it was trained on normal color channels).
Expected behavior
Converting the image to RGB using result = model(cv2.cvtColor(scr, cv2.COLOR_BGR2RGB), size=400) fixed the problem.
- TorchHub shows a normal image with
result.show()
- Accuracy of the model back to normal
Environment
If applicable, add screenshots to help explain your problem.
- OS: [Windows 10]
- GPU [e.g. RTX 2080 SUPER]
ð Bug
Images grabbed with
mssneed to be converted to RGB before being fed as input totorch'smodelsHowever the proposed solution to do this conversion to RGB does not work
img2 = cv2.imread('bus.jpg')[:, :, ::-1]Instead, this has to be used:
result = model(cv2.cvtColor(scr, cv2.COLOR_BGR2RGB), size=400)To Reproduce (REQUIRED)
Input:
See full code and resolution on SO
Output:
result.show()outputting a non-normal color channel image, with dramatically reduced model accuracy of course (since it was trained on normal color channels).Expected behavior
Converting the image to RGB using
result = model(cv2.cvtColor(scr, cv2.COLOR_BGR2RGB), size=400)fixed the problem.result.show()Environment
If applicable, add screenshots to help explain your problem.