当前位置:网站首页>昇腾体验官第五期随手记I
昇腾体验官第五期随手记I
2022-07-07 12:35:00 【华为云】
首先,体验目标是通用目标检测,代码在这里。
通过查看代码文档,知道了昇腾 AI 处理器的PCIe的工作模式,有RC和EP模式。如果PCIe工作在主模式,可以扩展外设,则称为RC模式;如果PCIe工作在从模式,则称为EP模式。
简单的来说,主模式(RC模式)就是昇腾处理器全包了,CPU的活它干了,AI的活它也干了。
从模式就是还是有CPU去干CPU自己的活。
二者之间的区别,下面这个图描述的很清楚

另外还有一张CANN结构图,也可以看看。我们常用的ACL,是在很上面了。

接下来看一下数据预处理,本例子的 数据输入类型 可以支持 pic video rtsp。
| 模型 | 输入图片编码格式 | 输入图片分辨率 |
|---|---|---|
| 图片检测推理模型 基于onnx的yolov3模型 | BGR | 416*416 |
| 车辆颜色分类推理模型 基于tensorflow的CNN模型 | RGB | 224*224 |
那么这个模型需要的输入图片,与我们一般给的输入图片会有差距(格式和分辨率率等),这个处理差距的过程就是预处理。
预处理流程:
- 因为是批量处理图片,先打开存放图片的文件夹
OpenPicsDir - 然后读入图片
ReadPic。这里面对于不同的图片类型,采用不同读取策略,比如ReadJpeg和ReadPng文件本身的读入是一样的代码,只是对于读入文件数据的元信息的解析,要使用不同的方法:acldvppJpegGetImageInfo和acldvppPngGetImageInfo - 然后是解压到原始格式并进行缩放等处理
ProcessPic,比如先解压缩为YUV420SP_U8格式的数据。使用的是 AclLite 里的类AclLiteImageProc的JpegD方法。AclLite是对ACL的进一步封装,里面的细节就不跟踪去看了,可以去参考这里。- 然后是缩放(reisze)来改变分辨率,使用的是 AclLite 里的类
AclLiteImageProc的ProportionPasteCenter方法,需要给出目标宽高。有点乱了…
- 然后是缩放(reisze)来改变分辨率,使用的是 AclLite 里的类
边栏推荐
- NLLB-200:Meta开源新模型,可互译200种语言
- [untitled]
- Vscode configuration uses pylint syntax checker
- CSMA/CD 载波监听多点接入/碰撞检测协议
- c#通过frame 和 page 切换页面
- 股票开户首选,炒股交易开户佣金最低网上开户安全吗
- AutoCAD - how to input angle dimensions and CAD diameter symbols greater than 180 degrees?
- Reading and understanding of eventbus source code
- SSRF vulnerability file pseudo protocol [netding Cup 2018] fakebook1
- Parameter keywords final, flags, internal, mapping keywords internal
猜你喜欢

LeetCode每日一题(636. Exclusive Time of Functions)

MRS离线数据分析:通过Flink作业处理OBS数据

手把手教会:XML建模

Docker deploy Oracle

Details of redis core data structure & new features of redis 6

Multi merchant mall system function disassembly lecture 01 - Product Architecture

The longest ascending subsequence model acwing 1014 Mountaineering

Codes de non - retour à zéro inversés, codes Manchester et codes Manchester différentiels couramment utilisés pour le codage des signaux numériques

使用day.js让时间 (显示为几分钟前 几小时前 几天前 几个月前 )

The longest ascending subsequence model acwing 482 Chorus formation
随机推荐
Attribute keywords aliases, calculated, cardinality, ClientName
c#利用 TCP 协议建立连接
requires php ~7.1 -> your PHP version (7.0.18) does not satisfy that requirement
oracle 非自动提交解决
多商户商城系统功能拆解01讲-产品架构
AI talent cultivation new ideas, this live broadcast has what you care about
Leetcode——344. 反转字符串/541. 反转字符串 II/151. 颠倒字符串中的单词/剑指 Offer 58 - II. 左旋转字符串
最长上升子序列模型 AcWing 1014. 登山
C # use TCP protocol to establish connection
Laravel form builder uses
[Reading stereo matching papers] [III] ints
Data flow diagram, data dictionary
Vscode configuration uses pylint syntax checker
Introduction to sakt method
Leetcode - Sword finger offer 05 Replace spaces
ndk初学习(一)
Parameter keywords final, flags, internal, mapping keywords internal
c#通过frame 和 page 切换页面
LeetCode每日一题(636. Exclusive Time of Functions)
Advanced Mathematics - Chapter 8 differential calculus of multivariate functions 1