VideoPipe可视化视频结构化框架更新总结

news2024/10/3 20:25:05

新增实例分割相关支持

增加了基于mask-rcnn的实例分割插件和相关sample。

 1 #include "VP.h"
 2 
 3 #include "../nodes/vp_file_src_node.h"
 4 #include "../nodes/infers/vp_mask_rcnn_detector_node.h"
 5 #include "../nodes/track/vp_sort_track_node.h"
 6 #include "../nodes/osd/vp_osd_node_v3.h"
 7 #include "../nodes/vp_screen_des_node.h"
 8 
 9 #include "../utils/analysis_board/vp_analysis_board.h"
10 
11 /*
12 * ## mask rcnn sample ##
13 * image segmentation using mask rcnn.
14 */
15 
16 #if mask_rcnn_sample
17 
18 int main() {
19     VP_SET_LOG_LEVEL(vp_utils::vp_log_level::INFO);
20     VP_LOGGER_INIT();
21 
22     // create nodes
23     auto file_src_0 = std::make_shared<vp_nodes::vp_file_src_node>("file_src_0", 0, "./test_video/19.mp4", 0.6);
24     auto mask_rcnn_detector = std::make_shared<vp_nodes::vp_mask_rcnn_detector_node>("mask_rcnn_detector", "./models/mask_rcnn/frozen_inference_graph.pb", "./models/mask_rcnn/mask_rcnn_inception_v2_coco_2018_01_28.pbtxt", "./models/coco_80classes.txt");
25     auto track_0 = std::make_shared<vp_nodes::vp_sort_track_node>("sort_track_0");
26     auto osd_v3_0 = std::make_shared<vp_nodes::vp_osd_node_v3>("osd_v3_0", "../third_party/paddle_ocr/font/NotoSansCJKsc-Medium.otf");
27     auto screen_des_0 = std::make_shared<vp_nodes::vp_screen_des_node>("screen_des_0", 0);
28 
29     // construct pipeline
30     mask_rcnn_detector->attach_to({file_src_0});
31     track_0->attach_to({mask_rcnn_detector});
32     osd_v3_0->attach_to({track_0});
33     screen_des_0->attach_to({osd_v3_0});
34 
35     file_src_0->start();
36 
37     // for debug purpose
38     vp_utils::vp_analysis_board board({file_src_0});
39     board.display();
40 }
41 
42 
43 #endif

上面代码效果图如下:

新增语义分割相关支持

新增了基于ENet网络的语义分割插件和sample。

 1 #include "VP.h"
 2 
 3 #include "../nodes/vp_file_src_node.h"
 4 #include "../nodes/infers/vp_enet_seg_node.h"
 5 #include "../nodes/osd/vp_seg_osd_node.h"
 6 #include "../nodes/vp_screen_des_node.h"
 7 
 8 #include "../utils/analysis_board/vp_analysis_board.h"
 9 
10 /*
11 * ## enet seg sample ##
12 * semantic segmentation based on ENet.
13 * 1 input, 2 outputs including orignal frame and mask frame.
14 */
15 
16 #if enet_seg_sample
17 
18 int main() {
19     VP_SET_LOG_LEVEL(vp_utils::vp_log_level::INFO);
20     VP_LOGGER_INIT();
21 
22     // create nodes
23     auto file_src_0 = std::make_shared<vp_nodes::vp_file_src_node>("file_src_0", 0, "./test_video/21.mp4");
24     auto enet_seg = std::make_shared<vp_nodes::vp_enet_seg_node>("enet_seg", "models/enet-cityscapes/enet-model.net");
25     auto seg_osd_0 = std::make_shared<vp_nodes::vp_seg_osd_node>("seg_osd_0", "models/enet-cityscapes/enet-classes.txt", "models/enet-cityscapes/enet-colors.txt");
26     auto screen_des_mask = std::make_shared<vp_nodes::vp_screen_des_node>("screen_des_mask", 0, true, vp_objects::vp_size(400, 225));
27     auto screen_des_original = std::make_shared<vp_nodes::vp_screen_des_node>("screen_des_original", 0, false, vp_objects::vp_size(400, 225));
28 
29     // construct pipeline
30     enet_seg->attach_to({file_src_0});
31     seg_osd_0->attach_to({enet_seg});
32     screen_des_mask->attach_to({seg_osd_0});
33     screen_des_original->attach_to({seg_osd_0});
34 
35     file_src_0->start();
36 
37     // for debug purpose
38     vp_utils::vp_analysis_board board({file_src_0});
39     board.display();
40 }
41 
42 #endif

