|
1 | 1 | # MobileNet-SSD |
2 | | -A caffe implementation of Google MobileNet SSD detection network, with pretrained weights on VOC0712. |
| 2 | +A caffe implementation of MobileNet-SSD detection network, with pretrained weights on VOC0712 and mAP=0.727. |
| 3 | + |
| 4 | +Network|mAP|Download|Download |
| 5 | +:---:|:---:|:---:|:---: |
| 6 | +MobileNet-SSD|72.7|[train](https://drive.google.com/open?id=0B3gersZ2cHIxVFI1Rjd5aDgwOG8)|[deploy](https://drive.google.com/open?id=0B3gersZ2cHIxRm5PMWRoTkdHdHc) |
3 | 7 |
|
4 | 8 | ### Run |
5 | 9 | 1. Download [SSD](https://github.com/weiliu89/caffe/tree/ssd) source code and compile (follow the SSD README). |
6 | | -2. Put all the files in SSD_HOME/examples/ |
7 | | -3. Run merge_bn.py to generate deploy caffemodel. |
8 | | -4. Run demo.py to test the detection result. |
| 10 | +2. Download the pretrained deploy weights from the link above. |
| 11 | +3. Put all the files in SSD_HOME/examples/ |
| 12 | +4. Run demo.py to show the detection result. |
9 | 13 |
|
10 | 14 |
|
11 | 15 | ### Train your own dataset |
12 | | -1. Convert your own dataset to lmdb database (follow the SSD README). |
13 | | -2. Modify the MobileNetSSD_train.prototxt like this (or use gen.py): |
14 | | - * Change the lmdb database and labelmap file path. |
15 | | -``` |
16 | | - data_param { |
17 | | - source: "/home/yaochuanqi/data/VOCdevkit/VOC0712/lmdb/VOC0712_trainval_lmdb" # change to your lmdb path |
18 | | - batch_size: 32 |
19 | | - backend: LMDB |
20 | | - } |
21 | | -
|
22 | | - ... |
23 | | -
|
24 | | - label_map_file: "../../data/VOC0712/labelmap_voc.prototxt" # change to your labelmap file |
25 | | -``` |
26 | | - * Change the mbox_conf layer output num for all 5 mbox_conf layers, and change the layer name of 5 mbox_conf. |
27 | | -``` |
28 | | - convolution_param { |
29 | | - num_output: 84 # 84 = 21 * 4, set to (classnum + 1) * 4 , "+1" is for background |
30 | | - bias_term: false |
31 | | -
|
32 | | - ... |
33 | | -
|
34 | | - convolution_param { |
35 | | - num_output: 126 # 126 = 21 * 6, set to (classnum + 1) * 6 , "+1" is for background |
36 | | - bias_term: false |
37 | | -``` |
| 16 | +1. Convert your own dataset to lmdb database (follow the SSD README), and create symlinks to current directory. |
38 | 17 | ``` |
39 | | -layer { |
40 | | - name: "conv11_mbox_conf" #set to a different name, e.g. "conv11_mbox_conf_voc" |
41 | | - type: "Convolution" |
42 | | - bottom: "conv11" |
| 18 | +ln -s PATH_TO_YOUR_TRAIN_LMDB trainval_lmdb |
| 19 | +ln -s PATH_TO_YOUR_TEST_LMDB test_lmdb |
43 | 20 | ``` |
44 | | -3. Run train.sh, after about 30000 iteration, the loss should be 2.0 - 3.0. |
45 | | -4. Run merge_bn.py to generate your own deploy caffemodel. |
| 21 | +2. Create the labelmap.prototxt file and put it into current directory. |
| 22 | +3. Use gen_model.sh to generate your own training model. |
| 23 | +4. Download the MobileNetSSD_train.caffemodel from the link above, and run train.sh, after about 30000 iterations, the loss should be 1.5 - 2.5. |
| 24 | +5. Run test.sh to evaluate the result. |
| 25 | +6. Run merge_bn.py to generate your own deploy caffemodel. |
46 | 26 |
|
47 | 27 | ### About some details |
48 | | -There are 3 differences between my model and [MobileNet-SSD on tensorflow](https://github.com/tensorflow/models/blob/master/object_detection/g3doc/detection_model_zoo.md): |
49 | | -1. I replaced the tensorflow's ReLU6 layer with ReLU. |
50 | | -2. My batch normal eps=0.00001 vs tensorflow's eps=0.001. |
51 | | -3. For the conv11 anchors, I use [(0.2, 1.0), (0.2, 2.0), (0.2, 0.5)] vs tensorflow's [(0.1, 1.0), (0.2, 2.0), (0.2, 0.5)]. |
| 28 | +There are 2 primary differences between this model and [MobileNet-SSD on tensorflow](https://github.com/tensorflow/models/blob/master/object_detection/g3doc/detection_model_zoo.md): |
| 29 | +1. ReLU6 layer is replaced by ReLU. |
| 30 | +2. For the conv11_mbox_prior layer, the anchors is [(0.2, 1.0), (0.2, 2.0), (0.2, 0.5)] vs tensorflow's [(0.1, 1.0), (0.2, 2.0), (0.2, 0.5)]. |
52 | 31 |
|
0 commit comments