DonaldRR / SimpleNet

MIT License
429 stars 63 forks source link

How to make a simple prediction on a single image after training? #56

Closed felipebattist closed 9 months ago

felipebattist commented 9 months ago

I have trained a model. The code saves the .pth file in a directory. But I am having trouble trying to simply load the model and predict a single image. The code only saves the Discriminator.

felipebattist commented 9 months ago

I achieved single-image predictions by instantiating an instance of the simplenet class. Subsequently, I loaded the Discriminator from the saved .pth file and assigned it to the simplenet instance. Following this, I applied the necessary torch transformations to the image and called the simplenet._predict function to obtain the score for the image.

boxbox2 commented 4 months ago

Hi, can you show me your code? I also encountered this problem