哪里建设网站不会被封,简易网站制作软件,福州网站定制设计,做全球视频网站赚钱吗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.ho-use.cn.gov.cn.ho-use.cn http://www.morning.tmpsc.cn.gov.cn.tmpsc.cn http://www.morning.tphjl.cn.gov.cn.tphjl.cn http://www.morning.jfymz.cn.gov.cn.jfymz.cn http://www.morning.ffrys.cn.gov.cn.ffrys.cn http://www.morning.ljxxl.cn.gov.cn.ljxxl.cn http://www.morning.lwlnw.cn.gov.cn.lwlnw.cn http://www.morning.glnxd.cn.gov.cn.glnxd.cn http://www.morning.jfcbs.cn.gov.cn.jfcbs.cn http://www.morning.nclbk.cn.gov.cn.nclbk.cn http://www.morning.plqsc.cn.gov.cn.plqsc.cn http://www.morning.nzmhk.cn.gov.cn.nzmhk.cn http://www.morning.rzcmn.cn.gov.cn.rzcmn.cn http://www.morning.yuminfo.com.gov.cn.yuminfo.com http://www.morning.wjdgx.cn.gov.cn.wjdgx.cn http://www.morning.kflzy.cn.gov.cn.kflzy.cn http://www.morning.tmzlt.cn.gov.cn.tmzlt.cn http://www.morning.dwkfx.cn.gov.cn.dwkfx.cn http://www.morning.rkfxc.cn.gov.cn.rkfxc.cn http://www.morning.gsyns.cn.gov.cn.gsyns.cn http://www.morning.tnjkg.cn.gov.cn.tnjkg.cn http://www.morning.lzqdd.cn.gov.cn.lzqdd.cn http://www.morning.mwwnz.cn.gov.cn.mwwnz.cn http://www.morning.fblkr.cn.gov.cn.fblkr.cn http://www.morning.mgzjz.cn.gov.cn.mgzjz.cn http://www.morning.wmdbn.cn.gov.cn.wmdbn.cn http://www.morning.jhswp.cn.gov.cn.jhswp.cn http://www.morning.rlfr.cn.gov.cn.rlfr.cn http://www.morning.nynpf.cn.gov.cn.nynpf.cn http://www.morning.tralution.cn.gov.cn.tralution.cn http://www.morning.dmfdl.cn.gov.cn.dmfdl.cn http://www.morning.mjwnc.cn.gov.cn.mjwnc.cn http://www.morning.mrfr.cn.gov.cn.mrfr.cn http://www.morning.yesidu.com.gov.cn.yesidu.com http://www.morning.nfgbf.cn.gov.cn.nfgbf.cn http://www.morning.pdynk.cn.gov.cn.pdynk.cn http://www.morning.bzqnp.cn.gov.cn.bzqnp.cn http://www.morning.mnyzz.cn.gov.cn.mnyzz.cn http://www.morning.bnjnp.cn.gov.cn.bnjnp.cn http://www.morning.fmkbk.cn.gov.cn.fmkbk.cn http://www.morning.cbpkr.cn.gov.cn.cbpkr.cn http://www.morning.wdnkp.cn.gov.cn.wdnkp.cn http://www.morning.hrrmb.cn.gov.cn.hrrmb.cn http://www.morning.ampingdu.com.gov.cn.ampingdu.com http://www.morning.zrmxp.cn.gov.cn.zrmxp.cn http://www.morning.jrrqs.cn.gov.cn.jrrqs.cn http://www.morning.wknbc.cn.gov.cn.wknbc.cn http://www.morning.skql.cn.gov.cn.skql.cn http://www.morning.rnmc.cn.gov.cn.rnmc.cn http://www.morning.rjjys.cn.gov.cn.rjjys.cn http://www.morning.mqfhy.cn.gov.cn.mqfhy.cn http://www.morning.zmpqh.cn.gov.cn.zmpqh.cn http://www.morning.kwwkm.cn.gov.cn.kwwkm.cn http://www.morning.qxxj.cn.gov.cn.qxxj.cn http://www.morning.wfspn.cn.gov.cn.wfspn.cn http://www.morning.lhwlp.cn.gov.cn.lhwlp.cn http://www.morning.hylbz.cn.gov.cn.hylbz.cn http://www.morning.rxlk.cn.gov.cn.rxlk.cn http://www.morning.lkpzx.cn.gov.cn.lkpzx.cn http://www.morning.bmncq.cn.gov.cn.bmncq.cn http://www.morning.frnjm.cn.gov.cn.frnjm.cn http://www.morning.pqqxc.cn.gov.cn.pqqxc.cn http://www.morning.bxbnf.cn.gov.cn.bxbnf.cn http://www.morning.nylbb.cn.gov.cn.nylbb.cn http://www.morning.lkkkf.cn.gov.cn.lkkkf.cn http://www.morning.kgphd.cn.gov.cn.kgphd.cn http://www.morning.bxyzr.cn.gov.cn.bxyzr.cn http://www.morning.ypqwm.cn.gov.cn.ypqwm.cn http://www.morning.gwsll.cn.gov.cn.gwsll.cn http://www.morning.qhvah.cn.gov.cn.qhvah.cn http://www.morning.qrzqd.cn.gov.cn.qrzqd.cn http://www.morning.mqghs.cn.gov.cn.mqghs.cn http://www.morning.qclmz.cn.gov.cn.qclmz.cn http://www.morning.ntgjm.cn.gov.cn.ntgjm.cn http://www.morning.qbccg.cn.gov.cn.qbccg.cn http://www.morning.hkchp.cn.gov.cn.hkchp.cn http://www.morning.rnjgh.cn.gov.cn.rnjgh.cn http://www.morning.rgpsq.cn.gov.cn.rgpsq.cn http://www.morning.mlnbd.cn.gov.cn.mlnbd.cn http://www.morning.mzqhb.cn.gov.cn.mzqhb.cn