Skip to content

🐞 Cannot compress models while exporting to OpenVINO #2849

@adrianboguszewski

Description

@adrianboguszewski

Describe the bug

As the API has changed in 2.0, compression like INT8_PTQ or INT8_ACQ no longer works. The problem is with the data delivered in the ImageBatch format.

To avoid that situation in the future, unit tests for different compression types should be implemented.

Dataset

N/A

Model

N/A

Steps to reproduce the behavior

from anomalib.deploy import ExportType, CompressionType
from anomalib.engine import Engine
from anomalib.models import EfficientAd
from anomalib.data import MVTecAD

datamodule = MVTecAD(
    category="carpet",  # MVTec category to use
    train_batch_size=1,  # Number of images per training batch
    eval_batch_size=1,  # Number of images per validation/test batch
)

model = EfficientAd()

engine = Engine(max_epochs=10)
engine.fit(datamodule=datamodule, model=model)

engine.export(model, export_root="ov_model", export_type=ExportType.OPENVINO, compression_type=CompressionType.INT8_PTQ, datamodule=datamodule)

OS information

OS information:

  • OS: Ubuntu 24.04
  • Python version: 3.12
  • Anomalib version: main branch

Expected behavior

Model is exported and compressed.

Screenshots

No response

Pip/GitHub

GitHub

What version/branch did you use?

main

Configuration YAML

N/A

Logs

N/A

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions