OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

How to use pt file

  • Thread starter Thread starter Haya Hesham
  • Start date Start date
H

Haya Hesham

Guest
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.

Code:
import torch

# Model
model=torch.load('E:\_best.pt')

# Images
imgs=['E:\Study\currency.jpg']

# Inference
results = model(imgs)

# Results
results.print()
results.save()  # or .show()
results.show()
results.xyxy[0]  # img1 predictions (tensor)
results.pandas().xyxy[0]
<p>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?</p>
<p>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.</p>
<pre><code>import torch

# Model
model=torch.load('E:\_best.pt')

# Images
imgs=['E:\Study\currency.jpg']

# Inference
results = model(imgs)

# Results
results.print()
results.save() # or .show()
results.show()
results.xyxy[0] # img1 predictions (tensor)
results.pandas().xyxy[0]
</code></pre>
 

Latest posts

B
Replies
0
Views
1
Blundering Ecologist
B
Top