Replies: 2 comments 1 reply
-
This seems to be an older version of config file you are using. anomalib/src/anomalib/data/image/mvtec.py Lines 307 to 324 in 404e896 Here's an example for mvtec (taken from here): class_path: anomalib.data.MVTec
init_args:
root: ./datasets/MVTec
category: bottle
train_batch_size: 32
eval_batch_size: 32
num_workers: 8
task: segmentation
transform: null
train_transform: null
eval_transform: null
test_split_mode: from_dir
test_split_ratio: 0.2
val_split_mode: same_as_test
val_split_ratio: 0.5
seed: null |
Beta Was this translation helpful? Give feedback.
-
One way to ensure you are using the right config structure is to use Anomalib CLI as follows: anomalib train --data MVTec --print_config which will return the following that you could modify # anomalib==1.2.0dev
seed_everything: true
trainer:
accelerator: auto
strategy: auto
devices: auto
num_nodes: 1
precision: null
logger: null
callbacks: null
fast_dev_run: false
max_epochs: null
min_epochs: null
max_steps: -1
min_steps: null
max_time: null
limit_train_batches: null
limit_val_batches: null
limit_test_batches: null
limit_predict_batches: null
overfit_batches: 0.0
val_check_interval: null
check_val_every_n_epoch: 1
num_sanity_val_steps: null
log_every_n_steps: null
enable_checkpointing: null
enable_progress_bar: null
enable_model_summary: null
accumulate_grad_batches: 1
gradient_clip_val: null
gradient_clip_algorithm: null
deterministic: null
benchmark: null
inference_mode: true
use_distributed_sampler: true
profiler: null
detect_anomaly: false
barebones: false
plugins: null
sync_batchnorm: false
reload_dataloaders_every_n_epochs: 0
task: SEGMENTATION
metrics:
image: null
pixel: null
logging:
log_graph: false
default_root_dir: results
ckpt_path: null
data:
class_path: anomalib.data.MVTec
init_args:
root: datasets/MVTec
category: bottle
train_batch_size: 32
eval_batch_size: 32
num_workers: 8
image_size: null
transform: null
train_transform: null
eval_transform: null
test_split_mode: FROM_DIR
test_split_ratio: 0.2
val_split_mode: SAME_AS_TEST
val_split_ratio: 0.5
seed: null |
Beta Was this translation helpful? Give feedback.
-
Hi guys, I meet some problem with the yaml file format, everything seems correct to me but it shows this error
ValueError: Not a valid subclass of AnomalibDataModule. Got value: {'init_args': {'name': 'mvtec', 'format':
'mvtec', 'class_path': 'anomalib.data.image.mvtec.MVTec', 'path': 'anomalib.data.image.mvtec.MVTec', 'task':
'segmentation', 'category': 'led', 'train_batch_size': 32, 'test_batch_size': 32, 'num_workers': 8, 'image_size':
[256, 256], 'center_crop': [224, 224], 'normalization': 'imagenet', 'transform_config': {'train': None, 'eval':
None}, 'test_split_mode': 'from_dir', 'test_split_ratio': 0.2, 'val_split_mode': 'same_as_test', 'val_split_ratio':
0.5, 'tiling': {'apply': False, 'tile_size': None, 'stride': None, 'remove_border_count': 0, 'use_random_tiling':
False, 'random_tile_count': 16}, 'init_args': {'image_size': [256, 256], 'center_crop': [224, 224]}}}
Subclass types expect one of:
data:
name: mvtec
format: mvtec
class_path: anomalib.data.image.mvtec.MVTec
path: anomalib.data.image.mvtec.MVTec
task: segmentation
category: led
train_batch_size: 32
test_batch_size: 32
num_workers: 8
image_size: # Updated to a sequence
- 256
- 256
center_crop: # Updated to a sequence
- 224
- 224
normalization: imagenet # data distribution to which the images will be normalized: [none, imagenet]
transform_config:
train: null
eval: null
test_split_mode: from_dir # options: [from_dir, synthetic]
test_split_ratio: 0.2 # fraction of train images held out testing (usage depends on test_split_mode)
val_split_mode: same_as_test # options: [same_as_test, from_test, synthetic]
val_split_ratio: 0.5 # fraction of train/test images held out for validation (usage depends on val_split_mode)
tiling:
apply: false
tile_size: null
stride: null
remove_border_count: 0
use_random_tiling: False
random_tile_count: 16
init_args: # Added init_args for data
# Include any initialization arguments required by the data class
image_size: # Also as a sequence
- 256
- 256
center_crop: # Also as a sequence
- 224
- 224
Beta Was this translation helpful? Give feedback.
All reactions