用OpenVINO 2020r2的accuracy_check精度检测工具检测ssd模型精度的示例

英特尔开发人员专区
企业官方账号
2020-09-28 06:15:10
加精
前面在 OpenVINO 2020的INT8转换工具POT的初体验 里面分享了一下POT和accuracy_check工具的用法,但是用的是分类classification模型,相对比较简单,今天简单分享一下写检测ssd模型精度的config文件的思路

首先要骂娘的是OpenVINO的文档写的极其差,几乎是找不到任何你想要的东西。也许这就是开源项目的精髓,一切全靠看代码... 所以先想一下,在我用DL workbench的时候,可以转换mobilenet-ssd模型和测试模型精度。所以这部分肯定是带在openvino安装目录里了,翻翻openvino accuracy_checker的目录,看到了一个可疑的文件



看一下文件内容

models:
- name: ssd-mobilenet-cf
launchers:
- framework: caffe
model: public/mobilenet-ssd/mobilenet-ssd.prototxt
weights: public/mobilenet-ssd/mobilenet-ssd.caffemodel
adapter: ssd
datasets:
- name: VOC2012
preprocessing:
- type: resize
size: 300
- type: normalization
mean: 127.5
std: 127.5
postprocessing:
- type: resize_prediction_boxes

- name: ssd-mobilenet
launchers:
- framework: dlsdk
tags:
- FP32
model: public/mobilenet-ssd/FP32/mobilenet-ssd.xml
weights: public/mobilenet-ssd/FP32/mobilenet-ssd.bin
adapter: ssd

- framework: dlsdk
tags:
- FP16
model: public/mobilenet-ssd/FP16/mobilenet-ssd.xml
weights: public/mobilenet-ssd/FP16/mobilenet-ssd.bin
adapter: ssd

datasets:
- name: VOC2012
preprocessing:
- type: resize
size: 300
postprocessing:
- type: resize_prediction_boxes

global_definitions: ../dataset_definitions.yml
有launchers部分,里面有模型的路径和文件名;有datasets部分,写着数据集是VOC2012, 底下描述的部分不太全。但是下面有一句奇怪的东东: global_definitions: ../dataset_definitions.yml

看上去有点像C语言的include, 看看这个文件



文件内容里找VOC2012的关键字

- name: VOC2012
annotation_conversion:
converter: voc_detection
annotations_dir: VOCdevkit/VOC2012/Annotations
images_dir: VOCdevkit/VOC2012/JPEGImages
imageset_file: VOCdevkit/VOC2012/ImageSets/Main/val.txt
data_source: VOCdevkit/VOC2012/JPEGImages
annotation: voc12.pickle
dataset_meta: voc12.json
postprocessing:
- type: resize_prediction_boxes
metrics:
- type: map
integral: 11point
ignore_difficult: True
presenter: print_scalar


这个大概就全了,新建一个mobilenet-ssd_ac.yml文件,用Ctrl CV大法,把我想要的东西都拷贝粘贴在一起

models:
- name: ssd-mobilenet
launchers:
- framework: dlsdk
tags:
- FP32
model: mobilenet-ssd.xml
weights: mobilenet-ssd.bin
adapter: ssd

datasets:
- name: VOC2012
preprocessing:
- type: resize
size: 300
postprocessing:
- type: resize_prediction_boxes
annotation_conversion:
converter: voc_detection
annotations_dir: VOCdevkit/VOC2012/Annotations
images_dir: VOCdevkit/VOC2012/JPEGImages
imageset_file: VOCdevkit/VOC2012/ImageSets/Main/val.txt
data_source: VOCdevkit/VOC2012/JPEGImages
annotation: voc12.pickle
dataset_meta: voc12.json
postprocessing:
- type: resize_prediction_boxes
metrics:
- type: map
integral: 11point
ignore_difficult: True
presenter: print_scalar



然后转换mobilenet-ssd的IR模型

C:\Program Files (x86)\IntelSWTools\openvino\deployment_tools\model_optimizer>python mo_caffe.py --input_model c:\work\cvt_model\mobilenet-ssd.caffemodel -o c:\work\mobilenet-ssd_ac --scale 127.5 --mean_values [127.5,127.5,127.5]
再从网上下一个VoC模型 VOCtrainval_11-May-2012.tar



把这几个文件放到一起


运行一下看看



mAP精度是79.84% 基本可以证明这个config文件是写对了 :)


总结一下:

在C:\Program Files (x86)\IntelSWTools\openvino_2020.3.194\deployment_tools\open_model_zoo\tools\accuracy_checker\configs下面有很多预先写好的开源模型精度检查配置文件,写自己的模型检测配置的时候可以拿来参考一下 :)
...全文
25433 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

566

社区成员

发帖
与我相关
我的任务
社区描述
英特尔® 边缘计算,聚焦于边缘计算、AI、IoT等领域,为开发者提供丰富的开发资源、创新技术、解决方案与行业活动。
社区管理员
  • 英特尔技术社区
  • shere_lin
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