zsyOAOA / DifFace

DifFace: Blind Face Restoration with Diffused Error Contraction (TPAMI, 2024)
Other
628 stars 42 forks source link

cv2.error: OpenCV(4.8.0) :-1: error: (-5:Bad argument) in function 'imencode' > Overload resolution failed: > - Can't parse 'params'. Sequence item with index 1 has a wrong type > - Can't parse 'params'. Sequence item with index 1 has a wrong type #16

Open dqyyds opened 1 year ago

dqyyds commented 1 year ago

I met this problem when I tried to run the command CUDA_VISIBLE_DEVICES=0 python main_sr.py --cfg_path configs/training/swinir_ffhq512.yaml --save_dir save_dir_1 Could someone help me solve it?

zsyOAOA commented 1 year ago

It seems that opencv failed to read your image. Please have a try read your image with opencv.

dqyyds commented 1 year ago

File "/home/ubuntu/extend/dq/newest/DifFace-master/datapipe/ffhq_degradation_dataset.py", line 176, in getitem img_lq = degradations.random_add_jpg_compression(img_lq, self.jpeg_range) File "/home/ubuntu/extend/dq/newest/DifFace-master/basicsr/data/degradations.py", line 764, in random_add_jpg_compression return add_jpg_compression(img, quality) File "/home/ubuntu/extend/dq/newest/DifFace-master/basicsr/data/degradations.py", line 745, in add_jpgcompression , encimg = cv2.imencode('.jpg', img * 255., encode_param) cv2.error: OpenCV(4.8.0) :-1: error: (-5:Bad argument) in function 'imencode'

Overload resolution failed:

  • Can't parse 'params'. Sequence item with index 1 has a wrong type
  • Can't parse 'params'. Sequence item with index 1 has a wrong type

It shows that there is a problem here, but I see that there is no problem with the code, can you tell me the version of opencv you are using

dqyyds commented 1 year ago

It solved. Thank you! It's a problem with the opencv version