Skip to content

Commit

Permalink
Update augmentation.py
Browse files Browse the repository at this point in the history
Implemented the value indication for default args, with None values labeled with Optional and the others having their values stated as "default=value"
  • Loading branch information
haidarjomaa authored Jan 23, 2024
1 parent 9117d17 commit 2ace18e
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions data_processing/augmentation.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ class TorchRandomRotate(nn.Module):
Args:
degrees (tuple or list): Range of possible rotation angles.
probability (float): Probability of applying the rotation.
interpolation (InterpolationMode): Interpolation mode for rotation.
center (tuple or None): Center of rotation. If None, the center is the center of the image.
fill (float): Value to fill the image during rotation.
mask_fill (float): Value to fill the mask during rotation.
probability (float, default=1): Probability of applying the rotation.
interpolation (InterpolationMode, default=BILINEAR): Interpolation mode for rotation.
center (tuple, Optional): Center of rotation. If None, the center is the center of the image.
fill (float, default=0): Value to fill the image during rotation.
mask_fill (float, default=0): Value to fill the mask during rotation.
Returns:
tuple: Tuple containing the rotated image and mask (if provided).
Expand Down Expand Up @@ -119,10 +119,10 @@ class RandomMaskIgnore(nn.Module):
It modifies the input mask tensor in-place, and the modified tensor is returned.
Args:
min_length (int): Minimum length of the randomly generated bounding box.
max_length (int): Maximum length of the randomly generated bounding box.
proba (float): Probability of applying the random mask modification.
ignore_index (int): Value used to fill the masked region.
min_length (int, default=50): Minimum length of the randomly generated bounding box.
max_length (int, default=100): Maximum length of the randomly generated bounding box.
proba (float, default=0.5): Probability of applying the random mask modification.
ignore_index (int, default=-10): Value used to fill the masked region.
"""

def __init__(self,min_length=50,max_length=100,proba=0.5,ignore_index=-10):
Expand Down Expand Up @@ -196,9 +196,9 @@ class MaskPixelDrop(nn.Module):
MaskPixelDrop randomly drops pixels in the input mask tensor based on specified probabilities for positive and negative drops.
Args:
neg_drop (int or tuple): Probability range for dropping negative pixels. Default is (0, 50).
pos_drop (int or tuple): Probability range for dropping positive pixels. Default is (0, 50).
ignore_index (int): Value used to fill the dropped pixels. Default is -10.
neg_drop (int or tuple, default for int =50): Probability range for dropping negative pixels. Default is (0, 50).
pos_drop (int or tuple, default for int =50): Probability range for dropping positive pixels. Default is (0, 50).
ignore_index (int, default=-10): Value used to fill the dropped pixels. Default is -10.
Returns:
torch.Tensor: Modified mask tensor with dropped pixels.
Expand Down

0 comments on commit 2ace18e

Please sign in to comment.