Skip to content

Commit

Permalink
Showing 3 changed files with 10 additions and 4 deletions.
4 changes: 2 additions & 2 deletions external/anomaly/ote_anomalib/train_task.py
Original file line number Diff line number Diff line change
@@ -38,7 +38,7 @@ def train(
dataset: DatasetEntity,
output_model: ModelEntity,
train_parameters: TrainParameters,
seed: Optional[int] = 0,
seed: Optional[int] = None,
) -> None:
"""Train the anomaly classification model.
@@ -53,7 +53,7 @@ def train(

config = self.get_config()

if seed is not None and seed > 0:
if seed:
logger.info(f"Setting seed to {seed}")
seed_everything(seed, workers=True)
config.trainer.deterministic = True
8 changes: 7 additions & 1 deletion external/anomaly/tools/README.md
Original file line number Diff line number Diff line change
@@ -11,7 +11,13 @@ This will generate three folders in `~/training_extensions/data/MVtec/` for clas
Then, to run sample.py you can use the following command.

```bash
python tools/sample.py --dataset_path ~/datasets/MVTec --category bottle --train-ann-files ../../data/MVtec/bottle/segmentation/train.json --val-ann-files ../../data/MVtec/bottle/segmentation/val.json --test-ann-files ../../data/MVtec/bottle/segmentation/test.json --model_template_path ./configs/anomaly_segmentation/padim/template.yaml
python tools/sample.py \
--dataset_path ~/datasets/MVTec \
--category bottle \
--train-ann-files ../../data/MVtec/bottle/segmentation/train.json \
--val-ann-files ../../data/MVtec/bottle/segmentation/val.json \
--test-ann-files ../../data/MVtec/bottle/segmentation/test.json \
--model_template_path ./configs/anomaly_segmentation/padim/template.yaml
```

Optionally, you can also optimize to `nncf` or `pot` by using the `--optimization` flag
2 changes: 1 addition & 1 deletion external/anomaly/tools/sample.py
Original file line number Diff line number Diff line change
@@ -61,7 +61,7 @@ def __init__(
val_subset: Dict[str, str],
test_subset: Dict[str, str],
model_template_path: str,
seed: Optional[int] = 0,
seed: Optional[int] = None,
) -> None:
"""Initialize OteAnomalyTask.

0 comments on commit 9ef77d0

Please sign in to comment.