Skip to content

Commit

Permalink
fix tf det augmentation and unify tf reco augmentations to pt (#1360)
Browse files Browse the repository at this point in the history
  • Loading branch information
felixT2K authored Oct 26, 2023
1 parent bc2d3c5 commit f22f6dd
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion references/detection/train_tensorflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ def main(args):
T.RandomSaturation(0.3),
T.RandomContrast(0.3),
T.RandomBrightness(0.3),
T.RandomApply(T.ToGray(), 0.1),
T.RandomApply(T.ToGray(num_output_channels=3), 0.1),
]
),
sample_transforms=T.SampleCompose(
Expand Down
10 changes: 9 additions & 1 deletion references/recognition/train_tensorflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,13 +226,17 @@ def main(args):
parts[0].joinpath("labels.json"),
img_transforms=T.Compose(
[
T.RandomApply(T.ColorInversion(), 0.1),
T.Resize((args.input_size, 4 * args.input_size), preserve_aspect_ratio=True),
# Augmentations
T.RandomApply(T.ColorInversion(), 0.1),
T.RandomApply(T.ToGray(num_output_channels=3), 0.1),
T.RandomJpegQuality(60),
T.RandomSaturation(0.3),
T.RandomContrast(0.3),
T.RandomBrightness(0.3),
T.RandomApply(T.RandomShadow(), 0.4),
T.RandomApply(T.GaussianNoise(mean=0.1, std=0.1), 0.1),
T.RandomApply(T.GaussianBlur(kernel_shape=3, std=(0.1, 0.1)), 0.3),
]
),
)
Expand All @@ -255,10 +259,14 @@ def main(args):
T.Resize((args.input_size, 4 * args.input_size), preserve_aspect_ratio=True),
# Ensure we have a 90% split of white-background images
T.RandomApply(T.ColorInversion(), 0.9),
T.RandomApply(T.ToGray(num_output_channels=3), 0.1),
T.RandomJpegQuality(60),
T.RandomSaturation(0.3),
T.RandomContrast(0.3),
T.RandomBrightness(0.3),
T.RandomApply(T.RandomShadow(), 0.4),
T.RandomApply(T.GaussianNoise(mean=0.1, std=0.1), 0.1),
T.RandomApply(T.GaussianBlur(kernel_shape=3, std=(0.1, 0.1)), 0.3),
]
),
)
Expand Down

0 comments on commit f22f6dd

Please sign in to comment.