modelconv 0.4.2__tar.gz → 0.4.3__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.4.2 → modelconv-0.4.3}/PKG-INFO +46 -25
- {modelconv-0.4.2 → modelconv-0.4.3}/README.md +44 -22
- {modelconv-0.4.2 → modelconv-0.4.3}/modelconv.egg-info/PKG-INFO +46 -25
- {modelconv-0.4.2 → modelconv-0.4.3}/modelconv.egg-info/SOURCES.txt +2 -0
- {modelconv-0.4.2 → modelconv-0.4.3}/modelconv.egg-info/requires.txt +1 -2
- {modelconv-0.4.2 → modelconv-0.4.3}/modelconverter/__init__.py +1 -1
- {modelconv-0.4.2 → modelconv-0.4.3}/modelconverter/__main__.py +67 -17
- {modelconv-0.4.2 → modelconv-0.4.3}/modelconverter/cli/utils.py +5 -0
- {modelconv-0.4.2 → modelconv-0.4.3}/modelconverter/hub/__main__.py +25 -19
- {modelconv-0.4.2 → modelconv-0.4.3}/modelconverter/hub/convert.py +1 -1
- {modelconv-0.4.2 → modelconv-0.4.3}/modelconverter/packages/base_analyze.py +1 -0
- {modelconv-0.4.2 → modelconv-0.4.3}/modelconverter/packages/base_benchmark.py +25 -5
- {modelconv-0.4.2 → modelconv-0.4.3}/modelconverter/packages/base_exporter.py +43 -19
- {modelconv-0.4.2 → modelconv-0.4.3}/modelconverter/packages/hailo/exporter.py +4 -15
- {modelconv-0.4.2 → modelconv-0.4.3}/modelconverter/packages/rvc2/benchmark.py +31 -27
- {modelconv-0.4.2 → modelconv-0.4.3}/modelconverter/packages/rvc4/analyze.py +167 -51
- {modelconv-0.4.2 → modelconv-0.4.3}/modelconverter/packages/rvc4/benchmark.py +33 -23
- {modelconv-0.4.2 → modelconv-0.4.3}/modelconverter/packages/rvc4/exporter.py +5 -1
- {modelconv-0.4.2 → modelconv-0.4.3}/modelconverter/utils/__init__.py +6 -2
- {modelconv-0.4.2 → modelconv-0.4.3}/modelconverter/utils/adb_handler.py +28 -0
- {modelconv-0.4.2 → modelconv-0.4.3}/modelconverter/utils/config.py +6 -1
- {modelconv-0.4.2 → modelconv-0.4.3}/modelconverter/utils/docker_utils.py +101 -22
- {modelconv-0.4.2 → modelconv-0.4.3}/modelconverter/utils/environ.py +18 -9
- {modelconv-0.4.2 → modelconv-0.4.3}/modelconverter/utils/filesystem_utils.py +6 -2
- modelconv-0.4.3/modelconverter/utils/general.py +54 -0
- {modelconv-0.4.2 → modelconv-0.4.3}/modelconverter/utils/metadata.py +51 -7
- {modelconv-0.4.2 → modelconv-0.4.3}/modelconverter/utils/nn_archive.py +6 -3
- {modelconv-0.4.2 → modelconv-0.4.3}/modelconverter/utils/onnx_tools.py +11 -0
- modelconv-0.4.3/modelconverter/utils/progress_handler.py +66 -0
- {modelconv-0.4.2 → modelconv-0.4.3}/pyproject.toml +1 -0
- {modelconv-0.4.2 → modelconv-0.4.3}/requirements-dev.txt +0 -1
- {modelconv-0.4.2 → modelconv-0.4.3}/requirements.txt +1 -1
- {modelconv-0.4.2 → modelconv-0.4.3}/tests/test_utils/test_config.py +3 -0
- {modelconv-0.4.2 → modelconv-0.4.3}/tests/test_utils/test_filesystem.py +3 -5
- {modelconv-0.4.2 → modelconv-0.4.3}/LICENSE +0 -0
- {modelconv-0.4.2 → modelconv-0.4.3}/modelconv.egg-info/dependency_links.txt +0 -0
- {modelconv-0.4.2 → modelconv-0.4.3}/modelconv.egg-info/entry_points.txt +0 -0
- {modelconv-0.4.2 → modelconv-0.4.3}/modelconv.egg-info/top_level.txt +0 -0
- {modelconv-0.4.2 → modelconv-0.4.3}/modelconverter/cli/__init__.py +0 -0
- {modelconv-0.4.2 → modelconv-0.4.3}/modelconverter/hub/__init__.py +0 -0
- {modelconv-0.4.2 → modelconv-0.4.3}/modelconverter/hub/hub_requests.py +0 -0
- {modelconv-0.4.2 → modelconv-0.4.3}/modelconverter/hub/typing.py +0 -0
- {modelconv-0.4.2 → modelconv-0.4.3}/modelconverter/packages/__init__.py +0 -0
- {modelconv-0.4.2 → modelconv-0.4.3}/modelconverter/packages/base_inferer.py +0 -0
- {modelconv-0.4.2 → modelconv-0.4.3}/modelconverter/packages/base_visualize.py +0 -0
- {modelconv-0.4.2 → modelconv-0.4.3}/modelconverter/packages/getters.py +0 -0
- {modelconv-0.4.2 → modelconv-0.4.3}/modelconverter/packages/hailo/__init__.py +0 -0
- {modelconv-0.4.2 → modelconv-0.4.3}/modelconverter/packages/hailo/inferer.py +0 -0
- {modelconv-0.4.2 → modelconv-0.4.3}/modelconverter/packages/hailo/requirements.txt +0 -0
- {modelconv-0.4.2 → modelconv-0.4.3}/modelconverter/packages/multistage_exporter.py +0 -0
- {modelconv-0.4.2 → modelconv-0.4.3}/modelconverter/packages/rvc2/__init__.py +0 -0
- {modelconv-0.4.2 → modelconv-0.4.3}/modelconverter/packages/rvc2/exporter.py +0 -0
- {modelconv-0.4.2 → modelconv-0.4.3}/modelconverter/packages/rvc2/inferer.py +0 -0
- {modelconv-0.4.2 → modelconv-0.4.3}/modelconverter/packages/rvc2/requirements.txt +0 -0
- {modelconv-0.4.2 → modelconv-0.4.3}/modelconverter/packages/rvc3/__init__.py +0 -0
- {modelconv-0.4.2 → modelconv-0.4.3}/modelconverter/packages/rvc3/benchmark.py +0 -0
- {modelconv-0.4.2 → modelconv-0.4.3}/modelconverter/packages/rvc3/exporter.py +0 -0
- {modelconv-0.4.2 → modelconv-0.4.3}/modelconverter/packages/rvc3/inferer.py +0 -0
- {modelconv-0.4.2 → modelconv-0.4.3}/modelconverter/packages/rvc3/requirements.txt +0 -0
- {modelconv-0.4.2 → modelconv-0.4.3}/modelconverter/packages/rvc4/__init__.py +0 -0
- {modelconv-0.4.2 → modelconv-0.4.3}/modelconverter/packages/rvc4/inferer.py +0 -0
- {modelconv-0.4.2 → modelconv-0.4.3}/modelconverter/packages/rvc4/requirements.txt +0 -0
- {modelconv-0.4.2 → modelconv-0.4.3}/modelconverter/packages/rvc4/visualize.py +0 -0
- {modelconv-0.4.2 → modelconv-0.4.3}/modelconverter/utils/calibration_data.py +0 -0
- {modelconv-0.4.2 → modelconv-0.4.3}/modelconverter/utils/constants.py +0 -0
- {modelconv-0.4.2 → modelconv-0.4.3}/modelconverter/utils/exceptions.py +0 -0
- {modelconv-0.4.2 → modelconv-0.4.3}/modelconverter/utils/hubai_utils.py +0 -0
- {modelconv-0.4.2 → modelconv-0.4.3}/modelconverter/utils/image.py +0 -0
- {modelconv-0.4.2 → modelconv-0.4.3}/modelconverter/utils/layout.py +0 -0
- {modelconv-0.4.2 → modelconv-0.4.3}/modelconverter/utils/subprocess.py +0 -0
- {modelconv-0.4.2 → modelconv-0.4.3}/modelconverter/utils/types.py +0 -0
- {modelconv-0.4.2 → modelconv-0.4.3}/requirements-analysis.txt +0 -0
- {modelconv-0.4.2 → modelconv-0.4.3}/requirements-bench.txt +0 -0
- {modelconv-0.4.2 → modelconv-0.4.3}/setup.cfg +0 -0
- {modelconv-0.4.2 → modelconv-0.4.3}/tests/__init__.py +0 -0
- {modelconv-0.4.2 → modelconv-0.4.3}/tests/conftest.py +0 -0
- {modelconv-0.4.2 → modelconv-0.4.3}/tests/test_packages/__init__.py +0 -0
- {modelconv-0.4.2 → modelconv-0.4.3}/tests/test_packages/common.py +0 -0
- {modelconv-0.4.2 → modelconv-0.4.3}/tests/test_packages/metrics/__init__.py +0 -0
- {modelconv-0.4.2 → modelconv-0.4.3}/tests/test_packages/metrics/base_metric.py +0 -0
- {modelconv-0.4.2 → modelconv-0.4.3}/tests/test_packages/metrics/mnist_metric.py +0 -0
- {modelconv-0.4.2 → modelconv-0.4.3}/tests/test_packages/metrics/resnet_metric.py +0 -0
- {modelconv-0.4.2 → modelconv-0.4.3}/tests/test_packages/metrics/yolov6_metric.py +0 -0
- {modelconv-0.4.2 → modelconv-0.4.3}/tests/test_packages/onnx_inferer.py +0 -0
- {modelconv-0.4.2 → modelconv-0.4.3}/tests/test_packages/test_cross_format_export.py +0 -0
- {modelconv-0.4.2 → modelconv-0.4.3}/tests/test_packages/test_hailo.py +0 -0
- {modelconv-0.4.2 → modelconv-0.4.3}/tests/test_packages/test_rvc2.py +0 -0
- {modelconv-0.4.2 → modelconv-0.4.3}/tests/test_packages/test_rvc3.py +0 -0
- {modelconv-0.4.2 → modelconv-0.4.3}/tests/test_packages/test_rvc4.py +0 -0
- {modelconv-0.4.2 → modelconv-0.4.3}/tests/test_utils/__init__.py +0 -0
- {modelconv-0.4.2 → modelconv-0.4.3}/tests/test_utils/conftest.py +0 -0
- {modelconv-0.4.2 → modelconv-0.4.3}/tests/test_utils/test_image.py +0 -0
- {modelconv-0.4.2 → modelconv-0.4.3}/tests/test_utils/test_layout.py +0 -0
- {modelconv-0.4.2 → modelconv-0.4.3}/tests/test_utils/test_modifier.py +0 -0
- {modelconv-0.4.2 → modelconv-0.4.3}/tests/test_utils/test_subprocess.py +0 -0
- {modelconv-0.4.2 → modelconv-0.4.3}/tools/__init__.py +0 -0
- {modelconv-0.4.2 → modelconv-0.4.3}/tools/convert_hub_rvc4_models.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: modelconv
|
|
3
|
-
Version: 0.4.
|
|
3
|
+
Version: 0.4.3
|
|
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,7 +17,7 @@ Description-Content-Type: text/markdown
|
|
|
17
17
|
License-File: LICENSE
|
|
18
18
|
Requires-Dist: Pillow
|
|
19
19
|
Requires-Dist: gcsfs
|
|
20
|
-
Requires-Dist: luxonis-ml[data,nn_archive]==0.
|
|
20
|
+
Requires-Dist: luxonis-ml[data,nn_archive]==0.8.0
|
|
21
21
|
Requires-Dist: onnx>=1.17.0
|
|
22
22
|
Requires-Dist: onnxruntime
|
|
23
23
|
Requires-Dist: onnxsim
|
|
@@ -39,7 +39,6 @@ Requires-Dist: plotly; extra == "analysis"
|
|
|
39
39
|
Provides-Extra: dev
|
|
40
40
|
Requires-Dist: pre-commit==3.2.1; extra == "dev"
|
|
41
41
|
Requires-Dist: pytest-cov>=4.1.0; extra == "dev"
|
|
42
|
-
Requires-Dist: docker-squash>=1.1.0; extra == "dev"
|
|
43
42
|
Requires-Dist: depthai==3.0.0a14; extra == "dev"
|
|
44
43
|
Provides-Extra: rvc2
|
|
45
44
|
Requires-Dist: tflite2onnx; extra == "rvc2"
|
|
@@ -100,7 +99,7 @@ Convert your **ONNX** models to a format compatible with any generation of Luxon
|
|
|
100
99
|
- [Calibration Data](#calibration-data)
|
|
101
100
|
- [Inference](#inference)
|
|
102
101
|
- [Inference Example](#inference-example)
|
|
103
|
-
- [
|
|
102
|
+
- [[RVC4] DLC model analysis](#rvc4-dlc-model-analysis)
|
|
104
103
|
- [Benchmarking](#benchmarking)
|
|
105
104
|
|
|
106
105
|
## Installation
|
|
@@ -114,7 +113,7 @@ pip install modelconv
|
|
|
114
113
|
|
|
115
114
|
Run `modelconverter --help` to see the available commands and options.
|
|
116
115
|
|
|
117
|
-
>
|
|
116
|
+
> [!NOTE]
|
|
118
117
|
> To use the [benchmarking feature](#benchmarking), the `depthai v3` package must be installed. While the `depthai v3` is not yet released on PyPI, you can install it with the following command:
|
|
119
118
|
>
|
|
120
119
|
> ```bash
|
|
@@ -150,10 +149,10 @@ The `encoding` flag in the YAML configuration file allows you to specify color e
|
|
|
150
149
|
```
|
|
151
150
|
This configuration specifies that the input data is in RGB format and will be converted to BGR format during processing.
|
|
152
151
|
|
|
153
|
-
>
|
|
152
|
+
> [!NOTE]
|
|
154
153
|
> If the encoding is not specified in the YAML configuration, the default values are set to `encoding.from=RGB` and `encoding.to=BGR`.
|
|
155
154
|
|
|
156
|
-
>
|
|
155
|
+
> [!NOTE]
|
|
157
156
|
> Certain options can be set **globally**, applying to all inputs of the model, or **per input**. If specified per input, these settings will override the global configuration for that input alone. The options that support this flexibility include `scale_values`, `mean_values`, `encoding`, `data_type`, `shape`, and `layout`.
|
|
158
157
|
|
|
159
158
|
### NN Archive Configuration File
|
|
@@ -165,13 +164,13 @@ In the NN Archive configuration, there are two flags related to color encoding c
|
|
|
165
164
|
- **`reverse_channels` (Deprecated)**:
|
|
166
165
|
Determines the input color format of the model: when set to *True*, the input is considered to be *"RGB"*, and when set to *False*, it is treated as *"BGR"*. This flag is deprecated and will be replaced by the `dai_type` flag in future versions.
|
|
167
166
|
|
|
168
|
-
>
|
|
167
|
+
> [!NOTE]
|
|
169
168
|
> If neither `dai_type` nor `reverse_channels` the input to the model is considered to be *"RGB"*.
|
|
170
169
|
|
|
171
|
-
>
|
|
170
|
+
> [!NOTE]
|
|
172
171
|
> If both `dai_type` and `reverse_channels` are provided, the converter will give priority to `dai_type`.
|
|
173
172
|
|
|
174
|
-
>
|
|
173
|
+
> [!IMPORTANT]
|
|
175
174
|
> Provide mean/scale values in the original color format used during model training (e.g., RGB or BGR). Any necessary channel permutation is handled internally—do not reorder values manually.
|
|
176
175
|
|
|
177
176
|
## Online Usage
|
|
@@ -188,7 +187,7 @@ To log in to HubAI, use the following command:
|
|
|
188
187
|
modelconverter hub login
|
|
189
188
|
```
|
|
190
189
|
|
|
191
|
-
>
|
|
190
|
+
> [!NOTE]
|
|
192
191
|
> The key can also be stored in an environment variable `HUBAI_API_KEY`. In such a case, it takes precedence over the saved key.
|
|
193
192
|
|
|
194
193
|
**CLI Example:**
|
|
@@ -216,16 +215,34 @@ environ.HUBAI_API_KEY = "your_api_key"
|
|
|
216
215
|
converted_model = convert.RVC4("configs/resnet18.yaml")
|
|
217
216
|
```
|
|
218
217
|
|
|
219
|
-
We have prepared several examples for you to check and are actively working on providing more. You can find them [here](https://github.com/luxonis/
|
|
218
|
+
We have prepared several examples for you to check and are actively working on providing more. You can find them [here](https://github.com/luxonis/ai-tutorials/tree/main/conversion).
|
|
220
219
|
|
|
221
|
-
>
|
|
220
|
+
> [!NOTE]
|
|
222
221
|
> To learn more about the available options, use `modelconverter hub convert --help`.
|
|
223
222
|
|
|
224
223
|
## Local Usage
|
|
225
224
|
|
|
226
225
|
If you prefer not to share your models with the cloud, you can run the conversion locally.
|
|
227
226
|
|
|
228
|
-
###
|
|
227
|
+
### Official Docker Images
|
|
228
|
+
|
|
229
|
+
We provide official Docker images only for RVC2 and RVC3 platforms.
|
|
230
|
+
Images for Hailo and RVC4 need to be built manually, as described in the [Build Instructions](#build-instructions) section.
|
|
231
|
+
|
|
232
|
+
The following images are available on [GitHub Container Registry](https://ghcr.io/luxonis):
|
|
233
|
+
|
|
234
|
+
**RVC2**
|
|
235
|
+
|
|
236
|
+
- `ghcr.io/luxonis/modelconverter-rvc2:2021.4.0-latest`
|
|
237
|
+
- `ghcr.io/luxonis/modelconverter-rvc2:2022.3.0-latest`
|
|
238
|
+
|
|
239
|
+
**RVC3**
|
|
240
|
+
|
|
241
|
+
- `ghcr.io/luxonis/modelconverter-rvc3:2022.3.0-latest`
|
|
242
|
+
|
|
243
|
+
### Build Instructions
|
|
244
|
+
|
|
245
|
+
#### Prerequisites
|
|
229
246
|
|
|
230
247
|
In local mode, `ModelConverter` requires `docker` to be installed on your system.
|
|
231
248
|
It is recommended to use Ubuntu OS for the best compatibility.
|
|
@@ -258,7 +275,11 @@ Requires `hailo_ai_sw_suite_<version>:1` docker image to be present on the syste
|
|
|
258
275
|
|
|
259
276
|
After you obtain the image, you need to rename it to `hailo_ai_sw_suite_<version>:1` using `docker tag <old_name> hailo_ai_sw_suite_<version>:1`.
|
|
260
277
|
|
|
261
|
-
|
|
278
|
+
#### Building the Images
|
|
279
|
+
|
|
280
|
+
This section is optional if you are using the `modelconverter` CLI, as it will automatically build the images for you.
|
|
281
|
+
|
|
282
|
+
In other cases, use the following command:
|
|
262
283
|
|
|
263
284
|
```bash
|
|
264
285
|
docker build -f docker/$TARGET/Dockerfile \
|
|
@@ -367,7 +388,7 @@ Below is a table of common command-line options available when using the `modelc
|
|
|
367
388
|
| `--tool-version` | | TEXT | Version of the underlying conversion tools to use. Available options differ based on the target platform (RVC2, RVC3, RVC4, HAILO) |
|
|
368
389
|
| `--archive-preprocess` / `--no-archive-preprocess` | | FLAG | Add pre-processing to the NN archive instead of the model |
|
|
369
390
|
|
|
370
|
-
>
|
|
391
|
+
> [!NOTE]
|
|
371
392
|
> This table is not exhaustive. For more detailed information about available options, run `modelconverter convert --help` in your command line interface. You can also check all the `[ config overrides ]` available at [defaults.yaml](shared_with_container/configs/defaults.yaml).
|
|
372
393
|
|
|
373
394
|
#### Handling Large ONNX Files (Exceeding 2GB)
|
|
@@ -383,7 +404,7 @@ For example:
|
|
|
383
404
|
- Model file: `model.onnx`
|
|
384
405
|
- External data file: `model.onnx_data`
|
|
385
406
|
|
|
386
|
-
>
|
|
407
|
+
> [!IMPORTANT]
|
|
387
408
|
> This naming convention is a **hard requirement** for the conversion process to work correctly.
|
|
388
409
|
|
|
389
410
|
**NN Archive Requirements:**
|
|
@@ -423,7 +444,7 @@ modelconverter convert rvc2 input_model models/yolov6n.onnx \
|
|
|
423
444
|
outputs.2.name out_2
|
|
424
445
|
```
|
|
425
446
|
|
|
426
|
-
>
|
|
447
|
+
> [!WARNING]
|
|
427
448
|
> If you modify the default stages names (`stages.stage_name`) in the configuration file (`config.yaml`), you need to provide the full path to each stage in the command-line arguments. For instance, if a stage name is changed to `stage1`, use `stages.stage1.inputs.0.name` instead of `inputs.0.name`.
|
|
428
449
|
|
|
429
450
|
## Multi-Stage Conversion
|
|
@@ -467,10 +488,10 @@ The `modelconverter` CLI is available inside the container as well.
|
|
|
467
488
|
Calibration data can be a mix of images (`.jpg`, `.png`, `.jpeg`) and `.npy`, `.raw` files.
|
|
468
489
|
Image files will be loaded and converted to the format specified in the config.
|
|
469
490
|
|
|
470
|
-
>
|
|
491
|
+
> [!IMPORTANT]
|
|
471
492
|
> No conversion is performed for `.npy` or `.raw` files, the files are used as provided.
|
|
472
493
|
|
|
473
|
-
>
|
|
494
|
+
> [!WARNING]
|
|
474
495
|
> `RVC4` and `Hailo` expects images to be provided in `NHWC` layout. If you provide the calibration data in a form of `.npy` or `.raw` format, you need to make sure they have the correct layout.
|
|
475
496
|
|
|
476
497
|
## Inference
|
|
@@ -537,7 +558,7 @@ output_path/
|
|
|
537
558
|
└── <outputs>
|
|
538
559
|
```
|
|
539
560
|
|
|
540
|
-
##
|
|
561
|
+
## [RVC4] DLC model analysis
|
|
541
562
|
|
|
542
563
|
ModelConverter offers additional analysis tools for the RVC4 platform. The tools provide an in-depth look at the following:
|
|
543
564
|
|
|
@@ -572,14 +593,14 @@ modelconverter analyze <dlc_model> <onnx_model> <path_to_input_images>
|
|
|
572
593
|
|
|
573
594
|
For other usage instructions run `modelconverter analyze --help`
|
|
574
595
|
|
|
575
|
-
>
|
|
596
|
+
> [!NOTE]
|
|
576
597
|
> It is important to ensure that you are using the correct ONNX model for comparison. Before converting to DLC, ModelConverter can modify the ONNX files by adding normalization layers or simplifying the graph. The ONNX model that is actually converted to DLC is typically located at `shared_with_container/outputs/model_name/intermediate_outputs/model_name-modified.onnx`
|
|
577
598
|
>
|
|
578
599
|
> If the model has multiple inputs, make sure that each input directory has the same number of images. The tool alphabetically sorts images in each directory and assumes that images with the same index are used as one input.
|
|
579
600
|
>
|
|
580
601
|
> Recommended number of input images is less than 50.
|
|
581
602
|
|
|
582
|
-
>
|
|
603
|
+
> [!IMPORTANT]
|
|
583
604
|
> The analysis requires the RVC4 device to be connected and accessible using the [Android Debug Bridge (ADB)](https://developer.android.com/tools/adb). Ensure that the device is connected and ADB is properly configured and the commands `snpe-net-run` and `snpe-diagview` can be executed in it.
|
|
584
605
|
|
|
585
606
|
The tool creates two CSV files located in `shared_with_container/outputs/analysis/model_name/`. One file contains output statistics for each layer, while the other contains statistics on cycle usage.
|
|
@@ -615,8 +636,8 @@ modelconverter benchmark rvc3 --model-path <path_to_model.xml>
|
|
|
615
636
|
The command prints a table with the benchmark results to the console and
|
|
616
637
|
optionally saves the results to a `.csv` file.
|
|
617
638
|
|
|
618
|
-
>
|
|
639
|
+
> [!NOTE]
|
|
619
640
|
> For **RVC2** and **RVC4**: The `--model-path` can be a path to a local .blob file, an NN Archive file (.tar.xz), or a name of a model slug from [Luxonis HubAI](https://hub.luxonis.com/ai). To access models from different teams in Luxonis HubAI, remember to update the HUBAI_API_KEY environment variable respectively.
|
|
620
641
|
|
|
621
|
-
>
|
|
642
|
+
> [!IMPORTANT]
|
|
622
643
|
> Benchmarking on *RVC4* requires the device to be connected and accessible using the [Android Debug Bridge (ADB)](https://developer.android.com/tools/adb). Ensure that the device is connected and ADB is properly configured and the command `snpe-parallel-run` can be executed in it.
|
|
@@ -41,7 +41,7 @@ Convert your **ONNX** models to a format compatible with any generation of Luxon
|
|
|
41
41
|
- [Calibration Data](#calibration-data)
|
|
42
42
|
- [Inference](#inference)
|
|
43
43
|
- [Inference Example](#inference-example)
|
|
44
|
-
- [
|
|
44
|
+
- [[RVC4] DLC model analysis](#rvc4-dlc-model-analysis)
|
|
45
45
|
- [Benchmarking](#benchmarking)
|
|
46
46
|
|
|
47
47
|
## Installation
|
|
@@ -55,7 +55,7 @@ pip install modelconv
|
|
|
55
55
|
|
|
56
56
|
Run `modelconverter --help` to see the available commands and options.
|
|
57
57
|
|
|
58
|
-
>
|
|
58
|
+
> [!NOTE]
|
|
59
59
|
> To use the [benchmarking feature](#benchmarking), the `depthai v3` package must be installed. While the `depthai v3` is not yet released on PyPI, you can install it with the following command:
|
|
60
60
|
>
|
|
61
61
|
> ```bash
|
|
@@ -91,10 +91,10 @@ The `encoding` flag in the YAML configuration file allows you to specify color e
|
|
|
91
91
|
```
|
|
92
92
|
This configuration specifies that the input data is in RGB format and will be converted to BGR format during processing.
|
|
93
93
|
|
|
94
|
-
>
|
|
94
|
+
> [!NOTE]
|
|
95
95
|
> If the encoding is not specified in the YAML configuration, the default values are set to `encoding.from=RGB` and `encoding.to=BGR`.
|
|
96
96
|
|
|
97
|
-
>
|
|
97
|
+
> [!NOTE]
|
|
98
98
|
> Certain options can be set **globally**, applying to all inputs of the model, or **per input**. If specified per input, these settings will override the global configuration for that input alone. The options that support this flexibility include `scale_values`, `mean_values`, `encoding`, `data_type`, `shape`, and `layout`.
|
|
99
99
|
|
|
100
100
|
### NN Archive Configuration File
|
|
@@ -106,13 +106,13 @@ In the NN Archive configuration, there are two flags related to color encoding c
|
|
|
106
106
|
- **`reverse_channels` (Deprecated)**:
|
|
107
107
|
Determines the input color format of the model: when set to *True*, the input is considered to be *"RGB"*, and when set to *False*, it is treated as *"BGR"*. This flag is deprecated and will be replaced by the `dai_type` flag in future versions.
|
|
108
108
|
|
|
109
|
-
>
|
|
109
|
+
> [!NOTE]
|
|
110
110
|
> If neither `dai_type` nor `reverse_channels` the input to the model is considered to be *"RGB"*.
|
|
111
111
|
|
|
112
|
-
>
|
|
112
|
+
> [!NOTE]
|
|
113
113
|
> If both `dai_type` and `reverse_channels` are provided, the converter will give priority to `dai_type`.
|
|
114
114
|
|
|
115
|
-
>
|
|
115
|
+
> [!IMPORTANT]
|
|
116
116
|
> Provide mean/scale values in the original color format used during model training (e.g., RGB or BGR). Any necessary channel permutation is handled internally—do not reorder values manually.
|
|
117
117
|
|
|
118
118
|
## Online Usage
|
|
@@ -129,7 +129,7 @@ To log in to HubAI, use the following command:
|
|
|
129
129
|
modelconverter hub login
|
|
130
130
|
```
|
|
131
131
|
|
|
132
|
-
>
|
|
132
|
+
> [!NOTE]
|
|
133
133
|
> The key can also be stored in an environment variable `HUBAI_API_KEY`. In such a case, it takes precedence over the saved key.
|
|
134
134
|
|
|
135
135
|
**CLI Example:**
|
|
@@ -157,16 +157,34 @@ environ.HUBAI_API_KEY = "your_api_key"
|
|
|
157
157
|
converted_model = convert.RVC4("configs/resnet18.yaml")
|
|
158
158
|
```
|
|
159
159
|
|
|
160
|
-
We have prepared several examples for you to check and are actively working on providing more. You can find them [here](https://github.com/luxonis/
|
|
160
|
+
We have prepared several examples for you to check and are actively working on providing more. You can find them [here](https://github.com/luxonis/ai-tutorials/tree/main/conversion).
|
|
161
161
|
|
|
162
|
-
>
|
|
162
|
+
> [!NOTE]
|
|
163
163
|
> To learn more about the available options, use `modelconverter hub convert --help`.
|
|
164
164
|
|
|
165
165
|
## Local Usage
|
|
166
166
|
|
|
167
167
|
If you prefer not to share your models with the cloud, you can run the conversion locally.
|
|
168
168
|
|
|
169
|
-
###
|
|
169
|
+
### Official Docker Images
|
|
170
|
+
|
|
171
|
+
We provide official Docker images only for RVC2 and RVC3 platforms.
|
|
172
|
+
Images for Hailo and RVC4 need to be built manually, as described in the [Build Instructions](#build-instructions) section.
|
|
173
|
+
|
|
174
|
+
The following images are available on [GitHub Container Registry](https://ghcr.io/luxonis):
|
|
175
|
+
|
|
176
|
+
**RVC2**
|
|
177
|
+
|
|
178
|
+
- `ghcr.io/luxonis/modelconverter-rvc2:2021.4.0-latest`
|
|
179
|
+
- `ghcr.io/luxonis/modelconverter-rvc2:2022.3.0-latest`
|
|
180
|
+
|
|
181
|
+
**RVC3**
|
|
182
|
+
|
|
183
|
+
- `ghcr.io/luxonis/modelconverter-rvc3:2022.3.0-latest`
|
|
184
|
+
|
|
185
|
+
### Build Instructions
|
|
186
|
+
|
|
187
|
+
#### Prerequisites
|
|
170
188
|
|
|
171
189
|
In local mode, `ModelConverter` requires `docker` to be installed on your system.
|
|
172
190
|
It is recommended to use Ubuntu OS for the best compatibility.
|
|
@@ -199,7 +217,11 @@ Requires `hailo_ai_sw_suite_<version>:1` docker image to be present on the syste
|
|
|
199
217
|
|
|
200
218
|
After you obtain the image, you need to rename it to `hailo_ai_sw_suite_<version>:1` using `docker tag <old_name> hailo_ai_sw_suite_<version>:1`.
|
|
201
219
|
|
|
202
|
-
|
|
220
|
+
#### Building the Images
|
|
221
|
+
|
|
222
|
+
This section is optional if you are using the `modelconverter` CLI, as it will automatically build the images for you.
|
|
223
|
+
|
|
224
|
+
In other cases, use the following command:
|
|
203
225
|
|
|
204
226
|
```bash
|
|
205
227
|
docker build -f docker/$TARGET/Dockerfile \
|
|
@@ -308,7 +330,7 @@ Below is a table of common command-line options available when using the `modelc
|
|
|
308
330
|
| `--tool-version` | | TEXT | Version of the underlying conversion tools to use. Available options differ based on the target platform (RVC2, RVC3, RVC4, HAILO) |
|
|
309
331
|
| `--archive-preprocess` / `--no-archive-preprocess` | | FLAG | Add pre-processing to the NN archive instead of the model |
|
|
310
332
|
|
|
311
|
-
>
|
|
333
|
+
> [!NOTE]
|
|
312
334
|
> This table is not exhaustive. For more detailed information about available options, run `modelconverter convert --help` in your command line interface. You can also check all the `[ config overrides ]` available at [defaults.yaml](shared_with_container/configs/defaults.yaml).
|
|
313
335
|
|
|
314
336
|
#### Handling Large ONNX Files (Exceeding 2GB)
|
|
@@ -324,7 +346,7 @@ For example:
|
|
|
324
346
|
- Model file: `model.onnx`
|
|
325
347
|
- External data file: `model.onnx_data`
|
|
326
348
|
|
|
327
|
-
>
|
|
349
|
+
> [!IMPORTANT]
|
|
328
350
|
> This naming convention is a **hard requirement** for the conversion process to work correctly.
|
|
329
351
|
|
|
330
352
|
**NN Archive Requirements:**
|
|
@@ -364,7 +386,7 @@ modelconverter convert rvc2 input_model models/yolov6n.onnx \
|
|
|
364
386
|
outputs.2.name out_2
|
|
365
387
|
```
|
|
366
388
|
|
|
367
|
-
>
|
|
389
|
+
> [!WARNING]
|
|
368
390
|
> If you modify the default stages names (`stages.stage_name`) in the configuration file (`config.yaml`), you need to provide the full path to each stage in the command-line arguments. For instance, if a stage name is changed to `stage1`, use `stages.stage1.inputs.0.name` instead of `inputs.0.name`.
|
|
369
391
|
|
|
370
392
|
## Multi-Stage Conversion
|
|
@@ -408,10 +430,10 @@ The `modelconverter` CLI is available inside the container as well.
|
|
|
408
430
|
Calibration data can be a mix of images (`.jpg`, `.png`, `.jpeg`) and `.npy`, `.raw` files.
|
|
409
431
|
Image files will be loaded and converted to the format specified in the config.
|
|
410
432
|
|
|
411
|
-
>
|
|
433
|
+
> [!IMPORTANT]
|
|
412
434
|
> No conversion is performed for `.npy` or `.raw` files, the files are used as provided.
|
|
413
435
|
|
|
414
|
-
>
|
|
436
|
+
> [!WARNING]
|
|
415
437
|
> `RVC4` and `Hailo` expects images to be provided in `NHWC` layout. If you provide the calibration data in a form of `.npy` or `.raw` format, you need to make sure they have the correct layout.
|
|
416
438
|
|
|
417
439
|
## Inference
|
|
@@ -478,7 +500,7 @@ output_path/
|
|
|
478
500
|
└── <outputs>
|
|
479
501
|
```
|
|
480
502
|
|
|
481
|
-
##
|
|
503
|
+
## [RVC4] DLC model analysis
|
|
482
504
|
|
|
483
505
|
ModelConverter offers additional analysis tools for the RVC4 platform. The tools provide an in-depth look at the following:
|
|
484
506
|
|
|
@@ -513,14 +535,14 @@ modelconverter analyze <dlc_model> <onnx_model> <path_to_input_images>
|
|
|
513
535
|
|
|
514
536
|
For other usage instructions run `modelconverter analyze --help`
|
|
515
537
|
|
|
516
|
-
>
|
|
538
|
+
> [!NOTE]
|
|
517
539
|
> It is important to ensure that you are using the correct ONNX model for comparison. Before converting to DLC, ModelConverter can modify the ONNX files by adding normalization layers or simplifying the graph. The ONNX model that is actually converted to DLC is typically located at `shared_with_container/outputs/model_name/intermediate_outputs/model_name-modified.onnx`
|
|
518
540
|
>
|
|
519
541
|
> If the model has multiple inputs, make sure that each input directory has the same number of images. The tool alphabetically sorts images in each directory and assumes that images with the same index are used as one input.
|
|
520
542
|
>
|
|
521
543
|
> Recommended number of input images is less than 50.
|
|
522
544
|
|
|
523
|
-
>
|
|
545
|
+
> [!IMPORTANT]
|
|
524
546
|
> The analysis requires the RVC4 device to be connected and accessible using the [Android Debug Bridge (ADB)](https://developer.android.com/tools/adb). Ensure that the device is connected and ADB is properly configured and the commands `snpe-net-run` and `snpe-diagview` can be executed in it.
|
|
525
547
|
|
|
526
548
|
The tool creates two CSV files located in `shared_with_container/outputs/analysis/model_name/`. One file contains output statistics for each layer, while the other contains statistics on cycle usage.
|
|
@@ -556,8 +578,8 @@ modelconverter benchmark rvc3 --model-path <path_to_model.xml>
|
|
|
556
578
|
The command prints a table with the benchmark results to the console and
|
|
557
579
|
optionally saves the results to a `.csv` file.
|
|
558
580
|
|
|
559
|
-
>
|
|
581
|
+
> [!NOTE]
|
|
560
582
|
> For **RVC2** and **RVC4**: The `--model-path` can be a path to a local .blob file, an NN Archive file (.tar.xz), or a name of a model slug from [Luxonis HubAI](https://hub.luxonis.com/ai). To access models from different teams in Luxonis HubAI, remember to update the HUBAI_API_KEY environment variable respectively.
|
|
561
583
|
|
|
562
|
-
>
|
|
584
|
+
> [!IMPORTANT]
|
|
563
585
|
> Benchmarking on *RVC4* requires the device to be connected and accessible using the [Android Debug Bridge (ADB)](https://developer.android.com/tools/adb). Ensure that the device is connected and ADB is properly configured and the command `snpe-parallel-run` can be executed in it.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: modelconv
|
|
3
|
-
Version: 0.4.
|
|
3
|
+
Version: 0.4.3
|
|
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,7 +17,7 @@ Description-Content-Type: text/markdown
|
|
|
17
17
|
License-File: LICENSE
|
|
18
18
|
Requires-Dist: Pillow
|
|
19
19
|
Requires-Dist: gcsfs
|
|
20
|
-
Requires-Dist: luxonis-ml[data,nn_archive]==0.
|
|
20
|
+
Requires-Dist: luxonis-ml[data,nn_archive]==0.8.0
|
|
21
21
|
Requires-Dist: onnx>=1.17.0
|
|
22
22
|
Requires-Dist: onnxruntime
|
|
23
23
|
Requires-Dist: onnxsim
|
|
@@ -39,7 +39,6 @@ Requires-Dist: plotly; extra == "analysis"
|
|
|
39
39
|
Provides-Extra: dev
|
|
40
40
|
Requires-Dist: pre-commit==3.2.1; extra == "dev"
|
|
41
41
|
Requires-Dist: pytest-cov>=4.1.0; extra == "dev"
|
|
42
|
-
Requires-Dist: docker-squash>=1.1.0; extra == "dev"
|
|
43
42
|
Requires-Dist: depthai==3.0.0a14; extra == "dev"
|
|
44
43
|
Provides-Extra: rvc2
|
|
45
44
|
Requires-Dist: tflite2onnx; extra == "rvc2"
|
|
@@ -100,7 +99,7 @@ Convert your **ONNX** models to a format compatible with any generation of Luxon
|
|
|
100
99
|
- [Calibration Data](#calibration-data)
|
|
101
100
|
- [Inference](#inference)
|
|
102
101
|
- [Inference Example](#inference-example)
|
|
103
|
-
- [
|
|
102
|
+
- [[RVC4] DLC model analysis](#rvc4-dlc-model-analysis)
|
|
104
103
|
- [Benchmarking](#benchmarking)
|
|
105
104
|
|
|
106
105
|
## Installation
|
|
@@ -114,7 +113,7 @@ pip install modelconv
|
|
|
114
113
|
|
|
115
114
|
Run `modelconverter --help` to see the available commands and options.
|
|
116
115
|
|
|
117
|
-
>
|
|
116
|
+
> [!NOTE]
|
|
118
117
|
> To use the [benchmarking feature](#benchmarking), the `depthai v3` package must be installed. While the `depthai v3` is not yet released on PyPI, you can install it with the following command:
|
|
119
118
|
>
|
|
120
119
|
> ```bash
|
|
@@ -150,10 +149,10 @@ The `encoding` flag in the YAML configuration file allows you to specify color e
|
|
|
150
149
|
```
|
|
151
150
|
This configuration specifies that the input data is in RGB format and will be converted to BGR format during processing.
|
|
152
151
|
|
|
153
|
-
>
|
|
152
|
+
> [!NOTE]
|
|
154
153
|
> If the encoding is not specified in the YAML configuration, the default values are set to `encoding.from=RGB` and `encoding.to=BGR`.
|
|
155
154
|
|
|
156
|
-
>
|
|
155
|
+
> [!NOTE]
|
|
157
156
|
> Certain options can be set **globally**, applying to all inputs of the model, or **per input**. If specified per input, these settings will override the global configuration for that input alone. The options that support this flexibility include `scale_values`, `mean_values`, `encoding`, `data_type`, `shape`, and `layout`.
|
|
158
157
|
|
|
159
158
|
### NN Archive Configuration File
|
|
@@ -165,13 +164,13 @@ In the NN Archive configuration, there are two flags related to color encoding c
|
|
|
165
164
|
- **`reverse_channels` (Deprecated)**:
|
|
166
165
|
Determines the input color format of the model: when set to *True*, the input is considered to be *"RGB"*, and when set to *False*, it is treated as *"BGR"*. This flag is deprecated and will be replaced by the `dai_type` flag in future versions.
|
|
167
166
|
|
|
168
|
-
>
|
|
167
|
+
> [!NOTE]
|
|
169
168
|
> If neither `dai_type` nor `reverse_channels` the input to the model is considered to be *"RGB"*.
|
|
170
169
|
|
|
171
|
-
>
|
|
170
|
+
> [!NOTE]
|
|
172
171
|
> If both `dai_type` and `reverse_channels` are provided, the converter will give priority to `dai_type`.
|
|
173
172
|
|
|
174
|
-
>
|
|
173
|
+
> [!IMPORTANT]
|
|
175
174
|
> Provide mean/scale values in the original color format used during model training (e.g., RGB or BGR). Any necessary channel permutation is handled internally—do not reorder values manually.
|
|
176
175
|
|
|
177
176
|
## Online Usage
|
|
@@ -188,7 +187,7 @@ To log in to HubAI, use the following command:
|
|
|
188
187
|
modelconverter hub login
|
|
189
188
|
```
|
|
190
189
|
|
|
191
|
-
>
|
|
190
|
+
> [!NOTE]
|
|
192
191
|
> The key can also be stored in an environment variable `HUBAI_API_KEY`. In such a case, it takes precedence over the saved key.
|
|
193
192
|
|
|
194
193
|
**CLI Example:**
|
|
@@ -216,16 +215,34 @@ environ.HUBAI_API_KEY = "your_api_key"
|
|
|
216
215
|
converted_model = convert.RVC4("configs/resnet18.yaml")
|
|
217
216
|
```
|
|
218
217
|
|
|
219
|
-
We have prepared several examples for you to check and are actively working on providing more. You can find them [here](https://github.com/luxonis/
|
|
218
|
+
We have prepared several examples for you to check and are actively working on providing more. You can find them [here](https://github.com/luxonis/ai-tutorials/tree/main/conversion).
|
|
220
219
|
|
|
221
|
-
>
|
|
220
|
+
> [!NOTE]
|
|
222
221
|
> To learn more about the available options, use `modelconverter hub convert --help`.
|
|
223
222
|
|
|
224
223
|
## Local Usage
|
|
225
224
|
|
|
226
225
|
If you prefer not to share your models with the cloud, you can run the conversion locally.
|
|
227
226
|
|
|
228
|
-
###
|
|
227
|
+
### Official Docker Images
|
|
228
|
+
|
|
229
|
+
We provide official Docker images only for RVC2 and RVC3 platforms.
|
|
230
|
+
Images for Hailo and RVC4 need to be built manually, as described in the [Build Instructions](#build-instructions) section.
|
|
231
|
+
|
|
232
|
+
The following images are available on [GitHub Container Registry](https://ghcr.io/luxonis):
|
|
233
|
+
|
|
234
|
+
**RVC2**
|
|
235
|
+
|
|
236
|
+
- `ghcr.io/luxonis/modelconverter-rvc2:2021.4.0-latest`
|
|
237
|
+
- `ghcr.io/luxonis/modelconverter-rvc2:2022.3.0-latest`
|
|
238
|
+
|
|
239
|
+
**RVC3**
|
|
240
|
+
|
|
241
|
+
- `ghcr.io/luxonis/modelconverter-rvc3:2022.3.0-latest`
|
|
242
|
+
|
|
243
|
+
### Build Instructions
|
|
244
|
+
|
|
245
|
+
#### Prerequisites
|
|
229
246
|
|
|
230
247
|
In local mode, `ModelConverter` requires `docker` to be installed on your system.
|
|
231
248
|
It is recommended to use Ubuntu OS for the best compatibility.
|
|
@@ -258,7 +275,11 @@ Requires `hailo_ai_sw_suite_<version>:1` docker image to be present on the syste
|
|
|
258
275
|
|
|
259
276
|
After you obtain the image, you need to rename it to `hailo_ai_sw_suite_<version>:1` using `docker tag <old_name> hailo_ai_sw_suite_<version>:1`.
|
|
260
277
|
|
|
261
|
-
|
|
278
|
+
#### Building the Images
|
|
279
|
+
|
|
280
|
+
This section is optional if you are using the `modelconverter` CLI, as it will automatically build the images for you.
|
|
281
|
+
|
|
282
|
+
In other cases, use the following command:
|
|
262
283
|
|
|
263
284
|
```bash
|
|
264
285
|
docker build -f docker/$TARGET/Dockerfile \
|
|
@@ -367,7 +388,7 @@ Below is a table of common command-line options available when using the `modelc
|
|
|
367
388
|
| `--tool-version` | | TEXT | Version of the underlying conversion tools to use. Available options differ based on the target platform (RVC2, RVC3, RVC4, HAILO) |
|
|
368
389
|
| `--archive-preprocess` / `--no-archive-preprocess` | | FLAG | Add pre-processing to the NN archive instead of the model |
|
|
369
390
|
|
|
370
|
-
>
|
|
391
|
+
> [!NOTE]
|
|
371
392
|
> This table is not exhaustive. For more detailed information about available options, run `modelconverter convert --help` in your command line interface. You can also check all the `[ config overrides ]` available at [defaults.yaml](shared_with_container/configs/defaults.yaml).
|
|
372
393
|
|
|
373
394
|
#### Handling Large ONNX Files (Exceeding 2GB)
|
|
@@ -383,7 +404,7 @@ For example:
|
|
|
383
404
|
- Model file: `model.onnx`
|
|
384
405
|
- External data file: `model.onnx_data`
|
|
385
406
|
|
|
386
|
-
>
|
|
407
|
+
> [!IMPORTANT]
|
|
387
408
|
> This naming convention is a **hard requirement** for the conversion process to work correctly.
|
|
388
409
|
|
|
389
410
|
**NN Archive Requirements:**
|
|
@@ -423,7 +444,7 @@ modelconverter convert rvc2 input_model models/yolov6n.onnx \
|
|
|
423
444
|
outputs.2.name out_2
|
|
424
445
|
```
|
|
425
446
|
|
|
426
|
-
>
|
|
447
|
+
> [!WARNING]
|
|
427
448
|
> If you modify the default stages names (`stages.stage_name`) in the configuration file (`config.yaml`), you need to provide the full path to each stage in the command-line arguments. For instance, if a stage name is changed to `stage1`, use `stages.stage1.inputs.0.name` instead of `inputs.0.name`.
|
|
428
449
|
|
|
429
450
|
## Multi-Stage Conversion
|
|
@@ -467,10 +488,10 @@ The `modelconverter` CLI is available inside the container as well.
|
|
|
467
488
|
Calibration data can be a mix of images (`.jpg`, `.png`, `.jpeg`) and `.npy`, `.raw` files.
|
|
468
489
|
Image files will be loaded and converted to the format specified in the config.
|
|
469
490
|
|
|
470
|
-
>
|
|
491
|
+
> [!IMPORTANT]
|
|
471
492
|
> No conversion is performed for `.npy` or `.raw` files, the files are used as provided.
|
|
472
493
|
|
|
473
|
-
>
|
|
494
|
+
> [!WARNING]
|
|
474
495
|
> `RVC4` and `Hailo` expects images to be provided in `NHWC` layout. If you provide the calibration data in a form of `.npy` or `.raw` format, you need to make sure they have the correct layout.
|
|
475
496
|
|
|
476
497
|
## Inference
|
|
@@ -537,7 +558,7 @@ output_path/
|
|
|
537
558
|
└── <outputs>
|
|
538
559
|
```
|
|
539
560
|
|
|
540
|
-
##
|
|
561
|
+
## [RVC4] DLC model analysis
|
|
541
562
|
|
|
542
563
|
ModelConverter offers additional analysis tools for the RVC4 platform. The tools provide an in-depth look at the following:
|
|
543
564
|
|
|
@@ -572,14 +593,14 @@ modelconverter analyze <dlc_model> <onnx_model> <path_to_input_images>
|
|
|
572
593
|
|
|
573
594
|
For other usage instructions run `modelconverter analyze --help`
|
|
574
595
|
|
|
575
|
-
>
|
|
596
|
+
> [!NOTE]
|
|
576
597
|
> It is important to ensure that you are using the correct ONNX model for comparison. Before converting to DLC, ModelConverter can modify the ONNX files by adding normalization layers or simplifying the graph. The ONNX model that is actually converted to DLC is typically located at `shared_with_container/outputs/model_name/intermediate_outputs/model_name-modified.onnx`
|
|
577
598
|
>
|
|
578
599
|
> If the model has multiple inputs, make sure that each input directory has the same number of images. The tool alphabetically sorts images in each directory and assumes that images with the same index are used as one input.
|
|
579
600
|
>
|
|
580
601
|
> Recommended number of input images is less than 50.
|
|
581
602
|
|
|
582
|
-
>
|
|
603
|
+
> [!IMPORTANT]
|
|
583
604
|
> The analysis requires the RVC4 device to be connected and accessible using the [Android Debug Bridge (ADB)](https://developer.android.com/tools/adb). Ensure that the device is connected and ADB is properly configured and the commands `snpe-net-run` and `snpe-diagview` can be executed in it.
|
|
584
605
|
|
|
585
606
|
The tool creates two CSV files located in `shared_with_container/outputs/analysis/model_name/`. One file contains output statistics for each layer, while the other contains statistics on cycle usage.
|
|
@@ -615,8 +636,8 @@ modelconverter benchmark rvc3 --model-path <path_to_model.xml>
|
|
|
615
636
|
The command prints a table with the benchmark results to the console and
|
|
616
637
|
optionally saves the results to a `.csv` file.
|
|
617
638
|
|
|
618
|
-
>
|
|
639
|
+
> [!NOTE]
|
|
619
640
|
> For **RVC2** and **RVC4**: The `--model-path` can be a path to a local .blob file, an NN Archive file (.tar.xz), or a name of a model slug from [Luxonis HubAI](https://hub.luxonis.com/ai). To access models from different teams in Luxonis HubAI, remember to update the HUBAI_API_KEY environment variable respectively.
|
|
620
641
|
|
|
621
|
-
>
|
|
642
|
+
> [!IMPORTANT]
|
|
622
643
|
> Benchmarking on *RVC4* requires the device to be connected and accessible using the [Android Debug Bridge (ADB)](https://developer.android.com/tools/adb). Ensure that the device is connected and ADB is properly configured and the command `snpe-parallel-run` can be executed in it.
|
|
@@ -58,12 +58,14 @@ modelconverter/utils/docker_utils.py
|
|
|
58
58
|
modelconverter/utils/environ.py
|
|
59
59
|
modelconverter/utils/exceptions.py
|
|
60
60
|
modelconverter/utils/filesystem_utils.py
|
|
61
|
+
modelconverter/utils/general.py
|
|
61
62
|
modelconverter/utils/hubai_utils.py
|
|
62
63
|
modelconverter/utils/image.py
|
|
63
64
|
modelconverter/utils/layout.py
|
|
64
65
|
modelconverter/utils/metadata.py
|
|
65
66
|
modelconverter/utils/nn_archive.py
|
|
66
67
|
modelconverter/utils/onnx_tools.py
|
|
68
|
+
modelconverter/utils/progress_handler.py
|
|
67
69
|
modelconverter/utils/subprocess.py
|
|
68
70
|
modelconverter/utils/types.py
|
|
69
71
|
tests/__init__.py
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Pillow
|
|
2
2
|
gcsfs
|
|
3
|
-
luxonis-ml[data,nn_archive]==0.
|
|
3
|
+
luxonis-ml[data,nn_archive]==0.8.0
|
|
4
4
|
onnx>=1.17.0
|
|
5
5
|
onnxruntime
|
|
6
6
|
onnxsim
|
|
@@ -25,7 +25,6 @@ depthai==3.0.0a14
|
|
|
25
25
|
[dev]
|
|
26
26
|
pre-commit==3.2.1
|
|
27
27
|
pytest-cov>=4.1.0
|
|
28
|
-
docker-squash>=1.1.0
|
|
29
28
|
depthai==3.0.0a14
|
|
30
29
|
|
|
31
30
|
[hailo]
|