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 and xmax for lr-flip but the formula above only change xmin.
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.
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.pyy[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
xminandxmaxfor 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_hflipnew_xmin, new_ymin, new_xmax, new_ymax = 1 - x_max, y_min, 1 - x_min, y_maxOr 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 xmaxy[1][..., 0] = img_size[1] - y[1][..., 2] # flip lr new xminEDIT : I got it. Yolo use
xcenter, ycenter, w, h, so it explains Equation (1) . Close the issue.