Closed osushilover closed 2 years ago
From the error log RuntimeError: stack expects each tensor to be equal size, but got [1, 3, 352, 352] at entry 0 and [1, 3, 604, 900] at entry 2
, it seems that the images you put in the folder do not have the same size. You may need to check for the size of the images.
Regarding the path results/demo_000
, the inference code should have created the folder in line 133.
Thank you for your kind answer, and this issue was cleared. It was a problem caused by my own inability to decipher that error message. Please forgive my lack of programming skills.
I am a colab user. I uploaded my own images to the folder "demo_000" and tried to infer, but it didn't work. The inference worked for the pre-prepared images.
Here is traceback. """
2022-01-13 13:16:36,348 - mmedit - INFO - load checkpoint from torchvision path: torchvision://vgg19 load checkpoint from local path: checkpoints/RealBasicVSR_x4.pth Traceback (most recent call last): File "inference_realbasicvsr.py", line 144, in
main()
File "inference_realbasicvsr.py", line 97, in main
inputs = torch.stack(inputs, dim=1)
RuntimeError: stack expects each tensor to be equal size, but got [1, 3, 352, 352] at entry 0 and [1, 3, 604, 900] at entry 2
\n# show the first image as an example\nimport mmcv\nimport matplotlib.pyplot as plt\n\nimg_input = mmcv.imread('data/demo_000/00000000.png', channel_order='rgb') \nimg_output = mmcv.imread('results/demo_000/00000000.png', channel_order='rgb') \n\nfig = plt.figure(figsize=(25, 20))\nax1 = fig.add_subplot(2, 1, 1) \nplt.title('Input image', fontsize=16)\nax1.axis('off')\nax2 = fig.add_subplot(2, 1, 2)\nplt.title('RealBasicVSR output', fontsize=16)\nax2.axis('off')\nax1.imshow(img_input)\nax2.imshow(img_output)\n
""" Note that the current ipynb file does not have a script to generate "results/demo_000". Please add mkdir codes if you can.