You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by jx...@apache.org on 2017/08/24 19:14:29 UTC
[incubator-mxnet] branch master updated: Fix RCNN multi-gpu
bucketing warning which may cause OOM error. (#6965)
This is an automated email from the ASF dual-hosted git repository.
jxie pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-mxnet.git
The following commit(s) were added to refs/heads/master by this push:
new c584b51 Fix RCNN multi-gpu bucketing warning which may cause OOM error. (#6965)
c584b51 is described below
commit c584b516b15eedb036a5cb598674031ffb751fb4
Author: Zehao Shi <ze...@foxmail.com>
AuthorDate: Fri Aug 25 03:14:26 2017 +0800
Fix RCNN multi-gpu bucketing warning which may cause OOM error. (#6965)
* Fix a spelling mistake.
* FIX pad example
* fix smooth l1 comment
* Fix rcnn multi-gpu bucketing warning
---
example/rcnn/rcnn/core/loader.py | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/example/rcnn/rcnn/core/loader.py b/example/rcnn/rcnn/core/loader.py
index 826ee20..fdd6e5c 100644
--- a/example/rcnn/rcnn/core/loader.py
+++ b/example/rcnn/rcnn/core/loader.py
@@ -165,11 +165,16 @@ class ROIIter(mx.io.DataIter):
vert = np.logical_not(horz)
horz_inds = np.where(horz)[0]
vert_inds = np.where(vert)[0]
+ # Avoid putting different aspect ratio image into the same bucket,
+ # which may cause bucketing warning.
+ pad_horz = self.batch_size - len(horz_inds) % self.batch_size
+ pad_vert = self.batch_size - len(vert_inds) % self.batch_size
+ horz_inds = np.hstack([horz_inds, horz_inds[:pad_horz]])
+ vert_inds = np.hstack([vert_inds, vert_inds[:pad_vert]])
inds = np.hstack((np.random.permutation(horz_inds), np.random.permutation(vert_inds)))
- extra = inds.shape[0] % self.batch_size
- inds_ = np.reshape(inds[:-extra], (-1, self.batch_size))
- row_perm = np.random.permutation(np.arange(inds_.shape[0]))
- inds[:-extra] = np.reshape(inds_[row_perm, :], (-1,))
+ inds = np.reshape(inds[:], (-1, self.batch_size))
+ row_perm = np.random.permutation(np.arange(inds.shape[0]))
+ inds = np.reshape(inds[row_perm, :], (-1,))
self.index = inds
else:
np.random.shuffle(self.index)
--
To stop receiving notification emails like this one, please contact
['"commits@mxnet.apache.org" <co...@mxnet.apache.org>'].