Closed lars-nieradzik closed 7 months ago
Hi, thanks for raising this, your proposed change looks good. Please create a PR and we can merge it in!
We ran this codebase on a large private dataset and didn't have any issues, what are the problems you are having?
I have added the pull request https://github.com/Chris-hughes10/Yolov7-training/pull/23. I was able to solve my problem with PASCAL VOC, I just chose the wrong hyperparameters. In the end, I can now confirm that your implementation works fine. On another private dataset, I was even able to outperform the original YOLOv7 implementation.
Fixed
Hi, thank you for rewriting YOLOv7. The original code is really a mess.
https://github.com/Chris-hughes10/Yolov7-training/blob/b1dad9942ee406f9e095d7b442e9730cb017de55/yolov7/loss.py#L626 might be incorrect. At least mixed precision does not work, when you write it this way.
The original code does: y = sqrt(sigmoid(x) sigmoid(y)), then applying log(y/(1-y)) to get back to the logit. binary_cross_entropy_with_logits is needed for mixed precision. In the end, the original pair_wise_cls_loss is simplified something like -0.5(plog(e^(x + y)/((1 + e^x) (1 + e^y))) + (1-p)log(1 - e^(x + y)/((1 + e^x) (1 + e^y)))). Might be possible to simplify this part in a different way.
I was also wondering if you tested your code on bigger datasets. I have trouble with PASCAL VOC.