anomalib icon indicating copy to clipboard operation
anomalib copied to clipboard

[Bug]: config upgrade to V1 does not work

Open nickjyj opened this issue 1 year ago • 3 comments

Describe the bug

I had a old config for my existing projects. After migrating to the new config using the upgrade script, started training but it failed with this error: error: Validation failed: No action for key "visualization.visualizers" to check its value.

If I commented out the entire section of "visualization" in the new config file, got this error: error: Validation failed: No action for key "results_dir.path" to check its value.

Dataset

Folder

Model

PADiM

Steps to reproduce the behavior

  1. install the library: git clone https://github.com/openvinotoolkit/anomalib.git && cd anomalib && pip install -e . && anomalib install --option core
  2. run the upgrade script: python /app/anomalib/tools/upgrade/config.py -i /app/configs/old.yaml -o /app/configs/new.yaml
  3. run the train cli: anomalib train --config /app/configs/new.yaml

OS information

OS information:

  • OS: Ubuntu 20.04
  • Python version: 3.10.0
  • Anomalib version: latest
  • PyTorch version: 2.0.0
  • CUDA/cuDNN version: 12.2
  • GPU models and configuration: 1 x GeForce RTX 3090
  • Any other relevant information: N/A

Expected behavior

The training process should have no errors.

Screenshots

No response

Pip/GitHub

GitHub

What version/branch did you use?

lastest

Configuration YAML

dataset:
  name: model
  format: folder
  path: /app/data/
  normal_dir: train/good
  normal_test_dir: null
  task: segmentation
  abnormal_dir: null  # leave null if no ground_truth
  mask: null    # leave null if no ground_truth
  extensions: null
  split_ratio: 0.2
  train_batch_size: 16
  test_batch_size: 16
  num_workers: 16
  image_size: 
  - 1120
  - 224
  center_crop: null
  normalization: imagenet
  transform_config:
    train: null
    eval: null
  test_split_mode: from_dir
  test_split_ratio: 0.1
  val_split_mode: same_as_test
  val_split_ratio: 0.1
  tiling:
    apply: true
    tile_size: 224
    stride: 224
    remove_border_count: 0
    use_random_tiling: false
    random_tile_count: 16
  eval_batch_size: 1

model:
  name: padim
  backbone: wide_resnet50_2
  # backbone: resnet18
  pre_trained: true
  layers:
  - layer1
  - layer2
  - layer3
  normalization_method: min_max
  n_features: 200

metrics:
  image:
  - F1Score
  - AUROC
  pixel:
  - F1Score
  - AUROC
  threshold:
    method: adaptive
    manual_image: null
    manual_pixel: null
visualization:
  show_images: false
  save_images: false
  log_images: false
  image_save_path: /app/out
  mode: full
project:
  seed: 42
  path: /app/out/results
  unique_dir: false
logging:
  logger: []
  log_graph: false
optimization:
  export_mode: null
trainer:
  enable_checkpointing: true
  default_root_dir: /app/out/results/padim/model/run
  gradient_clip_val: 0
  gradient_clip_algorithm: norm
  num_nodes: 1
  devices: 1
  enable_progress_bar: true
  overfit_batches: 0.0
  track_grad_norm: -1
  check_val_every_n_epoch: 1
  fast_dev_run: false
  accumulate_grad_batches: 1
  max_epochs: 1
  min_epochs: null
  max_steps: -1
  min_steps: null
  max_time: null
  limit_train_batches: 1.0
  limit_val_batches: 1.0
  limit_test_batches: 1.0
  limit_predict_batches: 1.0
  val_check_interval: 1.0
  log_every_n_steps: 50
  accelerator: auto
  strategy: null
  sync_batchnorm: false
  precision: 32
  enable_model_summary: true
  num_sanity_val_steps: 0
  profiler: null
  benchmark: false
  deterministic: false
  reload_dataloaders_every_n_epochs: 0
  auto_lr_find: false
  replace_sampler_ddp: true
  detect_anomaly: false
  auto_scale_batch_size: false
  plugins: null
  move_metrics_to_cpu: false
  multiple_trainloader_mode: max_size_cycle

Logs

anomalib_train-1  | [05/02/24 14:55:41] INFO     OpenVINO is possibly not installed   openvino.py:32
anomalib_train-1  |                              in the environment. Skipping adding                
anomalib_train-1  |                              it to parser.                                      
anomalib_train-1  | Usage: anomalib [-h] [-c CONFIG] [--print_config [=flags]]
anomalib_train-1  |                 {install,fit,validate,test,train,predict,export} ...
anomalib_train-1  | error: Validation failed: No action for key "visualization.visualizers" to check its value.

Code of Conduct

  • [X] I agree to follow this project's Code of Conduct

nickjyj avatar May 02 '24 15:05 nickjyj

any update on this?

nickjyj avatar May 13 '24 13:05 nickjyj

I think https://github.com/openvinotoolkit/anomalib/blob/28e023ea88cda9a41d284e6fd2ac5d5e7fdb66f2/tools/upgrade/config.py#L212 and https://github.com/openvinotoolkit/anomalib/blob/28e023ea88cda9a41d284e6fd2ac5d5e7fdb66f2/tools/upgrade/config.py#L239 are missing items in v1 config. I think this should no longer be supported. Can you please check? @ashwinvaidya17

cc. @samet-akcay

harimkang avatar May 17 '24 02:05 harimkang

any update?

nickjyj avatar Jul 23 '24 17:07 nickjyj