Skip to content

Commit

Permalink
Avoid out of box
Browse files Browse the repository at this point in the history
  • Loading branch information
Yuliang-Liu authored Apr 4, 2022
1 parent 6827212 commit 534d529
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions adet/data/augmentation.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ def gen_crop_transform_with_instance(crop_size, image_size, instances, crop_box=
instance (dict): an annotation dict of one instance, in Detectron2's
dataset format.
"""
instances[::2] = np.clip(instances[::2], 0, image_size[1])
instances[1::2] = np.clip(instances[1::2], 0, image_size[0])
bbox = random.choice(instances)
crop_size = np.asarray(crop_size, dtype=np.int32)
center_yx = (bbox[1] + bbox[3]) * 0.5, (bbox[0] + bbox[2]) * 0.5
Expand Down

0 comments on commit 534d529

Please sign in to comment.