DifFace icon indicating copy to clipboard operation
DifFace copied to clipboard

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

Open dqyyds opened this issue 1 year ago • 3 comments

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?

dqyyds avatar Jul 22 '23 06:07 dqyyds

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

zsyOAOA avatar Jul 22 '23 07:07 zsyOAOA

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_jpg_compression _, 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 avatar Jul 22 '23 07:07 dqyyds

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

dqyyds avatar Jul 22 '23 07:07 dqyyds