Skip to content

Commit fe91a0d

Browse files
committed
Small changes.
* commit '962ecb0403eb44af10ebb685675ad9caf04ac9d9': clean up redundent function. Fix compatibility for python3 clean up bbox. clean up nms. fix heading space. fix link. Update README.md fix visualization. # Conflicts: # README.md # experiments/scripts/train_faster_rcnn.sh # lib/model/test.py # lib/setup.py # lib/utils/bbox.pyx # lib/utils/visualization.py
2 parents 88c6583 + 962ecb0 commit fe91a0d

File tree

6 files changed

+48
-66
lines changed

6 files changed

+48
-66
lines changed

README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,11 @@ Additional features not mentioned in the [report](https://arxiv.org/pdf/1702.021
7070

7171
| GPU model | Architecture |
7272
| ------------- | ------------- |
73-
| TitanX (Maxwell/Pascal) | sm_52 |
74-
| Grid K520 (AWS g2.2xlarge) | sm_30 |
75-
| Tesla K80 (AWS p2.xlarge) | sm_37 |
73+
| TitanX (Maxwell/Pascal) | sm_52 |
74+
| GTX 960M | sm_50 |
75+
| GTX 1080 (Ti) | sm_61 |
76+
| Grid K520 (AWS g2.2xlarge) | sm_30 |
77+
| Tesla K80 (AWS p2.xlarge) | sm_37 |
7678

7779
**Note**: You are welcome to contribute the settings on your end if you have made the code work properly on other GPUs.
7880

experiments/scripts/train_faster_rcnn.sh

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -51,35 +51,35 @@ echo Logging output to "$LOG"
5151

5252
set +x
5353
if [[ ! -z ${EXTRA_ARGS_SLUG} ]]; then
54-
NET_FINAL=output/${NET}/${TRAIN_IMDB}/${EXTRA_ARGS_SLUG}/${NET}_faster_rcnn_iter_${ITERS}.pth
54+
NET_FINAL=output/${NET}/${TRAIN_IMDB}/${EXTRA_ARGS_SLUG}/${NET}_faster_rcnn_iter_${ITERS}.ckpt
5555
else
56-
NET_FINAL=output/${NET}/${TRAIN_IMDB}/default/${NET}_faster_rcnn_iter_${ITERS}.pth
56+
NET_FINAL=output/${NET}/${TRAIN_IMDB}/default/${NET}_faster_rcnn_iter_${ITERS}.ckpt
5757
fi
5858
set -x
5959

6060
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}.pth \
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}.pth \
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
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
8383
fi
8484

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

lib/datasets/factory.py

Lines changed: 5 additions & 0 deletions
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

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,14 @@
2323

2424

2525
class pascal_voc(imdb):
26-
def __init__(self, image_set, year, devkit_path=None):
27-
imdb.__init__(self, 'voc_' + year + '_' + image_set)
26+
def __init__(self, image_set, year, use_diff=False):
27+
name = 'voc_' + year + '_' + image_set
28+
if use_diff:
29+
name += '_diff'
30+
imdb.__init__(self, name)
2831
self._year = year
2932
self._image_set = image_set
30-
self._devkit_path = self._get_default_path() if devkit_path is None \
31-
else devkit_path
33+
self._devkit_path = self._get_default_path()
3234
self._data_path = os.path.join(self._devkit_path, 'VOC' + self._year)
3335
self._classes = ('__background__', # always index 0
3436
'aeroplane', 'bicycle', 'bird', 'boat',
@@ -47,7 +49,7 @@ def __init__(self, image_set, year, devkit_path=None):
4749
# PASCAL specific config options
4850
self.config = {'cleanup': True,
4951
'use_salt': True,
50-
'use_diff': False,
52+
'use_diff': use_diff,
5153
'matlab_eval': False,
5254
'rpn_file': None}
5355

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

lib/datasets/voc_eval.py

Lines changed: 6 additions & 2 deletions
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,

lib/nets/mobilenet_v1.py

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -249,37 +249,6 @@ def _head_to_tail(self, pool5, is_training, reuse=False):
249249
fc7 = tf.reduce_mean(fc7, axis=[1, 2])
250250
return fc7
251251

252-
def _build_network(self, is_training=True):
253-
# select initializers
254-
if cfg.TRAIN.TRUNCATED:
255-
initializer = tf.truncated_normal_initializer(mean=0.0, stddev=0.01)
256-
initializer_bbox = tf.truncated_normal_initializer(mean=0.0, stddev=0.001)
257-
else:
258-
initializer = tf.random_normal_initializer(mean=0.0, stddev=0.01)
259-
initializer_bbox = tf.random_normal_initializer(mean=0.0, stddev=0.001)
260-
261-
net_conv = self._image_to_head(is_training)
262-
with tf.variable_scope(self._scope, self._scope):
263-
# build the anchors for the image
264-
self._anchor_component()
265-
# region proposal network
266-
rois = self._region_proposal(net_conv, is_training, initializer)
267-
# region of interest pooling
268-
if cfg.POOLING_MODE == 'crop':
269-
pool5 = self._crop_pool_layer(net_conv, rois, "pool5")
270-
else:
271-
raise NotImplementedError
272-
273-
fc7 = self._head_to_tail(pool5, is_training)
274-
with tf.variable_scope(self._scope, self._scope):
275-
# region classification
276-
cls_prob, bbox_pred = self._region_classification(fc7, is_training,
277-
initializer, initializer_bbox)
278-
279-
self._score_summaries.update(self._predictions)
280-
281-
return rois, cls_prob, bbox_pred
282-
283252
def get_variables_to_restore(self, variables, var_keep_dic):
284253
variables_to_restore = []
285254

0 commit comments

Comments
 (0)