-
Notifications
You must be signed in to change notification settings - Fork 639
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Refactor test * fix key issue * Change from Path to str * Check for empty path * Set default path to None
- Loading branch information
1 parent
c8ef5dd
commit 4f98857
Showing
6 changed files
with
50 additions
and
91 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
from pathlib import Path | ||
from typing import List, Optional, Union | ||
|
||
from omegaconf import DictConfig, ListConfig | ||
|
||
from anomalib.config import get_configurable_parameters | ||
|
||
from .dataset import get_dataset_path | ||
|
||
|
||
def get_test_configurable_parameters( | ||
dataset_path: Optional[str] = None, | ||
model_name: Optional[str] = None, | ||
model_config_path: Optional[Union[Path, str]] = None, | ||
weight_file: Optional[str] = None, | ||
openvino: bool = False, | ||
config_filename: Optional[str] = "config", | ||
config_file_extension: Optional[str] = "yaml", | ||
) -> Union[DictConfig, ListConfig]: | ||
"""Get configurable parameters for testing. | ||
Args: | ||
datset_path: Optional[Path]: Path to dataset | ||
model_name: Optional[str]: (Default value = None) | ||
model_config_path: Optional[Union[Path, str]]: (Default value = None) | ||
weight_file: Path to the weight file | ||
openvino: Use OpenVINO | ||
config_filename: Optional[str]: (Default value = "config") | ||
config_file_extension: Optional[str]: (Default value = "yaml") | ||
Returns: | ||
Union[DictConfig, ListConfig]: Configurable parameters in DictConfig object. | ||
""" | ||
|
||
config = get_configurable_parameters( | ||
model_name, model_config_path, weight_file, openvino, config_filename, config_file_extension | ||
) | ||
|
||
# Update path to match the dataset path in the test image/runner | ||
config.dataset.path = get_dataset_path() if dataset_path is None else dataset_path | ||
|
||
return config |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,6 @@ | |
""" | ||
|
||
import tempfile | ||
from pathlib import Path | ||
|
||
import albumentations as A | ||
import numpy as np | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters