ultralytics / yolov5

YOLOv5 🚀 in PyTorch > ONNX > CoreML > TFLite
https://docs.ultralytics.com
GNU Affero General Public License v3.0
50.66k stars 16.33k forks source link

I want to get the coordinate system x0,y0,x0,y0. #12271

Closed youngjaean closed 1 year ago

youngjaean commented 1 year ago

Search before asking

Question

I want to get the coordinate system x0,y0,x0,y0.

Currently, when I get the result in a CSV file, it comes out normalized. Also, if you get the value before normalization, it will be an int type. I want to get a value in float format.

I also want to know if the coordinates are from the 640 or from the original image.

If I turn inference YOLOv5 <class 'models.common.Detections'> instance image 1/1: 1024x1024 1 None, 1 Metal, 2 Glasss, 1 Styrofoam, 3 Batterys Speed: 15.8ms pre-process, 13.4ms inference, 2.6ms NMS per image at shape (1, 3, 640, 640)

Also, when saved as a CSV, the

0000.jpg [tensor(394., device='cuda:0'), tensor(621., device='cuda:0'), tensor(447., device='cuda:0'), tensor(686., device='cuda:0')] cat 0.67
0000.jpg [tensor(432., device='cuda:0'), tensor(469., device='cuda:0'), tensor(584., device='cuda:0'), tensor(680., device='cuda:0')] dog 0.74
0000.jpg [tensor(629., device='cuda:0'), tensor(249., device='cuda:0'), tensor(755., device='cuda:0'), tensor(344., device='cuda:0')] gee trash 0.79
0000.jpg [tensor(545., device='cuda:0'), tensor(340., device='cuda:0'), tensor(706., device='cuda:0'), tensor(600., device='cuda:0')] bee 0.80

or

0000.jpg [0.41064453125, 0.63818359375, 0.0517578125, 0.0634765625] cat
0000.jpg [0.49609375, 0.56103515625, 0.1484375, 0.2060546875] bee
0000.jpg [0.67578125, 0.28955078125, 0.123046875, 0.0927734375] dog
0000.jpg [0.61083984375, 0.458984375, 0.1572265625, 0.25390625] dog

Additional

No response

github-actions[bot] commented 1 year ago

👋 Hello @youngjaean, thank you for your interest in YOLOv5 🚀! Please visit our ⭐️ Tutorials to get started, where you can find quickstart guides for simple tasks like Custom Data Training all the way to advanced concepts like Hyperparameter Evolution.

If this is a 🐛 Bug Report, please provide a minimum reproducible example to help us debug it.

If this is a custom training ❓ Question, please provide as much information as possible, including dataset image examples and training logs, and verify you are following our Tips for Best Training Results.

Requirements

Python>=3.8.0 with all requirements.txt installed including PyTorch>=1.8. To get started:

git clone https://github.com/ultralytics/yolov5  # clone
cd yolov5
pip install -r requirements.txt  # install

Environments

YOLOv5 may be run in any of the following up-to-date verified environments (with all dependencies including CUDA/CUDNN, Python and PyTorch preinstalled):

Status

YOLOv5 CI

If this badge is green, all YOLOv5 GitHub Actions Continuous Integration (CI) tests are currently passing. CI tests verify correct operation of YOLOv5 training, validation, inference, export and benchmarks on macOS, Windows, and Ubuntu every 24 hours and on every commit.

Introducing YOLOv8 🚀

We're excited to announce the launch of our latest state-of-the-art (SOTA) object detection model for 2023 - YOLOv8 🚀!

Designed to be fast, accurate, and easy to use, YOLOv8 is an ideal choice for a wide range of object detection, image segmentation and image classification tasks. With YOLOv8, you'll be able to quickly and accurately detect objects in real-time, streamline your workflows, and achieve new levels of accuracy in your projects.

Check out our YOLOv8 Docs for details and get started with:

pip install ultralytics
youngjaean commented 1 year ago

Search before asking

  • [x] I have searched the YOLOv5 issues and discussions and found no similar questions.

Question

I want to get the coordinate system x0,y0,x0,y0.

Currently, when I get the result in a CSV file, it comes out normalized. Also, if you get the value before normalization, it will be an int type. I want to get a value in float format.

I also want to know if the coordinates are from the 640 or from the original image.

If I turn inference YOLOv5 <class 'models.common.Detections'> instance image 1/1: 1024x1024 1 None, 1 Metal, 2 Glasss, 1 Styrofoam, 3 Batterys Speed: 15.8ms pre-process, 13.4ms inference, 2.6ms NMS per image at shape (1, 3, 640, 640)

Also, when saved as a CSV, the

0000.jpg [tensor(394., device='cuda:0'), tensor(621., device='cuda:0'), tensor(447., device='cuda:0'), tensor(686., device='cuda:0')] cat 0.67 0000.jpg [tensor(432., device='cuda:0'), tensor(469., device='cuda:0'), tensor(584., device='cuda:0'), tensor(680., device='cuda:0')] dog 0.74 0000.jpg [tensor(629., device='cuda:0'), tensor(249., device='cuda:0'), tensor(755., device='cuda:0'), tensor(344., device='cuda:0')] gee trash 0.79 0000.jpg [tensor(545., device='cuda:0'), tensor(340., device='cuda:0'), tensor(706., device='cuda:0'), tensor(600., device='cuda:0')] bee 0.80 or

0000.jpg [0.41064453125, 0.63818359375, 0.0517578125, 0.0634765625] cat 0000.jpg [0.49609375, 0.56103515625, 0.1484375, 0.2060546875] bee 0000.jpg [0.67578125, 0.28955078125, 0.123046875, 0.0927734375] dog 0000.jpg [0.61083984375, 0.458984375, 0.1572265625, 0.25390625] dog

Additional

No response

glenn-jocher commented 1 year ago

@youngjaean the coordinates in the CSV output of YOLOv5 are normalized, ranging from 0 to 1. If you want the coordinates in float format, you can use the normalized values as is. Regarding your question about whether the coordinates are from the original image or a resized image, the coordinates provided are from the resized image with a size of 640x640. Thank you for your interest in YOLOv5!

youngjaean commented 1 year ago

Thank you for your detailed response

glenn-jocher commented 1 year ago

@youngjaean thanks for your question! The coordinates provided in the CSV output of YOLOv5 are normalized, ranging from 0 to 1. You can use these normalized values as is if you want to work with float coordinates. As for the origin of the coordinates, they are from the resized image with a size of 640x640. If you have any further questions, feel free to ask.