Skip to content

The streetscapes module

Bases: ModelBase

__init__(model_id='facebook/mask2former-swin-large-mapillary-vistas-panoptic', threshold=0.5, mask_threshold=0.5, overlap_mask_area_threshold=0.8, labels_to_fuse=None, *args, **kwargs)

A wrapper for the Mask2Former model.

The following documentation for the model parameters is taken from the HuggingFace page for the panoptic processing pipeline for the Mask2Former model.

These parameters are passed directly to the corresponding arguments of the post_process_panoptic_segmentation() method of the image processor.

Parameters:

Name Type Description Default
model_id str

Mask2Former model to load. Defaults to "facebook/mask2former-swin-large-mapillary-vistas-panoptic".

'facebook/mask2former-swin-large-mapillary-vistas-panoptic'
threshold float

The probability score threshold to keep predicted instance masks. Defaults to 0.5.

0.5
mask_threshold float

Threshold to use when turning the predicted masks into binary values. Defaults to 0.5.

0.5
overlap_mask_area_threshold float

The overlap mask area threshold to merge or discard small disconnected parts within each binary instance mask.The overlap mask area threshold to merge or discard small disconnected parts within each binary instance mask. Defaults to 0.8.

0.8
labels_to_fuse set[str | int]

The labels in this state will have all their instances be fused together. For instance, we could say there can only be one sky in an image, but several persons, so the label ID for sky would be in that set, but not the one for person. This differs slightly from the original parameter because it can also accept strings instead of integers (the strings are converted to their IDs). Defaults to None.

None