ultralytics / yolov5

YOLOv5 πŸš€ in PyTorch > ONNX > CoreML > TFLite
https://docs.ultralytics.com
GNU Affero General Public License v3.0
50.88k stars 16.38k forks source link

YoloV5 vs Yolor #8269

Closed MasIgor closed 2 years ago

MasIgor commented 2 years ago

Search before asking

Question

Hello,

we are trying both yoloV5 and yolor to train some crates. the results are different, with yolor reaching a maximum precision of 0.8, and yoloV5 reaching a precision of 0.98 on the same dataset.

We would love to use yoloV5 as it is faster and easier to use/train, and its conversion to ONNX is much easier and seemless.

BUT: yoloR is recognizing some crates better, that are critical for us.

yolor: image

yoloV5: image

the biggest problem is the crate on the far right not being recognized, not even with a low score. (treshold 0.2) the second problem is the bounding boxes that are not as precise as with yolor.

this has been trained with the L model. yoloR was trained with the p (smallest) model.

Overall yoloV5 has much better recognition, probably also due to the bigger network, but the two points above are a problem. The images are given, we can not change illumination or things like that.

The hyper parameters used:

# YOLOv5 πŸš€ by Ultralytics, GPL-3.0 license
# Hyperparameters for low-augmentation COCO training from scratch
# python train.py --batch 64 --cfg yolov5n6.yaml --weights '' --data coco.yaml --img 640 --epochs 300 --linear
# See tutorials for hyperparameter evolution https://github.com/ultralytics/yolov5#tutorials

lr0: 0.01  # initial learning rate (SGD=1E-2, Adam=1E-3)
lrf: 0.01  # final OneCycleLR learning rate (lr0 * lrf)
momentum: 0.937  # SGD momentum/Adam beta1
weight_decay: 0.0005  # optimizer weight decay 5e-4
warmup_epochs: **10.0**  # warmup epochs (fractions ok)
warmup_momentum: 0.8  # warmup initial momentum
warmup_bias_lr: 0.1  # warmup initial bias lr
box: 0.05  # box loss gain
cls: 0.5  # cls loss gain
cls_pw: 1.0  # cls BCELoss positive_weight
obj: 1.0  # obj loss gain (scale with pixels)
obj_pw: 1.0  # obj BCELoss positive_weight
iou_t: 0.20  # IoU training threshold
anchor_t: 4.0  # anchor-multiple threshold
# anchors: 3  # anchors per output layer (0 to ignore)
fl_gamma: 0.0  # focal loss gamma (efficientDet default gamma=1.5)
hsv_h: 0.015  # image HSV-Hue augmentation (fraction)
hsv_s: 0.7  # image HSV-Saturation augmentation (fraction)
hsv_v: 0.4  # image HSV-Value augmentation (fraction)
degrees: 0.0  # image rotation (+/- deg)
translate: 0.1  # image translation (+/- fraction)
scale: **0.2**  # image scale (+/- gain)
shear: 0.0  # image shear (+/- deg)
perspective: 0.0  # image perspective (+/- fraction), range 0-0.001
flipud: 0.0  # image flip up-down (probability)
fliplr: **0.0**  # image flip left-right (probability)
mosaic: 1.0  # image mosaic (probability)
mixup: 0.0  # image mixup (probability)
copy_paste: 0.0  # segment copy-paste (probability)

the changed values have been marked.

What could I do to solve the two problems? Thank you for your great work!

Additional

No response

trantuanngoc commented 2 years ago

very interesting question but unfortunately, no one responds

glenn-jocher commented 2 years ago

@trantuanngoc OP closed issue a week ago so I assume issue is resolved.

@tanzerlana did you resolve your problems?

MasIgor commented 2 years ago

Nope, its not resolved. but the company decided to stick with yoloR for that project so I didnt want to take further time from you away and closed the question.

glenn-jocher commented 2 years ago

@tanzerlana got it, thank you

trantuanngoc commented 2 years ago

@glenn-jocher Could you answer the question? OP closed the issue but i feel it has a lot of knowledge to learn from.

glenn-jocher commented 2 years ago

@trantuanngoc I'm not sure what question you're referring to. In general we point uses to our tips for best results so that they can ensure that they are implementing best practices in their dataset and training workflows:

YOLOv5 Tutorials

Good luck πŸ€ and let us know if you have any other questions!

trantuanngoc commented 2 years ago

@cgerum OP said the far right and left crates are not even recognized with low threshold (0.2). Can you give some information why it happens and how to resolve

glenn-jocher commented 2 years ago

@trantuanngoc not having access to OPs dataset nor commands to reproduce his results I can't comment, but as I said above our best practices guide should be followed as closely as possible for best results.