Skip to content

Commit

Permalink
add rpn subcls
Browse files Browse the repository at this point in the history
  • Loading branch information
Yu Xiang committed Jun 7, 2016
1 parent 0c5eb59 commit 027ff53
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
1 change: 1 addition & 0 deletions fast-rcnn/experiments/cfgs/pascal_rpn_cls_vgg16.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,4 @@ TEST:
ROI_THRESHOLD: 0.005
ROI_NUM: 2000
BBOX_REG: True
SUBCLS: False
22 changes: 12 additions & 10 deletions fast-rcnn/lib/fast_rcnn/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -386,17 +386,19 @@ def im_detect_proposal(net, im, boxes_grid, num_classes, num_subclasses, subclas

# build max_scores
tmp = np.reshape(scores_subcls, (scores_subcls.shape[0], scores_subcls.shape[1]))
max_scores = np.zeros((scores_subcls.shape[0], num_classes))
max_scores[:,0] = tmp[:,0]
assert (num_classes == 2 or num_classes == 4 or num_classes == 13 or num_classes == 21), 'The number of classes is not supported!'
if num_classes == 2:
max_scores[:,1] = tmp[:,1:].max(axis = 1)
if cfg.TEST.SUBCLS:
max_scores = np.zeros((scores_subcls.shape[0], num_classes))
max_scores[:,0] = tmp[:,0]
assert (num_classes == 2 or num_classes == 4 or num_classes == 13 or num_classes == 21), 'The number of classes is not supported!'
if num_classes == 2:
max_scores[:,1] = tmp[:,1:].max(axis = 1)
else:
for i in xrange(1, num_classes):
index = np.where(subclass_mapping == i)[0]
max_scores[:,i] = tmp[:,index].max(axis = 1)
scores = max_scores
else:
for i in xrange(1, num_classes):
index = np.where(subclass_mapping == i)[0]
max_scores[:,i] = tmp[:,index].max(axis = 1)

scores = max_scores
scores = tmp

rois = net.blobs['rois_sub'].data
inds = rois[:,0]
Expand Down

0 comments on commit 027ff53

Please sign in to comment.