Update transform_instance_annotations to match the original function.
Summary:
update the transform_instance_annotations function to match the original version.
The current version will cause troubles when training with person keypoints.
@@ -63,7 +63,9 @@ def annotations_to_instances(annos, image_size, sample_points=0):
return target
-def transform_instance_annotations(annotation, transforms, image_size):
+def transform_instance_annotations(
+ annotation, transforms, image_size, *, keypoint_hflip_indices=None
+):
"""
Apply transforms to box, and point annotations of a single instance.
It will use `transforms.apply_box` for the box, and
@@ -73,13 +75,16 @@ def transform_instance_annotations(annotation, transforms, image_size):
It will be modified in-place.
transforms (TransformList or list[Transform]):
image_size (tuple): the height, width of the transformed image
+ keypoint_hflip_indices (ndarray[int]): see `create_keypoint_hflip_indices`.
Returns:
dict:
the same input dict with fields "bbox", "point_coords", "point_labels"
transformed according to `transforms`.
The "bbox_mode" field will be set to XYXY_ABS.
"""
- annotation = base_transform_instance_annotations(annotation, transforms, image_size)
+ annotation = base_transform_instance_annotations(
+ annotation, transforms, image_size, keypoint_hflip_indices
+ )
assert ("point_coords" in annotation) == ("point_labels" in annotation)
if "point_coords" in annotation and "point_labels" in annotation:
