-
-
Notifications
You must be signed in to change notification settings - Fork 16.4k
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
Correctness of flip formula #248
Comments
Hello @ratthachat, thank you for your interest in our work! Please visit our Custom Training Tutorial to get started, and see our Jupyter Notebook , Docker Image, and Google Cloud Quickstart Guide for example environments. 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 model or data training question, please note that Ultralytics does not provide free personal support. As a leader in vision ML and AI, we do offer professional consulting, from simple expert advice up to delivery of fully customized, end-to-end production solutions for our clients, such as:
For more information please visit https://www.ultralytics.com. |
Yes, xywh format. |
First of all thanks so much for making this Yolo V5! It's now the best model in Kaggle Wheat detection : https://www.kaggle.com/c/global-wheat-detection
Trying to modify TTA, I found you use the following lr-flip formula for bbox :
In
models/yolo.py
y[1][..., 0] = img_size[1] - y[1][..., 0] # flip lr ---- Equation (1)
I have checked on Yolo V3 and it's the same, so I am sure the formula is correct.
However, in my understanding we should change both
xmin
andxmax
for lr-flip but the formula above only changexmin
.For examples, the famous albumentations formula is :
https://github.com/albumentations-team/albumentations/blob/master/albumentations/augmentations/functional.py
In
def bbox_hflip
new_xmin, new_ymin, new_xmax, new_ymax = 1 - x_max, y_min, 1 - x_min, y_max
Or explained intuitively here : https://blog.paperspace.com/data-augmentation-for-bounding-boxes/
So my question is how can the above equation (1) is correct ??
It should be
y[1][..., 2] = img_size[1] - y[1][..., 0] # flip lr new xmax
y[1][..., 0] = img_size[1] - y[1][..., 2] # flip lr new xmin
EDIT : I got it. Yolo use
xcenter, ycenter, w, h
, so it explains Equation (1) . Close the issue.The text was updated successfully, but these errors were encountered: