A trick for using YOLOv5
source link: https://donghao.org/2022/09/30/a-trick-for-using-yolov5/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
A trick for using YOLOv5
To detect birds and squirrels, we created a dataset to train the YOLOv5 model. After a week’s training with:
python3 -u train.py --data coco.yaml --cfg yolov5s.yaml --weights '' --batch-size 28 --workers 1
python3 -u train.py --data coco.yaml --cfg yolov5s.yaml --weights '' --batch-size 28 --workers 1
The model could recognize birds and squirrels properly except only for this image:
Why does the model recognize the right-side significant squirrel as a bird? Even though I tried a bigger model, the result was the same…
Only after researching the parameters of the function model()
of YOLOv5, I found out we can use a different image size: 960 for detecting.
import inspect import torch import cv2 model = torch.hub.load('.', 'custom', path='last.pt', source='local') #model = torch.hub.load('ultralytics/yolov5', 'yolov5s') model.eval() image = cv2.imread(img) results = model(img, size=960) results.show()
import inspect
import torch
import cv2
model = torch.hub.load('.', 'custom', path='last.pt', source='local')
#model = torch.hub.load('ultralytics/yolov5', 'yolov5s')
model.eval()
image = cv2.imread(img)
results = model(img, size=960)
results.show()
The result is below for model(img, size=960)
Hmm, seems the single-stage YOLOv5 model is nearsighted, just like me…
Related Posts
- The awesome YOLOv5
I just found a repository YOLOv5 from Github. It's not just the models are accurate…
- Export YOLOv5 models for mobile device
Somebody has finished the work about exporting YOLOv5 models to tflite model. To use it,…
- Model saving error when using Apex
Apex is a tool to enable mixed-precision training that comes from Nvidia. import apex.amp as…
September 30, 2022 - 4:32
RobinDong
machine learning
YOLO, YOLOv5
Leave a comment
Leave a Reply Cancel reply
Your email address will not be published. Required fields are marked *
Comment *
Name *
Email *
Website
Save my name, email, and website in this browser for the next time I comment.
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK