WongKinYiu / yolov7

Implementation of paper - YOLOv7: Trainable bag-of-freebies sets new state-of-the-art for real-time object detectors
GNU General Public License v3.0
13.18k stars 4.17k forks source link

yolov7 traning results much worse than yoloxs and yoloe #302

Open CodingFarmers opened 2 years ago

CodingFarmers commented 2 years ago

I trained yolov7 with my dataset following this command python -m torch.distributed.launch --nproc_per_node 4 --master_port 9527 train.py --workers 8 --device 0,1,2,3 --sync-bn --batch-size 128 --data data/coco.yaml --img 640 640 --cfg cfg/training/yolov7.yaml --weights '' --name yolov7 --hyp data/hyp.scratch.p5.yaml However, yolov7's result is 20 points lower than yoloxs and yoloe, even after I adjust some parameters like lr, scheduler, epochs and mosaic prob, etc. Can you give me some adivices about how to tune yolov7?thx~

WongKinYiu commented 2 years ago

Do your GPUs have tensor cores, if not, you have to set half to False to get correct results.

CodingFarmers commented 2 years ago

Do your GPUs have tensor cores, if not, you have to set half to False to get correct results.

yes, i use v100 for training

WongKinYiu commented 2 years ago

What is the AP you got of YOLOv7.

kx-Z commented 2 years ago

I also have the same problem, no matter whether I use yolov7x or yolov7-d6, and the model with default settings or after tuning hyperparameters is about 5 points lower than the map of yolox-x. My validation set and test set may have a slight gap, but yolox also faces the same problem, which may cause such a big difference in the results? Can you give me some advice?

CodingFarmers commented 2 years ago

What is the AP you got of YOLOv7.

I just train with full labeled data and test on image level annotated videos to calculate auc, maybe kx-Z can answer this question

I also have the same problem, no matter whether I use yolov7x or yolov7-d6, and the model with default settings or after tuning hyperparameters is about 5 points lower than the map of yolox-x. My validation set and test set may have a slight gap, but yolox also faces the same problem, which may cause such a big difference in the results? Can you give me some advice?

WongKinYiu commented 2 years ago

For AUC, you may need check if the precision and recall calculation are same or not. Usually, there are two kind of calculation, which are continuous and interpolation. Different calculation method may have quite different resulting AUC. Also, some metric take care of real system, the maxima recall will be TP > confidence score. Some metric calculate theoretical value, which directly set maxima recall to 100%. Above mentioned metric calculation may lead very different results for same system. The better way is save results of different methods, and use same method to calculate metric.

For AP, they also have similar issue. For example, AP calculated in YOLOv7 is about 1.x to 2.x % lower than pycocotools. While in YOLOv5, the calculated AP is 0.x% lower or 0.x% higher than pycocotools. If confidence score is set higher, the calculated AP will become unreliable. I am not sure about AP calculation method used in YOLOX, but you could use same metric calculation method to compare different systems first, than we could keep discussing this issue.

CodingFarmers commented 2 years ago

For AUC, you may need check if the precision and recall calculation are same or not. Usually, there are two kind of calculation, which are continuous and interpolation. Different calculation method may have quite different resulting AUC. Also, some metric take care of real system, the maxima recall will be TP > confidence score. Some metric calculate theoretical value, which directly set maxima recall to 100%. Above mentioned metric calculation may lead very different results for same system. The better way is save results of different methods, and use same method to calculate metric.

For AP, they also have similar issue. For example, AP calculated in YOLOv7 is about 1.x to 2.x % lower than pycocotools. While in YOLOv5, the calculated AP is 0.x% lower or 0.x% higher than pycocotools. If confidence score is set higher, the calculated AP will become unreliable. I am not sure about AP calculation method used in YOLOX, but you could use same metric calculation method to compare different systems first, than we could keep discussing this issue.

surely i use same code to calc auc

Eliza-and-black commented 2 years ago

I also have the same problem, I use yolov7x_face based on your yolov7x , and the model with default settings or after tuning hyperparameters is about 4~6 points lower than the map of yolov5_face. which may cause such a big difference in the results? Can you give me some advice?

Eliza-and-black commented 2 years ago

By the way, I use 3060 with tensor core.