openvinotoolkit / anomalib

An anomaly detection library comprising state-of-the-art algorithms and features such as experiment management, hyper-parameter optimization, and edge inference.
https://anomalib.readthedocs.io/en/latest/
Apache License 2.0
3.4k stars 615 forks source link

[Bug]: Why is training slow to start, about efficientAD? #2166

Open tianlan6767 opened 3 days ago

tianlan6767 commented 3 days ago

Describe the bug

Why is training slow to start ? when i run the training code, it needs at least 6 minutes to train, how i can fix it ?

Dataset

Folder

Model

Other (please specify in the field below)

Steps to reproduce the behavior

  1. python train.py

OS information

OS information:

Expected behavior

How to train code quickly

Screenshots

run the code image

waiting image training image

Pip/GitHub

pip

What version/branch did you use?

1.2.0.dev0

Configuration YAML

seed_everything: true

trainer:
  accelerator: auto 
  strategy: auto
  devices: auto
  num_nodes: 1
  precision: 32
  logger: null
  callbacks: null
  fast_dev_run: false
  max_epochs: 1000
  min_epochs: null
  max_steps: 70000
  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: 0
  log_every_n_steps: null
  enable_checkpointing: True
  enable_progress_bar: True
  enable_model_summary: True
  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
normalization:
  normalization_method: MIN_MAX
task: SEGMENTATION
metrics:
  image:
  - BinaryF1Score
  - AUROC
  pixel:
  - AUROC
  - BinaryF1Score
  threshold:
    class_path: anomalib.metrics.F1AdaptiveThreshold
    init_args:
      default_value: 0.5
      thresholds: null
      ignore_index: null
      validate_args: true
      compute_on_cpu: false
      dist_sync_on_step: false
      sync_on_compute: true
default_root_dir: ./ct_splice_8p/run/anomalib
ckpt_path: null
model:
  class_path: anomalib.models.EfficientAd
  init_args:
    imagenet_dir: datasets/imagenette
    teacher_out_channels: 384
    model_size: S
    lr: 0.0001
    weight_decay: 1.0e-05
    padding: false
    pad_maps: true
data:
  class_path: anomalib.data.Folder
  init_args:
    name: splice_16p
    normal_dir: train/good
    root: ./datasets/ct_splice_8p
    # abnormal_dir: test/broken_large
    # normal_test_dir: null
    # mask_dir: ground_truth/broken_large
    normal_split_ratio: 0.0
    extensions:
    - .jpg
    train_batch_size: 1
    eval_batch_size: 1
    num_workers: 1
    image_size:
    - 512
    - 512
    train_transform: 
      class_path: torchvision.transforms.v2.Compose
      init_args:
        transforms:
          - class_path: torchvision.transforms.v2.ToImage
          - class_path: torchvision.transforms.v2.Resize
            init_args:
              size: [512, 512]
              antialias: True
          - class_path: torchvision.transforms.v2.ToDtype
            init_args:
              dtype: torch.float32
              scale: True
    eval_transform:
      class_path: torchvision.transforms.v2.Compose
      init_args:
        transforms:
          - class_path: torchvision.transforms.v2.ToImage
          - class_path: torchvision.transforms.v2.Resize
            init_args:
              size: [512, 512]
              antialias: True
          - class_path: torchvision.transforms.v2.ToDtype
            init_args:
              dtype: torch.float32
              scale: True
    test_split_mode: synthetic # from_dir NONE synthetic
    test_split_ratio: 0.2
    val_split_mode: same_as_test
    val_split_ratio: 0.2
    seed: null

Logs

null

Code of Conduct