上面代码效果图如下:

新增多级推理插件sample

多个检测、分类插件串联,不同分类器作用于不同的主目标:

 1 #include "VP.h"
 2 
 3 #include "../nodes/vp_file_src_node.h"
 4 #include "../nodes/infers/vp_yolo_detector_node.h"
 5 #include "../nodes/infers/vp_classifier_node.h"
 6 #include "../nodes/osd/vp_osd_node.h"
 7 #include "../nodes/vp_screen_des_node.h"
 8 #include "../utils/analysis_board/vp_analysis_board.h"
 9 
10 /*
11 * ## multi detectors and classifiers sample ##
12 * show multi infer nodes work together.
13 * 1 detector and 2 classifiers applied on primary class ids(1/2/3).
14 */
15 
16 #if multi_detectors_and_classifiers_sample
17 
18 int main() {
19     VP_SET_LOG_LEVEL(vp_utils::vp_log_level::INFO);
20     VP_LOGGER_INIT();
21 
22     // create nodes
23     auto file_src_0 = std::make_shared<vp_nodes::vp_file_src_node>("file_src_0", 0, "test_video/20.mp4", 0.6);
24     /* primary detector */
25     // labels for detector model
26     // 0 - person
27     // 1 - car
28     // 2 - bus
29     // 3 - truck
30     // 4 - 2wheel
31     auto primary_detector = std::make_shared<vp_nodes::vp_yolo_detector_node>("primary_detector", "models/det_cls/yolov3-tiny-2022-0721_best.weights", "models/det_cls/yolov3-tiny-2022-0721.cfg", "models/det_cls/yolov3_tiny_5classes.txt", 416, 416, 1);
32     /* secondary classifier 1, applied to car(1)/bus(2)/truck(3) only */
33     auto _1st_classifier = std::make_shared<vp_nodes::vp_classifier_node>("1st_classifier", "models/det_cls/vehicle/resnet18-batch=N-type_view_0322_nhwc.onnx", "", "models/det_cls/vehicle/vehicle_types.txt", 224, 224, 1, std::vector<int>{1, 2, 3}, 10, false, 1, cv::Scalar(), cv::Scalar(), true, true);
34     /* secondary classifier 2, applied to car(1)/bus(2)/truck(3) only */
35     auto _2nd_classifier = std::make_shared<vp_nodes::vp_classifier_node>("2nd_classifier", "models/det_cls/vehicle/resnet18-batch=N-color_view_0322_nhwc.onnx", "", "models/det_cls/vehicle/vehicle_colors.txt", 224, 224, 1, std::vector<int>{1, 2, 3}, 10, false, 1, cv::Scalar(), cv::Scalar(), true, true);
36     auto osd_0 = std::make_shared<vp_nodes::vp_osd_node>("osd_0");
37     auto screen_des_0 = std::make_shared<vp_nodes::vp_screen_des_node>("screen_des_o", 0);
38 
39     // construct pipeline
40     primary_detector->attach_to({file_src_0});
41     _1st_classifier->attach_to({primary_detector});
42     _2nd_classifier->attach_to({_1st_classifier});
43     osd_0->attach_to({_2nd_classifier});
44     screen_des_0->attach_to({osd_0});
45 
46     // start
47     file_src_0->start();
48 
49     // for debug purpose
50     vp_utils::vp_analysis_board board({file_src_0});
51     board.display();
52 }
53 
54 #endif

上面代码运行效果如下:

新增图片源输入插件

支持以图片方式输入(文件或UDP),频率可调、各个通道互相独立。

 1 #include "VP.h"
 2 
 3 #include "../nodes/vp_image_src_node.h"
 4 #include "../nodes/infers/vp_yolo_detector_node.h"
 5 #include "../nodes/osd/vp_osd_node.h"
 6 #include "../nodes/vp_split_node.h"
 7 #include "../nodes/vp_screen_des_node.h"
 8 
 9 #include "../utils/analysis_board/vp_analysis_board.h"
10 
11 /*
12 * ## image_src_sample ##
13 * show how vp_image_src_node works, read image from local file or receive image from remote via udp.
14 */
15 
16 #if image_src_sample
17 
18 int main() {
19     VP_SET_LOG_LEVEL(vp_utils::vp_log_level::INFO);
20     VP_LOGGER_INIT();
21 
22     // create nodes
23     auto image_src_0 = std::make_shared<vp_nodes::vp_image_src_node>("image_file_src_0", 0, "./images/test_%d.jpg", 1, 0.4); // read 1 image EVERY 1 second from local files, such as test_0.jpg,test_1.jpg
24     /* sending command for test: `gst-launch-1.0 filesrc location=16.mp4 ! qtdemux ! avdec_h264 ! videoconvert ! videoscale ! video/x-raw,width=416,height=416 ! videorate ! video/x-raw,framerate=1/1 ! jpegenc ! rtpjpegpay ! udpsink host=ip port=6000` */
25     auto image_src_1 = std::make_shared<vp_nodes::vp_image_src_node>("image_udp_src_1", 1, "6000", 3);                       // receive 1 image EVERY 3 seconds from remote via udp , such as 127.0.0.1:6000
26     auto yolo_detector = std::make_shared<vp_nodes::vp_yolo_detector_node>("yolo_detector", "models/det_cls/yolov3-tiny-2022-0721_best.weights", "models/det_cls/yolov3-tiny-2022-0721.cfg", "models/det_cls/yolov3_tiny_5classes.txt");
27     auto osd = std::make_shared<vp_nodes::vp_osd_node>("osd");
28     auto split = std::make_shared<vp_nodes::vp_split_node>("split_by_channel", true);    // split by channel index (important!)
29     auto screen_des_0 = std::make_shared<vp_nodes::vp_screen_des_node>("screen_des_0", 0);
30     auto screen_des_1 = std::make_shared<vp_nodes::vp_screen_des_node>("screen_des_1", 1);
31     
32     // construct pipeline
33     yolo_detector->attach_to({image_src_0, image_src_1});
34     osd->attach_to({yolo_detector});
35     split->attach_to({osd});
36     screen_des_0->attach_to({split});
37     screen_des_1->attach_to({split});
38 
39     image_src_0->start();  // start read from local file
40     image_src_1->start();  // start receive from remote via udp
41 
42     // for debug purpose
43     vp_utils::vp_analysis_board board({image_src_0, image_src_1});
44     board.display();
45 }
46 
47 #endif

上面代码运行效果如下:

新增图片结果输出插件

支持以图片格式输出结果(文件或UDP),频率可调、各通道互相独立。

 1 #include "VP.h"
 2 
 3 #include "../nodes/vp_file_src_node.h"
 4 #include "../nodes/infers/vp_yunet_face_detector_node.h"
 5 #include "../nodes/infers/vp_sface_feature_encoder_node.h"
 6 #include "../nodes/osd/vp_face_osd_node_v2.h"
 7 #include "../nodes/vp_screen_des_node.h"
 8 #include "../nodes/vp_image_des_node.h"
 9 
10 #include "../utils/analysis_board/vp_analysis_board.h"
11 
12 /*
13 * ## image_des_sample ##
14 * show how vp_image_des_node works, save image to local file or push image to remote via udp.
15 */
16 
17 #if image_des_sample
18 
19 int main() {
20     VP_SET_LOG_LEVEL(vp_utils::vp_log_level::INFO);
21     VP_LOGGER_INIT();
22 
23     // create nodes
24     auto file_src_0 = std::make_shared<vp_nodes::vp_file_src_node>("file_src_0", 0, "./test_video/10.mp4", 0.6);
25     auto yunet_face_detector_0 = std::make_shared<vp_nodes::vp_yunet_face_detector_node>("yunet_face_detector_0", "./models/face/face_detection_yunet_2022mar.onnx");
26     auto sface_face_encoder_0 = std::make_shared<vp_nodes::vp_sface_feature_encoder_node>("sface_face_encoder_0", "./models/face/face_recognition_sface_2021dec.onnx");
27     auto osd_0 = std::make_shared<vp_nodes::vp_face_osd_node_v2>("osd_0");
28     auto screen_des_0 = std::make_shared<vp_nodes::vp_screen_des_node>("screen_des_0", 0);
29     
30     /* save to file, `%d` is placeholder for filename index */
31     //auto image_des_0 = std::make_shared<vp_nodes::vp_image_des_node>("image_file_des_0", 0, "./images/%d.jpg", 3);
32     
33     /* push via udp,  receiving command for test: `gst-launch-1.0 udpsrc port=6000 ! application/x-rtp,encoding-name=jpeg ! rtpjpegdepay ! jpegparse ! jpegdec ! queue ! videoconvert ! autovideosink` */
34     auto image_des_0 = std::make_shared<vp_nodes::vp_image_des_node>("image_udp_des_0", 0, "192.168.77.248:6000", 3, vp_objects::vp_size(400, 200));
35 
36     // construct pipeline
37     yunet_face_detector_0->attach_to({file_src_0});
38     sface_face_encoder_0->attach_to({yunet_face_detector_0});
39     osd_0->attach_to({sface_face_encoder_0});
40     screen_des_0->attach_to({osd_0});
41     image_des_0->attach_to({osd_0});
42 
43     file_src_0->start();
44 
45     // for debug purpose
46     vp_utils::vp_analysis_board board({file_src_0});
47     board.display();
48 }
49 
50 #endif

上面代码运行效果如下:

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/769793.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

vite 引入局部组件 必须带.vue

11:03:47 AM [vite] Internal server error: Failed to resolve import “./components/layoutsHeader” from “src/views/layouts/layouts.vue”. Does the file exist? 在这里插入图片描述

Apple Logic Pro 10.7.9 - 音频编辑

Apple Logic Pro 10.7.9 - 音频编辑 Logic Pro 10.7.9 MainStage 3.6.4 (Universal) 请访问原文链接&#xff1a;https://sysin.org/blog/apple-logic-pro/&#xff0c;查看最新版。原创作品&#xff0c;转载请保留出处。 作者主页&#xff1a;sysin.org Logic Pro X 10.3&…

Hive概述

Hive 一 Hive基本概念 1 Hive简介 学习目标 - 了解什么是Hive - 了解为什么使用Hive####1.1 什么是 Hive Hive 由 Facebook 实现并开源&#xff0c;是基于 Hadoop 的一个数据仓库工具&#xff0c;可以将结构化的数据映射为一张数据库表&#xff0c;并提供 HQL(Hive SQL)查询…

位操作计算规则以及用途

位操作列表 符号中文名英文&按位与bitwise AND|按位或Bitwise OR^按位异或Bitwise XOR<<按位左移Shift Left>>按位右移Shift Right~按位取反Bitwise NOT 所有位运算的规则 低位&#xff1a;靠后的位 高位&#xff1a;靠前的位 低位对齐&#xff0c;高位补0,…

搭建Redis分片集群

说明&#xff1a;单体Redis有许多问题&#xff0c;可通过Redis数据持久化、搭建主从集群、哨兵和Redis分片集群解决单体Redis数据丢失、高并发、数据恢复和海量数据存储的问题。前三个参考http://t.csdn.cn/6pp2F、http://t.csdn.cn/o9u0S&#xff0c;本问介绍如何创建Redis分片…

【历史上的今天】7 月 19 日:IMAP 协议之父出生;Project Kotlin 公开亮相;CT 成像实现新突破

整理 | 王启隆 透过「历史上的今天」&#xff0c;从过去看未来&#xff0c;从现在亦可以改变未来。 今天是 2023 年 7 月 19 日&#xff0c;在 2010 年的今天&#xff0c;亚马逊发布了一份新闻稿&#xff0c;提到它现在销售的 Kindle 书籍比精装书还多。亚马逊公司旗下 Lab126…

数据库应用:MySQL高级语句(一)

目录 一、理论 1.常用查询 2.函数 3.进阶查询 二、实验 1.普通查询 2.函数 3.进阶查询 三、问题 1.MySQL || 运算符不生效 四、总结 一、理论 1.常用查询 常用查询包括&#xff1a;增、删、改、查&#xff1b; 对 MySQL 数据库的查询&#xff0c;除了基本的查询外…

手动实现 Tomcat 底层机制+ 自己设Servlet最终版本V3

文章目录 实现任务阶段 3- 处理 Servlet分析代码实现● 分析示意图WyxRequestHandlerwyxResponsewyxRequestwyxServlet接口wyxHttpServletwyxCalServletWebUtilswyxTomcatV3代码里面的容器图 实现任务阶段 3- 处理 Servlet 分析代码实现 ● 分析示意图 WyxRequestHandler 1.…

暑期代码每日一练Day3:874. 模拟行走机器人

题目 874. 模拟行走机器人 分析 这道题就是个简单的模拟 主要有两点考察点&#xff1a; 对方向数组的运用 方向数组存储的是各个方向的单位向量&#xff0c;也即&#xff1a; 方向XY向北01向东10向南0-1向西-10 存储在数组中&#xff0c;则是方向数组&#xff1a; in…

vue3后台管理系统封装的普通表格组件

1.普通的表格组件效果 ComtableListR.vue组件 <template><div class"tableBox"><div class"btn-add"><a-space><a-upload v-model:file-list"fileList" v-if"hasImport" name"file" accept&qu…

关于Arduino IDE库文件存放路径问题总结(双版本)

在开发过程中,如果不注意,库文件存放路径很乱,如果在转移系统环境时,容易忘记备份。编译过程中出现多个可用引用包的位置,为了解决这些问题,要明白各文件夹的默认路径在哪,区别在哪,如有了解不对的地方请指正。 IDE安装目录(默认C盘,自定义可以其他盘符下)IDE升级可…

动态规划(四) —— 子序列和子串系列问题总结

前言 通过前面有关动态规划经典问题如背包问题、打家劫舍系列问题和股票投资问题的学习相信小伙伴跟荔枝一样对于动态规划题目有了一定的感觉。接下来再这篇文章中荔枝会继续梳理有关动态规划的经典系列问题——子序列和子串问题&#xff0c;给出解题的分析思路和具体的题解&am…

曲阜师范大学2023年暑期大一新生排位赛 题解

目录 A (1). Sum 详细点击&#xff1a;sum //整除分块 B (2). Sort C (3). String //字符串dp D (4). Factor ​​​​​​​ ​​​​​​​ //素数筛变式 E (5). Tree ​​​​​​​ …

复现Nature图表:GSEA分析及可视化包装函数

这篇帖子主要的目的是写一个转录组GSEA分析和可视化通用的函数。起因是我们想要复现一篇文章的GSEA可视化图片&#xff0c;这个Nature文章GSEA可视化挺好的&#xff1a; image.png &#xff08;reference&#xff1a;B-cell-specific checkpoint molecules that regulate anti…

vscode报警和报错没有颜色

前言 解决方法来源 https://www.zhihu.com/question/506531863 解决步骤 安装IPython conda install IPython打开/anaconda3/envs/mmagic3/lib/python3.8/site-packages&#xff0c;然后创建一个文件&#xff0c;sitecustomize.py&#xff0c;里面写入 import sys frome IP…

Python(二十一)intput()函数的高级使用

❤️ 专栏简介&#xff1a;本专栏记录了我个人从零开始学习Python编程的过程。在这个专栏中&#xff0c;我将分享我在学习Python的过程中的学习笔记、学习路线以及各个知识点。 ☀️ 专栏适用人群 &#xff1a;本专栏适用于希望学习Python编程的初学者和有一定编程基础的人。无…

Kafka消息队列基础入门和实战例子

1、Kafka 1.1 Kafka部署配置 1.1.1 下载Kafka 下载Kafka https://kafka.apache.org/downloads.html https://archive.apache.org/dist/kafka/2.4.1/kafka_2.11-2.4.1.tgz下载Scala-2.11版本 Scala-2.11经典版本解压 直接解压到某个目录&#xff0c;可以一起放在Java相关的…

MathType公式编辑器右边选项变灰

今天在写论文的时候&#xff0c;想要给公式添加编号&#xff0c;发现Word中的MathType好多选项都变灰了&#xff0c;然后查找了一些资料&#xff0c;最终解决&#xff0c;这里记录一下&#xff0c;方便以后查阅。 MathType公式编辑器右边选项变灰 问题描述解决方案禁止MathType…

C++---树形DP---树的中心(每日一道算法2023.7.19)

注意事项&#xff1a; 本题为"树形DP—树的最长路径"的近似题&#xff0c;同时涉及到 单链表模拟邻接表存储图 的操作&#xff0c;建议先理解那篇文章。 题目&#xff1a; 给定一棵树&#xff0c;树中包含 n 个结点&#xff08;编号1~n&#xff09;和 n−1 条无向边…

pandas清洗客户编码异常数据

前言 在不同行业中&#xff0c;我们经常会遇到一个麻烦的问题&#xff1a;数据清洗。尤其是当我们需要处理客户编码异常数据时&#xff0c;这个问题变得尤为重要。想象一下&#xff0c;许多银行都是以客户为单位管理数据的&#xff0c;因此每个客户都有一个独特的编码。在处理…