申威芯片UOS中opencv DNN推理

Cmake,opencv,opencv-contribute安装

#apt可能需要更新apt update
apt install -y wget unzip
apt-get install build-essential libgtk2.0-dev libgtk-3-dev libavcodec-dev libavformat-dev libjpeg-dev libswscale-dev libtiff5-dev

#安装cmake
apt install cmake
查看cmake
cmake -version
#下载opencv
wget -O opencv.zip https://github.com/opencv/opencv/archive/4.5.0.zip

unzip opencv.zip
mv opencv-4.5.0 opencv
cd opencv

#下载opencv_contrib
wget -O opencv_contrib.zip https://github.com/opencv/opencv_contrib/archive/4.5.0.zip
unzip opencv_contrib.zip
mv opencv_contrib-4.5.0  opencv_contrib

mkdir build
cd build
cmake -D CMAKE_BUILD_TYPE=RELEASE \
    -DINSTALL_PYTHON_EXAMPLES=ON \
    -DINSTALL_C_EXAMPLES=ON \
    -DOPENCV_EXTRA_MODULES_PATH=../opencv_contrib/modules \
    -DBUILD_EXAMPLES=ON ..

make -j4
make install

编译opencv dnn yolov5

#配置CMakeLists.txt,放入工程

cmake_minimum_required(VERSION 2.8)
project( yolo )
find_package( OpenCV REQUIRED )
include_directories( ${OpenCV_INCLUDE_DIRS} )
add_executable( yolo main.cpp yolo.cpp )
target_link_libraries( yolo ${OpenCV_LIBS} )

在opencvdnn工程中:

mkdir build && build
cmake ..
make -j4
./yolo

申威芯片UOS中opencv DNN推理_第1张图片

你可能感兴趣的:(opencv,dnn,webpack)