You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by lx...@apache.org on 2017/07/07 15:58:49 UTC
[36/50] [abbrv] incubator-mxnet-test git commit: fix label bug which
harms voc accuracy (#6849)
fix label bug which harms voc accuracy (#6849)
* fix label bug which harms voc accuracy
* change padding rois sampling from neg rois only
Project: http://git-wip-us.apache.org/repos/asf/incubator-mxnet-test/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-mxnet-test/commit/5fb08321
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mxnet-test/tree/5fb08321
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mxnet-test/diff/5fb08321
Branch: refs/heads/master
Commit: 5fb083212f2337963462295e782610df5e2345d4
Parents: 998378a
Author: Han Shen <th...@gmail.com>
Authored: Tue Jul 4 02:37:28 2017 +0800
Committer: Eric Junyuan Xie <pi...@users.noreply.github.com>
Committed: Mon Jul 3 11:37:28 2017 -0700
----------------------------------------------------------------------
example/rcnn/rcnn/io/rcnn.py | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-mxnet-test/blob/5fb08321/example/rcnn/rcnn/io/rcnn.py
----------------------------------------------------------------------
diff --git a/example/rcnn/rcnn/io/rcnn.py b/example/rcnn/rcnn/io/rcnn.py
index aad1a46..807447c 100644
--- a/example/rcnn/rcnn/io/rcnn.py
+++ b/example/rcnn/rcnn/io/rcnn.py
@@ -146,12 +146,13 @@ def sample_rois(rois, fg_rois_per_image, rois_per_image, num_classes,
# indexes selected
keep_indexes = np.append(fg_indexes, bg_indexes)
-
+ neg_idx = np.where(overlaps < config.TRAIN.FG_THRESH)[0]
+ neg_rois = rois[neg_idx]
# pad more to ensure a fixed minibatch size
while keep_indexes.shape[0] < rois_per_image:
- gap = np.minimum(len(rois), rois_per_image - keep_indexes.shape[0])
- gap_indexes = npr.choice(range(len(rois)), size=gap, replace=False)
- keep_indexes = np.append(keep_indexes, gap_indexes)
+ gap = np.minimum(len(neg_rois), rois_per_image - keep_indexes.shape[0])
+ gap_indexes = npr.choice(range(len(neg_rois)), size=gap, replace=False)
+ keep_indexes = np.append(keep_indexes, neg_idx[gap_indexes])
# select labels
labels = labels[keep_indexes]