Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🔨 Move export functionality to base anomaly module #1752

Closed
djdameln opened this issue Feb 19, 2024 · 3 comments · Fixed by #1803 or #2057
Closed

🔨 Move export functionality to base anomaly module #1752

djdameln opened this issue Feb 19, 2024 · 3 comments · Fixed by #1803 or #2057
Assignees
Labels
Enhancement New feature or request Feature
Milestone

Comments

@djdameln
Copy link
Contributor

What is the motivation for this task?

When exporting, the anomalib engine uses several functions defined in anomalib.deploy.export. A cleaner solution would be to add the export functionality to the base anomaly module, similar to LightningModule.to_onnx.

Describe the solution you'd like

Add the following methods to AnomalyModule: AnomalyModule.to_torch, AnomalyModule.to_onnx and AnomalyModule.to_openvino. This would simplify the export syntax from:

from anomalib.models import Padim
from anomalib.deploy.export import ExportType, export_to_onnx, export_to_openvino, export_to_torch

model = Padim()
export_to_openvino(
    model=model,
    export_root="path/to/export/folder",
)

to:

from anomalib.models import Padim

model = Padim()
model.to_openvino("path/to/export/folder")

Additional context

No response

@djdameln djdameln added the Task label Feb 19, 2024
@samet-akcay samet-akcay changed the title [Task]: Move export functionality to base anomaly module 🔨 Move export functionality to base anomaly module Feb 20, 2024
@samet-akcay samet-akcay added Enhancement New feature or request Feature and removed Task labels Feb 20, 2024
@github-project-automation github-project-automation bot moved this to 📝 To Do in Anomalib Feb 20, 2024
@samet-akcay samet-akcay added this to the v1.1.0 milestone Feb 20, 2024
@thinhngo-x
Copy link
Contributor

Hi,

Do you think it would be better to retain the anomalib.deploy.export functions after refactoring or else to move entirely the export functions to AnomalyModule?

@thinhngo-x
Copy link
Contributor

@samet-akcay can you assign this task for me pls? I'm working on it right now. Thanks.

@samet-akcay
Copy link
Contributor

All yours :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement New feature or request Feature
Projects
Archived in project
4 participants