Skip to content

The streetscapes module

ModelBase

Bases: ABC

__init__(device=None)

A model serving as the base for all segmentation models.

Parameters:

Name Type Description Default
device str

Device to use for processign. Defaults to None.

None

load_image(path)

A list of images or paths to image files.

Parameters:

Name Type Description Default
path Path | str

A path to an image.

required

Returns:

Type Description
tuple[list[Path], list[ndarray]]

A tuple containing: 1. The ID of the image. 2. The images as a NumPy array.

load_images(images)

A list of images or paths to image files.

Parameters:

Name Type Description Default
images PathLike

A path or a list of paths to image files.

required

Returns:

Type Description
tuple[list[Path], list[ndarray]]

A tuple containing: 1. The paths to the images. 2. The images as NumPy arrays.

segment(paths, labels, batch_size=10)

Retrieve the paths of local images from a dataset.

Parameters:

Name Type Description Default
paths PathLike

Path(s) to image file(s).

required
labels dict

A flattened set of labels to look for, with optional subsets of labels that should be checked in order to eliminate overlaps. Cf. BaseSegmenter._flatten_labels()

required
batch_size int

Process the images in batches of this size. Defaults to 10.

10

Returns:

Type Description
Table

A table of information about the segmentations.