torralba-lab / im2recipe-Pytorch

im2recipe Pytorch implementation
MIT License
270 stars 100 forks source link

Recipe Visulization and new Prediction #15

Open demdecuong opened 5 years ago

demdecuong commented 5 years ago

I am using Ubuntu 18.04,Pytorch 0.4.1, Py27, no cuda In test.py, i have deleted all line which format is ".cuda()" since my local computer is not suit the GPU way. Moreover , i haved modified the batch_size in agr.py = 1 instead of 160. Then, i meet the problem in : File "test.py", line 107, in test output = model(input_var[0],input_var[1], input_var[2], input_var[3], input_var[4]) IndexError: list index out of range

This the whole process with the command : python test.py --model_path=snapshots/model_e500_v-8.950.pth.tar => loading checkpoint 'snapshots/model_e500_v-8.950.pth.tar' => loaded checkpoint 'snapshots/model_e500_v-8.950.pth.tar' (epoch 500) /home/minh/anaconda2/envs/im2recipe/lib/python2.7/site-packages/torchvision/transforms/transforms.py:188: UserWarning: The use of the transforms.Scale transform is deprecated, please use transforms.Resize instead. "please use transforms.Resize instead.") Test loader prepared. Exception OSError: OSError(104, 'Connection reset by peer') in <bound method _DataLoaderIter.del of <torch.utils.data.dataloader._DataLoaderIter object at 0x7f1a29958810>> ignored Traceback (most recent call last): File "test.py", line 179, in main() File "test.py", line 81, in main test(test_loader, model, criterion) File "test.py", line 107, in test output = model(input_var[0],input_var[1], input_var[2], input_var[3], input_var[4]) IndexError: list index out of range

Please give me some advices , Thanks anyway !

nhynes commented 5 years ago

Hi! Thanks for the issue report. Do you know which of the inputs to model(...) are out of range? You can find this out by adding

from IPython import embed
embed()

before line 107 in test.py. That'll spawn an interpreter in which you can probe each of the inputs.

demdecuong commented 5 years ago

Hi! Thanks for the issue report. Do you know which of the inputs to model(...) are out of range? You can find this out by adding

from IPython import embed
embed()

before line 107 in test.py. That'll spawn an interpreter in which you can probe each of the inputs.

Thanks you. I realize that the target_val type is long while input_val type is float which is the main problem

nhynes commented 5 years ago

Cool. Glad you were able to solve your problem. I'm tentatively closing this issue but you should feel free to reopen it if you run into any trouble.

demdecuong commented 5 years ago

I has taken a course project on my university (University of Science_HCMUS) which we should follow and analyze a science paper in our favor topic. And i choose your paper as the best one since i am a food lover .

I am running the your pretrained model (model_e500_v-8.950.pth.tar) well now.However , i would like to see the visualization off this trained model and view the dataset recipe.Cause i try alot to open the .mdb file on ubuntu but no one is effective enough. Could you send me some python code for this issue.

Moreover, i wonder if i want to have a new predict one,what size of image i should prepared. Please give me some advices ?

Btw,I had read the issue #13 ( https://github.com/torralba-lab/im2recipe-Pytorch/issues/13?fbclid=IwAR0Y7eGzSQ4rPgLp6YN0uIaWc4WkofdRGFJvEwIYo1YSuR9DHhzQHLZSLx4) but i can not get it well :(

Merry Christmas