Skip to content

Commit

Permalink
add coarse salt/pepper to imgaug transforms (#209)
Browse files Browse the repository at this point in the history
* add coarse salt/pepper to imgaug transforms

* comment new transforms
  • Loading branch information
themattinthehatt authored Nov 1, 2024
1 parent 362626a commit 9c2c6d3
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions lightning_pose/data/augmentations.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,20 @@ def imgaug_transform(cfg: DictConfig) -> iaa.Sequential:
apply_prob_0,
iaa.CoarseDropout(p=prct, size_percent=size_prct, per_channel=per_channel)
))
# coarse salt and pepper
# bright reflections can often confuse the model into thinking they are paws
# (which can also just be bright blobs) - so include some additional transforms that put
# bright blobs (and dark blobs) into the image
prct = 0.01 # probability of changing a pixel to salt/pepper noise
size_prct = (0.05, 0.1) # drop pix on a low-res version of img that's `size_prct` of og
data_transform.append(iaa.Sometimes(
apply_prob_0,
iaa.CoarseSalt(p=prct, size_percent=size_prct), # bigger chunks than coarse dropout
))
data_transform.append(iaa.Sometimes(
apply_prob_0,
iaa.CoarsePepper(p=prct, size_percent=size_prct),
))
# elastic transform
alpha = (0, 10) # controls strength of displacement
sigma = 5 # cotnrols smoothness of displacement
Expand Down

0 comments on commit 9c2c6d3

Please sign in to comment.