-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Fix] Add swap_labe_pairs
in RandomFlip
#2332
Conversation
mmcv/transforms/processing.py
Outdated
def _flip_keypoints(self, keypoints: np.ndarray, img_shape: Tuple[int, | ||
int], | ||
direction: str) -> np.ndarray: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
def _flip_keypoints(self, keypoints: np.ndarray, img_shape: Tuple[int, | |
int], | |
direction: str) -> np.ndarray: | |
def _flip_keypoints( | |
self, | |
keypoints: np.ndarray, | |
img_shape: Tuple[int, int], | |
direction: str,) -> np.ndarray: |
mmcv/transforms/processing.py
Outdated
swap_label_pairs (list, optional): The label pair need to be swapped | ||
for ground truth, like 'left arm' and 'right arm' need to be | ||
swapped after horizontal flipping. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does the swap_label_paris
only affect seg maps? How about key points?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And better to provide the detailed usage of the argument. How to specify the left arm
and right arm
pair?
mmcv/transforms/processing.py
Outdated
swap_seg_labels (list, optional): The label pair need to be swapped | ||
for ground truth, like 'left arm' and 'right arm' need to be | ||
swapped after horizontal flipping. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better to add an example here, like
swap_seg_labels (list, optional): The label pair need to be swapped | |
for ground truth, like 'left arm' and 'right arm' need to be | |
swapped after horizontal flipping. | |
swap_seg_labels (list, optional): The label pair need to be swapped | |
for ground truth, like 'left arm' and 'right arm' need to be | |
swapped after horizontal flipping. For example, ``[(1, 5)]``, | |
where 1/5 is the label of the left/right arm. Defaults to None. |
Motivation
To handle datasets with left/right annotations when flip the seg map horizontally.
Modification
Add
swap_label_pairs
inRandomFlip
init, and swap the labels of a seg map whenswap_label_pairs
is defined.BC-breaking (Optional)
No
Use cases (Optional)
LIP dataset data augmentation
Checklist
Before PR:
After PR: