Skip to content

Commit

Permalink
Remove bboxes from fb augmentations (#120)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #120

Defines BaseTransform separately for `fb/` augmentations so we don't need to add bbox support (until requested by an internal user at some point). Also defines a separate `base_unit_test.py` that doesn't pass in or expect bbox args.

Differential Revision: D30991086

fbshipit-source-id: ff516f181a9649f6a21c5628cf1031c09c5bd4c2
  • Loading branch information
Zoe Papakipos authored and facebook-github-bot committed Sep 17, 2021
1 parent c1110ca commit 1e672dc
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions augly/image/utils/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,11 @@ def check_for_gone_bboxes(transformed_bboxes: List[Tuple]) -> List[Optional[Tupl


def transform_bboxes(
dst_bboxes: Optional[List[Tuple]],
bbox_format: Optional[str],
function_name: str,
image: Image.Image,
aug_image: Image.Image,
dst_bboxes: Optional[List[Tuple]] = None,
bbox_format: Optional[str] = None,
bboxes_helper_func: Optional[Callable] = None,
**kwargs,
) -> None:
Expand Down Expand Up @@ -145,16 +145,15 @@ def get_func_kwargs(
if metadata is None:
return {}

bboxes = local_kwargs.pop("bboxes")
bboxes = [] if bboxes is None else bboxes
bboxes = local_kwargs.pop("bboxes", None)
bboxes = bboxes if len(metadata) == 0 else metadata[-1]["dst_bboxes"]

func_kwargs = deepcopy(local_kwargs)
func_kwargs.pop("metadata")

func_kwargs["src_bboxes"] = (
deepcopy(bboxes if len(metadata) == 0 else metadata[-1]["dst_bboxes"])
)
func_kwargs["dst_bboxes"] = deepcopy(bboxes)
if bboxes is not None:
func_kwargs["src_bboxes"] = deepcopy(bboxes)
func_kwargs["dst_bboxes"] = deepcopy(bboxes)
func_kwargs.update(**deepcopy(kwargs))

return func_kwargs
Expand Down

0 comments on commit 1e672dc

Please sign in to comment.