Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Commit

Permalink
Fix undefined names in SSD example
Browse files Browse the repository at this point in the history
maskUtils is disabled. Comment out all code referencing it.
Initializing start_offset.
  • Loading branch information
vandanavk committed Aug 1, 2018
1 parent e5f9d4d commit f8097f3
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 15 deletions.
31 changes: 16 additions & 15 deletions example/ssd/dataset/pycocotools/coco.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,22 +255,23 @@ def showAnns(self, anns):
color.append(c)
else:
# mask
t = self.imgs[ann['image_id']]
if type(ann['segmentation']['counts']) == list:
raise NotImplementedError("maskUtils disabled!")
# t = self.imgs[ann['image_id']]
# if type(ann['segmentation']['counts']) == list:
# rle = maskUtils.frPyObjects([ann['segmentation']], t['height'], t['width'])
raise NotImplementedError("maskUtils disabled!")
else:
rle = [ann['segmentation']]
# raise NotImplementedError("maskUtils disabled!")
# else:
# rle = [ann['segmentation']]
# m = maskUtils.decode(rle)
raise NotImplementedError("maskUtils disabled!")
img = np.ones( (m.shape[0], m.shape[1], 3) )
if ann['iscrowd'] == 1:
color_mask = np.array([2.0,166.0,101.0])/255
if ann['iscrowd'] == 0:
color_mask = np.random.random((1, 3)).tolist()[0]
for i in range(3):
img[:,:,i] = color_mask[i]
ax.imshow(np.dstack( (img, m*0.5) ))
# raise NotImplementedError("maskUtils disabled!")
# img = np.ones( (m.shape[0], m.shape[1], 3) )
# if ann['iscrowd'] == 1:
# color_mask = np.array([2.0,166.0,101.0])/255
# if ann['iscrowd'] == 0:
# color_mask = np.random.random((1, 3)).tolist()[0]
# for i in range(3):
# img[:,:,i] = color_mask[i]
# ax.imshow(np.dstack( (img, m*0.5) ))
if 'keypoints' in ann and type(ann['keypoints']) == list:
# turn skeleton into zero-based index
sks = np.array(self.loadCats(ann['category_id'])[0]['skeleton'])-1
Expand Down Expand Up @@ -432,4 +433,4 @@ def annToMask(self, ann):
rle = self.annToRLE(ann)
# m = maskUtils.decode(rle)
raise NotImplementedError("maskUtils disabled!")
return m
# return m
3 changes: 3 additions & 0 deletions example/ssd/symbol/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,9 @@ def multibox_layer(from_layers, num_classes, sizes=[.2, .95],
assert sizes[0] > 0 and sizes[0] < 1
assert sizes[1] > 0 and sizes[1] < 1 and sizes[1] > sizes[0]
tmp = np.linspace(sizes[0], sizes[1], num=(len(from_layers)-1))
# Ref for start_offset value:
# https://arxiv.org/abs/1512.02325
start_offset = 0.1
min_sizes = [start_offset] + tmp.tolist()
max_sizes = tmp.tolist() + [tmp[-1]+start_offset]
sizes = zip(min_sizes, max_sizes)
Expand Down

0 comments on commit f8097f3

Please sign in to comment.