Skip to content
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

Is there a way different than Pandas to read bounding box data? #7368

Closed
1 task done
RRighart opened this issue Apr 10, 2022 · 4 comments
Closed
1 task done

Is there a way different than Pandas to read bounding box data? #7368

RRighart opened this issue Apr 10, 2022 · 4 comments
Labels
question Further information is requested Stale

Comments

@RRighart
Copy link

Search before asking

Question

I am using Yolov5 for training and torch.hub.load for loading the trained model.
Using Pandas, I am able to get a nice table with boundary box information.

results = model(img, size=640)
df = results.pandas().xyxy[0]

As Pandas can become memory intense, I was wondering if there is a different way of loading the same data, using for example Numpy. I would be very grateful for any useful reference on this topic!

Additional

No response

@RRighart RRighart added the question Further information is requested label Apr 10, 2022
@glenn-jocher
Copy link
Member

glenn-jocher commented Apr 10, 2022

@RRighart see PyTorch Hub Tutorial for readout options.

YOLOv5 Tutorials

Good luck 🍀 and let us know if you have any other questions!

@RRighart
Copy link
Author

Thank you ! I have seen the PyTorch Hub Tutorial.
Actually I realise that the Numpy solution depends on counting and selecting the right columns manually, which can be dangerous if other columns are inserted at some point. For ex. if I need confidence scores, I need to put 4:

arr = results.xyxy[0].cpu().numpy()
arr[:,4]  

You also present the json method. I was wondering, is there a way to avoid using pandas in the middle?

d = results.pandas().xyxy[0].to_json(orient='records')

@glenn-jocher
Copy link
Member

@RRighart the standard outputs are tensors. You're free to do anything you want with them.

@github-actions
Copy link
Contributor

github-actions bot commented May 12, 2022

👋 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 ⭐!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested Stale
Projects
None yet
Development

No branches or pull requests

2 participants