ModelMetadata dataclass
Loads and parses Machine Learning Model Metadata JSON.
Parameters
Path or S3 URI to the model metadata JSON file.
Raises
Shape mismatch error if the length of the class_map differs from the shape of the result.
Only MLM metadata that define statistics per band and norm_by_channels are supported.
read_model_metadata()
read_model_metadata(model_meta_uri)
Reads and parses a model metadata JSON file from S3.
Parameters
The S3 URI for the model metadata JSON file.
Returns
pystac.STACObject: The parsed model metadata conforming to the MLM Extension.
create_object_detection_udfs()
create_object_detection_udfs(batch_size, sedona)
Create and register UDFs for object detection tasks.
Registers SQL functions for RS_DETECT_BBOXES and RS_FILTER_BOX_CONFIDENCE and returns corresponding functions.
Parameters
The number of samples to include in each batch.
The current Sedona context.
Returns
Tuple[Callable, Callable]: A tuple of functions configured for object detection.
create_semantic_segmentation_udfs()
create_semantic_segmentation_udfs(batch_size, sedona)
Create and register SQL functions for semantic segmentation tasks.
Registers SQL function as RS_SEGMENT and returns a corresponding function.
Parameters
The number of samples to include in each batch.
The current Sedona context.
Returns
A function configured for semantic segmentation.
create_single_label_classification_udfs()
create_single_label_classification_udfs(batch_size, sedona)
Create and register SQL Functions for single-label classification tasks.
Registers SQL function as RS_CLASSIFY RS_MAX_CONFIDENCE and returns corresponding functions.
Parameters
The number of samples to include in each batch.
The current Sedona context.
Returns
Tuple[Callable, Callable]: A tuple of pandas UDFs configured for single-label classification tasks, [RS_CLASSIFY, RS_MAX_CONFIDENCE].
show_detections()
show_detections(df, geometry_column=None, geometry_crs='EPSG:4326', confidence_threshold=0.05, plot_geoms=True, side_by_side=True)
Plot raster images with detected object geometries overlaid.
This function handles both Pandas and Wherobots DataFrames containing geometries, automatically detecting the raster column. It is compatible with dataframes returned from a SQL inference function. Exploded dataframes are not supported.
Parameters
Pandas or Wherobots DataFrame containing raster data and detection results
Column name containing WKT geometries
Coordinate reference system of the geometries
Minimum confidence score for displaying detections
Whether to overlay geometries on the images
Whether to show original and detection images side by side
Raises
If the DataFrame is empty or required columns cannot be found

