Skip to content

Detections Classes Replacement

Class: DetectionsClassesReplacementBlockV1

Source: inference.core.workflows.core_steps.fusion.detections_classes_replacement.v1.DetectionsClassesReplacementBlockV1

Combine results of detection model with classification results performed separately for each and every bounding box.

Bounding boxes without top class predicted by classification model are discarded, for multi-label classification results, most confident label is taken as bounding box class.

Type identifier

Use the following identifier in step "type" field: roboflow_core/detections_classes_replacement@v1to add the block as as step in your workflow.

Properties

Name Type Description Refs
name str Enter a unique identifier for this step..
fallback_class_name str The class name to be used as a fallback if no class is predicted for a bounding box.
fallback_class_id int The class id to be used as a fallback if no class is predicted for a bounding box;if not specified or negative, the class id will be set to 9223372036854775807.

The Refs column marks possibility to parametrise the property with dynamic values available in workflow runtime. See Bindings for more info.

Available Connections

Compatible Blocks

Check what blocks you can connect to Detections Classes Replacement in version v1.

Input and Output Bindings

The available connections depend on its binding kinds. Check what binding kinds Detections Classes Replacement in version v1 has.

Bindings
  • input

    • object_detection_predictions (Union[object_detection_prediction, instance_segmentation_prediction, keypoint_detection_prediction]): The output of a detection model describing the bounding boxes that will have classes replaced..
    • classification_predictions (classification_prediction): The output of classification model for crops taken based on RoIs pointed as the other parameter.
    • fallback_class_name (string): The class name to be used as a fallback if no class is predicted for a bounding box.
    • fallback_class_id (integer): The class id to be used as a fallback if no class is predicted for a bounding box;if not specified or negative, the class id will be set to 9223372036854775807.
  • output

    • predictions (Union[object_detection_prediction, instance_segmentation_prediction, keypoint_detection_prediction]): Prediction with detected bounding boxes in form of sv.Detections(...) object if object_detection_prediction or Prediction with detected bounding boxes and segmentation masks in form of sv.Detections(...) object if instance_segmentation_prediction or Prediction with detected bounding boxes and detected keypoints in form of sv.Detections(...) object if keypoint_detection_prediction.
Example JSON definition of step Detections Classes Replacement in version v1
{
    "name": "<your_step_name_here>",
    "type": "roboflow_core/detections_classes_replacement@v1",
    "object_detection_predictions": "$steps.my_object_detection_model.predictions",
    "classification_predictions": "$steps.my_classification_model.predictions",
    "fallback_class_name": "unknown",
    "fallback_class_id": 77
}