Skip to content

Commit d726834

Browse files
author
Xinlei Chen
committed
fix link.
1 parent 7c058de commit d726834

File tree

6 files changed

+60
-34
lines changed

6 files changed

+60
-34
lines changed

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ Approximate *baseline* [setup](https://github.com/endernewton/tf-faster-rcnn/blo
3434
- For COCO, we find the performance improving with more iterations (VGG16 350k/490k: 26.9, 600k/790k: 28.3, 900k/1190k: 29.5), and potentially better performance can be achieved with even more iterations.
3535
- For Resnets, we fix the first block (total 4) when fine-tuning the network, and only use ``crop_and_resize`` to resize the RoIs (7x7) without max-pool (which I find useless especially for COCO). The final feature maps are average-pooled for classification and regression. All batch normalization parameters are fixed. Weight decay is set to Renset101 default 1e-4. Learning rate for biases is not doubled.
3636
- For approximate [FPN](https://arxiv.org/abs/1612.03144) baseline setup we simply resize the image with 800 pixels, add 32^2 anchors, and take 1000 proposals during testing.
37-
- Check out [here](http://ladoga.graphics.cs.cmu.edu/xinleic/tf-faster-rcnn/)/[here](http://gs11655.sp.cs.cmu.edu/xinleic/tf-faster-rcnn/)/[here](https://drive.google.com/open?id=0B1_fAEgxdnvJSmF3YUlZcHFqWTQ) for the latest models, including longer COCO VGG16 models and Resnet ones.
37+
- Check out [here](http://ladoga.graphics.cs.cmu.edu/xinleic/tf-faster-rcnn/)/[here](http://xinlei.sp.cs.cmu.edu/xinleic/tf-faster-rcnn/)/[here](https://drive.google.com/open?id=0B1_fAEgxdnvJSmF3YUlZcHFqWTQ) for the latest models, including longer COCO VGG16 models and Resnet ones.
3838

3939
### Additional features
4040
Additional features not mentioned in the [report](https://arxiv.org/pdf/1702.02138.pdf) are added to make research life easier:
@@ -99,7 +99,7 @@ If you find it useful, the ``data/cache`` folder created on my side is also shar
9999
./data/scripts/fetch_faster_rcnn_models.sh
100100
```
101101
**Note**: if you cannot download the models through the link, or you want to try more models, you can check out the following solutions and optionally update the downloading script:
102-
- Another server [here](http://gs11655.sp.cs.cmu.edu/xinleic/tf-faster-rcnn/).
102+
- Another server [here](http://xinlei.sp.cs.cmu.edu/xinleic/tf-faster-rcnn/).
103103
- Google drive [here](https://drive.google.com/open?id=0B1_fAEgxdnvJSmF3YUlZcHFqWTQ).
104104

105105
2. Create a folder and a softlink to use the pre-trained model

experiments/scripts/test_faster_rcnn.sh

+7
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,13 @@ case ${DATASET} in
2222
ANCHORS="[8,16,32]"
2323
RATIOS="[0.5,1,2]"
2424
;;
25+
pascal_voc_diff)
26+
TRAIN_IMDB="voc_2007_trainval"
27+
TEST_IMDB="voc_2007_test_diff"
28+
ITERS=70000
29+
ANCHORS="[8,16,32]"
30+
RATIOS="[0.5,1,2]"
31+
;;
2532
pascal_voc_0712)
2633
TRAIN_IMDB="voc_2007_trainval+voc_2012_trainval"
2734
TEST_IMDB="voc_2007_test"

experiments/scripts/train_faster_rcnn.sh

+32-24
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,14 @@ case ${DATASET} in
2323
ANCHORS="[8,16,32]"
2424
RATIOS="[0.5,1,2]"
2525
;;
26+
pascal_voc_diff)
27+
TRAIN_IMDB="voc_2007_trainval"
28+
TEST_IMDB="voc_2007_test_diff"
29+
STEPSIZE="[50000]"
30+
ITERS=70000
31+
ANCHORS="[8,16,32]"
32+
RATIOS="[0.5,1,2]"
33+
;;
2634
pascal_voc_0712)
2735
TRAIN_IMDB="voc_2007_trainval+voc_2012_trainval"
2836
TEST_IMDB="voc_2007_test"
@@ -51,35 +59,35 @@ echo Logging output to "$LOG"
5159

5260
set +x
5361
if [[ ! -z ${EXTRA_ARGS_SLUG} ]]; then
54-
NET_FINAL=output/${NET}/${TRAIN_IMDB}/${EXTRA_ARGS_SLUG}/${NET}_faster_rcnn_iter_${ITERS}.ckpt
62+
NET_FINAL=output/${NET}/${TRAIN_IMDB}/${EXTRA_ARGS_SLUG}/${NET}_faster_rcnn_iter_${ITERS}.ckpt
5563
else
56-
NET_FINAL=output/${NET}/${TRAIN_IMDB}/default/${NET}_faster_rcnn_iter_${ITERS}.ckpt
64+
NET_FINAL=output/${NET}/${TRAIN_IMDB}/default/${NET}_faster_rcnn_iter_${ITERS}.ckpt
5765
fi
5866
set -x
5967

6068
if [ ! -f ${NET_FINAL}.index ]; then
61-
if [[ ! -z ${EXTRA_ARGS_SLUG} ]]; then
62-
CUDA_VISIBLE_DEVICES=${GPU_ID} time python ./tools/trainval_net.py \
63-
--weight data/imagenet_weights/${NET}.ckpt \
64-
--imdb ${TRAIN_IMDB} \
65-
--imdbval ${TEST_IMDB} \
66-
--iters ${ITERS} \
67-
--cfg experiments/cfgs/${NET}.yml \
68-
--tag ${EXTRA_ARGS_SLUG} \
69-
--net ${NET} \
70-
--set ANCHOR_SCALES ${ANCHORS} ANCHOR_RATIOS ${RATIOS} \
71-
TRAIN.STEPSIZE ${STEPSIZE} ${EXTRA_ARGS}
72-
else
73-
CUDA_VISIBLE_DEVICES=${GPU_ID} time python ./tools/trainval_net.py \
74-
--weight data/imagenet_weights/${NET}.ckpt \
75-
--imdb ${TRAIN_IMDB} \
76-
--imdbval ${TEST_IMDB} \
77-
--iters ${ITERS} \
78-
--cfg experiments/cfgs/${NET}.yml \
79-
--net ${NET} \
80-
--set ANCHOR_SCALES ${ANCHORS} ANCHOR_RATIOS ${RATIOS} \
81-
TRAIN.STEPSIZE ${STEPSIZE} ${EXTRA_ARGS}
82-
fi
69+
if [[ ! -z ${EXTRA_ARGS_SLUG} ]]; then
70+
CUDA_VISIBLE_DEVICES=${GPU_ID} time python ./tools/trainval_net.py \
71+
--weight data/imagenet_weights/${NET}.ckpt \
72+
--imdb ${TRAIN_IMDB} \
73+
--imdbval ${TEST_IMDB} \
74+
--iters ${ITERS} \
75+
--cfg experiments/cfgs/${NET}.yml \
76+
--tag ${EXTRA_ARGS_SLUG} \
77+
--net ${NET} \
78+
--set ANCHOR_SCALES ${ANCHORS} ANCHOR_RATIOS ${RATIOS} \
79+
TRAIN.STEPSIZE ${STEPSIZE} ${EXTRA_ARGS}
80+
else
81+
CUDA_VISIBLE_DEVICES=${GPU_ID} time python ./tools/trainval_net.py \
82+
--weight data/imagenet_weights/${NET}.ckpt \
83+
--imdb ${TRAIN_IMDB} \
84+
--imdbval ${TEST_IMDB} \
85+
--iters ${ITERS} \
86+
--cfg experiments/cfgs/${NET}.yml \
87+
--net ${NET} \
88+
--set ANCHOR_SCALES ${ANCHORS} ANCHOR_RATIOS ${RATIOS} \
89+
TRAIN.STEPSIZE ${STEPSIZE} ${EXTRA_ARGS}
90+
fi
8391
fi
8492

8593
./experiments/scripts/test_faster_rcnn.sh $@

lib/datasets/factory.py

+5
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@
2222
name = 'voc_{}_{}'.format(year, split)
2323
__sets[name] = (lambda split=split, year=year: pascal_voc(split, year))
2424

25+
for year in ['2007', '2012']:
26+
for split in ['train', 'val', 'trainval', 'test']:
27+
name = 'voc_{}_{}_diff'.format(year, split)
28+
__sets[name] = (lambda split=split, year=year: pascal_voc(split, year, use_diff=True))
29+
2530
# Set up coco_2014_<split>
2631
for year in ['2014']:
2732
for split in ['train', 'val', 'minival', 'valminusminival', 'trainval']:

lib/datasets/pascal_voc.py

+8-6
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,14 @@
2424

2525

2626
class pascal_voc(imdb):
27-
def __init__(self, image_set, year, devkit_path=None):
28-
imdb.__init__(self, 'voc_' + year + '_' + image_set)
27+
def __init__(self, image_set, year, use_diff=False):
28+
name = 'voc_' + year + '_' + image_set
29+
if use_diff:
30+
name += '_diff'
31+
imdb.__init__(self, name)
2932
self._year = year
3033
self._image_set = image_set
31-
self._devkit_path = self._get_default_path() if devkit_path is None \
32-
else devkit_path
34+
self._devkit_path = self._get_default_path()
3335
self._data_path = os.path.join(self._devkit_path, 'VOC' + self._year)
3436
self._classes = ('__background__', # always index 0
3537
'aeroplane', 'bicycle', 'bird', 'boat',
@@ -48,7 +50,7 @@ def __init__(self, image_set, year, devkit_path=None):
4850
# PASCAL specific config options
4951
self.config = {'cleanup': True,
5052
'use_salt': True,
51-
'use_diff': False,
53+
'use_diff': use_diff,
5254
'matlab_eval': False,
5355
'rpn_file': None}
5456

@@ -241,7 +243,7 @@ def _do_python_eval(self, output_dir='output'):
241243
filename = self._get_voc_results_file_template().format(cls)
242244
rec, prec, ap = voc_eval(
243245
filename, annopath, imagesetfile, cls, cachedir, ovthresh=0.5,
244-
use_07_metric=use_07_metric)
246+
use_07_metric=use_07_metric, use_diff=self.config['use_diff'])
245247
aps += [ap]
246248
print(('AP for {} = {:.4f}'.format(cls, ap)))
247249
with open(os.path.join(output_dir, cls + '_pr.pkl'), 'wb') as f:

lib/datasets/voc_eval.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,8 @@ def voc_eval(detpath,
7272
classname,
7373
cachedir,
7474
ovthresh=0.5,
75-
use_07_metric=False):
75+
use_07_metric=False,
76+
use_diff=False):
7677
"""rec, prec, ap = voc_eval(detpath,
7778
annopath,
7879
imagesetfile,
@@ -133,7 +134,10 @@ def voc_eval(detpath,
133134
for imagename in imagenames:
134135
R = [obj for obj in recs[imagename] if obj['name'] == classname]
135136
bbox = np.array([x['bbox'] for x in R])
136-
difficult = np.array([x['difficult'] for x in R]).astype(np.bool)
137+
if use_diff:
138+
difficult = np.array([False for x in R]).astype(np.bool)
139+
else:
140+
difficult = np.array([x['difficult'] for x in R]).astype(np.bool)
137141
det = [False] * len(R)
138142
npos = npos + sum(~difficult)
139143
class_recs[imagename] = {'bbox': bbox,

0 commit comments

Comments
 (0)