openvinotoolkit / anomalib

An anomaly detection library comprising state-of-the-art algorithms and features such as experiment management, hyper-parameter optimization, and edge inference.
https://anomalib.readthedocs.io/en/latest/
Apache License 2.0
3.41k stars 616 forks source link

[Bug]: OpenVINO IR Export default is not FP16 #2097

Open junxnone opened 1 month ago

junxnone commented 1 month ago

Describe the bug

compress_to_fp16 is False, but the comment say that fp16 compression is enabled by default, it is confused.

https://github.com/openvinotoolkit/anomalib/blob/e5b91d6a32c469ec0b9c4c161272b68114ba6fa3/src/anomalib/models/components/base/export_mixin.py#L155-L164

https://github.com/openvinotoolkit/anomalib/blob/e5b91d6a32c469ec0b9c4c161272b68114ba6fa3/src/anomalib/models/components/base/export_mixin.py#L253-L255

Dataset

MVTec

Model

Other (please specify in the field below)

Steps to reproduce the behavior

OS information

OS information:

Expected behavior

same as the comment

Screenshots

No response

Pip/GitHub

pip

What version/branch did you use?

main

Configuration YAML

None

Logs

Source path:... 
test_anomalib/anomalib/src/anomalib/models/components/base/export_mixin.py
Starting var:.. self = WinClip(  (model): WinClipModel(    (clip): CLIP...0,), eps=1e-05, elementwise_affine=True)    )  ))
Starting var:.. export_root = PosixPath('testfp16')
Starting var:.. input_size = None
Starting var:.. transform = None
Starting var:.. compression_type = None
Starting var:.. datamodule = None
Starting var:.. ov_args = None
Starting var:.. task = <TaskType.SEGMENTATION: 'segmentation'>
11:01:25.264373 call       156     def to_openvino(

...
...

11:03:08.462087 line       257             compress_to_fp16 = compression_type == CompressionType.FP16
New var:....... compress_to_fp16 = False
11:03:08.463238 line       258             ov.save_model(model, ov_model_path, compress_to_fp16=compress_to_fp16)

Code of Conduct