Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: 'NoneType' object has no attribute 'train' #219

Closed
LukasBommes opened this issue Apr 11, 2022 · 3 comments
Closed

AttributeError: 'NoneType' object has no attribute 'train' #219

LukasBommes opened this issue Apr 11, 2022 · 3 comments

Comments

@LukasBommes
Copy link
Contributor

Currently, I encounter the following error when running tools/train.py with a custom folder dataset and transform_config: null set in the config.

Traceback (most recent call last):
  File "tools/train.py", line 71, in <module>
    train()
  File "tools/train.py", line 54, in train
    datamodule = get_datamodule(config)
  File "/anomalib/anomalib/data/__init__.py", line 83, in get_datamodule
    transform_config_train=config.dataset.transform_config.train,
AttributeError: 'NoneType' object has no attribute 'train'

The config is as follows:

dataset:
  name: pv_fault_single_patch_per_module_converted_small
  format: folder
  path: ./datasets/pv_fault_single_patch_per_module_converted_small
  normal: normal
  abnormal: abnormal
  task: classification
  mask: null
  extensions: null
  split_ratio: 0.2
  seed: 0  
  image_size: 64 #224
  train_batch_size: 32
  test_batch_size: 1
  num_workers: 16
  transform_config: 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

Where the rest corresponds to the default Padim config.

@alexriedel1
Copy link
Contributor

you have to update your config.yaml :)

@samet-akcay
Copy link
Contributor

@LukasBommes, it's due to the changes made in PR #168. Train and validation augmentations are now split. As @alexriedel1 said, configs has been modified as follows:

  ...
  test_batch_size: 1
  num_workers: 0
  transform_config:
    train: null
    val: null
  create_validation_set: false
  ...

If you update your config file, it should work

@LukasBommes
Copy link
Contributor Author

Ah, I see. Thanks a lot for clarifying this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants