[
    {
        "id": "yolov8_seg_photo_tab",
        "type": "tab",
        "label": "YOLOv8-Seg 实例分割",
        "disabled": false,
        "info": "# YOLOv8-Seg 实例分割\n\n## 功能介绍\n\nYOLOv8-Seg实例分割算法，支持USB摄像头和MIPI摄像头实时视频流模式。\n\n## 使用流程\n\n### USB视频流分割（实时）\n1. **启动视频流**：点击\"🎥 USB摄像头视频流\"按钮\n2. **查看可视化**：点击\"打开可视化页面\"在浏览器中查看实时分割结果\n3. **停止服务**：完成后点击\"停止所有服务\"\n\n### MIPI视频流分割（实时）\n1. **启动视频流**：点击\"🎥 MIPI摄像头视频流\"按钮\n2. **查看可视化**：点击\"打开可视化页面\"在浏览器中查看实时分割结果\n3. **停止服务**：完成后点击\"停止所有服务\"\n\n## 支持平台\n\n- RDK X5\n- RDK S100\n\n## 核心通信配置\n\n### WebSocket视频流\n- **视频流地址**: `http://{host}:8000`\n- **图像Topic**: `/image` (JPEG编码的图像流)\n- **性能**: 实时检测，延迟低\n\n## 注意事项\n\n- 视频流模式需要先启动视频流，再打开可视化页面\n- 分割过程需要几秒钟时间，请耐心等待",
        "env": []
    },
    {
        "id": "comment_video_section",
        "type": "comment",
        "z": "yolov8_seg_photo_tab",
        "name": "🎥 USB视频流分割流程",
        "info": "点击视频流按钮启动实时分割，然后打开可视化页面查看结果",
        "x": 150,
        "y": 360,
        "wires": []
    },
    {
        "id": "inject_usb_video",
        "type": "inject",
        "z": "yolov8_seg_photo_tab",
        "name": "🎥 USB摄像头视频流",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "usb_video",
        "payload": "start",
        "payloadType": "str",
        "x": 140,
        "y": 420,
        "wires": [
            [
                "exec_usb_video"
            ]
        ]
    },
    {
        "id": "exec_usb_video",
        "type": "exec",
        "z": "yolov8_seg_photo_tab",
        "name": "USB视频流启动器",
        "command": "source /opt/tros/humble/setup.bash && export CAM_TYPE=usb && ros2 launch dnn_node_example dnn_node_example.launch.py dnn_example_dump_render_img:=0 dnn_example_config_file:=config/yolov8segworkconfig.json dnn_example_image_width:=1920 dnn_example_image_height:=1080",
        "addpay": false,
        "append": "",
        "useSpawn": true,
        "timer": "120",
        "oldrc": false,
        "x": 380,
        "y": 420,
        "wires": [
            [
                "debug_usb_video_output"
            ],
            [
                "debug_usb_video_error"
            ],
            []
        ]
    },
    {
        "id": "debug_usb_video_output",
        "type": "debug",
        "z": "yolov8_seg_photo_tab",
        "name": "USB视频流输出",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": true,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "payload",
        "statusType": "auto",
        "x": 650,
        "y": 400,
        "wires": []
    },
    {
        "id": "debug_usb_video_error",
        "type": "debug",
        "z": "yolov8_seg_photo_tab",
        "name": "USB视频流错误",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 650,
        "y": 440,
        "wires": []
    },
    {
        "id": "comment_mipi_video_section",
        "type": "comment",
        "z": "yolov8_seg_photo_tab",
        "name": "🎥 MIPI视频流分割流程",
        "info": "点击视频流按钮启动实时分割，然后打开可视化页面查看结果",
        "x": 150,
        "y": 500,
        "wires": []
    },
    {
        "id": "inject_mipi_video",
        "type": "inject",
        "z": "yolov8_seg_photo_tab",
        "name": "🎥 MIPI摄像头视频流",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "mipi_video",
        "payload": "start",
        "payloadType": "str",
        "x": 140,
        "y": 560,
        "wires": [
            [
                "exec_mipi_video"
            ]
        ]
    },
    {
        "id": "exec_mipi_video",
        "type": "exec",
        "z": "yolov8_seg_photo_tab",
        "name": "MIPI视频流启动器",
        "command": "source /opt/tros/humble/setup.bash && export CAM_TYPE=mipi && ros2 launch dnn_node_example dnn_node_example.launch.py dnn_example_dump_render_img:=0 dnn_example_config_file:=config/yolov8segworkconfig.json dnn_example_image_width:=1920 dnn_example_image_height:=1080",
        "addpay": false,
        "append": "",
        "useSpawn": true,
        "timer": "120",
        "oldrc": false,
        "x": 380,
        "y": 560,
        "wires": [
            [
                "debug_mipi_video_output"
            ],
            [
                "debug_mipi_video_error"
            ],
            []
        ]
    },
    {
        "id": "debug_mipi_video_output",
        "type": "debug",
        "z": "yolov8_seg_photo_tab",
        "name": "MIPI视频流输出",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": true,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "payload",
        "statusType": "auto",
        "x": 650,
        "y": 540,
        "wires": []
    },
    {
        "id": "debug_mipi_video_error",
        "type": "debug",
        "z": "yolov8_seg_photo_tab",
        "name": "MIPI视频流错误",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 650,
        "y": 580,
        "wires": []
    },
    {
        "id": "comment_browser_section",
        "type": "comment",
        "z": "yolov8_seg_photo_tab",
        "name": "2️⃣ 查看检测结果",
        "info": "在浏览器中查看实时检测画面",
        "x": 200,
        "y": 640,
        "wires": []
    },
    {
        "id": "inject_browser",
        "type": "inject",
        "z": "yolov8_seg_photo_tab",
        "name": "打开可视化页面",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "http://{host}:8000",
        "payloadType": "str",
        "x": 140,
        "y": 680,
        "wires": [
            [
                "openurl_browser"
            ]
        ]
    },
    {
        "id": "openurl_browser",
        "type": "rdk-tools openurl",
        "z": "yolov8_seg_photo_tab",
        "name": "",
        "x": 380,
        "y": 680,
        "wires": []
    },
    {
        "id": "comment_control_section",
        "type": "comment",
        "z": "yolov8_seg_photo_tab",
        "name": "🎮 控制功能",
        "info": "停止分割服务",
        "x": 150,
        "y": 720,
        "wires": []
    },
    {
        "id": "inject_stop",
        "type": "inject",
        "z": "yolov8_seg_photo_tab",
        "name": "停止分割服务",
        "props": [
            {
                "p": "payload"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "topic": "",
        "payload": "stop",
        "payloadType": "str",
        "x": 140,
        "y": 780,
        "wires": [
            [
                "exec_stop_all"
            ]
        ]
    },
    {
        "id": "exec_stop_all",
        "type": "exec",
        "z": "yolov8_seg_photo_tab",
        "name": "停止服务",
        "command": "sudo pkill -9 -f hobot_usb_cam; sudo pkill -9 -f dnn_node_example; sudo pkill -9 -f hobot_codec_republish; sudo pkill -9 -f websocket; sudo pkill -9 -f python3; sudo pkill -9 -f 'ros2 launch'; sudo pkill -9 -f 'ros2 run'; sleep 2; sudo rm -rf /dev/shm/*; ros2 daemon stop 2>/dev/null; sleep 1; echo '✓ 服务已彻底停止，资源已释放'",
        "addpay": false,
        "append": "",
        "useSpawn": false,
        "timer": "10",
        "oldrc": false,
        "x": 350,
        "y": 780,
        "wires": [
            [
                "debug_stop_info"
            ],
            [],
            []
        ]
    },
    {
        "id": "debug_stop_info",
        "type": "debug",
        "z": "yolov8_seg_photo_tab",
        "name": "停止状态",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": true,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "payload",
        "statusType": "auto",
        "x": 550,
        "y": 780,
        "wires": []
    },
    {
        "id": "global_config_yolov8",
        "type": "global-config",
        "env": [],
        "modules": {
            "node-red-node-rdk-camera": "0.0.17",
            "node-red-contrib-image-tools": "2.1.1"
        }
    }
]
