Skip to content

Commit

Permalink
apply fixes from #6547
Browse files Browse the repository at this point in the history
  • Loading branch information
sayakpaul committed Jan 22, 2024
1 parent d66d554 commit da786ce
Showing 1 changed file with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -740,6 +740,10 @@ def preprocess_train(examples):
# Resize.
combined_im = train_resize(combined_im)

# Flipping.
if not args.no_flip and random.random() < 0.5:
combined_im = train_flip(combined_im)

# Cropping.
if not args.random_crop:
y1 = max(0, int(round((combined_im.shape[1] - args.resolution) / 2.0)))
Expand All @@ -749,11 +753,6 @@ def preprocess_train(examples):
y1, x1, h, w = train_crop.get_params(combined_im, (args.resolution, args.resolution))
combined_im = crop(combined_im, y1, x1, h, w)

# Flipping.
if random.random() < 0.5:
x1 = combined_im.shape[2] - x1
combined_im = train_flip(combined_im)

crop_top_left = (y1, x1)
crop_top_lefts.append(crop_top_left)
combined_im = normalize(combined_im)
Expand Down

0 comments on commit da786ce

Please sign in to comment.