AX650N DEMO 板 NPU 示例说明

AX650N DEMO 板 NPU 示例说明 圈圈虫 2023-12-09 09:52:47 1103

背景

通过该文章能初步掌握 AX650N DEMO 板上已 NPU 相关示例及工具,方便开发者快速评估 AX650N NPU 特性。

SDK 版本查询

root@ax650:~# cat /proc/ax_proc/version
Ax_Version V1.54.0

NPU 工具

ax_run_model:用于验证 NPU 工具链编译生成的模型 compiled.axmodel 能否在芯片上正常运行、模型Meta信息、推理耗时等数据。

root@ax650:~# ax_run_model
usage: ax_run_model --model=string [options] ...
options:
  -m, --model                path to a model file (string)
  -r, --repeat               repeat times running a model (int [=1])
  -w, --warmup               repeat times before running a model to warming up (int [=1])
  -v, --vnpu                 type of Visual-NPU inited {0=Disable, 1=STD, 2=BigLittle} (int [=0])
  -a, --affinity             npu affinity when running a model (int [=1])
  -p, --parallel             parallel run model using all affinity npu cores (int [=0])
  -b, --batch                the batch will running (int [=0])
  -i, --input-folder         the folder of each inputs (folders) located (string [=])
  -o, --output-folder        the folder of each outputs (folders) will saved in (string [=])
  -l, --list                 the list of inputs which will test (string [=])
      --verify               verify outputs after running model
      --save-benchmark       save benchmark result(min, max, avg) as a json file
      --inputs-is-folder     each time model running needs inputs stored in each standalone input folders
      --outputs-is-folder    each time model running saved outputs stored in each standalone output folders
      --use-tensor-name      using tensor names instead of using tensor indexes when loading & saving io files
  -?, --help                 print this message

执行示例

root@ax650:~# ax_run_model -m /opt/data/npu/models/yolov5s.axmodel -w 3 -r 10
   Run AxModel:
         model: /opt/data/npu/models/yolov5s.axmodel
          type: 1 Core
          vnpu: Disable
      affinity: 0b001
        warmup: 3
        repeat: 10
         batch: { auto: 1 }
      parallel: false
   pulsar2 ver: 1.2-patch2 7e6b2b5f
    engine ver: 2.5.1a
      tool ver: 2.2.1
      cmm size: 12730188 Bytes
  ------------------------------------------------------
  min =   7.652 ms   max =   7.660 ms   avg =   7.657 ms
  ------------------------------------------------------

NPU 示例

SDK 中预置了物体分类示例 sample_npu_classification ,物体检测示例 sample_npu_yolov5s
sample_npu_classification

root@ax650:~# sample_npu_classification -m /opt/data/npu/models/mobilenetv2.axmodel -i /opt/data/npu/images/cat.jpg
--------------------------------------
model file : /opt/data/npu/models/mobilenetv2.axmodel
image file : /opt/data/npu/images/cat.jpg
img_h, img_w : 224 224
--------------------------------------
topk cost time:0.07 ms
9.5094, 285
9.3773, 282
9.2452, 281
8.5849, 283
7.6603, 287
--------------------------------------
Repeat 1 times, avg time 0.73 ms, max_time 0.73 ms, min_time 0.73 ms
--------------------------------------

sample_npu_yolov5s

root@ax650:~# sample_npu_yolov5s -m /opt/data/npu/models/yolov5s.axmodel -i /opt/data/npu/images/dog.jpg
--------------------------------------
model file : /opt/data/npu/models/yolov5s.axmodel
image file : /opt/data/npu/images/dog.jpg
img_h, img_w : 640 640
--------------------------------------
post process cost time:2.31 ms
--------------------------------------
Repeat 1 times, avg time 7.66 ms, max_time 7.66 ms, min_time 7.66 ms
--------------------------------------
detection num: 3
16:  91%, [ 138,  218,  310,  541], dog
 2:  69%, [ 470,   76,  690,  173], car
 1:  56%, [ 158,  120,  569,  420], bicycle
--------------------------------------
声明:本文内容由易百纳平台入驻作者撰写,文章观点仅代表作者本人,不代表易百纳立场。如有内容侵权或者其他问题,请联系本站进行删除。
红包 4 1 评论 打赏
评论
0个
内容存在敏感词
手气红包
    易百纳技术社区暂无数据
相关专栏
置顶时间设置
结束时间
删除原因
  • 广告/SPAM
  • 恶意灌水
  • 违规内容
  • 文不对题
  • 重复发帖
打赏作者
易百纳技术社区
圈圈虫
您的支持将鼓励我继续创作!
打赏金额:
¥1易百纳技术社区
¥5易百纳技术社区
¥10易百纳技术社区
¥50易百纳技术社区
¥100易百纳技术社区
支付方式:
微信支付
支付宝支付
易百纳技术社区微信支付
易百纳技术社区
打赏成功!

感谢您的打赏,如若您也想被打赏,可前往 发表专栏 哦~

举报反馈

举报类型

  • 内容涉黄/赌/毒
  • 内容侵权/抄袭
  • 政治相关
  • 涉嫌广告
  • 侮辱谩骂
  • 其他

详细说明

审核成功

发布时间设置
发布时间:
是否关联周任务-专栏模块

审核失败

失败原因
备注
拼手气红包 红包规则
祝福语
恭喜发财,大吉大利!
红包金额
红包最小金额不能低于5元
红包数量
红包数量范围10~50个
余额支付
当前余额:
可前往问答、专栏板块获取收益 去获取
取 消 确 定

小包子的红包

恭喜发财,大吉大利

已领取20/40,共1.6元 红包规则

    易百纳技术社区