Skip to content

Commit

Permalink
Added usage examples
Browse files Browse the repository at this point in the history
Signed-off-by: Adrian Boguszewski <adrian.boguszewski@intel.com>
  • Loading branch information
adrianboguszewski committed Jun 3, 2024
1 parent 7a2b067 commit fd866b5
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/anomalib/engine/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -922,12 +922,12 @@ def export(
3. To export as an OpenVINO ``.xml`` and ``.bin`` file you can run the following command.
```python
anomalib export --model Padim --export_mode openvino --ckpt_path <PATH_TO_CHECKPOINT> \
--input_size "[256,256]"
--input_size "[256,256] --compression_type "fp16"
```
4. You can also override OpenVINO model optimizer by adding the ``--ov_args.<key>`` arguments.
4. You can also quantize OpenVINO model with the following.
```python
anomalib export --model Padim --export_mode openvino --ckpt_path <PATH_TO_CHECKPOINT> \
--input_size "[256,256]" --ov_args.compress_to_fp16 False
--input_size "[256,256]" --compression_type "int8_ptq" --data MVTec
```
"""
export_type = ExportType(export_type)
Expand Down
16 changes: 16 additions & 0 deletions src/anomalib/models/components/base/export_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,22 @@ def to_openvino(
... task=datamodule.test_data.task
... )
Export and Quantize the Model (OpenVINO IR):
This example demonstrates how to export and quantize the model to OpenVINO IR.
>>> from anomalib.models import Patchcore
>>> from anomalib.data import Visa
...
>>> datamodule = Visa()
>>> model = Patchcore()
...
>>> model.to_openvino(
... export_root="path/to/export",
... compression_type=CompressionType.INT8_PTQ,
... datamodule=datamodule,
... task=datamodule.test_data.task
... )
Using Custom Transforms:
This example shows how to use a custom ``Transform`` object for the ``transform`` argument.
Expand Down

0 comments on commit fd866b5

Please sign in to comment.