在线观看www成人影院-在线观看www日本免费网站-在线观看www视频-在线观看操-欧美18在线-欧美1级

0
  • 聊天消息
  • 系統消息
  • 評論與回復
登錄后你可以
  • 下載海量資料
  • 學習在線課程
  • 觀看技術視頻
  • 寫文章/發帖/加入社區
會員中心
創作中心

完善資料讓更多小伙伴認識你,還能領取20積分哦,立即完善>

3天內不再提示

NPU和CPU對比運行速度有何不同?基于i.MX 8M Plus處理器的MYD-JX8MPQ開發板

米爾電子 ? 2022-05-09 16:46 ? 次閱讀

參考

https://www.toradex.cn/blog/nxp-imx8ji-yueiq-kuang-jia-ce-shi-machine-learning

IMX-MACHINE-LEARNING-UG.pdf


CPU和NPU圖像分類

cd /usr/bin/tensoRFlow-lite-2.4.0/examples

CPU運行

./label_image -m mobilenet_v1_1.0_224_quant.tflite -i grace_hopper.bmp -l labels.txt

INFO: Loaded model mobilenet_v1_1.0_224_quant.tflite

INFO: resolved reporter

INFO: invoked

INFO: averagetime:50.66ms

INFO: 0.780392: 653 military unIForm

INFO: 0.105882: 907 Windsor tie

INFO: 0.0156863: 458 bow tie

INFO: 0.0117647: 466 bulletproof vest

INFO: 0.00784314: 835 suit


GPU/NPU加速運行

./label_image -m mobilenet_v1_1.0_224_quant.tflite -i grace_hopper.bmp -l labels.txt-a 1

INFO: Loaded model mobilenet_v1_1.0_224_quant.tflite

INFO: resolved reporter

INFO: Created TensorFlow Lite delegate for NNAPI.

INFO: Applied NNAPI delegate.

INFO: invoked

INFO: average time:2.775ms

INFO: 0.768627: 653 military uniform

INFO: 0.105882: 907 Windsor tie

INFO: 0.0196078: 458 bow tie

INFO: 0.0117647: 466 bulletproof vest

INFO: 0.00784314: 835 suit

USE_GPU_INFERENCE=0./label_image -m mobilenet_v1_1.0_224_quant.tflite -i grace_hopper.bmp -l labels.txt--external_delegate_path=/usr/lib/libvx_delegate.so

Python運行

python3 label_image.py

INFO: Created TensorFlow Lite delegate for NNAPI.

Applied NNAPI delegate.

WARM-up time:6628.5ms

Inference time: 2.9 ms

0.870588: military uniform

0.031373: Windsor tie

0.011765: mortarboard

0.007843: bow tie

0.007843: bulletproof vest


基準測試CPU單核運行

./benchmark_model --graph=mobilenet_v1_1.0_224_quant.tflite

STARTING!

Log parameter values verbosely: [0]

Graph: [mobilenet_v1_1.0_224_quant.tflite]

Loaded model mobilenet_v1_1.0_224_quant.tflite

The input model file size (MB): 4.27635

Initialized session in 15.076ms.

Running benchmark for at least 1 iterations and at least 0.5 seconds but terminate if exceeding 150 seconds.

count=4 first=166743 curr=161124 min=161054 max=166743avg=162728std=2347

Running benchmark for at least 50 iterations and at least 1 seconds but terminate if exceeding 150 seconds.

count=50 first=161039 curr=161030 min=160877 max=161292 avg=161039std=94

Inference timings in us: Init: 15076, First inference: 166743, Warmup (avg):162728, Inference (avg):161039

Note: as the benchmark tool itself affects memory footprint, the following is only APPROXIMATE to the actual memory footprint of the model at runtime. Take the information at your discretion.

Peak memory footprint (MB): init=2.65234 overall=9.00391

CPU多核運行

./benchmark_model --graph=mobilenet_v1_1.0_224_quant.tflite --num_threads=4

4核--num_threads設置為4性能最好

STARTING!

Log parameter values verbosely: [0]

Num threads: [4]

Graph: [mobilenet_v1_1.0_224_quant.tflite]

#threads used for CPU inference: [4]

Loaded model mobilenet_v1_1.0_224_quant.tflite

The input model file size (MB): 4.27635

