def transform_bounding_boxes(
        self,
        bounding_boxes,
        transformation,
        training=True,
    ):
        """
        bounding_boxes = {
            "boxes": (batch, num_boxes, 4),  # left-top-right-bottom (xyxy)
            "labels": (batch, num_boxes, num_classes),
        }
        or
        bounding_boxes = {
            "boxes": (num_boxes, 4),
            "labels": (num_boxes, num_classes),
        }
        """

        if training:
            h_start, w_start = transformation
            if not self.backend.is_tensor(bounding_boxes["boxes"]):
                bounding_boxes = densify_bounding_boxes(
                    bounding_boxes, backend=self.backend
                )
            boxes = bounding_boxes["boxes"]
            # Convert to a standard xyxy as operations are done xyxy by default.
            boxes = convert_format(
                boxes=boxes,
                source=self.bounding_box_format,
                target="xyxy",
                height=self.height,
                width=self.width,
            )
            h_start = self.backend.cast(h_start, boxes.dtype)
            w_start = self.backend.cast(w_start, boxes.dtype)
            if len(self.backend.shape(boxes)) == 3:
                boxes = self.backend.numpy.stack(
                    [
                        self.backend.numpy.maximum(boxes[:, :, 0] - h_start, 0),
                        self.backend.numpy.maximum(boxes[:, :, 1] - w_start, 0),
                        self.backend.numpy.maximum(boxes[:, :, 2] - h_start, 0),
                        self.backend.numpy.maximum(boxes[:, :, 3] - w_start, 0),
                    ],
                    axis=-1,
                )
            else:
                boxes = self.backend.numpy.stack(
                    [
                        self.backend.numpy.maximum(boxes[:, 0] - h_start, 0),
                        self.backend.numpy.maximum(boxes[:, 1] - w_start, 0),
                        self.backend.numpy.maximum(boxes[:, 2] - h_start, 0),
                        self.backend.numpy.maximum(boxes[:, 3] - w_start, 0),
                    ],
                    axis=-1,
                )

            # Convert to user defined bounding box format
            boxes = convert_format(
                boxes=boxes,
                source="xyxy",
                target=self.bounding_box_format,
                height=self.height,
                width=self.width,
            )

            return {
                "boxes": boxes,
                "labels": bounding_boxes["labels"],
            }
        return bounding_boxes

        bounding_boxes = {
            "boxes": (batch, num_boxes, 4),  # left-top-right-bottom (xyxy)
            "labels": (batch, num_boxes, num_classes),
        }
        or
        bounding_boxes = {
            "boxes": (num_boxes, 4),
            "labels": (num_boxes, num_classes),
        }
        
keras/src/layers/preprocessing/image_preprocessing/random_crop.py