Ver Fonte

更新画图模块

leon há 3 semanas atrás
pai
commit
1905206f0a
3 ficheiros alterados com 128 adições e 7 exclusões
  1. 1 0
      src/infer/trt/yolo/yolo.cu
  2. 1 1
      src/nodes/draw/drawNode.cpp
  3. 126 6
      workspace/demo.json

+ 1 - 0
src/infer/trt/yolo/yolo.cu

@@ -759,6 +759,7 @@ Result YoloModelImpl::forwards(void *stream)
         {
             data::Box result_object_box(pbox[0], pbox[1], pbox[2], pbox[3], pbox[4], label);
             result_object_box.label = class_names_[label];
+            result_object_box.class_id = label - class_names_.size();
             if (model_type_ == ModelType::YOLO11POSE)
             {
                 result_object_box.keypoints.reserve(KEY_POINT_NUM);

+ 1 - 1
src/nodes/draw/drawNode.cpp

@@ -146,7 +146,7 @@ void DrawNode::handle_data(std::shared_ptr<meta::MetaData>& meta_data)
         std::tuple<int, int, int, int> pbox = std::make_tuple(box.left, box.top, box.right, box.bottom);
         int x, y;
         std::string text;
-        if (box.class_id != -1) 
+        if (box.class_id > 0) 
         {
             text = str_format("%s %.2f id=%d", box.label.c_str(), box.score, box.class_id);
         }

+ 126 - 6
workspace/demo.json

@@ -1,6 +1,6 @@
 {
     "models": {
-        "yolo_model_main": {
+        "yolo_pose_model": {
             "model_path": "model/yolo11lpose.engine",
             "model_type": "YOLO11POSE",
             "names": [
@@ -9,6 +9,95 @@
             "gpu_id": 1,
             "confidence_threshold": 0.25,
             "nms_threshold": 0.45
+        },
+        "yolo_seg_model": {
+            "model_path": "model/model1.engine",
+            "model_type": "YOLO11SEG",
+            "names": [
+                "person",
+                "bicycle",
+                "car",
+                "motorcycle",
+                "airplane",
+                "bus",
+                "train",
+                "truck",
+                "boat",
+                "traffic light",
+                "fire hydrant",
+                "stop sign",
+                "parking meter",
+                "bench",
+                "bird",
+                "cat",
+                "dog",
+                "horse",
+                "sheep",
+                "cow",
+                "elephant",
+                "bear",
+                "zebra",
+                "giraffe",
+                "backpack",
+                "umbrella",
+                "handbag",
+                "tie",
+                "suitcase",
+                "frisbee",
+                "skis",
+                "snowboard",
+                "sports ball",
+                "kite",
+                "baseball bat",
+                "baseball glove",
+                "skateboard",
+                "surfboard",
+                "tennis racket",
+                "bottle",
+                "wine glass",
+                "cup",
+                "fork",
+                "knife",
+                "spoon",
+                "bowl",
+                "banana",
+                "apple",
+                "sandwich",
+                "orange",
+                "broccoli",
+                "carrot",
+                "hot dog",
+                "pizza",
+                "donut",
+                "cake",
+                "chair",
+                "couch",
+                "potted plant",
+                "bed",
+                "dining table",
+                "toilet",
+                "tv",
+                "laptop",
+                "mouse",
+                "remote",
+                "keyboard",
+                "cell phone",
+                "microwave",
+                "oven",
+                "toaster",
+                "sink",
+                "refrigerator",
+                "book",
+                "clock",
+                "vase",
+                "scissors",
+                "teddy bear",
+                "hair drier",
+                "toothbrush"
+            ],
+            "gpu_id": 1,
+            "confidence_threshold": 0.25,
+            "nms_threshold": 0.45
         }
     },
     "pipelines": [
@@ -30,7 +119,7 @@
                     "node_id": "infer_0",
                     "node_type": "Inference",
                     "params": {
-                        "model_id": "yolo_model_main"
+                        "model_id": "yolo_pose_model"
                     }
                 },
                 {
@@ -43,10 +132,41 @@
                     }
                 },
                 {
-                    "node_id": "analyze_0",
-                    "node_type": "Analyzer",
+                    "node_id": "draw_0",
+                    "node_type": "Drawer",
                     "params": {}
                 },
+                {
+                    "node_id": "rtsp_0",
+                    "node_type": "Recorder",
+                    "params": {
+                        "gst_pipeline": "appsrc ! videoconvert ! video/x-raw,format=I420 ! x264enc speed-preset=ultrafast bitrate=4000 key-int-max=40 ! video/x-h264,profile=baseline ! rtspclientsink location=rtsp://172.16.20.168:8554/live",
+                        "fps": 20
+                    }
+                }
+            ]
+        },
+        {
+            "pipeline_id": "pipeline_1",
+            "description": "处理摄像头1的视频流",
+            "nodes": [
+                {
+                    "node_id": "src_1",
+                    "node_type": "Source",
+                    "params": {
+                        "stream_url": "rtsp://admin:lww123456@172.16.22.16:554/Streaming/Channels/201",
+                        "gpu_id": 1,
+                        "decode_type": "GPU",
+                        "skip_frame": 1
+                    }
+                },
+                {
+                    "node_id": "infer_1",
+                    "node_type": "Inference",
+                    "params": {
+                        "model_id": "yolo_seg_model"
+                    }
+                },
                 {
                     "node_id": "draw_0",
                     "node_type": "Drawer",
@@ -56,8 +176,8 @@
                     "node_id": "rtsp_0",
                     "node_type": "Recorder",
                     "params": {
-                        "gst_pipeline": "appsrc ! videoconvert ! video/x-raw,format=I420 ! x264enc speed-preset=ultrafast bitrate=2000 key-int-max=50 ! video/x-h264,profile=baseline ! rtspclientsink location=rtsp://172.16.20.168:8554/live",
-                        "fps": 25
+                        "gst_pipeline": "appsrc ! videoconvert ! video/x-raw,format=I420 ! x264enc speed-preset=ultrafast bitrate=4000 key-int-max=40 ! video/x-h264,profile=baseline ! rtspclientsink location=rtsp://172.16.20.168:8554/live1",
+                        "fps": 20
                     }
                 }
             ]