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

前面在 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下面有很多预先写好的开源模型精度检查配置文件,写自己的模型检测配置的时候可以拿来参考一下 :) 

 

  • 3
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值