Hello,
I have referred this url :https://pytorch.org/tutorials/beginner/transfer_learning_tutorial.html
and made a model for a dataset.My data set folder contain train,val and test folders.How can I test this model using my test images?
Thanks
Hello,
I have referred this url :https://pytorch.org/tutorials/beginner/transfer_learning_tutorial.html
and made a model for a dataset.My data set folder contain train,val and test folders.How can I test this model using my test images?
Thanks
Hello @Adon_Augustin
Testing the model on images set follows the same process as validation as given in the url shared by you. All you need to do is create test DataLoader(if you have many images) and pass it to the model and obtain the output.
The output from the model will have class probabilities (batch_size x no.Classes) and using torch.max(model_output,1) returns the max_probability for a class and index.
Ex:
max_value, max_index = torch.max(model_output,1)
you can use the max_index to get the class name for particular input.
class_names[max_index]
where class_names is a list contains all class names.
For reference see the last test code cell in this GitHub code link
Let me know if you face any issues!
Thank you let me try that