Skip to content

SQL Functions

RS_CLASSIFY

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

Input Parameters

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

Returns

Return Type: A MAP containing the following fields: - key: STRING. The class label. - value: FLOAT. The confidence score for the class label.

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.

Input Parameters

  • prediction_column: MAP. The prediction column result from RS_CLASSIFY

Returns

Return Type: A STRUCT containing the following fields: - 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.

Input Parameters

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

Returns

Return Type: A STRUCT containing the following fields: - 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.

Input Parameters

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

Returns

Return Type: A STRUCT containing the following fields: - 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.

Input Parameters

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

Returns

Return Type: A STRUCT containing the following fields: - 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;