Classes
SlicedInference
- Performs sliced inference on large images for improved small object detection.
Functions
auto_slice_size
- Automatically calculate optimal slice dimensions based on image properties.
SlicedInference
Performs sliced inference on large images for improved small object detection. The main challenge in sliced inference is accurately merging predictions from overlapping slices. This implementation handles critical edge cases including objects on slice boundaries, nested objects, and partial detections at slice edges using intelligent NMS/NMM algorithms with configurable thresholds.Example
Example
auto_slice_size
Automatically calculate optimal slice dimensions based on image properties. Computes slice dimensions that maintain the image’s aspect ratio while targeting a specific slice size. Ensures slices are neither too small (minimum 320px) nor larger than the original image dimensions.Function Signature
Parameters
Height of the input image in pixels
Width of the input image in pixels
Target dimension for the larger side of each slice. Will be adjusted to maintain aspect ratio. Default is 640.
Returns
Tuple[int, int]: Optimal (slice_height, slice_width) dimensions that maintain aspect ratio and respect size constraints.
Example
Example