anomalib icon indicating copy to clipboard operation
anomalib copied to clipboard

Instantiate Datamodule, Model and Engine from config

Open CyrilWW opened this issue 1 year ago • 2 comments

What is the motivation for this task?

With 1.0.0dev version, I could use a config.yaml and get the prediction scores, customize the anomaly heatmap, etc. with the API. With the Pypi 1.0.1 version, the get_configurable_parameters function is abandoned, and I struggle to use an equivalent for parsing the config.yaml in a script using the API.

Describe the solution you'd like

I would like to have an equivalent of get_configurable_parameters function, usable in the API, in order to use the parameters included in this file, and the API capabilities.

Additional context

No response

CyrilWW avatar Apr 14 '24 18:04 CyrilWW

Hi @CyrilWW, we will introduce a new method for Datamodule, Model and Engine, called from_config to be able to instantiate these objects with a config file.

# To instantiate a datamodule
datamodule = AnomalibDataModule.from_config("/path/to/your/data/config")

# To instantiate a model
model = AnomalyModel.from_config("/path/to/your/model/config")

# To instantiate Engine or all of these above
engine.from_config("/path/to/your/engine/or/full/config")

It's on our to-do list, but we haven't found time to implement this feature yet.

samet-akcay avatar Apr 15 '24 05:04 samet-akcay

@harimkang kindly accepted to work on this!

samet-akcay avatar Apr 15 '24 05:04 samet-akcay

https://github.com/openvinotoolkit/anomalib/pull/2065 - With the merge of this PR, the feature is complete as an Anomalib 1.1 target.

harimkang avatar May 29 '24 04:05 harimkang