icandle / CAMixerSR

CAMixerSR: Only Details Need More “Attention” (CVPR 2024)
https://arxiv.org/abs/2402.19289
Apache License 2.0
225 stars 13 forks source link

About image size error #29

Open ZhenyuSun-Walker opened 1 month ago

ZhenyuSun-Walker commented 1 month ago

Hello sir, when I run the command python basicsr/test.py -opt options/test/test_x4.yml, I found that there is assertion error: Traceback (most recent call last): File "/home/sunzhenyu/Projects/CAMixerSR/codes/basicsr/test.py", line 11, in <module> test_pipeline(root_path) File "/home/sunzhenyu/anaconda3/envs/CAMixerSR/lib/python3.9/site-packages/basicsr/test.py", line 40, in test_pipeline model.validation(test_loader, current_iter=opt['name'], tb_logger=None, save_img=opt['val']['save_img']) File "/home/sunzhenyu/anaconda3/envs/CAMixerSR/lib/python3.9/site-packages/basicsr/models/base_model.py", line 48, in validation self.nondist_validation(dataloader, current_iter, tb_logger, save_img) File "/home/sunzhenyu/anaconda3/envs/CAMixerSR/lib/python3.9/site-packages/basicsr/models/sr_model.py", line 188, in nondist_validation self.metric_results[name] += calculate_metric(metric_data, opt_) File "/home/sunzhenyu/anaconda3/envs/CAMixerSR/lib/python3.9/site-packages/basicsr/metrics/__init__.py", line 19, in calculate_metric metric = METRIC_REGISTRY.get(metric_type)(**data, **opt) File "/home/sunzhenyu/anaconda3/envs/CAMixerSR/lib/python3.9/site-packages/basicsr/metrics/psnr_ssim.py", line 28, in calculate_psnr assert img.shape == img2.shape, (f'Image shapes are different: {img.shape}, {img2.shape}.') AssertionError: Image shapes are different: (3872, 16384, 3), (968, 4096, 3).

icandle commented 1 month ago

It is due to the size mismatch for LR and HR images. To solve the problem, make sure the images in LR fold are 1/factors large of ones in HR fold.