def get_transform(self, image, boxes):
        """Call function to crop images and bounding boxes with minimum IoU
        constraint.

        Args:
            boxes: ground truth boxes in (x1, y1, x2, y2) format
        """
        if boxes is None:
            return NoOpTransform()
        h, w, c = image.shape
        for _ in range(self.mode_trials):
            mode = random.choice(self.sample_mode)
            self.mode = mode
            if mode == 1:
                return NoOpTransform()

            min_iou = mode
            for _ in range(self.crop_trials):
                new_w = random.uniform(self.min_crop_size * w, w)
                new_h = random.uniform(self.min_crop_size * h, h)

                # h / w in [0.5, 2]
                if new_h / new_w < 0.5 or new_h / new_w > 2:
                    continue

                left = random.uniform(w - new_w)
                top = random.uniform(h - new_h)

                patch = np.array((int(left), int(top), int(left + new_w), int(top + new_h)))
                # Line or point crop is not allowed
                if patch[2] == patch[0] or patch[3] == patch[1]:
                    continue
                overlaps = pairwise_iou(
                    Boxes(patch.reshape(-1, 4)), Boxes(boxes.reshape(-1, 4))
                ).reshape(-1)
                if len(overlaps) > 0 and overlaps.min() < min_iou:
                    continue

                # center of boxes should inside the crop img
                # only adjust boxes and instance masks when the gt is not empty
                if len(overlaps) > 0:
                    # adjust boxes
                    def is_center_of_bboxes_in_patch(boxes, patch):
                        center = (boxes[:, :2] + boxes[:, 2:]) / 2
                        mask = (
                            (center[:, 0] > patch[0])
                            * (center[:, 1] > patch[1])
                            * (center[:, 0] < patch[2])
                            * (center[:, 1] < patch[3])
                        )
                        return mask

                    mask = is_center_of_bboxes_in_patch(boxes, patch)
                    if not mask.any():
                        continue
                return CropTransform(int(left), int(top), int(new_w), int(new_h))
Call function to crop images and bounding boxes with minimum IoU
        constraint.

        Args:
            boxes: ground truth boxes in (x1, y1, x2, y2) format
        
ControlNet-v1-1-nightly/annotator/oneformer/detectron2/data/transforms/augmentation_impl.py