yolov5
yolov5 copied to clipboard
The center of annotated bound box change position
Search before asking
- [X] I have searched the YOLOv5 issues and discussions and found no similar questions.
Question
I found that annotation position is not what I expect.
For example, This data is image 601_151, its coordinate system is [0 0.40795277343749997 0.37763712890625 0.0997937890625 0.0438759765625]. The coordinate system I use is left top is 0,0 ; right bottom is 1,1;
This is the correct bounding box. I use python to read coordinate information and overlap it to image confirm its correction position.
But after I upload data to YoloV5, its label image created by YoloV5 (left side ) vs I use python to overlap bounding box (right side, correct position )
any clues?
import PIL import matplotlib.pyplot as plt import matplotlib.patches as patches
fig, axs = plt.subplots(nrows, ncols, figsize=(24,15)) axs = axs.flatten()
ds = PIL.Image.open('601_151.jpg') axs[0].imshow(ds, cmap="bone") axs[0].axis("off")
normalized_cordinate = [0.40795277343749997, 0.37763712890625, 0.0997937890625, 0.0438759765625] x = 512normalized_cordinate[0] y = 512normalized_cordinate[1] width = 512normalized_cordinate[2] height = 512normalized_cordinate[3]
rect = patches.Rectangle((x, y), width, height, fill=False, edgecolor="red", linewidth=1.0) axs[0].add_patch(rect)
Additional
No response
👋 Hello @frabob2017, 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 screenshots and minimum viable code to reproduce your issue, otherwise we can not help you.
If this is a custom training ❓ Question, please provide as much information as possible, including dataset images, training logs, screenshots, and a public link to online W&B logging if available.
For business inquiries or professional support requests please visit https://ultralytics.com or email [email protected].
Requirements
Python>=3.7.0 with all requirements.txt installed including PyTorch>=1.7. 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):
-
Google Colab and Kaggle notebooks with free GPU:
- Google Cloud Deep Learning VM. See GCP Quickstart Guide
- Amazon Deep Learning AMI. See AWS Quickstart Guide
-
Docker Image. See Docker Quickstart Guide
Status
If this badge is green, all YOLOv5 GitHub Actions Continuous Integration (CI) tests are currently passing. CI tests verify correct operation of YOLOv5 training (train.py), validation (val.py), inference (detect.py) and export (export.py) on macOS, Windows, and Ubuntu every 24 hours and on every commit.
But after I upload data to YoloV5, its label image created by YoloV5 (left side )
By this, do you mean the train_batch_01, 02, 03.jpgs created when training is started?
Hello Martin,
Yes, it is the val_batch1_labels.jpg, val_batch2_labels.jpg; val_batch3_labels.jpg. It is the labels program read from the ground truth labels. The position of bounding box shift. Frank
I just tried drawing the bounding box from your coordinates and it looks correct to me, are you sure you are using yolo annotations? class x center y center width height
Hello Martin,
Thank you for your testing. You see, right side one is correct. It covers the fracture area. The left side one is NOT correct. I used Yolo format. [class x y width height] format. Radiologists I worked with draw ROI in CSV format. I convert their coordinate system to Yolo format. I tested it using Python. The position is correct. But I run in YoloV5, it is not correct, shifting a little bit.
I find the same issue when I upload the data to RoboFlow. Do you need the data, I can send you sample data for your testing.
Thank you.
Radiologist coordinate system is not normalized. What I did is normalized them. The image size is 512, 512; what I did is just normalized by 512.
Hello Martin,
Thank you for your testing. You see, right side one is correct. It covers the fracture area. The left side one is NOT correct. I used Yolo format. [class x y width height] format. Radiologists I worked with draw ROI in CSV format. I convert their coordinate system to Yolo format. I tested it using Python. The position is correct. But I run in YoloV5, it is not correct, shifting a little bit.
I find the same issue when I upload the data to RoboFlow. Do you need the data, I can send you sample data for your testing.
Thank you.
The one on the left is the one I drew from the coordinates you provided, so again, I think that your annotation might be wrong. Perhaps it is class x1 y1 width height where it should be class center_x center_y width height.
Hello Martin, Thank you so much for help. I double check again PIL.rectangle(x,y), x,y is left bottom corner. I make a mistake and think it is center point. Thank you so much. It is also a great learning course for me.
👍🏼 glad to be of help. Please don't forget to mark the issue as solved if your problem has been solved.
this problem is solved. thank you so much.
👋 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:
- Wiki – https://github.com/ultralytics/yolov5/wiki
- Tutorials – https://docs.ultralytics.com/yolov5
- Docs – https://docs.ultralytics.com
Access additional Ultralytics ⚡ resources:
- Ultralytics HUB – https://ultralytics.com/hub
- Vision API – https://ultralytics.com/yolov5
- About Us – https://ultralytics.com/about
- Join Our Team – https://ultralytics.com/work
- Contact Us – https://ultralytics.com/contact
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 ⭐!
@frabob2017 you're welcome! If you have any more questions or need further assistance, feel free to ask. Happy coding!