-
-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can I get an output of image coordinates of the detected objects with unique id and corresponding frame number in a text file or excel file? #108
Comments
👋 Hello @zsefvbhu, thank you for raising an issue about Ultralytics HUB 🚀! Please visit https://ultralytics.com/hub to learn more, and see our ⭐️ HUB Guidelines to quickly get started uploading datasets and training YOLOv5 models. If this is a 🐛 Bug Report, please provide screenshots and steps to recreate your problem to help us get started working on a fix. If this is a ❓ Question, please provide as much information as possible, including dataset, model, environment details etc. so that we might provide the most helpful response. We try to respond to all issues as promptly as possible. Thank you for your patience! |
@zsefvbhu Thanks for the question. Currently the only way would be to split your video into frames and run inference on each frame. This sounds like an interesting task and I will look into it more, perhaps we can handle everything for you on the server and just send back the results from your uploaded video. |
@zsefvbhu you can't do this in HUB yet, but you can download your HUB model and use it with the YOLOv5 repo, i.e. with detect.py for videos using --save-txt to output to text file, or using PyTorch Hub inference for the most flexibility (recommended). YOLOv5 🚀 PyTorch Hub models allow for simple model loading and inference in a pure python environment without using Simple Inference ExampleThis example loads a pretrained YOLOv5s model from PyTorch Hub as import torch
# Model
model = torch.hub.load('ultralytics/yolov5', 'yolov5s') # yolov5n - yolov5x6 official model
# 'custom', 'path/to/best.pt') # custom model
# Images
im = 'https://ultralytics.com/images/zidane.jpg' # or file, Path, URL, PIL, OpenCV, numpy, list
# Inference
results = model(im)
# Results
results.print() # or .show(), .save(), .crop(), .pandas(), etc.
results.xyxy[0] # im predictions (tensor)
results.pandas().xyxy[0] # im predictions (pandas)
# xmin ymin xmax ymax confidence class name
# 0 749.50 43.50 1148.0 704.5 0.874023 0 person
# 2 114.75 195.75 1095.0 708.0 0.624512 0 person
# 3 986.00 304.00 1028.0 420.0 0.286865 27 tie
results.pandas().xyxy[0].value_counts('name') # class counts (pandas)
# person 2
# tie 1 See YOLOv5 PyTorch Hub Tutorial for details. Good luck 🍀 and let us know if you have any other questions! |
How can i run this model in a video file? |
@zsefvbhu Using YOLOv5 you just need to use the correct arguments. In addition pass in your weights.
|
no loop through frame is required? result = model(vid)?? |
@zsefvbhu Sorry I misunderstood you, this will generate frames with the bounding boxes overlayed. It will not return the data for plotting. |
Ok, I actually need those pixel coordinates like Xmin, Ymin, Xmax, Ymax for those detection bounding boxes |
👋 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. Access additional YOLOv5 🚀 resources:
Access additional Ultralytics ⚡ resources:
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 ⭐! |
@zsefvbhu you can run inference on a video file with the YOLOv5 PyTorch Hub model to obtain the bounding box coordinates for each detection. After loading your model using the For processing the video, you would typically use either OpenCV or a similar library to read the video frame by frame, perform inference on each frame using the model, and then collect the results. The Remember that iterating through video frames and processing them is not a feature directly provided by YOLOv5's PyTorch Hub interface but can be accomplished with additional coding. You have to extract and handle the video frames and the loop mechanism in your script. The |
Search before asking
Description
Can I get an output of image coordinates of the detected objects with a unique id and corresponding frame number in a text file or excel file? ClearML gives the output of training results, but I want output of detections detected in a video.
Use case
No response
Additional
No response
The text was updated successfully, but these errors were encountered: