模型贡献至Open model zoo
YOLO系列 MobileNet-YOLOV4-SYG
-
查询model和dataset是否开源,license
-
open model zoo参考yolov3和v4,v4可能需要最新openvino支持
基础 查看开源和支持框架
MIT keras-yolov3
yolov4
支持框架TensorFlow openvino
测试环境
测试要求
Open model zoo repository
How to contribute models to Open model zoo
虚拟机说明
Ubuntu18.04
Python3.6.9-自带
OpenCV-Python4.5.1.48
tensorflow1.15.4
numpy1.16.3
scipy1.5.4
openvino2021.2
keras2.3.1
快速安装
在Ubuntu18.04上直接安装openvino,相关依赖项package会自动检测并安装,因为版本不匹配导致安装报错可直接重装相关依赖项
测试位置
/opt/intel/openvino/deployment_tools/open_model_zoo/tools
配置文件位置和结构
/opt/intel/openvino_2021.2.185/deployment_tools/open_model_zoo/models/public
测试项目
accuracy_checker——accuracy checker测试
downloader——downloader和model convert测试
1.model.yml
文件作用
模型描述,提供下载方式,pb转化IR的教程
用downloader.py和converter.py测试时需要
1.1其他参数
Copyright
复制Legal Information内容即可
description
参考example DenseNet-121
main purpose features references to a paper or/and a source
task_type: detection
参考
framework: tf
quantizable: yes
licenseMobileNetv2+YOLOv4
1.2files参数
repo设置和download link
github release 功能的使用及问题解决
size字节,右键属性大小即可
sha256 生成hash:sha256,生成后即唯一
sha256sum mobilenet-yolo-syg.h5
source来自GitHub链接,要求the model can be downloaded either via a direct HTTP(S) link or from Google Drive*
1.3postprocessing参数
作用
对于下载的文件自动进行后处理,只有解压unpack_archive和替换regex_replace
- $type: unpack_archive
file: VOCdevkit0829.zip
format: zip
目录下直接显示已解压的VOCdevkit,而不是VOCdevkit0829.zip
1.4model_optimizer_args参数
intro
作用 Inference Engine (IE) supports models in the Intermediate Representation (IR) format。
NOTE
(1)Image preprocessing parameters (mean and scale) must be built into a converted model to simplify model usage.
(2)输入图像颜色通道BGR
参数
参数和使用Model Optimizer转换TF模型一样
input_model pb文件
dl_dir用于替换下载模型的子目录
conv_dir用于替换转换后模型的子目录
input_shape
input image feeds the input node of model
[N,H,W,C] for TF models,输入个数N
input
参考yolo-v3-yf和yolo-v4-tf有指定为input=input_1
scale_values
参考yolo-v3-yf,用于input image per channel,channel的确切含义和顺序取决于原始model的训练方式
参考值data[255,255,255],info[255,255,255]
transformations_config
json文件
data_type=FP16
{FP16,FP32,half,float}
If original model is in FP32 and --data_type=FP16 is
specified, all model weights and biases are quantized to FP16
在convert.py和和mo_tf.py中–precisions=FP16一样。
其他未用参数
scale_values
scale_values=input_1[255]
reverse_input_channels
The color channel order (RGB or BGR) of an input data should match the channel order of the model training dataset. If they are
different, perform the RGB<->BGR conversion specifying the command-line parameter: --reverse_input_channels.
通过mo_tf.py转mobilenet-yolov4模型时,未用到该参数。且模型inference时PIL读取顺序为RGB。
framework, data_type, model_name and output_dir
无须指定,因为会被自动推导。
batch=1
如有intput_shape=[1,416,416,3],则已指定batch=1,无需重复。
测试downloader
downloader.py
工具
model.yml位置
/open_model_zoo/models/public/mobilenet-yolo-syg/
command
cd /opt/intel/openvino_2021.2.185/deployment_tools/open_model_zoo/tools/downloader
./downloader.py --name mobilenet-yolo-syg
测试converter.py
工具
converter.py pb to IR
cd /opt/intel/openvino_2021.2.185/deployment_tools/open_model_zoo/tools/downloader
./converter.py --name mobilenet-yolo-syg --precisions=FP16
/open_model_zoo/tools/downloader/public/mobilenet-yolo-syg
quantizer.py(但是未要求做,可不做)
工具
作用
使用训练后优化工具包Optimization Toolkit将IR格式的全精度模型量化为低精度版本。
command
sudo ./quantizer.py --name mobilenet-yolo-syg --model_dir ./public/mobilenet-yolo-syg/FP16/ --dataset_dir
./public/mobilenet-yolo-syg/VOCdevkit/ --output_dir ./ --precisions=FP16-INT8 --target_device CPU
参数解释
dataset_dir 数据集目录
model_dir 模型目录
output_dir 输出目录
precisions=FP16 输出精度