# BlobConverter CLI
This tool allows you to convert neural network files (from various sources, like Tensorflow, Caffe or OpenVINO)
to MyriadX blob file
## Installation
```
python3 -m pip install blobconverter
```
## Usage
```
usage: blobconverter [-h] [-zn ZOO_NAME] [-zt ZOO_TYPE] [-onnx ONNX_MODEL] [-cp CAFFE_PROTO] [-cm CAFFE_MODEL] [-tf TENSORFLOW_PB] [-ox OPENVINO_XML] [-ob OPENVINO_BIN]
[-rawn RAW_NAME] [-rawc RAW_CONFIG] [-sh {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16}] [-dt DATA_TYPE] [-o OUTPUT_DIR] [-v VERSION]
[--optimizer-params OPTIMIZER_PARAMS] [--compile-params COMPILE_PARAMS] [--converter-url URL] [--no-cache] [--zoo-list] [--download-ir]
optional arguments:
-h, --help show this help message and exit
-zn ZOO_NAME, --zoo-name ZOO_NAME
Name of a model to download from OpenVINO Model Zoo
-zt ZOO_TYPE, --zoo-type ZOO_TYPE
Type of the model zoo to use, available: "intel", "depthai"
-onnx ONNX_MODEL, --onnx-model ONNX_MODEL
Path to ONNX .onnx file
-cp CAFFE_PROTO, --caffe-proto CAFFE_PROTO
Path to Caffe .prototxt file
-cm CAFFE_MODEL, --caffe-model CAFFE_MODEL
Path to Caffe .caffemodel file
-tf TENSORFLOW_PB, --tensorflow-pb TENSORFLOW_PB
Path to TensorFlow .pb file
-ox OPENVINO_XML, --openvino-xml OPENVINO_XML
Path to OpenVINO .xml file
-ob OPENVINO_BIN, --openvino-bin OPENVINO_BIN
Path to OpenVINO .bin file
-rawn RAW_NAME, --raw-name RAW_NAME
Name of the converted model (advanced)
-rawc RAW_CONFIG, --raw-config RAW_CONFIG
Path to raw .yml file with model config (advanced)
-sh {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16}, --shaves {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16}
Specifies number of SHAVE cores that converted model will use
-dt DATA_TYPE, --data-type DATA_TYPE
Specifies model data type
-o OUTPUT_DIR, --output-dir OUTPUT_DIR
Directory where the output blob should be saved
-v VERSION, --version VERSION
OpenVINO version to use for conversion
--optimizer-params OPTIMIZER_PARAMS
Additional params to use when converting a model to OpenVINO IR
--compile-params COMPILE_PARAMS
Additional params to use when compiling a model to MyriadX blob
--converter-url URL URL to BlobConverter API endpoint used for conversion
--no-cache Omit .cache directory and force new compilation of the blob
--zoo-list List all models available in OpenVINO Model Zoo
--download-ir Downloads OpenVINO IR files used to compile the blob. Result path points to a result ZIP archive
```
## Conversion examples (cli)
### OpenVINO Model Zoo
```
python3 -m blobconverter --zoo-name face-detection-retail-0004 --shaves 6
```
To list all available models, run
```
python3 -m blobconverter --zoo-list
```
### Caffe
```
python3 -m blobconverter --caffe-proto /path/to/mobilenet-ssd.prototxt --caffe-model /path/to/mobilenet-ssd.caffemodel --shaves 6
```
### TensorFlow
```
python3 -m blobconverter --tensorflow-pb /path/to/deeplabv3_mnv2_pascal_train_aug.pb --optimizer-params --reverse_input_channels --input_shape=[1,513,513,3] --input=1:mul_1 --output=ArgMax --shaves 6
```
### ONNX
```
python3 -m blobconverter --onnx-model /path/to/model.onnx --shaves 6
```
### OpenVINO IR
```
python3 -m blobconverter --openvino-xml /path/to/face-detection-retail-0004.xml --openvino-bin /path/to/face-detection-retail-0004.bin --shaves 7
```
### Raw model config (advanced)
```
python3 -m blobconverter --raw-config /path/to/model.yml --raw-name license-plate-recognition-barrier-0007 --shaves 6
```
## Conversion examples (Python)
### OpenVINO Model Zoo
```python
import blobconverter
blob_path = blobconverter.from_zoo(
name="face-detection-retail-0004",
shaves=6,
)
```
To get all available models, use
```python
import blobconverter
available_models = blobconverter.zoo_list()
```
### Caffe
```python
import blobconverter
blob_path = blobconverter.from_caffe(
proto="/path/to/mobilenet-ssd.prototxt",
model="/path/to/mobilenet-ssd.caffemodel",
data_type="FP16",
shaves=5,
)
```
### TensorFlow
```python
import blobconverter
blob_path = blobconverter.from_tf(
frozen_pb="/path/to/deeplabv3_mnv2_pascal_train_aug.pb",
data_type="FP16",
shaves=5,
optimizer_params=[
"--reverse_input_channels",
"--input_shape=[1,513,513,3]",
"--input=1:mul_1",
"--output=ArgMax",
],
)
```
### ONNX
```python
import blobconverter
blob_path = blobconverter.from_onnx(
model="/path/to/model.onnx",
data_type="FP16",
shaves=5,
)
```
### OpenVINO IR
```python
import blobconverter
blob_path = blobconverter.from_openvino(
xml="/path/to/face-detection-retail-0004.xml",
bin="/path/to/face-detection-retail-0004.bin",
data_type="FP16",
shaves=5,
)
```
### Raw model config (advanced)
```python
import blobconverter
blob_path = blobconverter.from_config(
name="license-plate-recognition-barrier-0007",
path="/path/to/model.yml",
data_type="FP16",
shaves=5,
)
```
### Use [DepthAI Model Zoo](https://github.com/luxonis/depthai-model-zoo) to download files
```python
import blobconverter
blob_path = blobconverter.from_zoo(name="megadepth", zoo_type="depthai")
```
### Download using URLs instead of local files
```python
import blobconverter
blob_path = blobconverter.from_openvino(
xml="https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/age-gender-recognition-retail-0013/FP16/age-gender-recognition-retail-0013.xml",
xml_size=31526,
xml_sha256="54d62ce4a3c3d7f1559a22ee9524bac41101103a8dceaabec537181995eda655",
bin="https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/age-gender-recognition-retail-0013/FP16/age-gender-recognition-retail-0013.bin",
bin_size=4276038,
bin_sha256="3586df5340e9fcd73ba0e2d802631bd9e027179490635c03b273d33d582e2b58"
)
```
Raw data
{
"_id": null,
"home_page": "https://github.com/luxonis/blobconverter",
"name": "blobconverter",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "blobconverter blob converter myriadx openvino tensorflow caffe ir",
"author": "Luxonis",
"author_email": "support@luxonis.com",
"download_url": "https://files.pythonhosted.org/packages/24/1f/b16b87b6af8789614ed09d729abaa675c5736200e0407d514b9c9d3de92b/blobconverter-1.4.0.tar.gz",
"platform": null,
"description": "# BlobConverter CLI\r\n\r\nThis tool allows you to convert neural network files (from various sources, like Tensorflow, Caffe or OpenVINO) \r\nto MyriadX blob file\r\n\r\n## Installation\r\n\r\n```\r\npython3 -m pip install blobconverter\r\n```\r\n## Usage\r\n\r\n```\r\nusage: blobconverter [-h] [-zn ZOO_NAME] [-zt ZOO_TYPE] [-onnx ONNX_MODEL] [-cp CAFFE_PROTO] [-cm CAFFE_MODEL] [-tf TENSORFLOW_PB] [-ox OPENVINO_XML] [-ob OPENVINO_BIN]\r\n [-rawn RAW_NAME] [-rawc RAW_CONFIG] [-sh {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16}] [-dt DATA_TYPE] [-o OUTPUT_DIR] [-v VERSION]\r\n [--optimizer-params OPTIMIZER_PARAMS] [--compile-params COMPILE_PARAMS] [--converter-url URL] [--no-cache] [--zoo-list] [--download-ir]\r\n\r\noptional arguments:\r\n -h, --help show this help message and exit\r\n -zn ZOO_NAME, --zoo-name ZOO_NAME\r\n Name of a model to download from OpenVINO Model Zoo\r\n -zt ZOO_TYPE, --zoo-type ZOO_TYPE\r\n Type of the model zoo to use, available: \"intel\", \"depthai\"\r\n -onnx ONNX_MODEL, --onnx-model ONNX_MODEL\r\n Path to ONNX .onnx file\r\n -cp CAFFE_PROTO, --caffe-proto CAFFE_PROTO\r\n Path to Caffe .prototxt file\r\n -cm CAFFE_MODEL, --caffe-model CAFFE_MODEL\r\n Path to Caffe .caffemodel file\r\n -tf TENSORFLOW_PB, --tensorflow-pb TENSORFLOW_PB\r\n Path to TensorFlow .pb file\r\n -ox OPENVINO_XML, --openvino-xml OPENVINO_XML\r\n Path to OpenVINO .xml file\r\n -ob OPENVINO_BIN, --openvino-bin OPENVINO_BIN\r\n Path to OpenVINO .bin file\r\n -rawn RAW_NAME, --raw-name RAW_NAME\r\n Name of the converted model (advanced)\r\n -rawc RAW_CONFIG, --raw-config RAW_CONFIG\r\n Path to raw .yml file with model config (advanced)\r\n -sh {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16}, --shaves {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16}\r\n Specifies number of SHAVE cores that converted model will use\r\n -dt DATA_TYPE, --data-type DATA_TYPE\r\n Specifies model data type\r\n -o OUTPUT_DIR, --output-dir OUTPUT_DIR\r\n Directory where the output blob should be saved\r\n -v VERSION, --version VERSION\r\n OpenVINO version to use for conversion\r\n --optimizer-params OPTIMIZER_PARAMS\r\n Additional params to use when converting a model to OpenVINO IR\r\n --compile-params COMPILE_PARAMS\r\n Additional params to use when compiling a model to MyriadX blob\r\n --converter-url URL URL to BlobConverter API endpoint used for conversion\r\n --no-cache Omit .cache directory and force new compilation of the blob\r\n --zoo-list List all models available in OpenVINO Model Zoo\r\n --download-ir Downloads OpenVINO IR files used to compile the blob. Result path points to a result ZIP archive\r\n```\r\n\r\n## Conversion examples (cli)\r\n\r\n### OpenVINO Model Zoo\r\n\r\n```\r\npython3 -m blobconverter --zoo-name face-detection-retail-0004 --shaves 6\r\n```\r\n\r\nTo list all available models, run\r\n\r\n```\r\npython3 -m blobconverter --zoo-list\r\n```\r\n\r\n### Caffe\r\n\r\n```\r\npython3 -m blobconverter --caffe-proto /path/to/mobilenet-ssd.prototxt --caffe-model /path/to/mobilenet-ssd.caffemodel --shaves 6\r\n```\r\n\r\n\r\n### TensorFlow\r\n\r\n```\r\npython3 -m blobconverter --tensorflow-pb /path/to/deeplabv3_mnv2_pascal_train_aug.pb --optimizer-params --reverse_input_channels --input_shape=[1,513,513,3] --input=1:mul_1 --output=ArgMax --shaves 6\r\n```\r\n\r\n\r\n### ONNX\r\n\r\n```\r\npython3 -m blobconverter --onnx-model /path/to/model.onnx --shaves 6\r\n```\r\n\r\n\r\n### OpenVINO IR\r\n\r\n```\r\npython3 -m blobconverter --openvino-xml /path/to/face-detection-retail-0004.xml --openvino-bin /path/to/face-detection-retail-0004.bin --shaves 7\r\n```\r\n\r\n\r\n### Raw model config (advanced)\r\n\r\n```\r\npython3 -m blobconverter --raw-config /path/to/model.yml --raw-name license-plate-recognition-barrier-0007 --shaves 6\r\n```\r\n\r\n## Conversion examples (Python)\r\n\r\n### OpenVINO Model Zoo\r\n\r\n```python\r\nimport blobconverter\r\n\r\nblob_path = blobconverter.from_zoo(\r\n name=\"face-detection-retail-0004\", \r\n shaves=6,\r\n)\r\n```\r\n\r\nTo get all available models, use\r\n\r\n```python\r\nimport blobconverter\r\n\r\navailable_models = blobconverter.zoo_list()\r\n```\r\n\r\n### Caffe\r\n\r\n```python\r\nimport blobconverter\r\n\r\nblob_path = blobconverter.from_caffe(\r\n proto=\"/path/to/mobilenet-ssd.prototxt\",\r\n model=\"/path/to/mobilenet-ssd.caffemodel\",\r\n data_type=\"FP16\",\r\n shaves=5,\r\n)\r\n```\r\n\r\n\r\n### TensorFlow\r\n\r\n```python\r\nimport blobconverter\r\n\r\nblob_path = blobconverter.from_tf(\r\n frozen_pb=\"/path/to/deeplabv3_mnv2_pascal_train_aug.pb\",\r\n data_type=\"FP16\",\r\n shaves=5,\r\n optimizer_params=[\r\n \"--reverse_input_channels\",\r\n \"--input_shape=[1,513,513,3]\",\r\n \"--input=1:mul_1\",\r\n \"--output=ArgMax\",\r\n ],\r\n)\r\n```\r\n\r\n### ONNX\r\n\r\n```python\r\nimport blobconverter\r\n\r\nblob_path = blobconverter.from_onnx(\r\n model=\"/path/to/model.onnx\",\r\n data_type=\"FP16\",\r\n shaves=5,\r\n)\r\n```\r\n\r\n\r\n### OpenVINO IR\r\n\r\n```python\r\nimport blobconverter\r\n\r\nblob_path = blobconverter.from_openvino(\r\n xml=\"/path/to/face-detection-retail-0004.xml\",\r\n bin=\"/path/to/face-detection-retail-0004.bin\",\r\n data_type=\"FP16\",\r\n shaves=5,\r\n)\r\n```\r\n\r\n\r\n### Raw model config (advanced)\r\n\r\n```python\r\nimport blobconverter\r\n\r\nblob_path = blobconverter.from_config(\r\n name=\"license-plate-recognition-barrier-0007\",\r\n path=\"/path/to/model.yml\",\r\n data_type=\"FP16\",\r\n shaves=5,\r\n)\r\n```\r\n\r\n### Use [DepthAI Model Zoo](https://github.com/luxonis/depthai-model-zoo) to download files\r\n\r\n```python\r\nimport blobconverter\r\n\r\nblob_path = blobconverter.from_zoo(name=\"megadepth\", zoo_type=\"depthai\")\r\n```\r\n\r\n### Download using URLs instead of local files\r\n```python\r\nimport blobconverter\r\n\r\nblob_path = blobconverter.from_openvino(\r\n xml=\"https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/age-gender-recognition-retail-0013/FP16/age-gender-recognition-retail-0013.xml\",\r\n xml_size=31526,\r\n xml_sha256=\"54d62ce4a3c3d7f1559a22ee9524bac41101103a8dceaabec537181995eda655\",\r\n bin=\"https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/age-gender-recognition-retail-0013/FP16/age-gender-recognition-retail-0013.bin\",\r\n bin_size=4276038,\r\n bin_sha256=\"3586df5340e9fcd73ba0e2d802631bd9e027179490635c03b273d33d582e2b58\"\r\n)\r\n```\r\n\r\n\r\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "The tool that allows you to convert neural networks to MyriadX blob",
"version": "1.4.0",
"project_urls": {
"Bug Tracker": "https://github.com/luxonis/blobconverter/issues",
"Homepage": "https://github.com/luxonis/blobconverter",
"Source Code": "https://github.com/luxonis/blobconverter/tree/master/cli"
},
"split_keywords": [
"blobconverter",
"blob",
"converter",
"myriadx",
"openvino",
"tensorflow",
"caffe",
"ir"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "bf8938fdb5d92711361f2cb5fd6e739d726793ad73260be613a248b6d7c0fc6d",
"md5": "414fa6854f29e3f347dd189aa5a422cb",
"sha256": "948f33f8ffc34a8e38a15ddeb66a32b8dd67bde1ea6f2b6184a1c88d887999fe"
},
"downloads": -1,
"filename": "blobconverter-1.4.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "414fa6854f29e3f347dd189aa5a422cb",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 10603,
"upload_time": "2023-05-08T17:19:33",
"upload_time_iso_8601": "2023-05-08T17:19:33.501943Z",
"url": "https://files.pythonhosted.org/packages/bf/89/38fdb5d92711361f2cb5fd6e739d726793ad73260be613a248b6d7c0fc6d/blobconverter-1.4.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "241fb16b87b6af8789614ed09d729abaa675c5736200e0407d514b9c9d3de92b",
"md5": "d9a52f75d505b3828ccf696f130cc9a0",
"sha256": "4d6de7d28a7b5829f9c780a1f822dfa2047bc8a98c1e2cde9782fc4301eb3eee"
},
"downloads": -1,
"filename": "blobconverter-1.4.0.tar.gz",
"has_sig": false,
"md5_digest": "d9a52f75d505b3828ccf696f130cc9a0",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 11344,
"upload_time": "2023-05-08T17:19:35",
"upload_time_iso_8601": "2023-05-08T17:19:35.858718Z",
"url": "https://files.pythonhosted.org/packages/24/1f/b16b87b6af8789614ed09d729abaa675c5736200e0407d514b9c9d3de92b/blobconverter-1.4.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-05-08 17:19:35",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "luxonis",
"github_project": "blobconverter",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [],
"lcname": "blobconverter"
}