CPM icon indicating copy to clipboard operation
CPM copied to clipboard

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

Open Zalmighty opened this issue 2 years ago • 2 comments

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 avatar Oct 26 '23 15:10 Zalmighty

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

Zalmighty avatar Oct 26 '23 15:10 Zalmighty

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))

keith2018 avatar Jan 24 '24 07:01 keith2018