modelconv 0.5.4__tar.gz → 0.5.6__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {modelconv-0.5.4 → modelconv-0.5.6}/PKG-INFO +60 -42
- {modelconv-0.5.4 → modelconv-0.5.6}/README.md +55 -37
- {modelconv-0.5.4 → modelconv-0.5.6}/modelconv.egg-info/PKG-INFO +60 -42
- {modelconv-0.5.4 → modelconv-0.5.6}/modelconv.egg-info/SOURCES.txt +1 -27
- {modelconv-0.5.4 → modelconv-0.5.6}/modelconv.egg-info/requires.txt +4 -4
- modelconv-0.5.6/modelconv.egg-info/top_level.txt +1 -0
- {modelconv-0.5.4 → modelconv-0.5.6}/modelconverter/__init__.py +1 -1
- {modelconv-0.5.4 → modelconv-0.5.6}/modelconverter/__main__.py +46 -27
- {modelconv-0.5.4 → modelconv-0.5.6}/modelconverter/cli/utils.py +23 -16
- {modelconv-0.5.4 → modelconv-0.5.6}/modelconverter/packages/base_benchmark.py +35 -50
- {modelconv-0.5.4 → modelconv-0.5.6}/modelconverter/packages/base_exporter.py +20 -6
- {modelconv-0.5.4 → modelconv-0.5.6}/modelconverter/packages/hailo/exporter.py +0 -1
- modelconv-0.5.6/modelconverter/packages/hailo/requirements.txt +7 -0
- {modelconv-0.5.4 → modelconv-0.5.6}/modelconverter/packages/rvc2/benchmark.py +17 -13
- {modelconv-0.5.4 → modelconv-0.5.6}/modelconverter/packages/rvc2/exporter.py +4 -2
- {modelconv-0.5.4 → modelconv-0.5.6}/modelconverter/packages/rvc3/benchmark.py +9 -10
- {modelconv-0.5.4 → modelconv-0.5.6}/modelconverter/packages/rvc4/analyze.py +73 -16
- modelconv-0.5.6/modelconverter/packages/rvc4/benchmark.py +736 -0
- {modelconv-0.5.4 → modelconv-0.5.6}/modelconverter/packages/rvc4/exporter.py +4 -5
- {modelconv-0.5.4 → modelconv-0.5.6}/modelconverter/utils/__init__.py +4 -5
- {modelconv-0.5.4 → modelconv-0.5.6}/modelconverter/utils/config.py +118 -4
- {modelconv-0.5.4 → modelconv-0.5.6}/modelconverter/utils/device_handlers.py +36 -112
- modelconv-0.5.6/modelconverter/utils/device_monitors.py +337 -0
- {modelconv-0.5.4 → modelconv-0.5.6}/modelconverter/utils/docker_utils.py +7 -10
- {modelconv-0.5.4 → modelconv-0.5.6}/modelconverter/utils/exceptions.py +0 -4
- {modelconv-0.5.4 → modelconv-0.5.6}/modelconverter/utils/filesystem_utils.py +2 -4
- {modelconv-0.5.4 → modelconv-0.5.6}/modelconverter/utils/general.py +4 -3
- {modelconv-0.5.4 → modelconv-0.5.6}/modelconverter/utils/metadata.py +8 -4
- {modelconv-0.5.4 → modelconv-0.5.6}/modelconverter/utils/nn_archive.py +67 -22
- {modelconv-0.5.4 → modelconv-0.5.6}/modelconverter/utils/onnx_tools.py +41 -38
- {modelconv-0.5.4 → modelconv-0.5.6}/modelconverter/utils/subprocess.py +2 -5
- {modelconv-0.5.4 → modelconv-0.5.6}/modelconverter/utils/types.py +105 -29
- {modelconv-0.5.4 → modelconv-0.5.6}/pyproject.toml +1 -0
- {modelconv-0.5.4 → modelconv-0.5.6}/requirements.txt +4 -2
- modelconv-0.5.4/modelconv.egg-info/top_level.txt +0 -5
- modelconv-0.5.4/modelconverter/packages/hailo/requirements.txt +0 -6
- modelconv-0.5.4/modelconverter/packages/rvc4/benchmark.py +0 -509
- modelconv-0.5.4/modelconverter/utils/device_monitors.py +0 -409
- modelconv-0.5.4/tests/__init__.py +0 -3
- modelconv-0.5.4/tests/conftest.py +0 -269
- modelconv-0.5.4/tests/test_benchmark/__init__.py +0 -0
- modelconv-0.5.4/tests/test_benchmark/conftest.py +0 -93
- modelconv-0.5.4/tests/test_benchmark/test_benchmark_regression.py +0 -279
- modelconv-0.5.4/tests/test_packages/__init__.py +0 -0
- modelconv-0.5.4/tests/test_packages/common.py +0 -159
- modelconv-0.5.4/tests/test_packages/metrics/__init__.py +0 -6
- modelconv-0.5.4/tests/test_packages/metrics/base_metric.py +0 -21
- modelconv-0.5.4/tests/test_packages/metrics/mnist_metric.py +0 -51
- modelconv-0.5.4/tests/test_packages/metrics/resnet_metric.py +0 -52
- modelconv-0.5.4/tests/test_packages/metrics/yolov6_metric.py +0 -241
- modelconv-0.5.4/tests/test_packages/onnx_inferer.py +0 -17
- modelconv-0.5.4/tests/test_packages/test_cross_format_export.py +0 -32
- modelconv-0.5.4/tests/test_packages/test_hailo.py +0 -31
- modelconv-0.5.4/tests/test_packages/test_rvc2.py +0 -95
- modelconv-0.5.4/tests/test_packages/test_rvc3.py +0 -45
- modelconv-0.5.4/tests/test_packages/test_rvc4.py +0 -54
- modelconv-0.5.4/tests/test_utils/__init__.py +0 -0
- modelconv-0.5.4/tests/test_utils/conftest.py +0 -11
- modelconv-0.5.4/tests/test_utils/test_config.py +0 -1457
- modelconv-0.5.4/tests/test_utils/test_filesystem.py +0 -73
- modelconv-0.5.4/tests/test_utils/test_image.py +0 -116
- modelconv-0.5.4/tests/test_utils/test_layout.py +0 -28
- modelconv-0.5.4/tests/test_utils/test_modifier.py +0 -237
- modelconv-0.5.4/tests/test_utils/test_onnx_compatibility.py +0 -112
- {modelconv-0.5.4 → modelconv-0.5.6}/LICENSE +0 -0
- {modelconv-0.5.4 → modelconv-0.5.6}/modelconv.egg-info/dependency_links.txt +0 -0
- {modelconv-0.5.4 → modelconv-0.5.6}/modelconv.egg-info/entry_points.txt +0 -0
- {modelconv-0.5.4 → modelconv-0.5.6}/modelconverter/cli/__init__.py +0 -0
- {modelconv-0.5.4 → modelconv-0.5.6}/modelconverter/packages/__init__.py +0 -0
- {modelconv-0.5.4 → modelconv-0.5.6}/modelconverter/packages/base_analyze.py +0 -0
- {modelconv-0.5.4 → modelconv-0.5.6}/modelconverter/packages/base_inferer.py +0 -0
- {modelconv-0.5.4 → modelconv-0.5.6}/modelconverter/packages/base_visualize.py +0 -0
- {modelconv-0.5.4 → modelconv-0.5.6}/modelconverter/packages/getters.py +0 -0
- {modelconv-0.5.4 → modelconv-0.5.6}/modelconverter/packages/hailo/__init__.py +0 -0
- {modelconv-0.5.4 → modelconv-0.5.6}/modelconverter/packages/hailo/inferer.py +0 -0
- {modelconv-0.5.4 → modelconv-0.5.6}/modelconverter/packages/multistage_exporter.py +0 -0
- {modelconv-0.5.4 → modelconv-0.5.6}/modelconverter/packages/rvc2/__init__.py +0 -0
- {modelconv-0.5.4 → modelconv-0.5.6}/modelconverter/packages/rvc2/inferer.py +0 -0
- {modelconv-0.5.4 → modelconv-0.5.6}/modelconverter/packages/rvc2/requirements.txt +0 -0
- {modelconv-0.5.4 → modelconv-0.5.6}/modelconverter/packages/rvc3/__init__.py +0 -0
- {modelconv-0.5.4 → modelconv-0.5.6}/modelconverter/packages/rvc3/exporter.py +0 -0
- {modelconv-0.5.4 → modelconv-0.5.6}/modelconverter/packages/rvc3/inferer.py +0 -0
- {modelconv-0.5.4 → modelconv-0.5.6}/modelconverter/packages/rvc3/requirements.txt +0 -0
- {modelconv-0.5.4 → modelconv-0.5.6}/modelconverter/packages/rvc4/__init__.py +0 -0
- {modelconv-0.5.4 → modelconv-0.5.6}/modelconverter/packages/rvc4/inferer.py +0 -0
- {modelconv-0.5.4 → modelconv-0.5.6}/modelconverter/packages/rvc4/requirements.txt +0 -0
- {modelconv-0.5.4 → modelconv-0.5.6}/modelconverter/packages/rvc4/visualize.py +0 -0
- {modelconv-0.5.4 → modelconv-0.5.6}/modelconverter/utils/calibration_data.py +0 -0
- {modelconv-0.5.4 → modelconv-0.5.6}/modelconverter/utils/constants.py +0 -0
- {modelconv-0.5.4 → modelconv-0.5.6}/modelconverter/utils/environ.py +0 -0
- {modelconv-0.5.4 → modelconv-0.5.6}/modelconverter/utils/hub_requests.py +0 -0
- {modelconv-0.5.4 → modelconv-0.5.6}/modelconverter/utils/hubai_utils.py +0 -0
- {modelconv-0.5.4 → modelconv-0.5.6}/modelconverter/utils/image.py +0 -0
- {modelconv-0.5.4 → modelconv-0.5.6}/modelconverter/utils/layout.py +0 -0
- {modelconv-0.5.4 → modelconv-0.5.6}/modelconverter/utils/onnx_compatibility.py +0 -0
- {modelconv-0.5.4 → modelconv-0.5.6}/modelconverter/utils/progress_handler.py +0 -0
- {modelconv-0.5.4 → modelconv-0.5.6}/requirements-analysis.txt +0 -0
- {modelconv-0.5.4 → modelconv-0.5.6}/requirements-bench.txt +0 -0
- {modelconv-0.5.4 → modelconv-0.5.6}/requirements-dev.txt +0 -0
- {modelconv-0.5.4 → modelconv-0.5.6}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: modelconv
|
|
3
|
-
Version: 0.5.
|
|
3
|
+
Version: 0.5.6
|
|
4
4
|
Summary: Converter for neural models into various formats.
|
|
5
5
|
Author-email: Luxonis <support@luxonis.com>
|
|
6
6
|
Maintainer-email: Luxonis <support@luxonis.com>
|
|
@@ -17,10 +17,12 @@ Requires-Python: >=3.10
|
|
|
17
17
|
Description-Content-Type: text/markdown
|
|
18
18
|
License-File: LICENSE
|
|
19
19
|
Requires-Dist: Pillow
|
|
20
|
-
Requires-Dist: luxonis-ml[data,gcs,
|
|
21
|
-
Requires-Dist: cyclopts
|
|
20
|
+
Requires-Dist: luxonis-ml[data,gcs,nn-archive,s3]>=0.8.5
|
|
21
|
+
Requires-Dist: cyclopts~=4.16
|
|
22
22
|
Requires-Dist: onnx==1.21.0
|
|
23
23
|
Requires-Dist: onnxruntime
|
|
24
|
+
Requires-Dist: onnxsim~=0.6
|
|
25
|
+
Requires-Dist: onnxslim~=0.1
|
|
24
26
|
Requires-Dist: onnxsim
|
|
25
27
|
Requires-Dist: docker
|
|
26
28
|
Requires-Dist: keyring
|
|
@@ -52,8 +54,6 @@ Requires-Dist: polars; extra == "rvc4"
|
|
|
52
54
|
Requires-Dist: pytest; extra == "rvc4"
|
|
53
55
|
Requires-Dist: onnx==1.18.0; extra == "rvc4"
|
|
54
56
|
Provides-Extra: hailo
|
|
55
|
-
Requires-Dist: nvidia-dali-cuda120==1.49.0; extra == "hailo"
|
|
56
|
-
Requires-Dist: nvidia-dali-tf-plugin-cuda120==1.49.0; extra == "hailo"
|
|
57
57
|
Requires-Dist: protobuf==3.20.3; extra == "hailo"
|
|
58
58
|
Requires-Dist: matplotlib==3.10.6; extra == "hailo"
|
|
59
59
|
Requires-Dist: pyparsing==2.4.7; extra == "hailo"
|
|
@@ -125,10 +125,10 @@ Run `modelconverter --help` to see the available commands and options.
|
|
|
125
125
|
|
|
126
126
|
There are two main ways to execute configure the conversion process:
|
|
127
127
|
|
|
128
|
-
1. **YAML Configuration File (Primary Method)**:
|
|
129
|
-
The primary way to configure the conversion is through a YAML configuration file. For reference, you can check [defaults.yaml](shared_with_container/configs/defaults.yaml) and other examples located in the [shared_with_container/configs](shared_with_container/configs) directory.
|
|
130
128
|
1. **NN Archive**:
|
|
131
129
|
Alternatively, you can use an [NN Archive](https://docs.luxonis.com/software-v3/ai-inference/nn-archive/#NN%20Archive) as input. An NN Archive includes a model in one of the supported formats—ONNX (.onnx), OpenVINO IR (.xml and .bin), or TensorFlow Lite (.tflite)—alongside a `config.json` file. The config.json file follows a specific configuration format as described under the `Configuration` section.
|
|
130
|
+
2. **YAML Configuration File (Legacy)**:
|
|
131
|
+
An alternative way to configure the conversion is through a YAML configuration file. For reference, you can check [defaults.yaml](shared_with_container/configs/defaults.yaml) and other examples located in the [shared_with_container/configs](shared_with_container/configs) directory.
|
|
132
132
|
|
|
133
133
|
**Modifying Settings with Command-Line Arguments**:
|
|
134
134
|
In addition to these two configuration methods, you have the flexibility to override specific settings directly via command-line arguments. By supplying `key-value` pairs in the CLI, you can adjust particular settings without explicitly altering the config files (YAML or NN Archive). For further details, refer to the [Examples](#examples) section.
|
|
@@ -259,21 +259,21 @@ Only the version `2022.3.0` of `OpenVino` is supported for `RVC3`. Follow the sa
|
|
|
259
259
|
|
|
260
260
|
**RVC4**
|
|
261
261
|
|
|
262
|
-
Requires `snpe-<version>.zip` archive to be present in `docker/extra_packages`. When building locally via the CLI, the tool will attempt to download the archive automatically if it is missing, but only when a **full SNPE build version** is provided (e.g. `2.
|
|
262
|
+
Requires `snpe-<version>.zip` archive to be present in `docker/extra_packages`. When building locally via the CLI, the tool will attempt to download the archive automatically if it is missing, but only when a **full SNPE build version** is provided (e.g. `2.41.0.251128`) and that version exists in the Qualcomm catalog. If you pass only the short version (e.g. `2.41.0`), the CLI expects either the image or archive to already be present. After the first download though you can use the local image with the short or long version.
|
|
263
263
|
You can also download different SNPE versions manually from [here](https://softwarecenter.qualcomm.com/catalog/item/Qualcomm_AI_Runtime_Community). After downloading, rename the archive according to the version number and place it in the `docker/extra_packages` directory.
|
|
264
264
|
|
|
265
|
-
Example (auto-download only on first build, afterwards available as `2.
|
|
265
|
+
Example (auto-download only on first build, afterwards available as `2.41.0.251128` or `2.41.0` ):
|
|
266
266
|
|
|
267
267
|
```bash
|
|
268
|
-
modelconverter convert rvc4 --tool-version 2.
|
|
268
|
+
modelconverter convert rvc4 --tool-version 2.41.0.251128 --path <config_or_archive>
|
|
269
269
|
```
|
|
270
270
|
|
|
271
271
|
Example (short version, assumes archive or image already present):
|
|
272
272
|
|
|
273
273
|
```bash
|
|
274
274
|
# Place the archive ahead of time (or run the command above beforehand):
|
|
275
|
-
# docker/extra_packages/snpe-2.
|
|
276
|
-
modelconverter convert rvc4 --tool-version 2.
|
|
275
|
+
# docker/extra_packages/snpe-2.41.0.zip
|
|
276
|
+
modelconverter convert rvc4 --tool-version 2.41.0 --path <config_or_archive>
|
|
277
277
|
```
|
|
278
278
|
|
|
279
279
|
**HAILO**
|
|
@@ -305,7 +305,7 @@ docker build -f docker/rvc2/Dockerfile \
|
|
|
305
305
|
> When the `--build-arg` flag is not provided, the Dockerfiles (`docker/<target>/Dockerfile`) fall back to their built-in default tool versions:
|
|
306
306
|
>
|
|
307
307
|
> - RVC2: `2022.3.0`
|
|
308
|
-
> - RVC4: `2.
|
|
308
|
+
> - RVC4: `2.41.0`
|
|
309
309
|
|
|
310
310
|
#### Local Image Tagging and CLI Usage
|
|
311
311
|
|
|
@@ -361,10 +361,10 @@ modelconverter convert rvc4 \
|
|
|
361
361
|
Example letting the CLI construct the tag automatically:
|
|
362
362
|
|
|
363
363
|
```bash
|
|
364
|
-
# Resolves to: luxonis/modelconverter-rvc4:2.
|
|
364
|
+
# Resolves to: luxonis/modelconverter-rvc4:2.41.0-latest
|
|
365
365
|
modelconverter convert rvc4 \
|
|
366
366
|
--image luxonis/modelconverter-rvc4 \
|
|
367
|
-
--tool-version 2.
|
|
367
|
+
--tool-version 2.41.0 \
|
|
368
368
|
--path <config_or_archive>
|
|
369
369
|
```
|
|
370
370
|
|
|
@@ -421,11 +421,11 @@ You can run the built image either manually using the `docker run` command or us
|
|
|
421
421
|
export AWS_S3_ENDPOINT_URL=<your_aws_s3_endpoint_url>
|
|
422
422
|
```
|
|
423
423
|
|
|
424
|
-
|
|
424
|
+
2. If `shared_with_container` directory doesn't exist on your host, create it.
|
|
425
425
|
|
|
426
|
-
|
|
426
|
+
3. Without remote files, place the model, config, and calibration data in the respective directories (refer [Sharing Files](#sharing-files)).
|
|
427
427
|
|
|
428
|
-
|
|
428
|
+
4. Execute the conversion:
|
|
429
429
|
|
|
430
430
|
- If using the `modelconverter` CLI:
|
|
431
431
|
|
|
@@ -526,7 +526,7 @@ modelconverter convert rvc3 --path configs/resnet18.yaml \
|
|
|
526
526
|
Specify all options via the command line without a config file:
|
|
527
527
|
|
|
528
528
|
```bash
|
|
529
|
-
modelconverter convert rvc2
|
|
529
|
+
modelconverter convert rvc2 --path models/yolov6n.onnx \
|
|
530
530
|
scale_values "[255,255,255]" \
|
|
531
531
|
inputs.0.encoding.from RGB \
|
|
532
532
|
inputs.0.encoding.to BGR \
|
|
@@ -542,7 +542,7 @@ modelconverter convert rvc2 input_model models/yolov6n.onnx \
|
|
|
542
542
|
## Multi-Stage Conversion
|
|
543
543
|
|
|
544
544
|
The converter supports multi-stage conversion. This means conversion of multiple
|
|
545
|
-
models where the output of one model is the input to another model. For
|
|
545
|
+
models where the output of one model is the input to another model. For multi-stage
|
|
546
546
|
conversion you must specify the `stages` section in the config file, see [defaults.yaml](shared_with_container/configs/defaults.yaml)
|
|
547
547
|
and [multistage.yaml](shared_with_container/configs/multistage.yaml) for reference.
|
|
548
548
|
|
|
@@ -667,37 +667,52 @@ For usage instructions, see `modelconverter benchmark --help`.
|
|
|
667
667
|
**Example:**
|
|
668
668
|
|
|
669
669
|
```bash
|
|
670
|
-
modelconverter benchmark rvc4 --model-path <path_to_model.
|
|
670
|
+
modelconverter benchmark rvc4 --model-path <path_to_model.tar.xz>
|
|
671
671
|
```
|
|
672
672
|
|
|
673
673
|
The command prints a table with the benchmark results to the console and
|
|
674
|
-
|
|
674
|
+
kptionally saves the results to a `.csv` file.
|
|
675
675
|
|
|
676
|
-
> [!
|
|
677
|
-
>
|
|
676
|
+
> [!IMPORTANT]
|
|
677
|
+
> **Device Connection Requirements for RVC4**: The device must be connected and accessible either using the [Android Debug Bridge (ADB)](https://developer.android.com/tools/adb) or via SSH for the benchmarking to work in the following cases:
|
|
678
|
+
>
|
|
679
|
+
> - When `--device-monitor` is enabled (requires ADB or SSH connection to the device to calculate power consumption)
|
|
680
|
+
> - When benchmarking is conducted using the SNPE tools (with `--no-dai-benchmark`; default is `--dai-benchmark`)
|
|
681
|
+
>
|
|
682
|
+
> The tool can find the correct device automatically but you can also specify it with the `--device-id` flag.
|
|
678
683
|
|
|
679
684
|
> [!NOTE]
|
|
680
|
-
> **
|
|
685
|
+
> **Duration Control**:
|
|
686
|
+
> There are two ways how to specify the duration of the benchmark:
|
|
687
|
+
>
|
|
688
|
+
> `depthai` backend (default):
|
|
689
|
+
>
|
|
690
|
+
> - `--benchmark-time`: The duration of the benchmark in seconds (default is 20 seconds).
|
|
681
691
|
>
|
|
682
|
-
>
|
|
683
|
-
> - `--repetitions`: Number of iterations to perform (default: 10)
|
|
692
|
+
> `SNPE` backend (only **RVC4** with `--no-dai-benchmark`):
|
|
684
693
|
>
|
|
685
|
-
>
|
|
694
|
+
> - `--num-images`: The number of images to run through the model (default is 500). The total benchmark time will depend on the model size and complexity, as well as the device performance. Too many images may lead to an out-of-memory error, while too few images may lead to less accurate results. Adjust this parameter based on your specific situation and requirements.
|
|
686
695
|
|
|
687
|
-
> [!
|
|
688
|
-
>
|
|
696
|
+
> [!NOTE]
|
|
697
|
+
> Benchmark input support depends on the target and backend:
|
|
698
|
+
>
|
|
699
|
+
> - **RVC2**: `--model-path` can be a local `.blob`, an NN Archive (`.tar.xz`), or a model slug from [Luxonis HubAI](https://hub.luxonis.com/ai).
|
|
700
|
+
> - **RVC4** with `--dai-benchmark` (default): `--model-path` can be an NN Archive (`.tar.xz`) or a model slug from [Luxonis HubAI](https://hub.luxonis.com/ai).
|
|
701
|
+
> - **RVC4** with `--no-dai-benchmark`: `--model-path` can be an NN Archive (`.tar.xz`), a model slug from [Luxonis HubAI](https://hub.luxonis.com/ai) or a `.dlc` file.
|
|
702
|
+
> In the case of a `.dlc` file, the tool `snpe-dlc-info` must be available in `PATH` either on the host machine or on the device.
|
|
689
703
|
>
|
|
690
|
-
>
|
|
691
|
-
|
|
692
|
-
>
|
|
704
|
+
> To access models from different teams in Luxonis HubAI, remember to update the `HUBAI_API_KEY` environment variable accordingly when using a model slug as an input.
|
|
705
|
+
|
|
706
|
+
> [!NOTE]
|
|
707
|
+
> If you experience Segmentation Faults (core dumps) during benchmarking on RVC4 using the SNPE backend (`--no-dai-benchmark`), it may be due to the device running out of memory. Try decreasing the value of `--num-images` (the default is 500) to reduce RAM usage.
|
|
693
708
|
|
|
694
709
|
## [RVC4] DLC model analysis
|
|
695
710
|
|
|
696
711
|
ModelConverter offers additional analysis tools for the RVC4 platform. The tools provide an in-depth look at the following:
|
|
697
712
|
|
|
698
713
|
1. The outputs of all layers in comparison to the ground truth ONNX model,
|
|
699
|
-
|
|
700
|
-
|
|
714
|
+
2. The cycle usage of each layer on an RVC4 device.
|
|
715
|
+
3. Visualizations for fast and easy comparison of multiple models.
|
|
701
716
|
|
|
702
717
|
This gives the user better insight into the successful quantization of a model, helps discover potential speed bottleneck layers, and allows for the comparison of different quantization parameters.
|
|
703
718
|
|
|
@@ -710,18 +725,21 @@ pip install modelconv[analysis]
|
|
|
710
725
|
There are several options to run the tools. The most general approach is:
|
|
711
726
|
|
|
712
727
|
```bash
|
|
713
|
-
modelconverter analyze
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
728
|
+
modelconverter analyze \
|
|
729
|
+
--dlc-model-path <dlc_model> \
|
|
730
|
+
--onnx-model-path <onnx_model> \
|
|
731
|
+
--image-dirs <input_name_1> <path_to_input_images_1> \
|
|
732
|
+
...
|
|
733
|
+
<input_name_n> <path_to_input_images_n>
|
|
719
734
|
```
|
|
720
735
|
|
|
721
736
|
If the model accepts only one input, there is no need to specify the input name and the tools can simply be ran as:
|
|
722
737
|
|
|
723
738
|
```bash
|
|
724
|
-
modelconverter analyze
|
|
739
|
+
modelconverter analyze \
|
|
740
|
+
--dlc-model-path <dlc_model> \
|
|
741
|
+
--onnx-model-path <onnx_model> \
|
|
742
|
+
--image-dirs <path_to_input_images>
|
|
725
743
|
```
|
|
726
744
|
|
|
727
745
|
For other usage instructions run `modelconverter analyze --help`
|
|
@@ -63,10 +63,10 @@ Run `modelconverter --help` to see the available commands and options.
|
|
|
63
63
|
|
|
64
64
|
There are two main ways to execute configure the conversion process:
|
|
65
65
|
|
|
66
|
-
1. **YAML Configuration File (Primary Method)**:
|
|
67
|
-
The primary way to configure the conversion is through a YAML configuration file. For reference, you can check [defaults.yaml](shared_with_container/configs/defaults.yaml) and other examples located in the [shared_with_container/configs](shared_with_container/configs) directory.
|
|
68
66
|
1. **NN Archive**:
|
|
69
67
|
Alternatively, you can use an [NN Archive](https://docs.luxonis.com/software-v3/ai-inference/nn-archive/#NN%20Archive) as input. An NN Archive includes a model in one of the supported formats—ONNX (.onnx), OpenVINO IR (.xml and .bin), or TensorFlow Lite (.tflite)—alongside a `config.json` file. The config.json file follows a specific configuration format as described under the `Configuration` section.
|
|
68
|
+
2. **YAML Configuration File (Legacy)**:
|
|
69
|
+
An alternative way to configure the conversion is through a YAML configuration file. For reference, you can check [defaults.yaml](shared_with_container/configs/defaults.yaml) and other examples located in the [shared_with_container/configs](shared_with_container/configs) directory.
|
|
70
70
|
|
|
71
71
|
**Modifying Settings with Command-Line Arguments**:
|
|
72
72
|
In addition to these two configuration methods, you have the flexibility to override specific settings directly via command-line arguments. By supplying `key-value` pairs in the CLI, you can adjust particular settings without explicitly altering the config files (YAML or NN Archive). For further details, refer to the [Examples](#examples) section.
|
|
@@ -197,21 +197,21 @@ Only the version `2022.3.0` of `OpenVino` is supported for `RVC3`. Follow the sa
|
|
|
197
197
|
|
|
198
198
|
**RVC4**
|
|
199
199
|
|
|
200
|
-
Requires `snpe-<version>.zip` archive to be present in `docker/extra_packages`. When building locally via the CLI, the tool will attempt to download the archive automatically if it is missing, but only when a **full SNPE build version** is provided (e.g. `2.
|
|
200
|
+
Requires `snpe-<version>.zip` archive to be present in `docker/extra_packages`. When building locally via the CLI, the tool will attempt to download the archive automatically if it is missing, but only when a **full SNPE build version** is provided (e.g. `2.41.0.251128`) and that version exists in the Qualcomm catalog. If you pass only the short version (e.g. `2.41.0`), the CLI expects either the image or archive to already be present. After the first download though you can use the local image with the short or long version.
|
|
201
201
|
You can also download different SNPE versions manually from [here](https://softwarecenter.qualcomm.com/catalog/item/Qualcomm_AI_Runtime_Community). After downloading, rename the archive according to the version number and place it in the `docker/extra_packages` directory.
|
|
202
202
|
|
|
203
|
-
Example (auto-download only on first build, afterwards available as `2.
|
|
203
|
+
Example (auto-download only on first build, afterwards available as `2.41.0.251128` or `2.41.0` ):
|
|
204
204
|
|
|
205
205
|
```bash
|
|
206
|
-
modelconverter convert rvc4 --tool-version 2.
|
|
206
|
+
modelconverter convert rvc4 --tool-version 2.41.0.251128 --path <config_or_archive>
|
|
207
207
|
```
|
|
208
208
|
|
|
209
209
|
Example (short version, assumes archive or image already present):
|
|
210
210
|
|
|
211
211
|
```bash
|
|
212
212
|
# Place the archive ahead of time (or run the command above beforehand):
|
|
213
|
-
# docker/extra_packages/snpe-2.
|
|
214
|
-
modelconverter convert rvc4 --tool-version 2.
|
|
213
|
+
# docker/extra_packages/snpe-2.41.0.zip
|
|
214
|
+
modelconverter convert rvc4 --tool-version 2.41.0 --path <config_or_archive>
|
|
215
215
|
```
|
|
216
216
|
|
|
217
217
|
**HAILO**
|
|
@@ -243,7 +243,7 @@ docker build -f docker/rvc2/Dockerfile \
|
|
|
243
243
|
> When the `--build-arg` flag is not provided, the Dockerfiles (`docker/<target>/Dockerfile`) fall back to their built-in default tool versions:
|
|
244
244
|
>
|
|
245
245
|
> - RVC2: `2022.3.0`
|
|
246
|
-
> - RVC4: `2.
|
|
246
|
+
> - RVC4: `2.41.0`
|
|
247
247
|
|
|
248
248
|
#### Local Image Tagging and CLI Usage
|
|
249
249
|
|
|
@@ -299,10 +299,10 @@ modelconverter convert rvc4 \
|
|
|
299
299
|
Example letting the CLI construct the tag automatically:
|
|
300
300
|
|
|
301
301
|
```bash
|
|
302
|
-
# Resolves to: luxonis/modelconverter-rvc4:2.
|
|
302
|
+
# Resolves to: luxonis/modelconverter-rvc4:2.41.0-latest
|
|
303
303
|
modelconverter convert rvc4 \
|
|
304
304
|
--image luxonis/modelconverter-rvc4 \
|
|
305
|
-
--tool-version 2.
|
|
305
|
+
--tool-version 2.41.0 \
|
|
306
306
|
--path <config_or_archive>
|
|
307
307
|
```
|
|
308
308
|
|
|
@@ -359,11 +359,11 @@ You can run the built image either manually using the `docker run` command or us
|
|
|
359
359
|
export AWS_S3_ENDPOINT_URL=<your_aws_s3_endpoint_url>
|
|
360
360
|
```
|
|
361
361
|
|
|
362
|
-
|
|
362
|
+
2. If `shared_with_container` directory doesn't exist on your host, create it.
|
|
363
363
|
|
|
364
|
-
|
|
364
|
+
3. Without remote files, place the model, config, and calibration data in the respective directories (refer [Sharing Files](#sharing-files)).
|
|
365
365
|
|
|
366
|
-
|
|
366
|
+
4. Execute the conversion:
|
|
367
367
|
|
|
368
368
|
- If using the `modelconverter` CLI:
|
|
369
369
|
|
|
@@ -464,7 +464,7 @@ modelconverter convert rvc3 --path configs/resnet18.yaml \
|
|
|
464
464
|
Specify all options via the command line without a config file:
|
|
465
465
|
|
|
466
466
|
```bash
|
|
467
|
-
modelconverter convert rvc2
|
|
467
|
+
modelconverter convert rvc2 --path models/yolov6n.onnx \
|
|
468
468
|
scale_values "[255,255,255]" \
|
|
469
469
|
inputs.0.encoding.from RGB \
|
|
470
470
|
inputs.0.encoding.to BGR \
|
|
@@ -480,7 +480,7 @@ modelconverter convert rvc2 input_model models/yolov6n.onnx \
|
|
|
480
480
|
## Multi-Stage Conversion
|
|
481
481
|
|
|
482
482
|
The converter supports multi-stage conversion. This means conversion of multiple
|
|
483
|
-
models where the output of one model is the input to another model. For
|
|
483
|
+
models where the output of one model is the input to another model. For multi-stage
|
|
484
484
|
conversion you must specify the `stages` section in the config file, see [defaults.yaml](shared_with_container/configs/defaults.yaml)
|
|
485
485
|
and [multistage.yaml](shared_with_container/configs/multistage.yaml) for reference.
|
|
486
486
|
|
|
@@ -605,37 +605,52 @@ For usage instructions, see `modelconverter benchmark --help`.
|
|
|
605
605
|
**Example:**
|
|
606
606
|
|
|
607
607
|
```bash
|
|
608
|
-
modelconverter benchmark rvc4 --model-path <path_to_model.
|
|
608
|
+
modelconverter benchmark rvc4 --model-path <path_to_model.tar.xz>
|
|
609
609
|
```
|
|
610
610
|
|
|
611
611
|
The command prints a table with the benchmark results to the console and
|
|
612
|
-
|
|
612
|
+
kptionally saves the results to a `.csv` file.
|
|
613
613
|
|
|
614
|
-
> [!
|
|
615
|
-
>
|
|
614
|
+
> [!IMPORTANT]
|
|
615
|
+
> **Device Connection Requirements for RVC4**: The device must be connected and accessible either using the [Android Debug Bridge (ADB)](https://developer.android.com/tools/adb) or via SSH for the benchmarking to work in the following cases:
|
|
616
|
+
>
|
|
617
|
+
> - When `--device-monitor` is enabled (requires ADB or SSH connection to the device to calculate power consumption)
|
|
618
|
+
> - When benchmarking is conducted using the SNPE tools (with `--no-dai-benchmark`; default is `--dai-benchmark`)
|
|
619
|
+
>
|
|
620
|
+
> The tool can find the correct device automatically but you can also specify it with the `--device-id` flag.
|
|
616
621
|
|
|
617
622
|
> [!NOTE]
|
|
618
|
-
> **
|
|
623
|
+
> **Duration Control**:
|
|
624
|
+
> There are two ways how to specify the duration of the benchmark:
|
|
625
|
+
>
|
|
626
|
+
> `depthai` backend (default):
|
|
627
|
+
>
|
|
628
|
+
> - `--benchmark-time`: The duration of the benchmark in seconds (default is 20 seconds).
|
|
619
629
|
>
|
|
620
|
-
>
|
|
621
|
-
> - `--repetitions`: Number of iterations to perform (default: 10)
|
|
630
|
+
> `SNPE` backend (only **RVC4** with `--no-dai-benchmark`):
|
|
622
631
|
>
|
|
623
|
-
>
|
|
632
|
+
> - `--num-images`: The number of images to run through the model (default is 500). The total benchmark time will depend on the model size and complexity, as well as the device performance. Too many images may lead to an out-of-memory error, while too few images may lead to less accurate results. Adjust this parameter based on your specific situation and requirements.
|
|
624
633
|
|
|
625
|
-
> [!
|
|
626
|
-
>
|
|
634
|
+
> [!NOTE]
|
|
635
|
+
> Benchmark input support depends on the target and backend:
|
|
636
|
+
>
|
|
637
|
+
> - **RVC2**: `--model-path` can be a local `.blob`, an NN Archive (`.tar.xz`), or a model slug from [Luxonis HubAI](https://hub.luxonis.com/ai).
|
|
638
|
+
> - **RVC4** with `--dai-benchmark` (default): `--model-path` can be an NN Archive (`.tar.xz`) or a model slug from [Luxonis HubAI](https://hub.luxonis.com/ai).
|
|
639
|
+
> - **RVC4** with `--no-dai-benchmark`: `--model-path` can be an NN Archive (`.tar.xz`), a model slug from [Luxonis HubAI](https://hub.luxonis.com/ai) or a `.dlc` file.
|
|
640
|
+
> In the case of a `.dlc` file, the tool `snpe-dlc-info` must be available in `PATH` either on the host machine or on the device.
|
|
627
641
|
>
|
|
628
|
-
>
|
|
629
|
-
|
|
630
|
-
>
|
|
642
|
+
> To access models from different teams in Luxonis HubAI, remember to update the `HUBAI_API_KEY` environment variable accordingly when using a model slug as an input.
|
|
643
|
+
|
|
644
|
+
> [!NOTE]
|
|
645
|
+
> If you experience Segmentation Faults (core dumps) during benchmarking on RVC4 using the SNPE backend (`--no-dai-benchmark`), it may be due to the device running out of memory. Try decreasing the value of `--num-images` (the default is 500) to reduce RAM usage.
|
|
631
646
|
|
|
632
647
|
## [RVC4] DLC model analysis
|
|
633
648
|
|
|
634
649
|
ModelConverter offers additional analysis tools for the RVC4 platform. The tools provide an in-depth look at the following:
|
|
635
650
|
|
|
636
651
|
1. The outputs of all layers in comparison to the ground truth ONNX model,
|
|
637
|
-
|
|
638
|
-
|
|
652
|
+
2. The cycle usage of each layer on an RVC4 device.
|
|
653
|
+
3. Visualizations for fast and easy comparison of multiple models.
|
|
639
654
|
|
|
640
655
|
This gives the user better insight into the successful quantization of a model, helps discover potential speed bottleneck layers, and allows for the comparison of different quantization parameters.
|
|
641
656
|
|
|
@@ -648,18 +663,21 @@ pip install modelconv[analysis]
|
|
|
648
663
|
There are several options to run the tools. The most general approach is:
|
|
649
664
|
|
|
650
665
|
```bash
|
|
651
|
-
modelconverter analyze
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
666
|
+
modelconverter analyze \
|
|
667
|
+
--dlc-model-path <dlc_model> \
|
|
668
|
+
--onnx-model-path <onnx_model> \
|
|
669
|
+
--image-dirs <input_name_1> <path_to_input_images_1> \
|
|
670
|
+
...
|
|
671
|
+
<input_name_n> <path_to_input_images_n>
|
|
657
672
|
```
|
|
658
673
|
|
|
659
674
|
If the model accepts only one input, there is no need to specify the input name and the tools can simply be ran as:
|
|
660
675
|
|
|
661
676
|
```bash
|
|
662
|
-
modelconverter analyze
|
|
677
|
+
modelconverter analyze \
|
|
678
|
+
--dlc-model-path <dlc_model> \
|
|
679
|
+
--onnx-model-path <onnx_model> \
|
|
680
|
+
--image-dirs <path_to_input_images>
|
|
663
681
|
```
|
|
664
682
|
|
|
665
683
|
For other usage instructions run `modelconverter analyze --help`
|