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

Instantiate Datamodule, Model and Engine from config #1992

Closed
CyrilWW opened this issue Apr 14, 2024 · 3 comments
Closed

Instantiate Datamodule, Model and Engine from config #1992

CyrilWW opened this issue Apr 14, 2024 · 3 comments
Assignees

Comments

@CyrilWW
Copy link

CyrilWW commented Apr 14, 2024

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

@samet-akcay
Copy link
Contributor

samet-akcay commented Apr 15, 2024

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 samet-akcay changed the title [Task]: How can I use both the API and a configuration file config.yaml ? Instantiate Datamodule, Model and Engine from config Apr 15, 2024
@samet-akcay
Copy link
Contributor

@harimkang kindly accepted to work on this!

@harimkang
Copy link
Collaborator

#2065 - With the merge of this PR, the feature is complete as an Anomalib 1.1 target.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: ✅ Done
Development

No branches or pull requests

3 participants