Skip to content

Commit

Permalink
fix property not updating bug (apache#13085)
Browse files Browse the repository at this point in the history
  • Loading branch information
zhreshold authored Nov 29, 2018
1 parent 6fd4384 commit e434251
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 2 additions & 0 deletions python/mxnet/image/detection.py
Original file line number Diff line number Diff line change
Expand Up @@ -745,9 +745,11 @@ def reshape(self, data_shape=None, label_shape=None):
if data_shape is not None:
self.check_data_shape(data_shape)
self.provide_data = [(self.provide_data[0][0], (self.batch_size,) + data_shape)]
self.data_shape = data_shape
if label_shape is not None:
self.check_label_shape(label_shape)
self.provide_label = [(self.provide_label[0][0], (self.batch_size,) + label_shape)]
self.label_shape = label_shape

def next(self):
"""Override the function for returning next batch."""
Expand Down
10 changes: 6 additions & 4 deletions tests/python/unittest/test_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,14 +159,14 @@ def check_imageiter(dtype='float32'):
with open(fname, 'w') as f:
for line in file_list:
f.write(line + '\n')

test_list = ['imglist', 'path_imglist']

for test in test_list:
imglist = im_list if test == 'imglist' else None
path_imglist = fname if test == 'path_imglist' else None
test_iter = mx.image.ImageIter(2, (3, 224, 224), label_width=1, imglist=imglist,

test_iter = mx.image.ImageIter(2, (3, 224, 224), label_width=1, imglist=imglist,
path_imglist=path_imglist, path_root='', dtype=dtype)
# test batch data shape
for _ in range(3):
Expand All @@ -181,7 +181,7 @@ def check_imageiter(dtype='float32'):
i += 1
assert i == 5
# test last_batch_handle(pad)
test_iter = mx.image.ImageIter(3, (3, 224, 224), label_width=1, imglist=imglist,
test_iter = mx.image.ImageIter(3, (3, 224, 224), label_width=1, imglist=imglist,
path_imglist=path_imglist, path_root='', dtype=dtype, last_batch_handle='pad')
i = 0
for batch in test_iter:
Expand Down Expand Up @@ -265,6 +265,8 @@ def test_image_detiter(self):

val_iter = mx.image.ImageDetIter(2, (3, 300, 300), imglist=im_list, path_root='')
det_iter = val_iter.sync_label_shape(det_iter)
assert det_iter.data_shape == val_iter.data_shape
assert det_iter.label_shape == val_iter.label_shape

# test file list
fname = './data/test_imagedetiter.lst'
Expand Down

0 comments on commit e434251

Please sign in to comment.