HPO#

Utils to help in HPO search.

class anomalib.pipelines.hpo.CometSweep(project, sweep_config, entity=None)#

Bases: object

comet sweep.

Parameters:
  • project (str) – Name of the project

  • sweep_config (DictConfig) – Sweep configuration.

  • entity (str, optional) – Username or workspace to send the project to. Defaults to None.

run()#

Run the sweep.

Return type:

None

class anomalib.pipelines.hpo.HPOBackend(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)#

Bases: str, Enum

HPO backend choices.

class anomalib.pipelines.hpo.Sweep(project, sweep_config, backend=HPOBackend.COMET, entity='')#

Bases: object

HPO class to run hyperparameter optimization.

Parameters:
  • project (str) – Name of the project.

  • sweep_config (Path | str) – Path to sweep configuration. The configuration depends on the type of backend.

  • backend (HPOBackend) – HPO backend to use. Defaults to `Backend.COMET`.

  • entity (str | None) – Username or workspace where you want to send your runs to. If not set, the default workspace is used.

get_runner(backend)#

Get the runner for the specified backend.

Return type:

CometSweep | WandbSweep

run()#

Run the sweep.

Return type:

None

class anomalib.pipelines.hpo.WandbSweep(project, sweep_config, entity=None)#

Bases: object

wandb sweep.

Parameters:
  • project (str) – Name of the project.

  • sweep_config (DictConfig) – Sweep configuration.

  • entity (str, optional) – Username or workspace to send the project to. Defaults to None.

run()#

Run the sweep.

Return type:

None

sweep()#

Load the model, update config and call fit. The metrics are logged to `wandb` dashboard.

Return type:

None

anomalib.pipelines.hpo.get_hpo_parser(parser=None)#

Get the HPO parser.

Return type:

LightningArgumentParser