Cyanogenoid / pytorch-vqa

Strong baseline for visual question answering
238 stars 97 forks source link

Test the model #8

Open souravsuresh opened 6 years ago

souravsuresh commented 6 years ago

Can you specify how exactly can i test the model i.e given an image with question the model is expected to return answers with confidence.

varunnrao commented 6 years ago

Yes, please let us know how to test the model, since your repository does not have any instructions on how to test. Instructions stop after you mention how to train and the log file is generated.

varunnrao commented 6 years ago

So, we'd like to know how to specify our own image and a series of questions to obtain answers with confidence after the model has been trained.

BA3000 commented 5 years ago

I think we can test in this way. First, modify the preprocess-images.py for preprocessing any given image, then use a method similar to the one difined in preprocess-vocab.py for preprocessing question. Finally, load and switch the model to evaluate mode and feed image feature and question for getting the output. With the result we get from our model, which is supposed to be an index, we can "translate" it into a specific answer with using the vocab.json, which is defined in the config.py and works like a dictionary.

puzex commented 3 years ago

I think we can test in this way. First, modify the preprocess-images.py for preprocessing any given image, then use a method similar to the one difined in preprocess-vocab.py for preprocessing question. Finally, load and switch the model to evaluate mode and feed image feature and question for getting the output. With the result we get from our model, which is supposed to be an index, we can "translate" it into a specific answer with using the vocab.json, which is defined in the config.py and works like a dictionary.

I have the same question for long time.Have you solved this problem?

BA3000 commented 3 years ago

I think we can test in this way. First, modify the preprocess-images.py for preprocessing any given image, then use a method similar to the one difined in preprocess-vocab.py for preprocessing question. Finally, load and switch the model to evaluate mode and feed image feature and question for getting the output. With the result we get from our model, which is supposed to be an index, we can "translate" it into a specific answer with using the vocab.json, which is defined in the config.py and works like a dictionary.

I have the same question for long time.Have you solved this problem?

yes, but I did not keep the code, so I cannot post it. it is actually quite easy to test the model, all you need is the trained model, load it and switch it to test mode. then load the test dataset and feed these data to the model for predicting answers. save the predictions as a JSON file then upload them to the VQA server. you will be able to see the resulted accuracy from the output of the VQA server.