Skip to content
Advertisement

How to use pt file

I’m trying to make a currency recognition model and I did so using a dataset on kaggle and colab using yolov5 and I exactly carried out the steps explained on yolov5 github. At the end, I downloaded a .pt file which has the weights of the model and now I want to use it in python file to detect and recognize currency . How to do this?

I am a beginner in computer vision and I am totally confused about what to do. I am searching over and over but I don’t reach anything.

JavaScript

Advertisement

Answer

If you want to read trained parameters from .pt file and load it into your model, you could do the following.

JavaScript

before calling load_state_dict(), be sure that the .pt file contains only model parameters, otherwise, error occurs. This can be checked by print(torch.load(file)).

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement