I'm trying to train an object detection algorithm (i.e. YOLOv4 Scaled, Faster R-CNN) on data taken from large orthophotos. Let's say I have one class, and I label the entire orthophoto with bounding boxes. After labeling, is there a way to slice up the entire image into individual photos of specified pixel sizes (i.e. 416x416 pixels) while keeping the bounding boxes? I can easily slice the photo into the specified dimensions, but the problem I am having is keeping the bounding boxes in these new images.

That way, I would not be exhausting my GPU's memory requirements.


1 Answer 1


You can reduce your photo size and scale the corresponding boxes to the new dimensions (416x416).

Or if you want to go with your technique, you can slice the image and then, check if the bounding box lies in the slice, then, reorient it according to the slice you took.

Take a look at albumentations library for this.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .