You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I use a custom dataset to train Fastflow with the new Lightning CLI Method. If I define 'category' in the config there is an Error:
anomalib: error: Parser key "data": Problem with given class_path "anomalib.data.Folder":
- 'Configuration check failed :: No action for destination key "category" to check its value.'
When I comment 'category' out in the config, there is an other AttributeError:
File "/home/USERNAME/masterthesis/anomalib/anomalib/utils/cli/cli.py", line 142, in __set_default_root_dir
category = config.data.init_args.category if config.data.init_args.keys() else ""
AttributeError: 'Namespace' object has no attribute 'category'
To Reproduce
Steps to reproduce the behavior:
Create config for Fastflow with custom Dataset:
# This is the config file for the new Anomalib CLI.
# To use this, run the following command:
# anomalib fit --config ./config/model/fastflow.yaml
ckpt_path: null
seed_everything: null
data:
class_path: anomalib.data.Folder
init_args:
root: ./synthetic_data/anomalib_lego_dataset
category: lego # not used in anomalib.data.Folder
normal_dir: good
abnormal_dir: abnormal
task: segmentation
mask_dir: ./synthetic_data/anomalib_lego_dataset/mask
extensions: ['.jpg']
normal_test_dir: null
split_ratio: 0.2
seed: 0
image_size: [256,256] # options: [256, 256, 448, 384] - for each supported backbone
train_batch_size: 16
test_batch_size: 16
num_workers: 8
transform_config_train: null
transform_config_val: null
create_validation_set: true
#tiling:
#apply: false
#tile_size: null
#stride: null
#remove_border_count: 0
#use_random_tiling: False
#random_tile_count: 16
model:
class_path: anomalib.models.Fastflow
init_args:
input_size: [256, 256]
backbone: wide_resnet50_2 # options: [resnet18, wide_resnet50_2, cait_m48_448, deit_base_distilled_patch16_384]
pre_trained: true
flow_steps: 8 # options: [8, 8, 20, 20] - for each supported backbone
conv3x3_only: False # options: [True, False, False, False] - for each supported backbone
hidden_ratio: 1.0 # options: [1.0, 1.0, 0.16, 0.16] - for each supported backbone
...
Call anomalib fit --config anomalib_model_config/fastflow_lightning.yaml
Output is:
anomalib: error: Parser key "data": Problem with given class_path "anomalib.data.Folder":
- 'Configuration check failed :: No action for destination key "category" to check its value.'
Modify Config File by commenting 'category' out and call anomalib fit --config anomalib_model_config/fastflow_lightning.yaml
Output is:
File "/home/USERNAME/masterthesis/anomalib/anomalib/utils/cli/cli.py", line 142, in __set_default_root_dir
category = config.data.init_args.category if config.data.init_args.keys() else ""
AttributeError: 'Namespace' object has no attribute 'category'
Expected behavior
Training should work by leaving out 'category'
Hardware and Software Configuration
OS: [Ubuntu 20.04]
NVIDIA Driver Version [515.65.01]
CUDA Version [11.7]
CUDNN Version [V10.1.243]
The text was updated successfully, but these errors were encountered:
Hey again, the bug is still present in the current version, so I took a second look.
The training works after I made a small change to anomalib/anomalib/utils/cli/cli.py and my config.
I removed 'category' from the config and removed the keys check in line 146 in cli.py:
Changed from: 146 category = config.data.init_args.category if config.data.init_args.keys() else ""
to: 146 category = ""
@dominikgraf, you are right. The error is because category is specified in your config. The new CLI is much stricter when it comes to passing the argument. If they are not part of the class args, it immediately throws error.
In this case, category is not one of the class arguments of the FolderDataset, which is why you encountered this issue.
You don't even need to change the code. If you remove category from your config file, it should work.
Thanks for your answer, @samet-akcay . I tried removing / commenting out 'category' as described in the lower part of my report:
Modify config file by removing / commenting out 'category' and call anomalib fit --config anomalib_model_config/fastflow_lightning.yaml again
Output is:
File "/home/USERNAME/masterthesis/anomalib/anomalib/utils/cli/cli.py", line 142, in __set_default_root_dir
category = config.data.init_args.category if config.data.init_args.keys() else ""
AttributeError: 'Namespace' object has no attribute 'category'
To me it seems that, the check of 'keys()' is skipped for some reason.
Removing 'category' from my config did not solve the Error.
Describe the bug
I use a custom dataset to train Fastflow with the new Lightning CLI Method. If I define 'category' in the config there is an Error:
When I comment 'category' out in the config, there is an other AttributeError:
To Reproduce
Steps to reproduce the behavior:
anomalib fit --config anomalib_model_config/fastflow_lightning.yaml
Output is:
anomalib fit --config anomalib_model_config/fastflow_lightning.yaml
Output is:
Expected behavior
Hardware and Software Configuration
The text was updated successfully, but these errors were encountered: