本文主要是介绍R3live+PaddleYOLO同步建图和目标检测,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
1.硬件环境
显卡2080ti,nvidia驱动470.141.03
系统ubuntu18.04,cuda-11.1,TensorRT-7.2.1.6, opencv-3.4.16
Python IDE: Anaconda、Pycharm
2.paddleyolo
2.1 环境搭建
1.源码下载
git clone https://github.com/PaddlePaddle/PaddleYOLO.git2.Conda环境创建
cd PaddleYOLO
conda create -n paddledetect python=3.7
pip install -r requirements.txt -i http://mirrors.aliyun.com/pypi/simple/3.Pycharm中安装paddle
pip install common dual tight data prox -i https://mirrors.aliyun.com/pypi/simple/
pip install paddle -i https://mirrors.aliyun.com/pypi/simple/
pip install paddlepaddle-gpu -i https://mirrors.aliyun.com/pypi/simple/
下面是我这边pip安装的包,你可以参考下,主要看下paddlepaddle-gpu的版本:
astor==0.8.1
Babel==2.10.3
bce-python-sdk==0.8.74
boto3==1.24.89
botocore==1.27.89
bottle==0.12.23
certifi==2022.9.24
charset-normalizer==2.1.1
click==8.1.3
common==0.1.2
cycler==0.11.0
Cython==0.29.32
data==0.4
decorator==5.1.1
dill==0.3.5.1
dual==0.0.10
dynamo3==0.4.10
filterpy==1.4.5
Flask==2.2.2
Flask-Babel==2.0.0
flywheel==0.5.4
fonttools==4.37.4
funcsigs==1.0.2
future==0.18.2
idna==3.4
importlib-metadata==5.0.0
itsdangerous==2.1.2
Jinja2==3.1.2
jmespath==1.0.1
joblib==1.2.0
kiwisolver==1.4.4
lap==0.4.0
MarkupSafe==2.1.1
matplotlib==3.5.3
mkl-fft==1.3.1
mkl-random==1.2.2
mkl-service==2.4.0
motmetrics==1.2.5
multiprocess==0.70.13
numpy==1.21.5
opencv-python==4.6.0.66
opt-einsum==3.3.0
packaging==21.3
paddle==1.0.2
paddle-bfloat==0.1.7
paddledet==2.4.0
paddlepaddle==2.3.2
paddlepaddle-gpu==2.3.2
pandas==1.3.5
peewee==3.15.3
Pillow==9.2.0
pip==22.2.2
protobuf==3.20.0
prox==0.0.17
pyclipper==1.3.0.post3
pycocotools==2.0.5
pycryptodome==3.15.0
pyparsing==3.0.9
PySocks==1.7.1
python-dateutil==2.8.2
python-geoip-python3==1.3
pytz==2022.4
PyYAML==6.0
requests==2.28.1
s3transfer==0.6.0
scikit-learn==1.0.2
scipy==1.7.3
setuptools==63.4.1
Shapely==1.8.4
six==1.16.0
sklearn==0.0
terminaltables==3.1.10
threadpoolctl==3.1.0
tight==0.1.0
tqdm==4.64.1
typeguard==2.13.3
typing_extensions==4.4.0
urllib3==1.26.12
visualdl==2.4.1
Werkzeug==2.2.2
wheel==0.37.1
xmltodict==0.13.0
zipp==3.8.1
2.2 模型导出
下面以yolov5-m为例进行操作:
cd PaddleYOLO
1.下载预训练模型权重
wget https://paddledet.bj.bcebos.com/models/yolov5_m_300e_coco.pdparams2.模型导出
mkdir -p model/yolov5m/out_model
python tools/export_model.py -c configs/yolov5/yolov5_m_300e_coco.yml --output_dir=./model/yolov5m/out_model -o weights=./yolov5_m_300e_coco.pdparams3.测试
python tools/infer.py -c ./configs/yolov5/yolov5_m_300e_coco.yml -o weights=./model/yolov5m/yolov5_m_300e_coco.pdparams --infer_img=demo/000000014439.jpg --draw_threshold=0.5
输出检测结果:output目录下。
下面是检测结果样图:
3.c++部署
3.1 环境配置
1.查看docs
cd PaddleYOLO/deploy/cpp
vim docs/linux_build.md
根据文档搭建paddle inference环境2.修改环境路径和参数
vim scripts/build.sh
3.2 编译
bash scripts/build.sh
可能会有错误,这里只记录部分报错,仅供参考:
1.Could NOT find Git (missing: GIT_EXECUTABLE)
vim PaddleYOLO/deploy/cpp/cmake/yaml-cpp.cmake
把下面这行注释掉
find_package(Git REQUIRED)2.CMake Error at CMakeLists.txt:94 (find_package):Could not find a package configuration file provided by "OpenCV" with anyof the following names:OpenCVConfig.cmakeopencv-config.cmake
vim PaddleYOLO/deploy/cpp/CMakeLists.txt
将把下面这行:
find_package(OpenCV REQUIRED PATHS ${OPENCV_DIR}/share/OpenCV NO_DEFAULT_PATH)
改为:
find_package(OpenCV REQUIRED)3.fatal error: glog/logging.h: No such file or directory
sudo apt install libgoogle-glog-dev
3.3 测试</
这篇关于R3live+PaddleYOLO同步建图和目标检测的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!