eric612 / MobileNet-YOLO

A caffe implementation of MobileNet-YOLO detection network
Other
865 stars 442 forks source link

训练loss #170

Open phoenares opened 5 years ago

phoenares commented 5 years ago

请问一下,训练的两个模型,loss和recall指标都很接近,为什么map会差别很大 I0925 11:49:18.817283 107938 sgd_solver.cpp:121] Iteration 9360, lr = 2e-05 I0925 11:52:34.540104 108845 yolov3_layer.cpp:411] noobj: 0.00110798 obj: 0.794362 iou: 0.872922 cat: 0.999894 recall: 1 recall75: 0.911085 count: 7 I0925 11:52:34.727129 108845 yolov3_layer.cpp:411] noobj: 0.00094404 obj: 0.57969 iou: 0.656713 cat: 0.999982 recall: 0.79657 recall75: 0.383505 count: 26 I0925 11:52:49.050206 107938 yolov3_layer.cpp:411] noobj: 0.000974857 obj: 0.784842 iou: 0.852538 cat: 0.999938 recall: 1 recall75: 0.872222 count: 4 I0925 11:52:49.155248 107938 yolov3_layer.cpp:411] noobj: 0.00130298 obj: 0.624775 iou: 0.645817 cat: 0.999985 recall: 0.756526 recall75: 0.382668 count: 29 I0925 11:54:01.006992 107938 solver.cpp:252] Iteration 9380 (0.070877 iter/s, 282.179s/20 iters), loss = 0.785152

这是其中一个模型,mAP只有0.2多

I0925 11:52:25.944167 29171 sgd_solver.cpp:121] Iteration 10480, lr = 2e-06 I0925 11:55:29.664680 29171 yolov3_layer.cpp:411] noobj: 0.00136001 obj: 0.801966 iou: 0.861124 cat: 0.99995 recall: 1 recall75: 0.95 count: 3 I0925 11:55:29.728757 29171 yolov3_layer.cpp:411] noobj: 0.00220153 obj: 0.672295 iou: 0.637296 cat: 0.999989 recall: 0.753864 recall75: 0.357375 count: 30 I0925 11:55:45.094514 30006 yolov3_layer.cpp:411] noobj: 0.00201535 obj: 0.838716 iou: 0.868648 cat: 0.999949 recall: 1 recall75: 0.953288 count: 5 I0925 11:55:45.136662 30006 yolov3_layer.cpp:411] noobj: 0.0024785 obj: 0.624499 iou: 0.616678 cat: 0.999986 recall: 0.704191 recall75: 0.361337 count: 29 I0925 11:56:55.804199 29171 solver.cpp:252] Iteration 10500 (0.0741153 iter/s, 269.85s/20 iters), loss = 0.882909 I0925 11:56:55.804535 29171 solver.cpp:271] Train net output #0: det_loss1 = 0.0180766 ( 1 = 0.0180766 loss) I0925 11:56:55.804569 29171 solver.cpp:271] Train net output #1: det_loss2 = 0.757168 ( 1 = 0.757168 loss)

这是另外一个模型,mAP是0.6多

phoenares commented 5 years ago

第一个模型只是在第二个模型的基础上加了几个anchor

MuhammadAsadJaved commented 5 years ago

@phoenares can you tell me how to calculate mAP from these outputs? I am running test.sh to evaluate my model but i do not understand results. can you explain which one is Precision and recall and how to calculate mAP?

I1009 11:06:38.190402 8789 yolov3_layer.cpp:411] noobj: 0.000200369 obj: 0.272396 iou: 0.691667 cat: 0.976338 recall: 0.965151 recall75: 0.284849 count: 4 I1009 11:06:38.280119 8789 solver.cpp:252] Iteration 510 (0.116824 iter/s, 85.5987s/10 iters), loss = 4.64793 I1009 11:06:38.280176 8789 solver.cpp:271] Train net output #0: det_loss1 = 1.03899e-05 ( 1 = 1.03899e-05 loss) I1009 11:06:38.280184 8789 solver.cpp:271] Train net output #1: det_loss2 = 1.80446 ( 1 = 1.80446 loss) I1009 11:06:38.280189 8789 solver.cpp:271] Train net output #2: det_loss3 = 2.25093 (* 1 = 2.25093 loss)

MuhammadAsadJaved commented 5 years ago

see the picture for better understanding. Please explain the results to me model

phoenares commented 5 years ago

see the picture for better understanding. Please explain the results to me model

The line before 'Iteration 850...' you can find two 'recall',recall is calculated with IOU threshold 0.5, recall75 is calculated with IOU threshold 0.75. you can run test.prototxt to get mAP,or record your model's output and calculate mAP like this https://github.com/Cartucho/mAP

MuhammadAsadJaved commented 5 years ago

@phoenares Can you please upload the test.sh and test.prototxt used for mAP. let me compare. I trained the yolov3 with solver.prototxt, yolov3-train.prototxt, yolov3-test.prototxt. after training when i run the test.sh it start saving the models again. do i need to make any changes in solver.prototxt for testing? please upload your these files then i will understand better.

phoenares commented 5 years ago

@MuhammadAsadJaved test.sh: caffe train --solver solver.prototxt --weights XXX.caffemodel this is my solver.prototxt

train_net: "models/yolov3_coco/sh2_0.5_yolo3_lite_train_simple_m3_gray_ft.prototxt" test_net: "models/yolov3_coco/sh2_0.5_yolo3_lite_test_m3_gray_ft.prototxt" test_iter: 500 test_interval: 1 base_lr: 0.01 display: 20 max_iter: 0 lr_policy: "multistep" gamma: 0.1 momentum: 0.9 weight_decay: 0.00005 snapshot: 0 snapshot_prefix: "models/yolov3_coco/sh2_yolo3_0.5_pos_3a" solver_mode: GPU debug_info: false snapshot_after_train: false test_initialization: true average_loss: 10 stepvalue: 20000 stepvalue: 30000 stepvalue: 40000 stepvalue: 45000 iter_size: 1 type: "SGD" eval_type: "detection" ap_version: "11point"

show_per_class_result: true

MuhammadAsadJaved commented 5 years ago

@phoenares Thank you for your response. After i run the test.sh i got the following output. Is the mAP? Test net output #0: detection_eval = 0.758738 If yes then do you have any idea how can get precision and recall also?

ModelEvaluation