建设银行手机外汇网站,程显峰 wordpress,广东建设工程信息网官网首页,合肥大建设ubuntu22.04Jetson OpenCV安装 1. 源由2. 分析3. 证实3.1 jtop安装3.2 jtop指令3.3 GPU支持情况 4. 安装OpenCV4.1 修改内容4.2 Python2环境【不需要】4.3 ubuntu22.04环境4.4 国内/本地环境问题4.5 cudnn版本问题 5. 总结6. 参考资料 1. 源由
昨天用Jetson跑demo程序发现帧率… ubuntu22.04Jetson OpenCV安装 1. 源由2. 分析3. 证实3.1 jtop安装3.2 jtop指令3.3 GPU支持情况 4. 安装OpenCV4.1 修改内容4.2 Python2环境【不需要】4.3 ubuntu22.04环境4.4 国内/本地环境问题4.5 cudnn版本问题 5. 总结6. 参考资料 1. 源由
昨天用Jetson跑demo程序发现帧率很慢(只有10FPS左右)按照视频文件怎么说应该有30FPS。但是为什么jetson orin nano跑不起来呢 dnn_object_detection_embedded_device 想着估计是GPU没有跑起来正好凑着调试了下板子记录、整理下资料。
2. 分析
从现象上看OpenCV运行的时候没有跑GPU从而导致高价买的Jetson Orin Nano连这么简单的Demo都跑不起来。
接下来就先看下板子运行的环境
ubuntu22.04/jammy/aarch64
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 22.04.4 LTS
Release: 22.04
Codename: jammy$ uname -a
Linux daniel-nvidia 5.15.122-tegra #1 SMP PREEMPT Mon Dec 18 21:24:25 PST 2023 aarch64 aarch64 aarch64 GNU/LinuxOpenCV版本4.8.0
$ opencv_version
4.8.0$ python3
Python 3.10.12 (main, Nov 20 2023, 15:14:05) [GCC 11.4.0] on linux
Type help, copyright, credits or license for more information.import cv2print(cv2.__version__)
4.8.0安装最新OpenCV4.9.0版本 与之前《ubuntu22.04laptop OpenCV安装》版本一致安装或者升级Jetson Orin Nano上OpenCV4.8.0版本官方论坛讨论NVIDIA: install OpenCV for python3 in Jetson NanoGoogle的网上资料Install OpenCV on Jetson NanoGoogle的教学视频 OpenCV with CUDA in Python on Jetson 3. 证实
要正式是否真的是OpenCV库对GPU的支持问题导致前面验证FPS帧率低那么就需要通过jtop指令来查看。
有朋友问你怎么知道的这些 Ans: 其实我并不知道是我搜出来的。其实就这么简单并不是我知道的多是网上这些问题很多人都已经早就解决了。即使真的有没有人解决的那么也是有办法的只不过思路和这个不太一样。
NVIDIA: Jtop install failNVIDIA: Where can I find these numbers in CUDA_ARCH_BIN?NVIDIA: Your GPU Compute CapabilityNVIDIA: OpenCV build script
3.1 jtop安装
$ pip3 --version
$ sudo -H pip3 install --no-cache-dir jetson-stats
$ sudo systemctl restart jtop.service
$ sudo reboot注一定要重启板子否则无效。
3.2 jtop指令
$ jtop -h
usage: jtop [-h] [--health] [--error-log] [--no-warnings] [--restore] [--loop] [--color-filter] [-r REFRESH] [-p PAGE] [-v]jtop is system monitoring utility and runs on terminaloptions:-h, --help show this help message and exit--health Status jtop and fix (default: False)--error-log Generate a log for GitHub (default: False)--no-warnings Do not show warnings (default: False)--restore Reset Jetson configuration (default: False)--loop Automatically switch page every 5s (default: False)--color-filter Change jtop base colors, you can use also JTOP_COLOR_FILTERTrue (default: False)-r REFRESH, --refresh REFRESHrefresh interval (default: 1000)-p PAGE, --page PAGE Open fix page (default: 1)-v, --version show programs version number and exit3.3 GPU支持情况
OpenCV: 4.8.0 with CUDA: NO所以该版本不支持GPU。 4. 安装OpenCV
两个链接脚本供参考安装
JetsonHacksNano/buildOpenCVmdegans/nano_build_opencv
为了更好的配合我们的例子就整合到SnapLearnOpenCV/scripts中供大家参考上述脚本支持
笔记本电脑(64位普通CPU)安装install_opencv_for_laptop.sh – ubuntu22.04laptop OpenCV安装AI最火的(Jetson Orin Nano)安装install_opencv_for_jetson.sh
4.1 修改内容
$ git diff
diff --git a/build_opencv.sh b/build_opencv.sh
index c12bb40..891eea3 100755
--- a/build_opencv.shb/build_opencv.sh-45,8 45,8 setup () {git_source () {echo Getting version $1 of OpenCV
- git clone --depth 1 --branch $1 https://github.com/opencv/opencv.git
- git clone --depth 1 --branch $1 https://github.com/opencv/opencv_contrib.gitgit clone --depth 1 --branch $1 gitgithub.com:opencv/opencv.gitgit clone --depth 1 --branch $1 gitgithub.com:opencv/opencv_contrib.git}install_dependencies () {-63,9 63,8 install_dependencies () {libatlas-base-dev \libavcodec-dev \libavformat-dev \
- libavresample-dev \libcanberra-gtk3-module \
- libdc1394-22-dev \libdc1394-dev \libeigen3-dev \libglew-dev \libgstreamer-plugins-base1.0-dev \-90,8 89,6 install_dependencies () {libxvidcore-dev \libx264-dev \pkg-config \
- python-dev \
- python-numpy \python3-dev \python3-numpy \python3-matplotlib \-103,14 100,13 install_dependencies () {configure () {local CMAKEFLAGS-D BUILD_EXAMPLESOFF
- -D BUILD_opencv_python2ON-D BUILD_opencv_python3ON-D CMAKE_BUILD_TYPERELEASE-D CMAKE_INSTALL_PREFIX${PREFIX}-D CUDA_ARCH_BIN5.3,6.2,7.2,8.7-D CUDA_ARCH_PTX-D CUDA_FAST_MATHON
- -D CUDNN_VERSION8.0-D CUDNN_VERSION8.9-D EIGEN_INCLUDE_PATH/usr/include/eigen3-D ENABLE_NEONON-D OPENCV_DNN_CUDAON4.2 Python2环境【不需要】
python2环境python-dev python-numpyOpenCV编译选项-D BUILD_opencv_python2ON
4.3 ubuntu22.04环境
无libavresample-dev库libdc1394-22-dev变更为libdc1394-dev
4.4 国内/本地环境问题
将https链接调整为git库链接
- git clone --depth 1 --branch $1 https://github.com/opencv/opencv.git
- git clone --depth 1 --branch $1 https://github.com/opencv/opencv_contrib.gitgit clone --depth 1 --branch $1 gitgithub.com:opencv/opencv.gitgit clone --depth 1 --branch $1 gitgithub.com:opencv/opencv_contrib.gitgit库采用git协议才能下载
$ git config --global url.ssh://gitssh.github.com:443/.insteadOf gitgithub.com:4.5 cudnn版本问题
《Linux 36.2Jetson Orin Nano基础环境构建》安装的是8.9.4.25.
- -D CUDNN_VERSION8.0-D CUDNN_VERSION8.95. 总结
修改完上述脚本后可以直接执行脚本指令
$ git clone gitgithub.com:mdegans/nano_build_opencv.git
$ cd nano_build_opencv
$ nano build_opencv.sh
$ ./build_opencv.sh或者
$ git clone gitgithub.com:SnapDragonfly/SnapLearnOpenCV.git
$ cd SnapLearnOpenCV/scripts
$ ./install_opencv_for_jetson.sh大致耗时约1个小时???没有计时反正也挺快的。执行opencv_version python jtop指令
$ echo $PATH
/home/daniel/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin$ opencv_version
4.9.0$ python
Python 3.10.12 (main, Nov 20 2023, 15:14:05) [GCC 11.4.0] on linux
Type help, copyright, credits or license for more information.import cv2print(cv2.__version__)
4.9.0$ jtop最后关于使用GPU和使用CPU对Demo的影响 dnn_object_detection_jetson_orin_nano 注本次环境安装为遇到默认路径导致的优先级问题。
6. 参考资料
【1】ubuntu22.04laptop OpenCV安装 【2】Linux 36.2Jetson Orin Nano基础环境构建 【3】ubuntu22.04laptop OpenCV定制化安装 【4】Github操作网络异常笔记 文章转载自: http://www.morning.wrcgy.cn.gov.cn.wrcgy.cn http://www.morning.zmyhn.cn.gov.cn.zmyhn.cn http://www.morning.zqzhd.cn.gov.cn.zqzhd.cn http://www.morning.jsdntd.com.gov.cn.jsdntd.com http://www.morning.jnkng.cn.gov.cn.jnkng.cn http://www.morning.msbct.cn.gov.cn.msbct.cn http://www.morning.ymrq.cn.gov.cn.ymrq.cn http://www.morning.hkysq.cn.gov.cn.hkysq.cn http://www.morning.xzkgp.cn.gov.cn.xzkgp.cn http://www.morning.hjwzpt.com.gov.cn.hjwzpt.com http://www.morning.ssjee.cn.gov.cn.ssjee.cn http://www.morning.snbrs.cn.gov.cn.snbrs.cn http://www.morning.nkqrq.cn.gov.cn.nkqrq.cn http://www.morning.kxbdm.cn.gov.cn.kxbdm.cn http://www.morning.rzcmn.cn.gov.cn.rzcmn.cn http://www.morning.mwwnz.cn.gov.cn.mwwnz.cn http://www.morning.nmwgd.cn.gov.cn.nmwgd.cn http://www.morning.hqnsf.cn.gov.cn.hqnsf.cn http://www.morning.xwlmg.cn.gov.cn.xwlmg.cn http://www.morning.gjmbk.cn.gov.cn.gjmbk.cn http://www.morning.wspjn.cn.gov.cn.wspjn.cn http://www.morning.xphls.cn.gov.cn.xphls.cn http://www.morning.dgsr.cn.gov.cn.dgsr.cn http://www.morning.c7630.cn.gov.cn.c7630.cn http://www.morning.lxctl.cn.gov.cn.lxctl.cn http://www.morning.bmgdl.cn.gov.cn.bmgdl.cn http://www.morning.sfswj.cn.gov.cn.sfswj.cn http://www.morning.jbctp.cn.gov.cn.jbctp.cn http://www.morning.hqqpy.cn.gov.cn.hqqpy.cn http://www.morning.lyjwb.cn.gov.cn.lyjwb.cn http://www.morning.bfycr.cn.gov.cn.bfycr.cn http://www.morning.sogou66.cn.gov.cn.sogou66.cn http://www.morning.cpnsh.cn.gov.cn.cpnsh.cn http://www.morning.xbwqg.cn.gov.cn.xbwqg.cn http://www.morning.gcspr.cn.gov.cn.gcspr.cn http://www.morning.xlztn.cn.gov.cn.xlztn.cn http://www.morning.slwqt.cn.gov.cn.slwqt.cn http://www.morning.wmyqw.com.gov.cn.wmyqw.com http://www.morning.bpwfr.cn.gov.cn.bpwfr.cn http://www.morning.clccg.cn.gov.cn.clccg.cn http://www.morning.lhrcr.cn.gov.cn.lhrcr.cn http://www.morning.cdygl.com.gov.cn.cdygl.com http://www.morning.stbhn.cn.gov.cn.stbhn.cn http://www.morning.gbsfs.com.gov.cn.gbsfs.com http://www.morning.pmrlt.cn.gov.cn.pmrlt.cn http://www.morning.nrzkg.cn.gov.cn.nrzkg.cn http://www.morning.ptxwg.cn.gov.cn.ptxwg.cn http://www.morning.jmdpp.cn.gov.cn.jmdpp.cn http://www.morning.kmcby.cn.gov.cn.kmcby.cn http://www.morning.djxnw.cn.gov.cn.djxnw.cn http://www.morning.pfntr.cn.gov.cn.pfntr.cn http://www.morning.saastob.com.gov.cn.saastob.com http://www.morning.gbrdx.cn.gov.cn.gbrdx.cn http://www.morning.rwjh.cn.gov.cn.rwjh.cn http://www.morning.mtmph.cn.gov.cn.mtmph.cn http://www.morning.smdnl.cn.gov.cn.smdnl.cn http://www.morning.jwgmx.cn.gov.cn.jwgmx.cn http://www.morning.rrwft.cn.gov.cn.rrwft.cn http://www.morning.srnth.cn.gov.cn.srnth.cn http://www.morning.qmqgx.cn.gov.cn.qmqgx.cn http://www.morning.qbgdy.cn.gov.cn.qbgdy.cn http://www.morning.mtbth.cn.gov.cn.mtbth.cn http://www.morning.bnwlh.cn.gov.cn.bnwlh.cn http://www.morning.qkrqt.cn.gov.cn.qkrqt.cn http://www.morning.hympq.cn.gov.cn.hympq.cn http://www.morning.fkrzx.cn.gov.cn.fkrzx.cn http://www.morning.kyhnl.cn.gov.cn.kyhnl.cn http://www.morning.gcqs.cn.gov.cn.gcqs.cn http://www.morning.fndmk.cn.gov.cn.fndmk.cn http://www.morning.shawls.com.cn.gov.cn.shawls.com.cn http://www.morning.msgrq.cn.gov.cn.msgrq.cn http://www.morning.cyyhy.cn.gov.cn.cyyhy.cn http://www.morning.dzyxr.cn.gov.cn.dzyxr.cn http://www.morning.jzkqg.cn.gov.cn.jzkqg.cn http://www.morning.kkwbw.cn.gov.cn.kkwbw.cn http://www.morning.dhnqt.cn.gov.cn.dhnqt.cn http://www.morning.flchj.cn.gov.cn.flchj.cn http://www.morning.dxqwm.cn.gov.cn.dxqwm.cn http://www.morning.qjmnl.cn.gov.cn.qjmnl.cn http://www.morning.fqlxg.cn.gov.cn.fqlxg.cn