Initialized session in 2.536ms.

Running benchmark for at least 1 iterations and at least 0.5 seconds but terminate if exceeding 150 seconds.

count=11 first=48722 curr=44756 min=44597 max=49397 avg=45518.9 std=1679

Running benchmark for at least 50 iterations and at least 1 seconds but terminate if exceeding 150 seconds.

count=50 first=44678 curr=44591 min=44590 max=50798avg=44965.2std=1170

Inference timings in us: Init: 2536, First inference: 48722, Warmup (avg):45518.9, Inference (avg):44965.2

Note: as the benchmark tool itself affects memory footprint, the following is only APPROXIMATE to the actual memory footprint of the model at runtime. Take the information at your discretion.

Peak memory footprint (MB): init=1.38281 overall=8.69922

GPU/NPU加速

./benchmark_model --graph=mobilenet_v1_1.0_224_quant.tflite --num_threads=4 --use_nnapi=true

STARTING!

Log parameter values verbosely: [0]

Num threads: [4]

Graph: [mobilenet_v1_1.0_224_quant.tflite]

#threads used for CPU inference: [4]

Use NNAPI: [1]

NNAPI accelerators available: [vsi-npu]

Loaded model mobilenet_v1_1.0_224_quant.tflite

INFO: Created TensorFlow Lite delegate for NNAPI.

Explicitly applied NNAPI delegate, and the model graph will be completely executed by the delegate.

The input model file size (MB): 4.27635

Initialized session in 3.968ms.

Running benchmark for at least 1 iterations and at least 0.5 seconds but terminate if exceeding 150 seconds.

count=1 curr=6611085

Running benchmark for at least 50 iterations and at least 1 seconds but terminate if exceeding 150 seconds.

count=369 first=2715 curr=2623 min=2572 max=2776avg=2634.2std=20

Inference timings in us: Init: 3968, First inference: 6611085, Warmup (avg): 6.61108e+06, Inference (avg): 2634.2

Note: as the benchmark tool itself affects memory footprint, the following is only APPROXIMATE to the actual memory footprint of the model at runtime. Take the information at your discretion.

Peak memory footprint (MB): init=2.42188 overall=28.4062

結果對比

CPU運行CPU多核多線程NPU加速
圖像分類50.66 ms2.775 ms
基準測試161039uS44965.2uS2634.2uS

OpenCV DNN

cd /usr/share/OpenCV/samples/bin

./example_dnn_classification --input=dog416.png --zoo=models.yml squeezenet

下載模型

cd /usr/share/opencv4/testdata/dnn/

python3 download_models_basic.py

圖像分類

cd /usr/share/OpenCV/samples/bin

./example_dnn_classification --input=dog416.png --zoo=models.yml squeezenet

e2a1f644-c70d-11ec-8521-dac502259ad0.jpg


文件瀏覽器地址欄輸入

ftp://ftp.toradex.cn/Linux/i.MX8/eIQ/OpenCV/Image_Classification.zip

下載文件

解壓得到文件models.yml和squeezenet_v1.1.caffemodel

cd /usr/share/OpenCV/samples/bin

將文件導入到開發板的/usr/share/OpenCV/samples/bin目錄下

$cp/usr/share/opencv4/testdata/dnn/dog416.png /usr/share/OpenCV/samples/bin/
$cp/usr/share/opencv4/testdata/dnn/squeezenet_v1.1.prototxt /usr/share/OpenCV/samples/bin/
$cp/usr/share/OpenCV/samples/data/dnn/classification_classes_ILSVRC2012.txt /usr/share/OpenCV/samples/bin/
$ cd /usr/share/OpenCV/samples/bin/

圖片輸入

./example_dnn_classification --input=dog416.png --zoo=models.yml squeezenet

報錯

root@myd-jx8mp:/usr/share/OpenCV/samples/bin# ./example_dnn_classification --input=dog416.png --zoo=model.yml squeezenet

ERRORS:

Missing parameter: 'mean'

Missing parameter: 'rgb'

加入參數--rgb 和 --mean=1

還是報錯加入參數--mode

root@myd-jx8mp:/usr/share/OpenCV/samples/bin# ./example_dnn_classification --rgb --mean=1 --input=dog416.png --zoo=models.yml squeezenet

[WARN:0]global/usr/src/debug/opencv/4.4.0.imx-r0/git/modules/videoio/src/cap_gstreamer.cpp (898) open OpenCV | GStreamer warning: unable to query duration of stream

[WARN:0]global/usr/src/debug/opencv/4.4.0.imx-r0/git/modules/videoio/src/cap_gstreamer.cpp (935) open OpenCV | GStreamer warning: Cannot query video position: status=1, value=0, duration=-1

root@myd-jx8mp:/usr/share/OpenCV/samples/bin#./example_dnn_classification --rgb --mean=1 --input=dog416.png --zoo=models.yml squeezenet --mode

[WARN:0]global/usr/src/debug/opencv/4.4.0.imx-r0/git/modules/videoio/src/cap_gstreamer.cpp (898) open OpenCV | GStreamer warning: unable to query duration of stream

[WARN:0]global/usr/src/debug/opencv/4.4.0.imx-r0/git/modules/videoio/src/cap_gstreamer.cpp (935) open OpenCV | GStreamer warning: Cannot query video position: status=1, value=0, duration=-1

視頻輸入

./example_dnn_classification --device=2 --zoo=models.yml squeezenet

問題

如果testdata目錄下沒有文件,則查找下

lhj@DESKTOP-BINN7F8:~/myd-jx8mp-yocto$ find . -name "dog416.png"

./build-xwayland/tmp/work/cortexa53-crypto-mx8mp-poky-linux/opencv/4.4.0.imx-r0/extra/testdata/dnn/dog416.png

再將相應的文件復制到開發板

cd./build-xwayland/tmp/work/cortexa53-crypto-mx8mp-poky-linux/opencv/4.4.0.imx-r0/extra/testdata/

tar -cvf /mnt/e/dnn.tar ./dnn/

cd/usr/share/opencv4/testdata目錄不存在則先創建

rz導入dnn.tar

解壓tar -xvf dnn.tar

terminate calLEDafter throwing an instance of 'cv::Exception'

what():OpenCV(4.4.0)/usr/src/debug/opencv/4.4.0.imx-r0/git/samples/dnn/classification.cpperrorAssertion failed) !model.empty() in function 'main'

Aborted

lhj@DESKTOP-BINN7F8:~/myd-jx8mp-yocto/build-xwayland$ find . -name classification.cpp

lhj@DESKTOP-BINN7F8:~/myd-jx8mp-yocto/build-xwayland$ cp ./tmp/work/cortexa53-crypto-mx8mp-poky-linux/opencv/4.4.0.imx-r0/packages-split/opencv-src/usr/src/debug/opencv/4.4.0.imx-r0/git/samples/dnn/classification.cpp /mnt/e

lhj@DESKTOP-BINN7F8:~/myd-jx8mp-yocto/build-xwayland$

YOLO對象檢測

cd /usr/share/OpenCV/samples/bin

./example_dnn_object_detection --width=1024 --height=1024 --scale=0.00392 --input=dog416.png --rgb --zoo=models.yml yolo

e2ba8f74-c70d-11ec-8521-dac502259ad0.jpg


https://pjreddie.com/darknet/yolo/下載cfg和weights文件

cd/usr/share/OpenCV/samples/bin/

導入上面下載的文件

cp/usr/share/OpenCV/samples/data/dnn/object_detection_classes_yolov3.txt/usr/share/OpenCV/samples/bin/

cp/usr/share/opencv4/testdata/dnn/yolov3.cfg/usr/share/OpenCV/samples/bin/./example_dnn_object_detection --width=1024 --height=1024 --scale=0.00392 --input=dog416.png --rgb --zoo=models.yml yolo

OpenCV經典機器學

cd /usr/share/OpenCV/samples/bin

線性SVM

./example_tutorial_introduction_to_svm

e2d1263a-c70d-11ec-8521-dac502259ad0.jpg

非線性SVM

./example_tutorial_non_linear_svms

e2e33c80-c70d-11ec-8521-dac502259ad0.jpg

PCA分析

./example_tutorial_introduction_to_pca ../data/pca_test1.jpg

e2fa2152-c70d-11ec-8521-dac502259ad0.jpg

邏輯回歸

./example_cpp_logistic_regression

e310c22c-c70d-11ec-8521-dac502259ad0.jpg

e323f9c8-c70d-11ec-8521-dac502259ad0.jpg

e3371f58-c70d-11ec-8521-dac502259ad0.jpg

聲明:本文內容及配圖由入駐作者撰寫或者入駐合作網站授權轉載。文章觀點僅代表作者本人,不代表電子發燒友網立場。文章及其配圖僅供工程師學習之用,如有內容侵權或者其他違規問題,請聯系本站處理。 舉報投訴
  • 嵌入式開發
    +關注

    關注

    18

    文章

    1036

    瀏覽量

    47747
收藏 人收藏

    評論

    相關推薦

    2.3T算力,真的強!1分鐘學會NPU開發,基于NXP i.MX 8MP平臺!

    科技飛速發展,人工智能與工業領域的融合日益深入。NXP旗下的i.MX 8M Plus作為一款高端工業處理器NPU算力高達2.3TOPS,正
    的頭像 發表于 01-24 10:21 ?136次閱讀
    2.3T算力,真的強!1分鐘學會<b class='flag-5'>NPU</b><b class='flag-5'>開發</b>,基于NXP <b class='flag-5'>i.MX</b> <b class='flag-5'>8</b>MP平臺!

    恩智浦i.MX 94應用處理器如何變革工業和汽車連接

    恩智浦半導體發布i.MX 94系列應用處理器,為工業和汽車連接設定了新的標準。作為i.MX 9系列應用處理器的最新成員,i.MX 94旨在提
    的頭像 發表于 01-17 10:51 ?300次閱讀

    【迅為電子】i.MX6UL和i.MX6ULL芯片區別與開發板對比

    【迅為電子】i.MX6UL和i.MX6ULL芯片區別與開發板對比
    的頭像 發表于 11-28 14:31 ?628次閱讀
    【迅為電子】<b class='flag-5'>i.MX</b>6UL和<b class='flag-5'>i.MX</b>6ULL芯片區別與<b class='flag-5'>開發板</b><b class='flag-5'>對比</b>

    i.MX Linux開發實戰指南—基于野火i.MX系列開發板

    電子發燒友網站提供《i.MX Linux開發實戰指南—基于野火i.MX系列開發板.pdf》資料免費下載
    發表于 10-10 17:23 ?11次下載

    使用TPS6521825和LP873347 PMIC為NXP i.MX 8M Mini和Nano供電

    電子發燒友網站提供《使用TPS6521825和LP873347 PMIC為NXP i.MX 8M Mini和Nano供電.pdf》資料免費下載
    發表于 09-13 09:42 ?0次下載
    使用TPS6521825和LP873347 PMIC為NXP <b class='flag-5'>i.MX</b> <b class='flag-5'>8M</b> Mini和Nano供電

    使用TPS65219為i.MX 8M Plus供電

    電子發燒友網站提供《使用TPS65219為i.MX 8M Plus供電.pdf》資料免費下載
    發表于 08-31 10:15 ?0次下載
    使用TPS65219為<b class='flag-5'>i.MX</b> <b class='flag-5'>8M</b> <b class='flag-5'>Plus</b>供電

    貿澤開售NXP Semiconductors i.MX 8ULP跨界應用處理器

    8ULP跨界應用處理器i.MX 8ULP通過EdgeLock?安全區域提供超低功耗處理功能和先進的集成安全性,可簡化復雜的安全部署,在I
    發表于 08-21 15:22 ?394次閱讀

    i.MX 8M Plus中的ISP圖像信號處理模塊特性概述

    應用處理器,是一款專注于機器學習和視覺、高級多媒體以及具有高可靠性的工業自動化解決方案,旨在滿足智慧家庭、樓宇、城市和工業4.0等應用的需求。 為了滿足日益增長的圖像和視覺處理的需求,i.MX
    的頭像 發表于 08-02 11:39 ?1404次閱讀

    康佳特推出基于恩智浦i.MX 95系列處理器的新款SMARC模塊

    (COM),擴展了基于低功耗恩智浦i.MX Arm處理器的模塊產品組合。康佳特也因此加強了與恩智浦的緊密合作關系。客戶將受益于標準模塊的可擴展性和可靠的升級路徑,以滿足現有和新能效邊緣 AI 應用的高安全性要求。 ?在這些應用中,與上一代
    發表于 07-16 14:55 ?1099次閱讀
    康佳特推出基于恩智浦<b class='flag-5'>i.MX</b> 95系列<b class='flag-5'>處理器</b>的新款SMARC模塊

    TSN時鐘同步 | PTP對時案例演示——基于NXP i.MX 8M Plus

    TLIMX8MP-EVM評估的TSN時鐘同步、PTP對時案例,創龍科技TLIMX8MP-EVM是基于NXP i.MX 8M
    發表于 07-10 10:28

    點擊參與米爾NXP i.MX 93開發板有獎試用

    米爾與NXP合作發布的新品基于NXPi.MX93應用處理器MYD-LMX9X開發板免費試用活動來啦~~米爾提供了3塊價值678元的MYD-
    的頭像 發表于 06-13 08:02 ?631次閱讀
    點擊參與米爾NXP <b class='flag-5'>i.MX</b> 93<b class='flag-5'>開發板</b>有獎試用

    免費!NXP i.MX 93開發板有獎試用

    米爾與NXP合作發布的新品基于NXPi.MX93應用處理器MYD-LMX9X開發板免費試用活動來啦~~米爾提供了2塊價值678
    的頭像 發表于 05-23 08:01 ?812次閱讀
    免費!NXP <b class='flag-5'>i.MX</b> 93<b class='flag-5'>開發板</b>有獎試用

    NXP系列-NXP i.MX 93核心開發板-入門級嵌入式核心-產品資料

    MYC-LMX9X核心開發板NXP i.MX 93重新定義入門級嵌入式CPU模組2*Cortex-A55@1.7GHz+Cortex-M
    發表于 04-23 11:07 ?5次下載

    重新定義入門級嵌入式處理器模組-米爾NXP i.MX 93核心

    ,進一步提升了性能、資源利用和價格的平衡。其中i.MX 93處理器配備雙核Cortex-A55@1.7 GHz+Cortex-M33@250MHz,兼顧多任務和實時性需求,集成0.5 TOPS
    的頭像 發表于 04-19 17:50 ?687次閱讀
    重新定義入門級嵌入式<b class='flag-5'>處理器</b>模組-米爾NXP <b class='flag-5'>i.MX</b> 93核心<b class='flag-5'>板</b>

    適用于 NXP i.MX 8M Mini 的 TPS6521825 電源管理IC TPS6521825數據表

    電子發燒友網站提供《適用于 NXP i.MX 8M Mini 的 TPS6521825 電源管理IC TPS6521825數據表.pdf》資料免費下載
    發表于 03-01 09:09 ?0次下載
    適用于 NXP <b class='flag-5'>i.MX</b> <b class='flag-5'>8M</b> Mini 的 TPS6521825 電源管理IC TPS6521825數據表
    主站蜘蛛池模板: 久久青青成人亚洲精品 | 日韩手机看片 | 午夜dy888理论在线播放 | 亚洲国产婷婷综合在线精品 | 日本不卡一区 | ccav在线永久免费看 | 免费人成黄页在线观看日本 | 天堂资源wwww在线看 | 国产黄大片在线观看 | 夜夜天天操 | 中文字幕第11页 | 女人被狂躁视频网站免费 | 亚洲一级免费视频 | 韩国三级hd中文字幕 | 色多多www网站| 免费能直接在线观看黄的视频 | 午夜h视频| 日韩一级特黄毛片在线看 | 国产日本特黄特色大片免费视频 | qvod高清在线成人观看 | 亚洲成年人影院 | 婷婷丁香激情五月 | 香蕉视频国产在线观看 | 加勒比一本大道香蕉在线视频 | 日本最顶级丰满的aⅴ艳星 日本最好的免费影院 | 狠狠色噜噜狠狠狠狠狠色综合久久 | 就爱干草视频 | 图片区网友自拍另类图区 | 人人狠狠综合88综合久久 | 日本边添边爱边摸边做边爱 | 成人久久久 | 国模大尺度在线 | 91网址在线播放 | 精品一区二区三区免费毛片爱 | 婷婷五月情 | 色偷偷91久久综合噜噜噜 | 91精品国产91久久久久青草 | 一区二区三区视频在线观看 | 失禁h啪肉尿出来高h受 | 天堂资源最新版在线www | 中国特黄一级片 |