openvino模型学习-从模型转化流水线制作
1、模型转换
(/home/kewei/openvino/openvion_venv) kewei@DESKTOP-3JRQ3HI:~/openvino/OV-200-lab-files/02/exercise-1$ cd ~/intel/openvino_2021/deployment_tools/model_optimizer/
(/home/kewei/openvino/openvion_venv) kewei@DESKTOP-3JRQ3HI:~/intel/openvino_2021/deployment_tools/model_optimizer$ mo_caffe.py --input_model $lab_dir/public/resnet-50/resnet-50.caffemodel --output_dir $lab_dir
Model Optimizer arguments:
Common parameters:- Path to the Input Model: /home/kewei/openvino/OV-200-lab-files/02/exercise-1//public/resnet-50/resnet-50.caffemodel- Path for generated IR: /home/kewei/openvino/OV-200-lab-files/02/exercise-1/- IR output name: resnet-50- Log level: ERROR- Batch: Not specified, inherited from the model- Input layers: Not specified, inherited from the model- Output layers: Not specified, inherited from the model- Input shapes: Not specified, inherited from the model- Mean values: Not specified- Scale values: Not specified- Scale factor: Not specified- Precision of IR: FP32- Enable fusing: True- Enable grouped convolutions fusing: True- Move mean values to preprocess section: None- Reverse input channels: False
Caffe specific parameters:- Path to Python Caffe* parser generated from caffe.proto: /home/kewei/intel/openvino_2021/deployment_tools/model_optimizer/mo/utils/../front/caffe/proto- Enable resnet optimization: True- Path to the Input prototxt: /home/kewei/openvino/OV-200-lab-files/02/exercise-1//public/resnet-50/resnet-50.prototxt- Path to CustomLayersMapping.xml: /home/kewei/intel/openvino_2021/deployment_tools/model_optimizer/mo/utils/../../extensions/front/caffe/CustomLayersMapping.xml- Path to a mean file: Not specified- Offsets for a mean file: Not specified- Inference Engine found in: /home/kewei/intel/openvino_2021/python/python3.7/openvino
Inference Engine version: 2021.4.2-3974-e2a469a3450-releases/2021/4
Model Optimizer version: 2021.4.2-3974-e2a469a3450-releases/2021/4
/home/kewei/intel/openvino_2021/deployment_tools/model_optimizer/mo/utils/versions_checker.py:170: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.req_ver = LooseVersion(required_v)
/home/kewei/openvino/openvion_venv/lib/python3.7/site-packages/setuptools/_distutils/version.py:351: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.other = LooseVersion(other)
[ SUCCESS ] Generated IR version 10 model.
[ SUCCESS ] XML file: /home/kewei/openvino/OV-200-lab-files/02/exercise-1/resnet-50.xml
[ SUCCESS ] BIN file: /home/kewei/openvino/OV-200-lab-files/02/exercise-1/resnet-50.bin
[ SUCCESS ] Total execution time: 17.21 seconds.
[ SUCCESS ] Memory consumed: 638 MB.
It's been a while, check for a new version of Intel(R) Distribution of OpenVINO(TM) toolkit here https://software.intel.com/content/www/us/en/develop/tools/openvino-toolkit/download.html?cid=other&source=prod&campid=ww_2022_bu_IOTG_OpenVINO-2022-1&content=upg_all&medium=organic or on the GitHub*
可以看到生成了如上文件。
进行推理:
python3 classification_sample_async.py --i images/car.png -m resnet-50.xml --labels squeezenet1.1.labels -d CPU
2、wsl使用netron查看神经网络:
pip install netron
netron ~/openvino/OV-200-lab-files/02/exercise-1/public/squeezenet1.1/squeezenet1.1.prototxt
打开http://localhost:8080
可以看到网络的详细构成了。
3、目标检测是计算机视觉核心任务之一,也是最常见与应用最广泛的视觉场景。OpenVINO已经提供了以下通用场景下的目标检测包括人脸检测、行人检测、物体检测、车辆检测、车牌检测等,一个图像目标检测显示示意图如下:
相比图像分类,目标检测多了每个对象位置信息,所以简单的认为目标检测=图像分类+Box位置信息。第一个深度学习相关的目标检测网络正是基于这样思想的RCNN模型,但是它的缺点是无法实时,所以2015年底有人提出了一个实时目标检测网络Single Shot MultiBox Detector缩写为SSD。
4、剪枝实验,得到的小模型仍然保持较好的精度
5、打印可用设备实验
第 12代智能英特尔® 酷睿™ 台式机处理器能够通过增强型 Gaussian & Neural Accelerator 3.0 (GNA)
6、ffmpeg用法
ffmpeg -i output_1.avi output_1.mp4
转换为mp4后,大小由100多兆变为了40多兆
7、推理语句,实际就一句
this_time1 = time.time()exec_net.start_async(request_id=next_request_id, inputs=feed_dict)this_time2 = time.time()print(this_time2-this_time1)
8、性能测试
Task 1:
测试ssd-mobilenet模型在2推理请求,2 streams下的性能
python3 benchmark_app.py -m models/ssd-mobilenet.xml -i images/ -t 20 -nstreams 2 -nireq 2
[ INFO ] First inference took 27.14 ms
[Step 11/11] Dumping statistics report
Count: 1272 iterations
Duration: 20055.84 ms
Latency: 29.64 ms
Throughput: 63.42 FPS
Task 2:
测试resnet-50模型在batch为4,异步推理的性能。并且将perf_counts和progress 选项设置为可见。
python3 benchmark_app.py -m models/resnet-50.xml -i images/ -t 20 -api async -progress True -pc True -b 4
Total time: 280361 microseconds
Total CPU time: 280361 microseconds
Count: 284 iterations
Duration: 20229.78 ms
Latency: 282.11 ms
Throughput: 56.15 FPS
9、AttributeError: ‘openvino.inference_engine.ie_api.IENetwork’ object has no attribute ‘layers’
对于layer新版本openvino已不支持,可行的做法是先注释掉
然后就跑起来了
10、报错: invalid optionnd_classification-file.sh: line 7: set: -
在运行bash face_detection_and_classification-file.sh出错
Linux下运行sh文件出现 invalid option set: -问题的原因主要是因为你可能在Windows环境下打开过.sh文件,那么无形中就会改变文件的一些属性,比如换行符的问题。这种情况极大的概率出现在在Windows环境下,打开,修改并保存了.sh文件。
解决方案是:在Linux环境下,在你的目标文件夹下,键入命令行
在你的目标文件夹下,键入命令行
vi ./*.sh
这里的*是你的sh文件名,记得修改。
进入之后,在sh文件首行加入一句话 set ff=UNIX
保存并退出
再在你的目标文件加下,键入命令行
dos2unix -q *.sh
或者
sed -i 's/\r//' *.sh
同样这里的*是具体文件名,需要修改。
这样就可以正常运行了。
bash *.sh
openvino模型学习-从模型转化流水线制作相关推荐
- 模型学习全面概述:利用机器学习查找软件漏洞
选自ACM 作者:Frits Vaandrager 机器之心编译 Communications of the ACM 近日发表一篇题为<Model Learning>的文章,详细介绍了模型 ...
- 在英特尔硬件上部署深度学习模型的无代码方法 关于OpenVINO深度学习工作台的三部分系列 第二部
作者 Taylor, Mary, 翻译 李翊玮 关于 OpenVINO™ 深度学习工作台的三部分系列文章 关于该系列 了解如何转换.微调和打包 推理就绪的 TensorFlow 模型,该模型针对英特尔 ...
- 在英特尔硬件上部署深度学习模型的无代码方法 OpenVINO 深度学习工作台的三部分系列 - CPU AI 第二部
作者 Taylor, Mary, 翻译 李翊玮 关于该系列 了解如何转换.微调和打包 推理就绪的 TensorFlow 模型,该模型针对英特尔®硬件进行了优化,仅使用 Web 浏览器.每一步都在云中使 ...
- 在英特尔硬件上部署深度学习模型的无代码方法 OpenVINO 深度学习工作台的三部分系列文章 - CPU AI 第一部
作者 Taylor, Mary, 翻译 李翊玮 关于该系列 了解如何转换.微调和打包推理就绪的 TensorFlow 模型,该模型针对英特尔®硬件进行了优化,仅使用 Web 浏览器.每一步都在云中使用 ...
- 太空夜景_太空深度学习的模型压缩技术概述
太空夜景 By Hannah Peterson and George Williams (gwilliams@gsitechnology.com) 汉娜·彼得森 ( Hannah Peterson)和 ...
- 深度学习实战——模型推理优化(模型压缩与加速)
忆如完整项目/代码详见github:https://github.com/yiru1225(转载标明出处 勿白嫖 star for projects thanks) 目录 系列文章目录 一.实验思路综 ...
- NVIDIA GPUs上深度学习推荐模型的优化
NVIDIA GPUs上深度学习推荐模型的优化 Optimizing the Deep Learning Recommendation Model on NVIDIA GPUs 推荐系统帮助人在成倍增 ...
- 谷歌、阿里们的杀手锏:三大领域,十大深度学习CTR模型演化图谱
作者 | 王喆 来源 | 转载自知乎专栏王喆的机器学习笔记 今天我们一起回顾一下近3年来的所有主流深度学习CTR模型,也是我工作之余的知识总结,希望能帮大家梳理推荐系统.计算广告领域在深度学习方面的前 ...
- 谷歌、阿里们的杀手锏:3大领域,10大深度学习CTR模型演化图谱(附论文)
来源:知乎 作者:王喆 本文约4000字,建议阅读8分钟. 本文为你介绍近3年来的所有主流深度学习CTR模型. 今天我们一起回顾一下近3年来的所有主流深度学习CTR模型,也是我工作之余的知识总结,希望 ...
最新文章
- 【剑指offer 面试题47】不用加减乘除做加法
- CSS3 稳固而知新: 居中
- Intel Code Challenge Final Round (Div. 1 + Div. 2, Combined) E. Goods transportation 动态规划
- UA MATH567 高维统计III 随机矩阵8 社区发现 Spectral Clustering的理论分析
- Linux基础优化方法(二)———系统安全相关优化:防火墙和selinux
- 梯度迭代树回归(GBDT)算法介绍及Spark MLlib调用实例(Scala/Java/python)
- 阿里Java编程规约(控制语句)
- 【操作系统】—处理机调度的概念以及层次
- oracle数据库文件默认的安装位置,Oracle 10g数据库默认安装应该注意的问题
- 如何将录屏转换为高清GIF
- 林子雨 慕课答案2021新版
- 深度时空网络、记忆网络与特征表达学习在 CTR 预估中的应用
- Python数据分析入门教程(五):数据运算
- 最近大火的chatGPT是什么?它是怎样聊天的?
- 算法分析与设计第五章作业
- Mac 安装minikube Error: No available formula with the name “minikube“
- RPC VS REST
- GeoHash代码实现--java
- 为什么前端工作越来越难找了?
- java 前后台json的传递
热门文章
- 新加坡国家博物馆——给你精神与身体的双重满足
- 计算电磁基本参数设置
- 基于鲸鱼优化算法的Simulink仿真模型参数优化
- 马云卸任:中国企业如何走出“创始人驱动”?
- PyQt_QMessageBox
- 二维码在染厂ERP中的一个重要应用!
- TypeError: Direct assignment to the reverse side of a related set is prohibited. Use parent_id.set()
- android 监听短信并获取验证码
- 【网络进阶】网络问题排查实例集锦(实战经验分享)
- urv中保研碰撞测试结果_深度解读中保研碰撞测试结果,多款热销车竟获“差评”...