Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RuntimeError: Unsupported image type, must be 8bit gray or RGB image. #34

Open
Zalmighty opened this issue Oct 26, 2023 · 2 comments
Open

Comments

@Zalmighty
Copy link

Traceback (most recent call last): File "main.py", line 34, in <module> model.prn_process(imgA) File "/data1/CPM/makeup.py", line 57, in prn_process self.pos = self.prn.process(self.face) File "/data1/CPM/utils/api.py", line 107, in process detected_faces = self.dlib_detect(image) File "/data1/CPM/utils/api.py", line 56, in dlib_detect return self.face_detector(image, 1) RuntimeError: Unsupported image type, must be 8bit gray or RGB image.

img_v2_e0aba768-04ac-4eb3-9722-8e845381477g
img_v2_230f2005-8a15-4dff-a850-babc4d6c9f9g

@Zalmighty
Copy link
Author

I use my images to test, same error occurs above, I don`t know how to deal with it = =!
CUDA_VISIBLE_DEVICES=0 python main.py --style ./imgs/style-1.png --input ./imgs/test.png

@keith2018
Copy link

in main.py

add .convert('RGB') will fix it

if __name__ == "__main__":
    args = get_args()
    model = Makeup(args)

    imgA = np.array(Image.open(args.input).convert('RGB'))
    imgB = np.array(Image.open(args.style).convert('RGB'))
    imgB = cv2.resize(imgB, (256, 256))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants