Skip to content

Commit

Permalink
Add 90 rotation to possible data augmentation
Browse files Browse the repository at this point in the history
  • Loading branch information
ndrplz committed Oct 15, 2017
1 parent d270db7 commit da81c07
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions capstone_traffic_light_classifier/traffic_light_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,13 @@ def coin_flip_is_head():

for b in range(batch.shape[0]):
if coin_flip_is_head():
batch[b] = np.fliplr(batch[b])
batch[b] = np.fliplr(batch[b]) # flip horizontally (mirroring)
if coin_flip_is_head():
batch[b] = np.flipud(batch[b])
batch[b] = np.flipud(batch[b]) # flip vertically
if coin_flip_is_head():
batch[b] = np.rot90(batch[b], 3) # rotate 90 degree clockwise
if coin_flip_is_head():
batch[b] = np.rot90(batch[b], 1) # rotate 90 degree counter-clockwise

return batch

Expand Down

0 comments on commit da81c07

Please sign in to comment.