|
1 |
| -# SSD: Single Shot MultiBox Detector |
| 1 | +# How to build bagua-caffe |
| 2 | +Build the code. Please follow [Caffe instruction](http://caffe.berkeleyvision.org/installation.html) to install all necessary packages and build it. |
2 | 3 |
|
3 |
| -[](https://travis-ci.org/weiliu89/caffe) |
4 |
| -[](LICENSE) |
5 |
| - |
6 |
| -By [Wei Liu](http://www.cs.unc.edu/~wliu/), [Dragomir Anguelov](https://www.linkedin.com/in/dragomiranguelov), [Dumitru Erhan](http://research.google.com/pubs/DumitruErhan.html), [Christian Szegedy](http://research.google.com/pubs/ChristianSzegedy.html), [Scott Reed](http://www-personal.umich.edu/~reedscot/), [Cheng-Yang Fu](http://www.cs.unc.edu/~cyfu/), [Alexander C. Berg](http://acberg.com). |
7 |
| - |
8 |
| -### Introduction |
9 |
| - |
10 |
| -SSD is an unified framework for object detection with a single network. You can use the code to train/evaluate a network for object detection task. For more details, please refer to our [arXiv paper](http://arxiv.org/abs/1512.02325) and our [slide](http://www.cs.unc.edu/~wliu/papers/ssd_eccv2016_slide.pdf). |
11 |
| - |
12 |
| -<p align="center"> |
13 |
| -<img src="http://www.cs.unc.edu/~wliu/papers/ssd.png" alt="SSD Framework" width="600px"> |
14 |
| -</p> |
15 |
| - |
16 |
| -| System | VOC2007 test *mAP* | **FPS** (Titan X) | Number of Boxes | Input resolution |
17 |
| -|:-------|:-----:|:-------:|:-------:|:-------:| |
18 |
| -| [Faster R-CNN (VGG16)](https://github.com/ShaoqingRen/faster_rcnn) | 73.2 | 7 | ~6000 | ~1000 x 600 | |
19 |
| -| [YOLO (customized)](http://pjreddie.com/darknet/yolo/) | 63.4 | 45 | 98 | 448 x 448 | |
20 |
| -| SSD300* (VGG16) | 77.2 | 46 | 8732 | 300 x 300 | |
21 |
| -| SSD512* (VGG16) | **79.8** | 19 | 24564 | 512 x 512 | |
22 |
| - |
23 |
| - |
24 |
| -<p align="left"> |
25 |
| -<img src="http://www.cs.unc.edu/~wliu/papers/ssd_results.png" alt="SSD results on multiple datasets" width="800px"> |
26 |
| -</p> |
27 |
| - |
28 |
| -_Note: SSD300* and SSD512* are the latest models. Current code should reproduce these results._ |
29 |
| - |
30 |
| -### Citing SSD |
31 |
| - |
32 |
| -Please cite SSD in your publications if it helps your research: |
33 |
| - |
34 |
| - @inproceedings{liu2016ssd, |
35 |
| - title = {{SSD}: Single Shot MultiBox Detector}, |
36 |
| - author = {Liu, Wei and Anguelov, Dragomir and Erhan, Dumitru and Szegedy, Christian and Reed, Scott and Fu, Cheng-Yang and Berg, Alexander C.}, |
37 |
| - booktitle = {ECCV}, |
38 |
| - year = {2016} |
39 |
| - } |
40 |
| - |
41 |
| -### Contents |
42 |
| -1. [Installation](#installation) |
43 |
| -2. [Preparation](#preparation) |
44 |
| -3. [Train/Eval](#traineval) |
45 |
| -4. [Models](#models) |
46 |
| - |
47 |
| -### Installation |
48 |
| -1. Get the code. We will call the directory that you cloned Caffe into `$CAFFE_ROOT` |
49 |
| - ```Shell |
50 |
| - git clone https://github.com/weiliu89/caffe.git |
51 |
| - cd caffe |
52 |
| - git checkout ssd |
53 |
| - ``` |
54 |
| - |
55 |
| -2. Build the code. Please follow [Caffe instruction](http://caffe.berkeleyvision.org/installation.html) to install all necessary packages and build it. |
56 |
| - ```Shell |
| 4 | + ```shell |
57 | 5 | # Modify Makefile.config according to your Caffe installation.
|
58 |
| - cp Makefile.config.example Makefile.config |
59 |
| - make -j8 |
60 |
| - # Make sure to include $CAFFE_ROOT/python to your PYTHONPATH. |
61 |
| - make py |
62 |
| - make test -j8 |
63 |
| - # (Optional) |
64 |
| - make runtest -j8 |
65 |
| - ``` |
66 |
| - |
67 |
| -### Preparation |
68 |
| -1. Download [fully convolutional reduced (atrous) VGGNet](https://gist.github.com/weiliu89/2ed6e13bfd5b57cf81d6). By default, we assume the model is stored in `$CAFFE_ROOT/models/VGGNet/` |
69 |
| - |
70 |
| -2. Download VOC2007 and VOC2012 dataset. By default, we assume the data is stored in `$HOME/data/` |
71 |
| - ```Shell |
72 |
| - # Download the data. |
73 |
| - cd $HOME/data |
74 |
| - wget http://host.robots.ox.ac.uk/pascal/VOC/voc2012/VOCtrainval_11-May-2012.tar |
75 |
| - wget http://host.robots.ox.ac.uk/pascal/VOC/voc2007/VOCtrainval_06-Nov-2007.tar |
76 |
| - wget http://host.robots.ox.ac.uk/pascal/VOC/voc2007/VOCtest_06-Nov-2007.tar |
77 |
| - # Extract the data. |
78 |
| - tar -xvf VOCtrainval_11-May-2012.tar |
79 |
| - tar -xvf VOCtrainval_06-Nov-2007.tar |
80 |
| - tar -xvf VOCtest_06-Nov-2007.tar |
81 |
| - ``` |
82 |
| - |
83 |
| -3. Create the LMDB file. |
84 |
| - ```Shell |
85 |
| - cd $CAFFE_ROOT |
86 |
| - # Create the trainval.txt, test.txt, and test_name_size.txt in data/VOC0712/ |
87 |
| - ./data/VOC0712/create_list.sh |
88 |
| - # You can modify the parameters in create_data.sh if needed. |
89 |
| - # It will create lmdb files for trainval and test with encoded original image: |
90 |
| - # - $HOME/data/VOCdevkit/VOC0712/lmdb/VOC0712_trainval_lmdb |
91 |
| - # - $HOME/data/VOCdevkit/VOC0712/lmdb/VOC0712_test_lmdb |
92 |
| - # and make soft links at examples/VOC0712/ |
93 |
| - ./data/VOC0712/create_data.sh |
94 |
| - ``` |
95 | 6 |
|
96 |
| -### Train/Eval |
97 |
| -1. Train your model and evaluate the model on the fly. |
98 |
| - ```Shell |
99 |
| - # It will create model definition files and save snapshot models in: |
100 |
| - # - $CAFFE_ROOT/models/VGGNet/VOC0712/SSD_300x300/ |
101 |
| - # and job file, log file, and the python script in: |
102 |
| - # - $CAFFE_ROOT/jobs/VGGNet/VOC0712/SSD_300x300/ |
103 |
| - # and save temporary evaluation results in: |
104 |
| - # - $HOME/data/VOCdevkit/results/VOC2007/SSD_300x300/ |
105 |
| - # It should reach 77.* mAP at 120k iterations. |
106 |
| - python examples/ssd/ssd_pascal.py |
107 |
| - ``` |
108 |
| - If you don't have time to train your model, you can download a pre-trained model at [here](http://www.cs.unc.edu/~wliu/projects/SSD/models_VGGNet_VOC0712_SSD_300x300.tar.gz). |
| 7 | + make -j8 |
109 | 8 |
|
110 |
| -2. Evaluate the most recent snapshot. |
111 |
| - ```Shell |
112 |
| - # If you would like to test a model you trained, you can do: |
113 |
| - python examples/ssd/score_ssd_pascal.py |
114 |
| - ``` |
| 9 | + # Build Node.js Addons |
115 | 10 |
|
116 |
| -3. Test your model using a webcam. Note: press <kbd>esc</kbd> to stop. |
117 |
| - ```Shell |
118 |
| - # If you would like to attach a webcam to a model you trained, you can do: |
119 |
| - python examples/ssd/ssd_pascal_webcam.py |
| 11 | + node-gyp configure build |
120 | 12 | ```
|
121 |
| - [Here](https://drive.google.com/file/d/0BzKzrI_SkD1_R09NcjM1eElLcWc/view) is a demo video of running a SSD500 model trained on [MSCOCO](http://mscoco.org) dataset. |
122 |
| - |
123 |
| -4. Check out [`examples/ssd_detect.ipynb`](https://github.com/weiliu89/caffe/blob/ssd/examples/ssd_detect.ipynb) or [`examples/ssd/ssd_detect.cpp`](https://github.com/weiliu89/caffe/blob/ssd/examples/ssd/ssd_detect.cpp) on how to detect objects using a SSD model. Check out [`examples/ssd/plot_detections.py`](https://github.com/weiliu89/caffe/blob/ssd/examples/ssd/plot_detections.py) on how to plot detection results output by ssd_detect.cpp. |
124 |
| - |
125 |
| -5. To train on other dataset, please refer to data/OTHERDATASET for more details. We currently add support for COCO and ILSVRC2016. We recommend using [`examples/ssd.ipynb`](https://github.com/weiliu89/caffe/blob/ssd/examples/ssd_detect.ipynb) to check whether the new dataset is prepared correctly. |
126 |
| - |
127 |
| -### Models |
128 |
| -We have provided the latest models that are trained from different datasets. To help reproduce the results in [Table 6](https://arxiv.org/pdf/1512.02325v4.pdf), most models contain a pretrained `.caffemodel` file, many `.prototxt` files, and python scripts. |
129 |
| - |
130 |
| -1. PASCAL VOC models: |
131 |
| - * 07+12: [SSD300*](http://www.cs.unc.edu/~wliu/projects/SSD/models_VGGNet_VOC0712_SSD_300x300.tar.gz), [SSD512*](http://www.cs.unc.edu/~wliu/projects/SSD/models_VGGNet_VOC0712_SSD_512x512.tar.gz) |
132 |
| - * 07++12: [SSD300*](http://www.cs.unc.edu/~wliu/projects/SSD/models_VGGNet_VOC0712Plus_SSD_300x300.tar.gz), [SSD512*](http://www.cs.unc.edu/~wliu/projects/SSD/models_VGGNet_VOC0712Plus_SSD_512x512.tar.gz) |
133 |
| - * COCO<sup>[1]</sup>: [SSD300*](http://www.cs.unc.edu/~wliu/projects/SSD/models_VGGNet_VOC0712_SSD_300x300_coco.tar.gz), [SSD512*](http://www.cs.unc.edu/~wliu/projects/SSD/models_VGGNet_VOC0712_SSD_512x512_coco.tar.gz) |
134 |
| - * 07+12+COCO: [SSD300*](http://www.cs.unc.edu/~wliu/projects/SSD/models_VGGNet_VOC0712_SSD_300x300_ft.tar.gz), [SSD512*](http://www.cs.unc.edu/~wliu/projects/SSD/models_VGGNet_VOC0712_SSD_512x512_ft.tar.gz) |
135 |
| - * 07++12+COCO: [SSD300*](http://www.cs.unc.edu/~wliu/projects/SSD/models_VGGNet_VOC0712Plus_SSD_300x300_ft.tar.gz), [SSD512*](http://www.cs.unc.edu/~wliu/projects/SSD/models_VGGNet_VOC0712Plus_SSD_512x512_ft.tar.gz) |
136 | 13 |
|
137 |
| -2. COCO models: |
138 |
| - * trainval35k: [SSD300*](http://www.cs.unc.edu/~wliu/projects/SSD/models_VGGNet_coco_SSD_300x300.tar.gz), [SSD512*](http://www.cs.unc.edu/~wliu/projects/SSD/models_VGGNet_coco_SSD_512x512.tar.gz) |
| 14 | +# Demo |
| 15 | +Here we provided a SSD demo for object detection. |
139 | 16 |
|
140 |
| -3. ILSVRC models: |
141 |
| - * trainval1: [SSD300*](http://www.cs.unc.edu/~wliu/projects/SSD/models_VGGNet_ILSVRC2016_SSD_300x300.tar.gz), [SSD500](http://www.cs.unc.edu/~wliu/projects/SSD/models_VGGNet_ilsvrc15_SSD_500x500.tar.gz) |
| 17 | +1. Download [SSD300*](http://www.cs.unc.edu/~wliu/projects/SSD/models_VGGNet_VOC0712_SSD_300x300.tar.gz), and only extract the **caffemodel** file into model-zoo/caffe/VOC0712/SSD_300x300. |
142 | 18 |
|
143 |
| -<sup>[1]</sup>We use [`examples/convert_model.ipynb`](https://github.com/weiliu89/caffe/blob/ssd/examples/convert_model.ipynb) to extract a VOC model from a pretrained COCO model. |
| 19 | +2. cd demo/caffe-ssd && node demo.js |
0 commit comments