Skip to content

Commit cb9f185

Browse files
committed
0411@2018.06.25:
1 parent 142cc2a commit cb9f185

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+1914
-7423
lines changed

.gitmodules

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
branch = fast-rcnn
55
[submodule "caffe-wsl"]
66
path = caffe-wsl
7-
url = https://shenyunhang@bitbucket.org/shenyunhang/caffe-wsl.git
7+
url = https://github.com/shenyunhang/caffe-wsl.git
88
branch = wsl
99
[submodule "caffe-fwsl"]
1010
path = caffe-fwsl
11-
url = https://shenyunhang@bitbucket.org/shenyunhang/ssd.git
11+
url = https://github.com/shenyunhang/caffe-fwsl.git

LICENSE

Lines changed: 1 addition & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Faster R-CNN
1+
CPG
22

33
The MIT License (MIT)
44

@@ -21,61 +21,3 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
2121
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2222
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2323
THE SOFTWARE.
24-
25-
************************************************************************
26-
27-
THIRD-PARTY SOFTWARE NOTICES AND INFORMATION
28-
29-
This project, Faster R-CNN, incorporates material from the project(s)
30-
listed below (collectively, "Third Party Code"). Microsoft is not the
31-
original author of the Third Party Code. The original copyright notice
32-
and license under which Microsoft received such Third Party Code are set
33-
out below. This Third Party Code is licensed to you under their original
34-
license terms set forth below. Microsoft reserves all other rights not
35-
expressly granted, whether by implication, estoppel or otherwise.
36-
37-
1. Caffe, (https://github.com/BVLC/caffe/)
38-
39-
COPYRIGHT
40-
41-
All contributions by the University of California:
42-
Copyright (c) 2014, 2015, The Regents of the University of California (Regents)
43-
All rights reserved.
44-
45-
All other contributions:
46-
Copyright (c) 2014, 2015, the respective contributors
47-
All rights reserved.
48-
49-
Caffe uses a shared copyright model: each contributor holds copyright
50-
over their contributions to Caffe. The project versioning records all
51-
such contribution and copyright details. If a contributor wants to
52-
further mark their specific copyright on a particular contribution,
53-
they should indicate their copyright solely in the commit message of
54-
the change when it is committed.
55-
56-
The BSD 2-Clause License
57-
58-
Redistribution and use in source and binary forms, with or without
59-
modification, are permitted provided that the following conditions
60-
are met:
61-
62-
1. Redistributions of source code must retain the above copyright notice,
63-
this list of conditions and the following disclaimer.
64-
65-
2. Redistributions in binary form must reproduce the above copyright
66-
notice, this list of conditions and the following disclaimer in the
67-
documentation and/or other materials provided with the distribution.
68-
69-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
70-
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
71-
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
72-
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
73-
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
74-
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
75-
TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
76-
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
77-
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
78-
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
79-
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
80-
81-
************END OF THIRD-PARTY SOFTWARE NOTICES AND INFORMATION**********

README.md

Lines changed: 63 additions & 108 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,11 @@
1-
### Disclaimer
2-
3-
The official Faster R-CNN code (written in MATLAB) is available [here](https://github.com/ShaoqingRen/faster_rcnn).
4-
If your goal is to reproduce the results in our NIPS 2015 paper, please use the [official code](https://github.com/ShaoqingRen/faster_rcnn).
5-
6-
This repository contains a Python *reimplementation* of the MATLAB code.
7-
This Python implementation is built on a fork of [Fast R-CNN](https://github.com/rbgirshick/fast-rcnn).
8-
There are slight differences between the two implementations.
9-
In particular, this Python port
10-
- is ~10% slower at test-time, because some operations execute on the CPU in Python layers (e.g., 220ms / image vs. 200ms / image for VGG16)
11-
- gives similar, but not exactly the same, mAP as the MATLAB version
12-
- is *not compatible* with models trained using the MATLAB code due to the minor implementation differences
13-
- **includes approximate joint training** that is 1.5x faster than alternating optimization (for VGG16) -- see these [slides](https://www.dropbox.com/s/xtr4yd4i5e0vw8g/iccv15_tutorial_training_rbg.pdf?dl=0) for more information
14-
15-
# *Faster* R-CNN: Towards Real-Time Object Detection with Region Proposal Networks
16-
17-
By Shaoqing Ren, Kaiming He, Ross Girshick, Jian Sun (Microsoft Research)
18-
19-
This Python implementation contains contributions from Sean Bell (Cornell) written during an MSR internship.
20-
21-
Please see the official [README.md](https://github.com/ShaoqingRen/faster_rcnn/blob/master/README.md) for more details.
22-
23-
Faster R-CNN was initially described in an [arXiv tech report](http://arxiv.org/abs/1506.01497) and was subsequently published in NIPS 2015.
24-
25-
### License
26-
27-
Faster R-CNN is released under the MIT License (refer to the LICENSE file for details).
28-
29-
### Citing Faster R-CNN
30-
31-
If you find Faster R-CNN useful in your research, please consider citing:
32-
33-
@inproceedings{renNIPS15fasterrcnn,
34-
Author = {Shaoqing Ren and Kaiming He and Ross Girshick and Jian Sun},
35-
Title = {Faster {R-CNN}: Towards Real-Time Object Detection
36-
with Region Proposal Networks},
37-
Booktitle = {Advances in Neural Information Processing Systems ({NIPS})},
38-
Year = {2015}
39-
}
1+
# CPG
2+
Object-Aware Spatial Constraint for Weakly Supervised Detection
403

414
### Contents
425
1. [Requirements: software](#requirements-software)
436
2. [Requirements: hardware](#requirements-hardware)
44-
3. [Basic installation](#installation-sufficient-for-the-demo)
45-
4. [Demo](#demo)
46-
5. [Beyond the demo: training and testing](#beyond-the-demo-installation-for-training-and-testing-models)
47-
6. [Usage](#usage)
7+
3. [Installation](#installation)
8+
4. [Usage](#usage)
489

4910
### Requirements: software
5011

@@ -58,44 +19,42 @@ If you find Faster R-CNN useful in your research, please consider citing:
5819
# Unrelatedly, it's also recommended that you use CUDNN
5920
USE_CUDNN := 1
6021
```
61-
62-
You can download my [Makefile.config](https://dl.dropboxusercontent.com/s/6joa55k64xo2h68/Makefile.config?dl=0) for reference.
22+
6323
2. Python packages you might not have: `cython`, `python-opencv`, `easydict`
6424
3. [Optional] MATLAB is required for **official** PASCAL VOC evaluation only. The code now includes unofficial Python evaluation code.
6525

6626
### Requirements: hardware
6727

68-
1. For training smaller networks (ZF, VGG_CNN_M_1024) a good GPU (e.g., Titan, K20, K40, ...) with at least 3G of memory suffices
69-
2. For training Fast R-CNN with VGG16, you'll need a K40 (~11G of memory)
70-
3. For training the end-to-end version of Faster R-CNN with VGG16, 3G of GPU memory is sufficient (using CUDNN)
28+
1. For training smaller networks (VGG_CNN_F, VGG_CNN_M_1024), a GPU with about 6G of memory suffices.
29+
2. For training lager networks (VGG16), you'll need a GPU with about 8G of memory.
7130

72-
### Installation (sufficient for the demo)
31+
### Installation
7332

74-
1. Clone the Faster R-CNN repository
33+
1. Clone the CPG repository
7534
```Shell
7635
# Make sure to clone with --recursive
77-
git clone --recursive https://github.com/rbgirshick/py-faster-rcnn.git
36+
git clone --recursive https://github.com/shenyunhang/CPG.git
7837
```
7938

80-
2. We'll call the directory that you cloned Faster R-CNN into `FRCN_ROOT`
39+
2. We'll call the directory that you cloned CPG into `CPG_ROOT`
8140

8241
*Ignore notes 1 and 2 if you followed step 1 above.*
8342

84-
**Note 1:** If you didn't clone Faster R-CNN with the `--recursive` flag, then you'll need to manually clone the `caffe-fast-rcnn` submodule:
43+
**Note 1:** If you didn't clone CPG with the `--recursive` flag, then you'll need to manually clone the `caffe-wsl` submodule:
8544
```Shell
8645
git submodule update --init --recursive
8746
```
88-
**Note 2:** The `caffe-fast-rcnn` submodule needs to be on the `faster-rcnn` branch (or equivalent detached state). This will happen automatically *if you followed step 1 instructions*.
47+
**Note 2:** The `caffe-wsl` submodule needs to be on the `wsl` branch (or equivalent detached state). This will happen automatically *if you followed step 1 instructions*.
8948

9049
3. Build the Cython modules
9150
```Shell
92-
cd $FRCN_ROOT/lib
51+
cd $CPG_ROOT/lib
9352
make
9453
```
9554

9655
4. Build Caffe and pycaffe
9756
```Shell
98-
cd $FRCN_ROOT/caffe-fast-rcnn
57+
cd $CPG_ROOT/caffe-wsl
9958
# Now follow the Caffe installation instructions here:
10059
# http://caffe.berkeleyvision.org/installation.html
10160
@@ -104,44 +63,23 @@ If you find Faster R-CNN useful in your research, please consider citing:
10463
make -j8 && make pycaffe
10564
```
10665

107-
5. Download pre-computed Faster R-CNN detectors
108-
```Shell
109-
cd $FRCN_ROOT
110-
./data/scripts/fetch_faster_rcnn_models.sh
111-
```
112-
113-
This will populate the `$FRCN_ROOT/data` folder with `faster_rcnn_models`. See `data/README.md` for details.
114-
These models were trained on VOC 2007 trainval.
115-
116-
### Demo
117-
118-
*After successfully completing [basic installation](#installation-sufficient-for-the-demo)*, you'll be ready to run the demo.
119-
120-
To run the demo
121-
```Shell
122-
cd $FRCN_ROOT
123-
./tools/demo.py
124-
```
125-
The demo performs detection using a VGG16 network trained for detection on PASCAL VOC 2007.
126-
127-
### Beyond the demo: installation for training and testing models
128-
1. Download the training, validation, test data and VOCdevkit
66+
5. Download the training, validation, test data and VOCdevkit
12967

13068
```Shell
13169
wget http://host.robots.ox.ac.uk/pascal/VOC/voc2007/VOCtrainval_06-Nov-2007.tar
13270
wget http://host.robots.ox.ac.uk/pascal/VOC/voc2007/VOCtest_06-Nov-2007.tar
13371
wget http://host.robots.ox.ac.uk/pascal/VOC/voc2007/VOCdevkit_08-Jun-2007.tar
13472
```
13573

136-
2. Extract all of these tars into one directory named `VOCdevkit`
74+
6. Extract all of these tars into one directory named `VOCdevkit`
13775

13876
```Shell
13977
tar xvf VOCtrainval_06-Nov-2007.tar
14078
tar xvf VOCtest_06-Nov-2007.tar
14179
tar xvf VOCdevkit_08-Jun-2007.tar
14280
```
14381

144-
3. It should have this basic structure
82+
7. It should have this basic structure
14583

14684
```Shell
14785
$VOCdevkit/ # development kit
@@ -150,61 +88,55 @@ The demo performs detection using a VGG16 network trained for detection on PASCA
15088
# ... and several other directories ...
15189
```
15290

153-
4. Create symlinks for the PASCAL VOC dataset
91+
8. Create symlinks for the PASCAL VOC dataset
15492

15593
```Shell
156-
cd $FRCN_ROOT/data
94+
cd $CPG_ROOT/data
15795
ln -s $VOCdevkit VOCdevkit2007
15896
```
15997
Using symlinks is a good idea because you will likely want to share the same PASCAL dataset installation between multiple projects.
160-
5. [Optional] follow similar steps to get PASCAL VOC 2010 and 2012
161-
6. [Optional] If you want to use COCO, please see some notes under `data/README.md`
162-
7. Follow the next sections to download pre-trained ImageNet models
98+
9. [Optional] follow similar steps to get PASCAL VOC 2010 and 2012
99+
10. [Optional] If you want to use COCO, please see some notes under `data/README.md`
100+
11. Follow the next sections to download pre-trained ImageNet models
101+
102+
### Download object proposals
103+
1. Selective Search: [original matlab code](http://disi.unitn.it/~uijlings/MyHomepage/index.php#page=projects1), [python wrapper](https://github.com/sergeyk/selective_search_ijcv_with_python)
104+
2. EdgeBoxes: [matlab code](https://github.com/pdollar/edges)
105+
3. MCG: [matlab code](http://www.eecs.berkeley.edu/Research/Projects/CS/vision/grouping/mcg/)
106+
163107

164108
### Download pre-trained ImageNet models
165109

166110
Pre-trained ImageNet models can be downloaded for the three networks described in the paper: ZF and VGG16.
167111

168112
```Shell
169-
cd $FRCN_ROOT
113+
cd $CPG_ROOT
170114
./data/scripts/fetch_imagenet_models.sh
171115
```
172-
VGG16 comes from the [Caffe Model Zoo](https://github.com/BVLC/caffe/wiki/Model-Zoo), but is provided here for your convenience.
173-
ZF was trained at MSRA.
174116

175117
### Usage
176118

177-
To train and test a Faster R-CNN detector using the **alternating optimization** algorithm from our NIPS 2015 paper, use `experiments/scripts/faster_rcnn_alt_opt.sh`.
178-
Output is written underneath `$FRCN_ROOT/output`.
119+
To train and test a CPG detector, use `experiments/scripts/cpg.sh`.
120+
Output is written underneath `$CPG_ROOT/output`.
179121

180122
```Shell
181-
cd $FRCN_ROOT
182-
./experiments/scripts/faster_rcnn_alt_opt.sh [GPU_ID] [NET] [--set ...]
123+
cd $CPG_ROOT
124+
./experiments/scripts/cpg.sh [GPU_ID] [NET] [--set ...]
183125
# GPU_ID is the GPU you want to train on
184-
# NET in {ZF, VGG_CNN_M_1024, VGG16} is the network arch to use
185-
# --set ... allows you to specify fast_rcnn.config options, e.g.
126+
# NET in {VGG_CNN_F, VGG_CNN_M_1024, VGG16} is the network arch to use
127+
# --set ... allows you to specify configure options, e.g.
186128
# --set EXP_DIR seed_rng1701 RNG_SEED 1701
187129
```
188130

189-
("alt opt" refers to the alternating optimization training algorithm described in the NIPS paper.)
190-
191-
To train and test a Faster R-CNN detector using the **approximate joint training** method, use `experiments/scripts/faster_rcnn_end2end.sh`.
192-
Output is written underneath `$FRCN_ROOT/output`.
131+
Example:
193132

194133
```Shell
195-
cd $FRCN_ROOT
196-
./experiments/scripts/faster_rcnn_end2end.sh [GPU_ID] [NET] [--set ...]
197-
# GPU_ID is the GPU you want to train on
198-
# NET in {ZF, VGG_CNN_M_1024, VGG16} is the network arch to use
199-
# --set ... allows you to specify fast_rcnn.config options, e.g.
200-
# --set EXP_DIR seed_rng1701 RNG_SEED 1701
134+
./experiments/scripts/cpg.sh 0 VGG16 pascal_voc --set EXP_DIR cpg
201135
```
202136

203-
This method trains the RPN module jointly with the Fast R-CNN network, rather than alternating between training the two. It results in faster (~ 1.5x speedup) training times and similar detection accuracy. See these [slides](https://www.dropbox.com/s/xtr4yd4i5e0vw8g/iccv15_tutorial_training_rbg.pdf?dl=0) for more details.
137+
This will reproduction the VGG16 result in paper.
204138

205-
Artifacts generated by the scripts in `tools` are written in this directory.
206-
207-
Trained Fast R-CNN networks are saved under:
139+
Trained CPG networks are saved under:
208140

209141
```
210142
output/<experiment directory>/<dataset name>/
@@ -215,3 +147,26 @@ Test outputs are saved under:
215147
```
216148
output/<experiment directory>/<dataset name>/<network snapshot name>/
217149
```
150+
151+
### Other method
152+
153+
WSDDN:
154+
155+
```Shell
156+
./experiments/scripts/wsddn.sh 0 VGG16 pascal_voc --set EXP_DIR wsddn
157+
```
158+
or
159+
```Shell
160+
./experiments/scripts/wsddn_x.sh 0 VGG16 pascal_voc --set EXP_DIR wsddn_x
161+
```
162+
163+
ContextLocNet:
164+
165+
```Shell
166+
./experiments/scripts/contextlocnet.sh 0 VGG16 pascal_voc --set EXP_DIR contextlocnet
167+
```
168+
or
169+
```Shell
170+
./experiments/scripts/contextlocnet_x.sh 0 VGG16 pascal_voc --set EXP_DIR contextlocnet_x
171+
```
172+

data/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@ faster_rcnn_models*
1010
*.mat
1111
*.caffemodel
1212
*.xml
13+
coco*

data/VOC2010/create_data_noise.sh

Lines changed: 0 additions & 35 deletions
This file was deleted.

0 commit comments

Comments
 (0)