Skip to content
This repository has been archived by the owner on Apr 27, 2020. It is now read-only.

Commit

Permalink
Merge pull request #1 from mcreng/modify_id_json
Browse files Browse the repository at this point in the history
modified id.json generation format.
  • Loading branch information
mcreng authored Jan 13, 2019
2 parents 158c789 + a5aa286 commit 7f4e1a1
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions im_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,8 @@ def get_bounding_box(img):
# create new image
output = np.zeros((*DIMENSION, 4), np.uint8)

place_pts = [(np.random.randint(0, DIMENSION[1] - imgs_aug[i]['size'][0]),
np.random.randint(0, DIMENSION[0] - imgs_aug[i]['size'][1])) for i in range(len(imgs_aug))] # the top left corner of where the images should be placed.
place_pts = [(np.random.randint(0, DIMENSION[1] - imgs_aug[i]['size'][0]), np.random.randint(0, DIMENSION[0] - imgs_aug[i]['size'][1]))
for i in range(len(imgs_aug))] # the top left corner of where the images should be placed.

# Place the images at designated positions, allow overlapping
for idx, (x, y) in enumerate(place_pts):
Expand Down Expand Up @@ -158,6 +158,6 @@ def get_bounding_box(img):
labels = [(a.replace(IMG_PATH+dataset, ''), len(c))
for a, b, c in os.walk(IMG_PATH+dataset)][1:]

idx2fruit = [{idx: label[0]} for idx, label in enumerate(labels)]
idx2fruit = {idx: label[0] for idx, label in enumerate(labels)}
with open(GEN_PATH+'id.json', 'w') as f:
json.dump(idx2fruit, f)

0 comments on commit 7f4e1a1

Please sign in to comment.