mecha10-behavior-patterns 0.1.23

Common behavior patterns for Mecha10 - subsumption, ensemble, and more
Documentation
{
  "$schema": "https://mecha10.dev/schemas/behavior-composition-v1.json",
  "name": "multi_model_ensemble",
  "description": "Multi-model ensemble for robust object detection using YOLO, MobileNet, and depth sensing. Results are fused using weighted voting for improved accuracy and reliability.",
  "root": {
    "type": "sequence",
    "name": "ensemble_pipeline",
    "children": [
      {
        "type": "node",
        "node": "capture_sensor_data",
        "name": "sensor_capture",
        "config": {
          "capture_rgb": true,
          "capture_depth": true,
          "synchronize_streams": true,
          "timeout_ms": 100
        }
      },
      {
        "type": "parallel",
        "name": "model_inference",
        "policy": "require_all",
        "children": [
          {
            "type": "node",
            "node": "yolo_detector",
            "name": "yolo_v8",
            "config_ref": "yolo"
          },
          {
            "type": "node",
            "node": "mobilenet_detector",
            "name": "mobilenet_v3",
            "config_ref": "mobilenet"
          },
          {
            "type": "node",
            "node": "depth_based_detector",
            "name": "depth_segmentation",
            "config_ref": "depth"
          }
        ]
      },
      {
        "type": "node",
        "node": "fuse_detections",
        "name": "detection_fusion",
        "config_ref": "fusion"
      },
      {
        "type": "node",
        "node": "filter_detections",
        "name": "detection_filter",
        "config": {
          "min_confidence": 0.6,
          "min_size_pixels": 100,
          "max_detections": 20,
          "non_max_suppression": true,
          "nms_iou_threshold": 0.5
        }
      },
      {
        "type": "selector",
        "name": "action_selection",
        "children": [
          {
            "type": "sequence",
            "name": "high_confidence_action",
            "children": [
              {
                "type": "node",
                "node": "check_detection_confidence",
                "name": "confidence_validator",
                "config": {
                  "min_confidence": 0.85,
                  "require_consensus": true,
                  "min_models_agreeing": 2
                }
              },
              {
                "type": "node",
                "node": "track_detected_objects",
                "name": "object_tracker",
                "config": {
                  "tracking_algorithm": "kalman_filter",
                  "max_track_age_sec": 2.0,
                  "association_threshold": 0.3
                }
              },
              {
                "type": "node",
                "node": "execute_high_confidence_action",
                "name": "confident_action",
                "config_ref": "action"
              }
            ]
          },
          {
            "type": "sequence",
            "name": "medium_confidence_action",
            "children": [
              {
                "type": "node",
                "node": "check_detection_confidence",
                "name": "medium_confidence_check",
                "config": {
                  "min_confidence": 0.6,
                  "max_confidence": 0.85,
                  "require_consensus": false
                }
              },
              {
                "type": "node",
                "node": "request_additional_observations",
                "name": "gather_more_data",
                "config": {
                  "additional_frames": 3,
                  "observation_interval_ms": 100,
                  "max_wait_time_ms": 500
                }
              },
              {
                "type": "node",
                "node": "execute_cautious_action",
                "name": "cautious_action",
                "config_ref": "action"
              }
            ]
          },
          {
            "type": "node",
            "node": "execute_default_action",
            "name": "default_action",
            "config": {
              "action_type": "continue_monitoring",
              "fallback_behavior": "maintain_distance"
            }
          }
        ]
      },
      {
        "type": "node",
        "node": "publish_results",
        "name": "result_publisher",
        "config": {
          "publish_to_topic": "/detections/ensemble",
          "include_metadata": true,
          "include_timing": true,
          "publish_rate_hz": 10.0
        }
      }
    ]
  },
  "configs": {
    "yolo": {
      "model_path": "models/yolov8n.onnx",
      "input_size": [640, 640],
      "confidence_threshold": 0.5,
      "iou_threshold": 0.45,
      "classes": ["person", "bicycle", "car", "motorcycle", "bus", "truck"],
      "max_detections": 100,
      "use_gpu": true,
      "batch_size": 1
    },
    "mobilenet": {
      "model_path": "models/mobilenet_v3_small.onnx",
      "input_size": [224, 224],
      "confidence_threshold": 0.4,
      "use_gpu": true,
      "preprocessing": "imagenet_normalization"
    },
    "depth": {
      "method": "connected_components",
      "min_depth_m": 0.3,
      "max_depth_m": 5.0,
      "min_cluster_size": 500,
      "depth_threshold_m": 0.1,
      "use_normals": true
    },
    "fusion": {
      "fusion_method": "weighted_voting",
      "weights": {
        "yolo": 0.5,
        "mobilenet": 0.3,
        "depth": 0.2
      },
      "confidence_boost_on_consensus": 0.15,
      "min_overlap_iou": 0.3,
      "temporal_smoothing": true,
      "smoothing_window_size": 5
    },
    "action": {
      "high_confidence_speed": 0.8,
      "medium_confidence_speed": 0.5,
      "low_confidence_speed": 0.3,
      "safety_margin_m": 0.8,
      "reaction_time_ms": 200
    }
  }
}