Lornatang / SRGAN-PyTorch

A simple and complete implementation of super-resolution paper.
Apache License 2.0
410 stars 105 forks source link

AssertionError: Supplied images have different sizes #65

Closed blue2339 closed 1 year ago

blue2339 commented 1 year ago

Hello, when I use ImageNet dataset to train the network, such an error occurred. How should I solve it? Thanks!

Traceback (most recent call last): File "/root/autodl-tmp/srgan/train_srresnet.py", line 331, in main() File "/root/autodl-tmp/srgan/train_srresnet.py", line 101, in main psnr, ssim = validate(srresnet_model, File "/root/autodl-tmp/srgan/train_srresnet.py", line 298, in validate psnr = psnr_model(sr, gt) File "/root/miniconda3/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1190, in _call_impl return forward_call(*input, **kwargs) File "/root/autodl-tmp/srgan/image_quality_assessment.py", line 416, in forward psnr_metrics = _psnr_torch(raw_tensor, dst_tensor, self.crop_border, self.only_test_y_channel) File "/root/autodl-tmp/srgan/image_quality_assessment.py", line 376, in _psnr_torch _check_tensor_shape(raw_tensor, dst_tensor) File "/root/autodl-tmp/srgan/image_quality_assessment.py", line 357, in _check_tensor_shape assert raw_tensor.shape == dst_tensor.shape, \ AssertionError: Supplied images have different sizes torch.Size([1, 3, 504, 504]) and torch.Size([1, 3, 288, 288])

Lornatang commented 1 year ago

Check LR and GT image size