Skip to content

Commit

Permalink
zoom_factor from ini
Browse files Browse the repository at this point in the history
  • Loading branch information
robbertvdg committed Jun 21, 2016
1 parent 2fa4fb9 commit 1f92ccb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion config/default.ini
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ mean_pixel: 0.66200809792889126
[augmentation]
augment: True
flip: True
zoom: 3 ;Only if OpenCV2 is available
zoom: 0.2 ;Only if OpenCV2 is available
rotation: 50
translation: 3

Expand Down
3 changes: 2 additions & 1 deletion src/deep/augment.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ def augment(images):
shift_x = np.random.uniform(*P.AUGMENTATION_PARAMS['translation_range'])
shift_y = np.random.uniform(*P.AUGMENTATION_PARAMS['translation_range'])
rotation_degrees = np.random.uniform(*P.AUGMENTATION_PARAMS['rotation_range'])
zoom_factor = 1 + (0.1-0.2*np.random.random())
zoom_f = np.random.uniform(*P.AUGMENTATION_PARAMS['zoom_range'])
zoom_factor = 1 + (zoom_f/2-zoom_f*np.random.random())
if CV2_AVAILABLE:
M = cv2.getRotationMatrix2D((center, center), rotation_degrees, zoom_factor)
M[0, 2] += shift_x
Expand Down

0 comments on commit 1f92ccb

Please sign in to comment.