VinAIResearch / CPM

💄 Lipstick ain't enough: Beyond Color-Matching for In-the-Wild Makeup Transfer (CVPR 2021)
https://thaoshibe.github.io/CPM
Apache License 2.0
367 stars 58 forks source link

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

Open Zalmighty opened 10 months ago

Zalmighty commented 10 months ago

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 commented 10 months ago

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 commented 7 months ago

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