Skip to main content

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 {2021.2,2021.3,2021.4,2022.1,2022.3_RVC3}]
                     [--optimizer-params OPTIMIZER_PARAMS]
                     [--compile-params COMPILE_PARAMS] [--converter-url URL]
                     [--no-cache] [--dry] [--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 {2021.2,2021.3,2021.4,2022.1,2022.3_RVC3}, --version {2021.2,2021.3,2021.4,2022.1,2022.3_RVC3}
                        OpenVINO version to use for conversion. To export
                        model for RVC3, you must set OpenVINO version to
                        '2022.3_RVC3'.
  --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
  --dry                 Instead of compiling the blob, return compilation commands (for manual conversion)
  --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

import blobconverter

blob_path = blobconverter.from_zoo(
    name="face-detection-retail-0004", 
    shaves=6,
)

To get all available models, use

import blobconverter

available_models = blobconverter.zoo_list()

Caffe

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

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

import blobconverter

blob_path = blobconverter.from_onnx(
    model="/path/to/model.onnx",
    data_type="FP16",
    shaves=5,
)

OpenVINO IR

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)

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 to download files

import blobconverter

blob_path = blobconverter.from_zoo(name="megadepth", zoo_type="depthai")

Download using URLs instead of local files

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"
)

Metadata

Release files for blobconverter 1.4.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for blobconverter 1.4.3
File Size Uploaded
blobconverter-1.4.3.tar.gz 10.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for blobconverter 1.4.3
File Interpreter ABI Platform
blobconverter-1.4.3-py3-none-any.whl Python 3 none any Details

Total release size: 21.6 kB

Release files / blobconverter-1.4.3.tar.gz

Download URL blobconverter-1.4.3.tar.gz
Size 10.9 kB
Tags Source
SHA-256 checksum
How to use checksums
bf7c70044b6d8899e69a15283edae9474eb98ed5300a69595698922b4fe2b220
BLAKE2b-256 checksum
How to use checksums
4dbd71680c5525da50203204f91566a01488c55d4c0214ac9ee2a96cfcabae0f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.5

Release files / blobconverter-1.4.3-py3-none-any.whl

Download URL blobconverter-1.4.3-py3-none-any.whl
Size 10.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9beb720a7e361652de9678550883bf313d630b52339857cd43b286f19966520e
BLAKE2b-256 checksum
How to use checksums
bb4456441d78a5a9c00a3f0e7df5761008173b581db7e5b5b96f3cb178eaf6ba
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.5

Release history Release notifications | RSS feed

This release

1.4.3 This release

2 release files

1.4.2

2 release files

1.4.1

2 release files

1.4.0

2 release files

1.3.0

2 release files

1.2.9

2 release files

1.2.8

2 release files

1.2.7

2 release files

1.2.6

2 release files

1.2.5

2 release files

1.2.4

2 release files

1.2.3

2 release files

1.2.2

2 release files

1.2.1

2 release files

1.2.0

2 release files

1.1.1

2 release files

1.0.0

2 release files

0.0.12

2 release files

0.0.10

2 release files

0.0.9

2 release files

0.0.8

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page