AlexeyAB / darknet

YOLOv4 / Scaled-YOLOv4 / YOLO - Neural Networks for Object Detection (Windows and Linux version of Darknet )
http://pjreddie.com/darknet/
Other
21.63k stars 7.95k forks source link

Training skills? #4253

Open zihaozhang9 opened 4 years ago

zihaozhang9 commented 4 years ago

Hello!Thank you for sharing the code, the darknet library is really great.

I have configured darknet and it is already available for training. I trained my own data set and the mAP indicator can reach 99%. However, I trained myself with the code written by pytorch, and the mAP indicator can only reach 45%. So I want to learn the training techniques in darknet. How data is loaded, how the training optimizer is configured, how the mAP indicator is calculated, and so on. But when I saw "load_data" I found that "pthread_create" had no specific code. Has this part been protected by lib? Do you have any suggestions for improving the accuracy?

Thank you very much~

AlexeyAB commented 4 years ago

I trained myself with the code written by pytorch

Which code did you use?

Read about parameters for Data augmentation and Optimizator: https://github.com/AlexeyAB/darknet/wiki/CFG-Parameters-in-the-%5Bnet%5D-section

Data augmentation code: https://github.com/AlexeyAB/darknet/blob/0fa9c8f10588cd5db54b742bc2bcbefcddd87000/src/image_opencv.cpp#L1129-L1245

Weights updating code: https://github.com/AlexeyAB/darknet/blob/0fa9c8f10588cd5db54b742bc2bcbefcddd87000/src/convolutional_kernels.cu#L1202-L1212

zihaozhang9 commented 4 years ago

OK!very thanks~ My code base on here (https://github.com/eriklindernoren/PyTorch-YOLOv3).

Is mAP calculated in the same way as mean(ap_class1, ap_class2...)? My training data has 4 categories. However, the number of "car" categories is much larger than "bus", much larger than "van", much larger than "others". The ap of each category in the darknet assessment results is well balanced. However, my results are as follows: | Index | Class name | AP | | 0 | car | 0.89444 | | 1 | bus | 0.59527 | | 2 | van | 0.00000 | | 3 | others | 0.00000 | Test mAP 0.37242840132105665 precision 0.4114725147461563 recall 0.4353298240383912 f1 0.4093582263769523 How does darknet solve the problem of category imbalance?

AlexeyAB commented 4 years ago

How the mAP is calculated: https://medium.com/@jonathan_hui/map-mean-average-precision-for-object-detection-45c121a31173

More: https://github.com/AlexeyAB/darknet/issues/2746


How does darknet solve the problem of category imbalance?

By using: