Skip to main content

RS_CLASSIFY

The RS_Classify function performs single-label, multi-class classification.

Parameters

model_id
STRING
required
The identifier of the model to be used for classification. Supported model ID: landcover-eurosat-sentinel2.
input_raster
LazyOutDBRaster
required
The SQL column containing the input raster data for classification.

Returns

MAP
MAP<STRING, FLOAT>
A map where the key is the class label (STRING) and the value is the confidence score for the class label (FLOAT).

Example Invocation

SELECT outdb_raster, RS_CLASSIFY('landcover-eurosat-sentinel2', outdb_raster) AS preds
FROM df_raster_input;

RS_MAX_CONFIDENCE

Returns the label and confidence of the highest confidence class from the RS_CLASSIFY function.

Parameters

prediction_column
MAP
required
The prediction column result from RS_CLASSIFY.

Returns

STRUCT
STRUCT
  • max_confidence_label: STRING. The label with the highest confidence score.
  • max_confidence_score: FLOAT. The highest confidence score.

RS_SEGMENT

The RS_Segment function performs semantic segmentation.

Parameters

model_id
STRING
required
The identifier of the model to be used for segmentation. Supported model ID: solar-satlas-sentinel2.
input_raster
LazyOutDBRaster
required
The SQL column containing the input raster data for segmentation.

Returns

STRUCT
STRUCT
  • confidence_array: ARRAY<FLOAT>. An array of confidence scores.
  • class_map: MAP<STRING, INTEGER>. A mapping of class labels to their corresponding integer values.

Example Invocation

SELECT outdb_raster, RS_SEGMENT('solar-satlas-sentinel2', outdb_raster) AS preds
FROM df_raster_input;

RS_DETECT_BBOXES

The RS_Detect_BBoxes function performs object detection and returns bounding boxes.

Parameters

model_id
STRING
required
The identifier of the model to be used for object detection. Supported model ID: marine-satlas-sentinel2.
input_raster
LazyOutDBRaster
required
The SQL column containing the input raster data for object detection.

Returns

STRUCT
STRUCT
  • bboxes_wkt: ARRAY<STRING>. The bounding boxes in Well-Known Text (WKT) format.
  • confidence_scores: ARRAY<FLOAT>. The confidence scores corresponding to the bounding boxes.
  • labels: ARRAY<INTEGER>. The labels for the bounding boxes.

Example Invocation

SELECT outdb_raster, RS_DETECT_BBOXES('marine-satlas-sentinel2', outdb_raster) AS preds
FROM df_raster_input;

RS_FILTER_BOX_CONFIDENCE

The RS_Filter_Box_Confidence function filters the bounding boxes by a confidence threshold.

Parameters

bboxes_wkt
ARRAY<STRING>
required
The bboxes_wkt column results from RS_DETECT_BBOXES.
confidence_scores
ARRAY<FLOAT>
required
The confidence scores corresponding to the bounding boxes.
labels
ARRAY<INTEGER>
required
The labels for the bounding boxes.

Returns

STRUCT
STRUCT
  • max_confidence_bboxes: ARRAY<STRING>. The bounding boxes with the highest confidence.
  • max_confidence_scores: ARRAY<FLOAT>. The confidence scores corresponding to the bounding boxes.
  • max_confidence_labels: ARRAY<STRING>. The labels for the bounding boxes with the highest confidence.

Example Invocation

SELECT outdb_raster, RS_FILTER_BOX_CONFIDENCE(bboxes_wkt, confidence_scores, labels) AS preds
FROM preds_table;

RS_TEXT_TO_BBOXES

The RS_Text_to_BBoxes function performs text-prompted object detection, returning bounding boxes for objects matching the text description. The flexibility of the text prompt depends on the underlying model.

Parameters

model_id
STRING
required
The identifier of the model to be used for text-prompted detection. Supported model IDs: owlv2.
input_raster
LazyOutDBRaster
required
The SQL column containing the input raster data for detection.
text_prompt
STRING
required
A natural language input used by the object detection model to determine which objects to identify.
confidence_threshold
FLOAT
required
A value between 0 and 1 to filter detection confidence. Lower values return more potential matches.

Returns

STRUCT
STRUCT
  • bboxes_wkt: ARRAY<STRING>. The bounding boxes in Well-Known Text (WKT) format.
  • confidence_scores: ARRAY<FLOAT>. The confidence scores corresponding to the bounding boxes.
  • labels: ARRAY<STRING>. The text labels for the bounding boxes (matching the input prompt).

Example Invocation

SELECT outdb_raster, RS_TEXT_TO_BBOXES('owlv2', outdb_raster, 'solar panels', 0.1) AS detect_result
FROM df_raster_input;

RS_TEXT_TO_SEGMENTS

The RS_Text_to_Segments function performs text-prompted instance segmentation, returning WKT polygons converted from pixel-wise masks for areas matching the text description.

Parameters

model_id
STRING
required
The identifier of the model to be used for text-prompted segmentation. Supported model ID: sam2.
input_raster
LazyOutDBRaster
required
The SQL column containing the input raster data for segmentation.
text_prompt
STRING
required
A natural language description of the features to segment.
confidence_threshold
FLOAT
required
A value between 0 and 1 to filter segmentation confidence. Lower values return more potential matches.

Returns

STRUCT
STRUCT
  • confidence_array: ARRAY<FLOAT>. An array of confidence scores for each segment.
  • segments_wkt: ARRAY<STRING>. The segmentation polygons in Well-Known Text (WKT) format.
  • labels: ARRAY<STRING>. The text labels for the segments (matching the input prompt).

Example Invocation

SELECT outdb_raster, RS_TEXT_TO_SEGMENTS('sam2', outdb_raster, 'solar panels', 0.3) AS detect_result
FROM df_raster_input;

Notes

The functions RS_Text_to_BBoxes and RS_Text_to_Segments are best suited for exploratory detection scenarios where:
  1. Target features have high visual contrast with surroundings.
  2. Target features have clear, unambiguous descriptions.
  3. Image resolution and quality are sufficient to resolve features of interest.
Results should be reviewed by a human operator for accuracy, as confidence scores may not perfectly separate correct from incorrect predictions. To visually inspect the tabular results, use the python API wherobots.inference.plot.detections.show_detections function.