Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AssertionError: size of input tensor and input format are different. #5

Open
Marshall-yao opened this issue Sep 10, 2019 · 9 comments

Comments

@Marshall-yao
Copy link

Hi ,thanks for your wonderful work .

When i retrained the work, I downloaded datasets and put them into data/origin dirctory.

Then i pretrained the code with command of python train.py --phase pretrain --learning_rate 1e-4.

However, it gave the error as follows:
Model check_point/my_model. Epoch [1/200]. Learning rate: 0.0001
100%|████████████████████████████████████████████████████████████████████████| 1000/1000 [04:41<00:00, 3.56it/s]
Finish train [1/200]. Loss: 8.88

Validating...
0%| | 0/10 [00:02<?, ?it/s]
Traceback (most recent call last):
File "train.py", line 314, in
main()
File "train.py", line 291, in main
update_tensorboard(epoch, tb, i, lr, sr, hr)
File "/home/18PESR-master/utils.py", line 47, in update_tensorboard
tb.add_image(str(img_idx) + '_LR', inp, epoch)
File "/home/anaconda3/lib/python3.5/site-packages/tensorboardX/writer.py", line 548, in add_image
image(tag, img_tensor, dataformats=dataformats), global_step, walltime)
File "/home/anaconda3/lib/python3.5/site-packages/tensorboardX/summary.py", line 211, in image
tensor = convert_to_HWC(tensor, dataformats)
File "/home/anaconda3/lib/python3.5/site-packages/tensorboardX/utils.py", line 103, in convert_to_HWC
tensor shape: {}, input_format: {}".format(tensor.shape, input_format)

AssertionError: size of input tensor and input format are different. tensor shape: (1, 3, 155, 103), input_format: CHW

Did you have any idea about this question?

Thanks .
Best regards.

@thangvubk
Copy link
Owner

As the error suggests, it might due to the format of the output is not compatible with the required format for tensorboard visualization. I will check and let you know.

@Marshall-yao
Copy link
Author

@thangvubk

Thanks for your reply.

I have been solved this problem .There is no bug about your code .

@thangvubk
Copy link
Owner

Nice :)

@Marshall-yao
Copy link
Author

Thanks .

Do you have any idea about my another problem of finetune ? I googled , but have not found solution.

@thangvubk
Copy link
Owner

what is the problem?

@Marshall-yao
Copy link
Author

#6

the new question released on your project PESR github .

@songyi1999
Copy link

@thangvubk

Thanks for your reply.

I have been solved this problem .There is no bug about your code .

I also encountered the same problem. What is your solution?

@Aaradhy8989
Copy link

@thangvubk

Thanks for your reply.

I have been solved this problem .There is no bug about your code .

I also encountered the same problem, how to tackle it?

@thangvubk
Copy link
Owner

@Aaradhy8989 @songyi1999,
can you post the error log here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants