首页
/ VideoPipe 项目下载及安装教程

VideoPipe 项目下载及安装教程

2024-12-08 15:48:14作者:范垣楠Rhoda

1. 项目介绍

VideoPipe 是一个跨平台的视频结构化(视频分析)框架,使用 C++ 编写。它具有最小的依赖性,易于使用,并且操作类似于管道,其中每个节点都是独立的,可以以各种方式组合。VideoPipe 可以用于构建不同类型的视频分析应用程序,适用于视频结构化、图像搜索、人脸识别和交通/安全领域的行为分析(如交通事件检测)等场景。

2. 项目下载位置

要下载 VideoPipe 项目,请访问项目的 GitHub 仓库。您可以通过以下命令克隆项目到本地:

git clone https://github.com/sherlockchou86/video_pipe_c.git

3. 项目安装环境配置

3.1 系统要求

  • Ubuntu 18.04 x86_64
  • NVIDIA rtx/tesla GPUs
  • Ubuntu 18.04 aarch64 NVIDIA jetson serials device (tx2 tested)
  • Ubuntu 18.04 x86_64 Cambrian MLU serials device (MLU 370 tested, code not provided)
  • Ubuntu 18.04 aarch64 Rockchip RK35** serials device (RK3588 tested, code not provided)

3.2 依赖库

  • C++ 17
  • OpenCV >= 4.6
  • GStreamer 1.14.5 (Required by OpenCV)
  • GCC >= 7.5

3.3 可选依赖

  • CUDA
  • TensorRT
  • Paddle Inference
  • ONNX Runtime

3.4 环境配置示例

以下是配置环境的示例步骤:

  1. 安装必要的依赖库:
sudo apt-get update
sudo apt-get install build-essential cmake git libopencv-dev libgstreamer1.0-dev
  1. 安装 CUDA 和 TensorRT(如果需要):
# 安装 CUDA
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/cuda-ubuntu1804.pin
sudo mv cuda-ubuntu1804.pin /etc/apt/preferences.d/cuda-repository-pin-600
sudo apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/7fa2af80.pub
sudo add-apt-repository "deb https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/ /"
sudo apt-get update
sudo apt-get -y install cuda

# 安装 TensorRT
sudo apt-get install tensorrt
  1. 安装 Paddle Inference(如果需要):
# 下载并安装 Paddle Inference
wget https://paddle-inference-lib.bj.bcebos.com/2.2.2/cxx_c/Linux/GPU/x86-64_gcc8.2_avx_mkl_cuda11.2_cudnn8.1.1_trt7.2.3.4/paddle_inference.tgz
tar -xzvf paddle_inference.tgz
sudo cp -r paddle_inference /usr/local/

4. 项目安装方式

  1. 克隆项目到本地:
git clone https://github.com/sherlockchou86/video_pipe_c.git
cd video_pipe_c
  1. 创建并进入构建目录:
mkdir build
cd build
  1. 配置并编译项目:
cmake ..
make -j8
  1. 可选:启用 CUDA 和 TensorRT 模块:
cmake -DVP_WITH_CUDA=ON -DVP_WITH_TRT=ON ..
make -j8

5. 项目处理脚本

以下是一个简单的示例脚本,用于运行 VideoPipe 中的一个示例:

#include "vp_nodes/vp_file_src_node.h"
#include "vp_nodes/infers/vp_yunet_face_detector_node.h"
#include "vp_nodes/infers/vp_sface_feature_encoder_node.h"
#include "vp_nodes/osd/vp_face_osd_node_v2.h"
#include "vp_nodes/vp_screen_des_node.h"
#include "vp_nodes/vp_rtmp_des_node.h"
#include "vp_utils/analysis_board/vp_analysis_board.h"

int main() {
    VP_SET_LOG_INCLUDE_CODE_LOCATION(false);
    VP_SET_LOG_INCLUDE_THREAD_ID(false);
    VP_LOGGER_INIT();

    // 1. 创建节点
    auto file_src_0 = std::make_shared<vp_nodes::vp_file_src_node>("file_src_0", 0, "/test_video/10.mp4", 0, 6);

    // 2. 模型推理节点
    auto yunet_face_detector = std::make_shared<vp_nodes::vp_yunet_face_detector_node>("yunet_face_detector", 0);
    auto sface_feature_encoder = std::make_shared<vp_nodes::vp_sface_feature_encoder_node>("sface_feature_encoder", 0);

    // 3. 创建 OSD 节点
    auto face_osd = std::make_shared<vp_nodes::vp_face_osd_node_v2>("face_osd", 0);

    // 4. 创建输出节点
    auto screen_des = std::make_shared<vp_nodes::vp_screen_des_node>("screen_des", 0);
    auto rtmp_des = std::make_shared<vp_nodes::vp_rtmp_des_node>("rtmp_des", 0, "rtmp://your_rtmp_server");

    // 5. 连接节点
    file_src_0->link(yunet_face_detector);
    yunet_face_detector->link(sface_feature_encoder);
    sface_feature_encoder->link(face_osd);
    face_osd->link(screen_des);
    face_osd->link(rtmp_des);

    // 6. 运行管道
    file_src_0->run();

    return 0;
}

请确保更新代码中的文件路径和 RTMP 服务器地址。

登录后查看全文
热门项目推荐
相关项目推荐