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_box

Clip the box to inside the provided image dimensions.

compute_iou

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

crop_with_fill

Extract a window from an image into an output of the window’s size, filling out-of-bounds pixels with fill.

edge_filter

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

get_bitdepth

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

is_valid_box

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

normalize_image_shape

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

rescale

Rescales the image using the bit depth provided.

resize

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

to_bounding_box

Convert a box-like input to a BoundingBox instance.

to_canonical_grayscale

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

to_int_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.