dataeval.utils.preprocessing

Utility functions for preprocessing images and bounding boxes.

Attributes

FloatBox

Bounding box as tuple of floats in xyxy format.

IntBox

Bounding box as tuple of integers in xyxy format.

Classes

BitDepth

Dataclass representing image bit depth information.

BoundingBox

A bounding box representation that supports multiple coordinate formats.

BoundingBoxFormat

Supported bounding box coordinate formats.

Functions

clip_and_pad(image, box)

Extract a region from an image based on a bounding box.

clip_box(image_shape, box)

Clip the box to inside the provided image dimensions.

compute_iou(boxes1, boxes2)

Compute Intersection over Union (IoU) between two sets of boxes.

edge_filter(image[, offset])

Return the image filtered using a 3x3 edge detection kernel.

get_bitdepth(image)

Approximates the bit depth of the image using the min and max pixel values.

is_valid_box(box)

Check if the box dimensions provided are valid (non-empty).

normalize_image_shape(image)

Normalize the image shape into (C,H,W) format.

rescale(image[, depth])

Rescales the image using the bit depth provided.

resize(image, resize_dim[, use_pil])

Resizes a grayscale (HxW) 8-bit image using PIL or scipy.ndimage.zoom.

to_bounding_box(boxlike[, image_shape])

Convert a box-like input to a BoundingBox instance.

to_canonical_grayscale(image)

Convert an image of arbitrary channels (CHW) to a single-channel uint8 grayscale image (HW).

to_int_box(box)

Convert a bounding box from float to int format.

Module Contents

dataeval.utils.preprocessing.FloatBox

Bounding box as tuple of floats in xyxy format.

dataeval.utils.preprocessing.IntBox

Bounding box as tuple of integers in xyxy format.