You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have searched the YOLOv5 issues and discussions and found no similar questions.
Question
Greetings,
I would like to know if there's a way to save the object-detected square box in a video as a picture in a folder.
what I mean is to save each object detected in each frame of the video that I run yolov5 on, as a picture by itself in a specific folder so that I can use them for another purpose later.
Thank you.
Additional
No response
The text was updated successfully, but these errors were encountered:
👋 Hello! Thanks for asking about cropping results with YOLOv5 🚀. Cropping bounding box detections can be useful for training classification models on box contents for example. This feature was added in PR #2827. You can crop detections using either detect.py or YOLOv5 PyTorch Hub:
detect.py
Crops will be saved under runs/detect/exp/crops, with a directory for each class detected.
python detect.py --save-crop
YOLOv5 PyTorch Hub
Crops will be saved under runs/detect/exp/crops if save=True, and also returned as a dictionary with crops as numpy arrays.
importtorch# Modelmodel=torch.hub.load('ultralytics/yolov5', 'yolov5s') # or yolov5m, yolov5l, yolov5x, custom# Imagesimg='https://ultralytics.com/images/zidane.jpg'# or file, Path, PIL, OpenCV, numpy, list# Inferenceresults=model(img)
# Resultscrops=results.crop(save=True)
# -- or --crops=results.crop(save=True, save_dir='runs/detect/exp') # specify save dir
Good luck 🍀 and let us know if you have any other questions!
👋 Hello, this issue has been automatically marked as stale because it has not had recent activity. Please note it will be closed if no further activity occurs.
Feel free to inform us of any other issues you discover or feature requests that come to mind in the future. Pull Requests (PRs) are also always welcomed!
Thank you for your contributions to YOLOv5 🚀 and Vision AI ⭐!
Search before asking
Question
Greetings,
I would like to know if there's a way to save the object-detected square box in a video as a picture in a folder.
what I mean is to save each object detected in each frame of the video that I run yolov5 on, as a picture by itself in a specific folder so that I can use them for another purpose later.
Thank you.
Additional
No response
The text was updated successfully, but these errors were encountered: