### Start BlobConverter Frontend Webserver Locally Source: https://github.com/luxonis/blobconverter/blob/master/README.md Navigate to the websrc directory, install Node.js dependencies with yarn, and start the development server for local testing. ```bash cd websrc yarn yarn start ``` -------------------------------- ### Install and Run BlobConverter System-wide Source: https://github.com/luxonis/blobconverter/blob/master/README.md Install project dependencies using pip and run the main script. Requires Python 3.5 or higher. ```bash pip install -r requirements.txt python main.py ``` -------------------------------- ### Build and Run BlobConverter with Docker Compose Source: https://github.com/luxonis/blobconverter/blob/master/README.md Use Docker Compose to build the BlobConverter image and start the service. Ensure Docker is installed. ```bash docker-compose build docker-compose up ``` -------------------------------- ### Docker Compose: Build and start server Source: https://context7.com/luxonis/blobconverter/llms.txt Build the Docker image and start the BlobConverter server using Docker Compose. The server will be accessible on port 8000. ```bash # Build and start server (served on port 8000) docker-compose build docker-compose up # Server available at http://localhost:8000 ``` -------------------------------- ### Install BlobConverter Source: https://github.com/luxonis/blobconverter/blob/master/cli/README.md Install the blobconverter package using pip. ```bash python3 -m pip install blobconverter ``` -------------------------------- ### Build and Run BlobConverter with Docker Source: https://github.com/luxonis/blobconverter/blob/master/README.md Build a Docker image for BlobConverter and run it as a container, exposing port 8000. Ensure Docker is installed. ```bash docker build -t blobconverter . docker run -p 8000:8000 blobconverter ``` -------------------------------- ### List Available Zoo Models Source: https://context7.com/luxonis/blobconverter/llms.txt Query the `/zoo_models` API to get a list of available model names and their supported data types for a specific version and zoo type. ```python import blobconverter # Intel zoo models for OpenVINO 2022.1 models = blobconverter.zoo_list(version="2022.1", zoo_type="intel") for model in models: print(f"{model['name']}: {', '.join(model['data_types'])}") # face-detection-retail-0004: FP16, FP16-INT8 # person-detection-retail-0013: FP16 # ... # DepthAI zoo models for RVC3 models_rvc3 = blobconverter.zoo_list( version="2022.3_RVC3", zoo_type="depthai", url="https://blobconverter.luxonis.com", ) print(f"Total DepthAI RVC3 models: {len(models_rvc3)}") ``` -------------------------------- ### GET /update Source: https://context7.com/luxonis/blobconverter/llms.txt Triggers an update of the model zoo data by executing the `docker_scheduled.sh` script. This is useful for refreshing the list of available models. ```APIDOC ## GET /update — Trigger model zoo update Runs `docker_scheduled.sh` to refresh the model zoo data. ### Request Example ```bash curl "http://localhost:8000/update" # Response: {"status": "Updated"} ``` ``` -------------------------------- ### Convert Model from Raw Config to Blob Source: https://github.com/luxonis/blobconverter/blob/master/cli/README.md Converts a model defined by a raw configuration file (YAML) to a DepthAI blob. This is an advanced option for custom model setups. Provide the model name, path to the config file, data type, and number of shaves. ```python import blobconverter blob_path = blobconverter.from_config( name="license-plate-recognition-barrier-0007", path="/path/to/model.yml", data_type="FP16", shaves=5, ) ``` -------------------------------- ### GET /zoo_models Source: https://context7.com/luxonis/blobconverter/llms.txt Retrieves a list of available models from the model zoo, including their supported data types. This endpoint accepts `version` and `zoo_type` as query parameters to filter the results. ```APIDOC ## GET /zoo_models — List available zoo models Returns JSON with `available` models and their supported `data_types`. Accepts `version` and `zoo_type` query parameters. ### Request Example ```bash # List Intel OpenVINO 2022.1 models curl "http://localhost:8000/zoo_models?version=2022.1&zoo_type=intel" # Response: # { # "version": "2", # "available": [ # {"name": "face-detection-retail-0004", "data_types": ["FP16", "FP16-INT8"]}, # {"name": "age-gender-recognition-retail-0013", "data_types": ["FP16"]}, # ... # ], # "unavailable": [] # } # List DepthAI zoo models for RVC3 curl "http://localhost:8000/zoo_models?version=2022.3_RVC3&zoo_type=depthai" # Response: full JSON model list from depthai_2022_1_RVC3_new.json # List Intel models for RVC3 curl "http://localhost:8000/zoo_models?version=2022.3_RVC3&zoo_type=intel" ``` ``` -------------------------------- ### Build and Upload BlobConverter CLI Package Source: https://github.com/luxonis/blobconverter/blob/master/README.md Steps to build the source distribution and wheel, check them, and upload to PyPi. Requires twine and setuptools. ```bash rm dist/* python setup.py sdist bdist_wheel twine check dist/* twine upload --username luxonis dist/* ``` -------------------------------- ### CLI: List available Intel zoo models Source: https://context7.com/luxonis/blobconverter/llms.txt Display a list of available Intel zoo models directly from the command line. ```bash # List available Intel zoo models python3 -m blobconverter --zoo-list ``` -------------------------------- ### List Available Models (CLI) Source: https://github.com/luxonis/blobconverter/blob/master/cli/README.md List all models available in the OpenVINO Model Zoo. ```bash python3 -m blobconverter --zoo-list ``` -------------------------------- ### CLI: Download OpenVINO IR alongside blob Source: https://context7.com/luxonis/blobconverter/llms.txt Compile a blob and simultaneously download the OpenVINO IR files. The output will be a zip archive containing both. ```bash # Download OpenVINO IR alongside the blob (outputs a .zip) python3 -m blobconverter --zoo-name face-detection-retail-0004 --shaves 6 --download-ir ``` -------------------------------- ### CLI: Convert from Intel OpenVINO Model Zoo Source: https://context7.com/luxonis/blobconverter/llms.txt Use the command-line interface to convert models from the Intel OpenVINO Model Zoo. Specify the zoo name, number of shaves, and version. ```bash # Convert from Intel OpenVINO Model Zoo python3 -m blobconverter --zoo-name face-detection-retail-0004 --shaves 6 --version 2022.1 ``` -------------------------------- ### List Intel OpenVINO Models (Bash) Source: https://context7.com/luxonis/blobconverter/llms.txt Retrieve a list of available models from the Intel OpenVINO Model Zoo for a specific version. The response includes model names and their supported data types. ```bash curl "http://localhost:8000/zoo_models?version=2022.1&zoo_type=intel" ``` -------------------------------- ### Compile Model from Uploaded OpenVINO IR Files (Bash) Source: https://context7.com/luxonis/blobconverter/llms.txt Compile a model using uploaded OpenVINO IR files (XML and BIN). Provide a model name, SHAVE count, data type, and a YAML configuration file. The compiled blob is saved to the specified output file. ```bash curl -X POST "http://localhost:8000/compile?version=2022.1" \ -F "name=my_model" \ -F "myriad_shaves=5" \ -F "data_type=FP16" \ -F "config=@model.yml" \ -F "my_model.xml=@my_model.xml" \ -F "my_model.bin=@my_model.bin" \ --output my_model_5shave.blob ``` -------------------------------- ### Convert from Raw Model Config (CLI) Source: https://github.com/luxonis/blobconverter/blob/master/cli/README.md Convert a model using a raw configuration file (.yml) and specify a name for the converted model, along with SHAVE cores. ```bash python3 -m blobconverter --raw-config /path/to/model.yml --raw-name license-plate-recognition-barrier-0007 --shaves 6 ``` -------------------------------- ### Convert from ONNX (CLI) Source: https://github.com/luxonis/blobconverter/blob/master/cli/README.md Convert an ONNX model by providing the path to the .onnx file and specifying the number of SHAVE cores. ```bash python3 -m blobconverter --onnx-model /path/to/model.onnx --shaves 6 ``` -------------------------------- ### Convert from Caffe (CLI) Source: https://github.com/luxonis/blobconverter/blob/master/cli/README.md Convert a Caffe model by providing paths to its prototxt and caffemodel files, and specify SHAVE cores. ```bash python3 -m blobconverter --caffe-proto /path/to/mobilenet-ssd.prototxt --caffe-model /path/to/mobilenet-ssd.caffemodel --shaves 6 ``` -------------------------------- ### Convert from OpenVINO IR (CLI) Source: https://github.com/luxonis/blobconverter/blob/master/cli/README.md Convert a model from OpenVINO Intermediate Representation (IR) by providing paths to the .xml and .bin files, and specify SHAVE cores. ```bash python3 -m blobconverter --openvino-xml /path/to/face-detection-retail-0004.xml --openvino-bin /path/to/face-detection-retail-0004.bin --shaves 7 ``` -------------------------------- ### Convert from OpenVINO Model Zoo (CLI) Source: https://github.com/luxonis/blobconverter/blob/master/cli/README.md Convert a model from the OpenVINO Model Zoo using its name and specify the number of SHAVE cores. ```bash python3 -m blobconverter --zoo-name face-detection-retail-0004 --shaves 6 ``` -------------------------------- ### Compile Model from OpenVINO Model Zoo (Bash) Source: https://context7.com/luxonis/blobconverter/llms.txt Use this command to compile a model directly from the Intel OpenVINO Model Zoo. Specify the model name, desired SHAVE cores, advanced parameters, data type, and zoo type. The output is saved as a .blob file. ```bash curl -X POST "http://localhost:8000/compile?version=2022.1" \ -F "name=face-detection-retail-0004" \ -F "myriad_shaves=6" \ -F "myriad_params_advanced=-ip U8" \ -F "data_type=FP16" \ -F "use_zoo=True" \ -F "zoo_type=intel" \ --output face-detection-retail-0004_6shave.blob ``` -------------------------------- ### Convert models from raw YAML config Source: https://context7.com/luxonis/blobconverter/llms.txt Use `from_config` for advanced control over model conversion using a raw OpenVINO model configuration YAML file. This is useful for models with custom download sources or pre-conversion steps. ```python import blobconverter ``` -------------------------------- ### List Intel Models for RVC3 (Bash) Source: https://context7.com/luxonis/blobconverter/llms.txt Query the API to list Intel OpenVINO models available for the RVC3 target. This is useful for checking compatibility and available models for newer hardware versions. ```bash curl "http://localhost:8000/zoo_models?version=2022.3_RVC3&zoo_type=intel" ``` -------------------------------- ### Download and compile models from Model Zoos Source: https://context7.com/luxonis/blobconverter/llms.txt Use `from_zoo` to download and compile models from the Intel OpenVINO or Luxonis DepthAI Model Zoos by name. It automatically handles fallback to a backup server if the primary compilation fails. ```python import blobconverter # From Intel OpenVINO Model Zoo (default) blob_path = blobconverter.from_zoo( name="face-detection-retail-0004", shaves=6, version="2022.1", zoo_type="intel", ) print(blob_path) # ~/.cache/blobconverter/face-detection-retail-0004_openvino_2022.1_6shave.blob # From Luxonis DepthAI Model Zoo blob_path = blobconverter.from_zoo( name="megadepth", zoo_type="depthai", shaves=4, ) # For RVC3 target hardware blob_path = blobconverter.from_zoo( name="yolov6n", zoo_type="depthai", version="2022.3_RVC3", ) ``` ```python import blobconverter models = blobconverter.zoo_list(version="2022.1", zoo_type="intel") for m in models[:5]: print(m["name"], m["data_types"]) # face-detection-retail-0004 ['FP16', 'FP16-INT8'] # age-gender-recognition-retail-0013 ['FP16'] ``` -------------------------------- ### Docker: Run BlobConverter server Source: https://context7.com/luxonis/blobconverter/llms.txt Run the BlobConverter server as a Docker container. Configure environment variables for AWS access, Sentry, and port mapping. ```bash docker build -t blobconverter . docker run -p 8000:8000 \ -e AWS_ACCESS=your_access_key \ -e AWS_SECRET=your_secret_key \ -e SENTRY_TOKEN=your_sentry_dsn \ blobconverter ``` -------------------------------- ### Download OpenVINO IR Model from URL Source: https://github.com/luxonis/blobconverter/blob/master/cli/README.md Downloads an OpenVINO IR model directly from a URL. This method requires providing the URLs for the XML and BIN files, along with their respective sizes and SHA256 checksums for verification. ```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" ) ``` -------------------------------- ### Convert from TensorFlow (CLI) Source: https://github.com/luxonis/blobconverter/blob/master/cli/README.md Convert a TensorFlow model by providing the path to its .pb file. Includes options for optimizer parameters, input shape, input name, output name, and SHAVE cores. ```bash 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 ``` -------------------------------- ### blobconverter.from_zoo() Source: https://context7.com/luxonis/blobconverter/llms.txt Downloads and compiles a model directly from the Intel OpenVINO Model Zoo or Luxonis DepthAI Model Zoo by name. Falls back to the Luxonis artifact backup server if primary compilation fails. ```APIDOC ## blobconverter.from_zoo() ### Description Downloads and compiles a model directly from the Intel OpenVINO Model Zoo or Luxonis DepthAI Model Zoo by name. Falls back to the Luxonis artifact backup server if primary compilation fails. ### Parameters - **name** (string) - Required - The name of the model to download. - **shaves** (int) - Optional - The number of shaves to use for compilation. - **version** (string) - Optional - The version of the model to download. - **zoo_type** (string) - Optional - The type of zoo to download from ('intel' or 'depthai'). Defaults to 'intel'. ### Returns - **blob_path** (string) - The path to the compiled blob file. ``` -------------------------------- ### CLI: Convert from Caffe with optimizer params Source: https://context7.com/luxonis/blobconverter/llms.txt Compile Caffe models using the CLI, specifying paths to the proto and model files, and the number of shaves. ```bash # Convert from Caffe with optimizer params python3 -m blobconverter \ --caffe-proto /path/to/mobilenet-ssd.prototxt \ --caffe-model /path/to/mobilenet-ssd.caffemodel \ --shaves 6 ``` -------------------------------- ### blobconverter.from_config() Source: https://context7.com/luxonis/blobconverter/llms.txt Allows full control via a raw OpenVINO model configuration YAML file, useful for models with custom download sources or pre-convert steps. ```APIDOC ## blobconverter.from_config() ### Description Allows full control via a raw OpenVINO model configuration YAML file, useful for models with custom download sources or pre-convert steps. ### Parameters - **config_path** (string) - Required - Path to the YAML configuration file. ### Returns - **blob_path** (string) - The path to the compiled blob file. ``` -------------------------------- ### Convert from OpenVINO Model Zoo (Python) Source: https://github.com/luxonis/blobconverter/blob/master/cli/README.md Convert a model from the OpenVINO Model Zoo using its name and specify the number of SHAVE cores. Returns the path to the compiled blob. ```python import blobconverter blob_path = blobconverter.from_zoo( name="face-detection-retail-0004", shaves=6, ) ``` -------------------------------- ### CLI: Convert from ONNX file Source: https://context7.com/luxonis/blobconverter/llms.txt Convert a model from ONNX format using the CLI. Provide the path to the ONNX file, desired shaves, and data type. ```bash # Convert from ONNX file python3 -m blobconverter --onnx-model /path/to/model.onnx --shaves 5 --data-type FP16 ``` -------------------------------- ### Convert models from Caffe Source: https://context7.com/luxonis/blobconverter/llms.txt Use `from_caffe` to convert Caffe models. It accepts both `.prototxt` (proto) and `.caffemodel` (model) files, which can be provided as local paths or HTTPS URLs. Optimizer parameters can be specified using `optimizer_params`. ```python import blobconverter blob_path = blobconverter.from_caffe( proto="/path/to/mobilenet-ssd.prototxt", model="/path/to/mobilenet-ssd.caffemodel", data_type="FP16", shaves=6, optimizer_params=[ "--mean_values=[127.5,127.5,127.5]", "--scale_values=[255,255,255]", ], ) print(blob_path) # ~/.cache/blobconverter/mobilenet-ssd_openvino_2022.1_6shave.blob ``` -------------------------------- ### Download OpenVINO IR from URL Source: https://github.com/luxonis/blobconverter/blob/master/cli/README.md Downloads OpenVINO IR files (.xml and .bin) directly from URLs and converts them to a blob format. Supports specifying file sizes and SHA256 checksums for validation. ```APIDOC ## Download OpenVINO IR from URL ### Description Downloads OpenVINO IR files (.xml and .bin) directly from URLs and converts them to a blob format. Supports specifying file sizes and SHA256 checksums for validation. ### Method `blobconverter.from_openvino()` ### Parameters #### Path Parameters - **xml** (string) - Required - URL to the OpenVINO IR XML file. - **xml_size** (integer) - Optional - Size of the XML file in bytes. - **xml_sha256** (string) - Optional - SHA256 checksum of the XML file. - **bin** (string) - Required - URL to the OpenVINO IR BIN file. - **bin_size** (integer) - Optional - Size of the BIN file in bytes. - **bin_sha256** (string) - Optional - SHA256 checksum of the BIN file. - **data_type** (string) - Optional - Data type for the blob (e.g., "FP16", "FP32"). Defaults to "FP16". - **shaves** (integer) - Optional - Number of shaves to use for the blob. Defaults to 5. ### Request Example ```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" ) ``` ``` -------------------------------- ### Convert from Caffe (Python) Source: https://github.com/luxonis/blobconverter/blob/master/cli/README.md Convert a Caffe model by providing paths to its prototxt and caffemodel files, specifying data type and SHAVE cores. Returns the path to the compiled blob. ```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, ) ``` -------------------------------- ### POST /compile Source: https://context7.com/luxonis/blobconverter/llms.txt Compiles a neural network model into a MyriadX .blob file. It accepts model files or a zoo model name and supports various query parameters and form fields for customization. The response header `X-HASH` provides the SHA-256 cache key. ```APIDOC ## POST /compile — Compile a model to MyriadX blob Accepts model files or a zoo model name and compiles them into a `.blob` file. Returns the binary blob (or a `.zip` with IR files if `download_ir=true`). The response header `X-HASH` contains the SHA-256 cache key for this compilation. **Query parameters:** `version` (default `2022.1`), `no_cache` (bool), `dry` (bool — return commands instead of compiling) **Form fields:** `name`, `myriad_shaves` (default `6`), `myriad_params_advanced` (default `-ip U8`), `data_type` (`FP16` or `FP16-INT8`), `use_zoo`, `download_ir`, `zoo_type` (`intel` or `depthai`) **File fields:** `config` (YAML model config), plus any model files referenced in the config. ### Request Example ```bash # Compile a model from OpenVINO Model Zoo (intel zoo) curl -X POST "http://localhost:8000/compile?version=2022.1" \ -F "name=face-detection-retail-0004" \ -F "myriad_shaves=6" \ -F "myriad_params_advanced=-ip U8" \ -F "data_type=FP16" \ -F "use_zoo=True" \ -F "zoo_type=intel" \ --output face-detection-retail-0004_6shave.blob # Compile from uploaded OpenVINO IR files curl -X POST "http://localhost:8000/compile?version=2022.1" \ -F "name=my_model" \ -F "myriad_shaves=5" \ -F "data_type=FP16" \ -F "config=@model.yml" \ -F "my_model.xml=@my_model.xml" \ -F "my_model.bin=@my_model.bin" \ --output my_model_5shave.blob # Dry run: get the compilation commands without executing curl -X POST "http://localhost:8000/compile?version=2022.1&dry=true" \ -F "name=face-detection-retail-0004" \ -F "use_zoo=True" # Response: ["python /app/model_compiler/openvino_2022.1/downloader.py ...", "...compile_tool -m ..."] # Compile for RVC3 target (VPUX.3400) curl -X POST "http://localhost:8000/compile?version=2022.3_RVC3" \ -F "name=yolov6n" \ -F "zoo_type=depthai" \ -F "use_zoo=True" \ --output yolov6n_rvc3.blob ``` ``` -------------------------------- ### CLI — Command-line interface Source: https://context7.com/luxonis/blobconverter/llms.txt Command-line interface for BlobConverter, mirroring the Python API for various conversion tasks. ```APIDOC ## CLI — Command-line interface ### Description The `blobconverter` CLI mirrors the Python API. Install with `pip install blobconverter`. ### Usage Examples **Convert from Intel OpenVINO Model Zoo:** ```bash python3 -m blobconverter --zoo-name face-detection-retail-0004 --shaves 6 --version 2022.1 ``` **Convert from ONNX file:** ```bash python3 -m blobconverter --onnx-model /path/to/model.onnx --shaves 5 --data-type FP16 ``` **Convert from Caffe with optimizer params:** ```bash python3 -m blobconverter \ --caffe-proto /path/to/mobilenet-ssd.prototxt \ --caffe-model /path/to/mobilenet-ssd.caffemodel \ --shaves 6 ``` **Convert from TensorFlow frozen graph:** ```bash python3 -m blobconverter \ --tensorflow-pb /path/to/model.pb \ --optimizer-params "--reverse_input_channels --input_shape=[1,513,513,3] --input=1:mul_1 --output=ArgMax" \ --shaves 5 ``` **Convert from OpenVINO IR:** ```bash python3 -m blobconverter \ --openvino-xml /path/to/model.xml \ --openvino-bin /path/to/model.bin \ --shaves 7 ``` **Convert for RVC3 target:** ```bash python3 -m blobconverter \ --zoo-name yolov6n --zoo-type depthai \ --version 2022.3_RVC3 ``` **List available Intel zoo models:** ```bash python3 -m blobconverter --zoo-list ``` **Dry run: print compilation commands:** ```bash python3 -m blobconverter --zoo-name face-detection-retail-0004 --shaves 6 --dry ``` **Download OpenVINO IR alongside the blob (outputs a .zip):** ```bash python3 -m blobconverter --zoo-name face-detection-retail-0004 --shaves 6 --download-ir ``` **Use a custom self-hosted BlobConverter API endpoint:** ```bash python3 -m blobconverter \ --zoo-name face-detection-retail-0004 \ --shaves 6 \ --converter-url http://my-server:8000 ``` **Skip local cache and force re-compilation:** ```bash python3 -m blobconverter --zoo-name face-detection-retail-0004 --shaves 6 --no-cache ``` ``` -------------------------------- ### Low-Level Blob Compilation with compile_blob Source: https://context7.com/luxonis/blobconverter/llms.txt This is the underlying function for all `from_*` helpers, offering full control over request data, file payloads, and caching. Use it directly for advanced customization. ```python import blobconverter blob_path = blobconverter.compile_blob( blob_name="my_custom_model", version="2022.1", shaves=6, req_data={"name": "my_custom_model", "use_zoo": "False"}, req_files={ "config": "/tmp/model.yml", "my_custom_model.xml": "/tmp/my_custom_model.xml", "my_custom_model.bin": "/tmp/my_custom_model.bin", }, output_dir="/tmp/blobs", url="http://localhost:8000", use_cache=True, compile_params=["-ip U8"], data_type="FP16", download_ir=False, dry=False, # Set True to get compilation commands without running them ) print(blob_path) # /tmp/blobs/my_custom_model_openvino_2022.1_6shave.blob ``` ```python # Dry run: inspect compilation commands before running commands = blobconverter.compile_blob( blob_name="face-detection-retail-0004", req_data={"name": "face-detection-retail-0004", "use_zoo": "True"}, dry=True, ) for cmd in commands: print(cmd) ``` -------------------------------- ### blobconverter.from_onnx() Source: https://context7.com/luxonis/blobconverter/llms.txt Converts a .onnx model file to a MyriadX blob via OpenVINO Model Optimizer. Accepts local paths or remote URLs. ```APIDOC ## blobconverter.from_onnx() ### Description Converts a .onnx model file to a MyriadX blob via OpenVINO Model Optimizer. Accepts local paths or remote URLs. ### Parameters - **model** (string) - Required - Path or URL to the ONNX model file. - **model_size** (int) - Optional - Size of the ONNX model file for integrity verification (required for URLs). - **model_sha256** (string) - Optional - SHA256 hash of the ONNX model file for integrity verification (required for URLs). - **data_type** (string) - Optional - The data type for the blob (e.g., 'FP16', 'FP32'). Defaults to 'FP16'. - **shaves** (int) - Optional - The number of shaves to use for compilation. - **version** (string) - Optional - The OpenVINO version to use for compilation. - **optimizer_params** (list) - Optional - A list of strings representing OpenVINO Model Optimizer parameters. - **compile_params** (list) - Optional - A list of strings representing OpenVINO compiler parameters. ### Returns - **blob_path** (string) - The path to the compiled blob file. ``` -------------------------------- ### Convert models from OpenVINO IR Source: https://context7.com/luxonis/blobconverter/llms.txt Use `from_openvino` to convert models from OpenVINO Intermediate Representation (IR) files. It accepts local file paths or HTTPS URLs for `.xml` and `.bin` files. For remote URLs, integrity verification parameters (`xml_size`, `xml_sha256`, `bin_size`, `bin_sha256`) are required. ```python import blobconverter # From local OpenVINO IR files 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, version="2022.1", ) # From remote URLs with integrity verification 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", shaves=6, ) print(blob_path) # ~/.cache/blobconverter/age-gender-recognition-retail-0013_openvino_2022.1_6shave.blob # Also download the OpenVINO IR zip alongside the blob zip_path = blobconverter.from_openvino( xml="/path/to/model.xml", bin="/path/to/model.bin", download_ir=True, ) # Returns path to .zip containing .xml, .bin, and .blob ``` -------------------------------- ### List Available Models (Python) Source: https://github.com/luxonis/blobconverter/blob/master/cli/README.md Retrieve a list of all available models in the OpenVINO Model Zoo using the Python API. ```python import blobconverter available_models = blobconverter.zoo_list() ``` -------------------------------- ### blobconverter.from_openvino() Source: https://context7.com/luxonis/blobconverter/llms.txt Converts a model from OpenVINO IR format. Accepts local file paths or HTTPS URLs for both .xml and .bin files. Integrity verification is required for remote URLs. ```APIDOC ## blobconverter.from_openvino() ### Description Converts a model from OpenVINO IR format. Accepts local file paths or HTTPS URLs for both .xml and .bin files. Integrity verification is required for remote URLs. ### Parameters - **xml** (string) - Required - Path or URL to the OpenVINO IR XML file. - **bin** (string) - Required - Path or URL to the OpenVINO IR BIN file. - **xml_size** (int) - Optional - Size of the XML file for integrity verification (required for URLs). - **xml_sha256** (string) - Optional - SHA256 hash of the XML file for integrity verification (required for URLs). - **bin_size** (int) - Optional - Size of the BIN file for integrity verification (required for URLs). - **bin_sha256** (string) - Optional - SHA256 hash of the BIN file for integrity verification (required for URLs). - **data_type** (string) - Optional - The data type for the blob (e.g., 'FP16', 'FP32'). Defaults to 'FP16'. - **shaves** (int) - Optional - The number of shaves to use for compilation. - **version** (string) - Optional - The OpenVINO version to use for compilation. - **download_ir** (bool) - Optional - If True, downloads the OpenVINO IR zip alongside the blob. Defaults to False. ### Returns - **blob_path** (string) - The path to the compiled blob file. - **zip_path** (string) - The path to the downloaded IR zip file (if download_ir is True). ``` -------------------------------- ### CLI: Use custom BlobConverter API endpoint Source: https://context7.com/luxonis/blobconverter/llms.txt Configure the CLI to use a custom, self-hosted BlobConverter API endpoint instead of the default one. ```bash # Use a custom self-hosted BlobConverter API endpoint python3 -m blobconverter \ --zoo-name face-detection-retail-0004 \ --shaves 6 \ --converter-url http://my-server:8000 ``` -------------------------------- ### Convert models from ONNX Source: https://context7.com/luxonis/blobconverter/llms.txt Use `from_onnx` to convert ONNX models to a MyriadX blob using OpenVINO Model Optimizer. This function accepts local paths or remote URLs for `.onnx` files. You can pass optimizer flags via `optimizer_params` and compilation flags via `compile_params`. ```python import blobconverter # From local ONNX file blob_path = blobconverter.from_onnx( model="/path/to/model.onnx", data_type="FP16", shaves=5, version="2022.1", optimizer_params=[ "--mean_values=[127.5,127.5,127.5]", "--scale_values=[255,255,255]", ], ) print(blob_path) # ~/.cache/blobconverter/model_openvino_2022.1_5shave.blob # From remote URL blob_path = blobconverter.from_onnx( model="https://example.com/models/yolov5s.onnx", model_size=14340765, model_sha256="abc123...", shaves=6, compile_params=["-ip U8", "-iop \"input:U8\""], ) ``` -------------------------------- ### Convert OpenVINO IR Model Source: https://github.com/luxonis/blobconverter/blob/master/cli/README.md Converts OpenVINO Intermediate Representation (IR) files (.xml and .bin) to a blob format. Supports specifying data type and number of shaves. ```APIDOC ## Convert OpenVINO IR Model ### Description Converts OpenVINO Intermediate Representation (IR) files (.xml and .bin) to a blob format. Supports specifying data type and number of shaves. ### Method `blobconverter.from_openvino()` ### Parameters #### Path Parameters - **xml** (string) - Required - Path to the OpenVINO IR XML file. - **bin** (string) - Required - Path to the OpenVINO IR BIN file. - **data_type** (string) - Optional - Data type for the blob (e.g., "FP16", "FP32"). Defaults to "FP16". - **shaves** (integer) - Optional - Number of shaves to use for the blob. Defaults to 5. ### Request Example ```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, ) ``` ``` -------------------------------- ### List DepthAI Zoo Models for RVC3 (Bash) Source: https://context7.com/luxonis/blobconverter/llms.txt Fetch the complete list of DepthAI zoo models compatible with the RVC3 target. This command queries the API for models specific to the DepthAI ecosystem and the RVC3 version. ```bash curl "http://localhost:8000/zoo_models?version=2022.3_RVC3&zoo_type=depthai" ``` -------------------------------- ### blobconverter.from_caffe() Source: https://context7.com/luxonis/blobconverter/llms.txt Converts a model from Caffe format. Accepts both .prototxt (proto) and .caffemodel (model) files, either as local paths or HTTPS URLs. ```APIDOC ## blobconverter.from_caffe() ### Description Converts a model from Caffe format. Accepts both .prototxt (proto) and .caffemodel (model) files, either as local paths or HTTPS URLs. ### Parameters - **proto** (string) - Required - Path or URL to the Caffe prototxt file. - **model** (string) - Required - Path or URL to the Caffe caffemodel file. - **data_type** (string) - Optional - The data type for the blob (e.g., 'FP16', 'FP32'). Defaults to 'FP16'. - **shaves** (int) - Optional - The number of shaves to use for compilation. - **version** (string) - Optional - The OpenVINO version to use for compilation. - **optimizer_params** (list) - Optional - A list of strings representing OpenVINO Model Optimizer parameters. ### Returns - **blob_path** (string) - The path to the compiled blob file. ``` -------------------------------- ### Compile Blob from Configuration Source: https://context7.com/luxonis/blobconverter/llms.txt Use this function to compile a model when its configuration is defined in a YAML file. It simplifies the process by abstracting away many compilation details. ```python import blobconverter blob_path = blobconverter.from_config( name="license-plate-recognition-barrier-0007", path="/path/to/model.yml", data_type="FP16", shaves=5, version="2022.1", ) print(blob_path) ``` -------------------------------- ### CLI: Convert from TensorFlow frozen graph Source: https://context7.com/luxonis/blobconverter/llms.txt Convert TensorFlow frozen graphs via the CLI. Include optimizer parameters for input/output specifications and shape adjustments. ```bash # Convert from TensorFlow frozen graph python3 -m blobconverter \ --tensorflow-pb /path/to/model.pb \ --optimizer-params "--reverse_input_channels --input_shape=[1,513,513,3] --input=1:mul_1 --output=ArgMax" \ --shaves 5 ``` -------------------------------- ### blobconverter.zoo_list() Source: https://context7.com/luxonis/blobconverter/llms.txt Lists all available zoo models. ```APIDOC ## blobconverter.zoo_list() ### Description Lists all available zoo models. ### Parameters - **version** (string) - Optional - The version of the zoo to list models from. - **zoo_type** (string) - Optional - The type of zoo to list models from ('intel' or 'depthai'). Defaults to 'intel'. ### Returns - **models** (list) - A list of dictionaries, where each dictionary represents a model and contains its 'name' and 'data_types'. ``` -------------------------------- ### Convert OpenVINO IR Model to Blob Source: https://github.com/luxonis/blobconverter/blob/master/cli/README.md Converts an OpenVINO Intermediate Representation (IR) model (XML and BIN files) to a DepthAI blob. Specify the paths to the XML and BIN files, data type, and number of shaves. ```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, ) ``` -------------------------------- ### Configure Global Defaults for BlobConverter (Python) Source: https://context7.com/luxonis/blobconverter/llms.txt Use `blobconverter.set_defaults()` to configure module-level defaults for all subsequent conversion calls. This function allows setting a custom API endpoint, default OpenVINO version, SHAVE cores, output directory, data type, compilation parameters, and model optimizer parameters. ```python import blobconverter blobconverter.set_defaults( url="http://localhost:8000", # Custom API endpoint version="2022.1", # Default OpenVINO version shaves=6, # Default SHAVE cores output_dir="/tmp/blobs", # Where to save .blob files data_type="FP16", # Default precision compile_params=["-ip U8"], # Default compile flags optimizer_params=[ "--mean_values=[127.5,127.5,127.5]", "--scale_values=[255,255,255]", ], silent=False, # Show download progress zoo_type="intel", # Default model zoo ) ``` -------------------------------- ### Convert Raw Model Config Source: https://github.com/luxonis/blobconverter/blob/master/cli/README.md Converts a model from a raw configuration file (e.g., YAML) to a blob format. Supports specifying model name, path, data type, and number of shaves. ```APIDOC ## Convert Raw Model Config ### Description Converts a model from a raw configuration file (e.g., YAML) to a blob format. Supports specifying model name, path, data type, and number of shaves. ### Method `blobconverter.from_config()` ### Parameters #### Path Parameters - **name** (string) - Required - The name of the model. - **path** (string) - Required - Path to the model configuration file. - **data_type** (string) - Optional - Data type for the blob (e.g., "FP16", "FP32"). Defaults to "FP16". - **shaves** (integer) - Optional - Number of shaves to use for the blob. Defaults to 5. ### Request Example ```python import blobconverter blob_path = blobconverter.from_config( name="license-plate-recognition-barrier-0007", path="/path/to/model.yml", data_type="FP16", shaves=5, ) ``` ``` -------------------------------- ### Compile Model for RVC3 Target (Bash) Source: https://context7.com/luxonis/blobconverter/llms.txt Compile a model specifically for the RVC3 target (VPUX.3400). This command specifies the OpenVINO version and the DepthAI zoo type. ```bash curl -X POST "http://localhost:8000/compile?version=2022.3_RVC3" \ -F "name=yolov6n" \ -F "zoo_type=depthai" \ -F "use_zoo=True" \ --output yolov6n_rvc3.blob ``` -------------------------------- ### blobconverter.zoo_list() Source: https://context7.com/luxonis/blobconverter/llms.txt List available zoo models from the BlobConverter API, specifying version and zoo type. ```APIDOC ## blobconverter.zoo_list() ### Description Queries the `/zoo_models` API endpoint and returns a list of available model names with their supported data types. ### Method ```python zoo_list(version: str, zoo_type: str = "intel", url: str = None) -> list ``` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **version** (str) - Required - The OpenVINO version or RVC3 version to filter models by (e.g., "2022.1", "2022.3_RVC3"). - **zoo_type** (str) - Optional - The type of zoo to query. Options: "intel" (default), "depthai". - **url** (str) - Optional - URL of the BlobConverter API endpoint. ### Request Example ```python import blobconverter # Intel zoo models for OpenVINO 2022.1 models = blobconverter.zoo_list(version="2022.1", zoo_type="intel") for model in models: print(f"{model['name']}: {', '.join(model['data_types'])}") # DepthAI zoo models for RVC3 models_rvc3 = blobconverter.zoo_list( version="2022.3_RVC3", zoo_type="depthai", url="https://blobconverter.luxonis.com" ) print(f"Total DepthAI RVC3 models: {len(models_rvc3)}") ``` ### Response #### Success Response (200) - **models** (list) - A list of dictionaries, where each dictionary contains: - **name** (str) - The name of the model. - **data_types** (list) - A list of supported data types for the model. ``` -------------------------------- ### Convert models from TensorFlow Source: https://context7.com/luxonis/blobconverter/llms.txt Use `from_tf` to convert frozen TensorFlow `.pb` graphs. The `optimizer_params` argument is used to pass Model Optimizer flags, such as input/output node names and shapes. ```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", ], ) print(blob_path) # ~/.cache/blobconverter/deeplabv3_mnv2_pascal_train_aug_openvino_2022.1_5shave.blob ``` -------------------------------- ### CLI: Convert for RVC3 target Source: https://context7.com/luxonis/blobconverter/llms.txt Compile models specifically for the RVC3 target using the CLI. Specify the zoo type as 'depthai' and the appropriate version. ```bash # Convert for RVC3 target python3 -m blobconverter \ --zoo-name yolov6n --zoo-type depthai \ --version 2022.3_RVC3 ``` -------------------------------- ### Download Model from DepthAI Model Zoo Source: https://github.com/luxonis/blobconverter/blob/master/cli/README.md Downloads a model directly from the DepthAI Model Zoo. Specify the model name and the zoo type (e.g., 'depthai'). ```python import blobconverter blob_path = blobconverter.from_zoo(name="megadepth", zoo_type="depthai") ```