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.68k stars 654 forks source link

[Bug]: v1.1.0 FileNotFoundError: No such file or directory: 'tools\\benchmarking\\benchmark_params.yaml' #2143

Closed openvino-book closed 3 months ago

openvino-book commented 3 months ago

Describe the bug

FileNotFoundError: No such file or directory: 'tools\benchmarking\benchmark_params.yaml' when executing "anomalib benchmark --config tools/benchmarking/benchmark_params.yaml"

Dataset

MVTec

Model

PatchCore

Steps to reproduce the behavior

Run command using "anomalib benchmark --config tools/benchmarking/benchmark_params.yaml" Error ocurr: 1718609021692 There is no benchmarking folder in tools folder as below 1718609059974

OS information

OS information:

Expected behavior

NULL

Screenshots

No response

Pip/GitHub

pip

What version/branch did you use?

1.1.0

Configuration YAML

NULL

Logs

(anomalib) D:\chapter_6>anomalib benchmark -h
usage: anomalib [options] benchmark [-h] --config CONFIG

options:
  -h, --help       Show this help message and exit.
  --config CONFIG  Configuration file path. (required, type: str | Path)

(anomalib) D:\chapter_6>anomalib benchmark --config tools/benchmarking/benchmark_params.yaml
2024-06-17 15:14:58,117 - anomalib.cli.pipelines - WARNING - This feature is experimental. It may change or be removed in the future.
[06/17/24 15:14:58] WARNING  This feature is experimental. It may change or be removed in  pipelines.py:34
                             the future.
╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
│ in _run_module_as_main:198                                                                       │
│ in _run_code:88                                                                                  │
│                                                                                                  │
│ in <module>:7                                                                                    │
│                                                                                                  │
│   4 from anomalib.cli.cli import main                                                            │
│   5 if __name__ == '__main__':                                                                   │
│   6 │   sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])                         │
│ ❱ 7 │   sys.exit(main())                                                                         │
│   8                                                                                              │
│                                                                                                  │
│ C:\Users\OV\anaconda3\envs\anomalib\Lib\site-packages\anomalib\cli\cli.py:486 in main            │
│                                                                                                  │
│   483 def main() -> None:                                                                        │
│   484 │   """Trainer via Anomalib CLI."""                                                        │
│   485 │   configure_logger()                                                                     │
│ ❱ 486 │   AnomalibCLI()                                                                          │
│   487                                                                                            │
│   488                                                                                            │
│   489 if __name__ == "__main__":                                                                 │
│                                                                                                  │
│ C:\Users\OV\anaconda3\envs\anomalib\Lib\site-packages\anomalib\cli\cli.py:65 in __init__         │
│                                                                                                  │
│    62 │   │   │   self.before_instantiate_classes()                                              │
│    63 │   │   │   self.instantiate_classes()                                                     │
│    64 │   │   if run:                                                                            │
│ ❱  65 │   │   │   self._run_subcommand()                                                         │
│    66 │                                                                                          │
│    67 │   def init_parser(self, **kwargs) -> ArgumentParser:                                     │
│    68 │   │   """Method that instantiates the argument parser."""                                │
│                                                                                                  │
│ C:\Users\OV\anaconda3\envs\anomalib\Lib\site-packages\anomalib\cli\cli.py:367 in _run_subcommand │
│                                                                                                  │
│   364 │   │   │   fn_kwargs = self._prepare_subcommand_kwargs(self.subcommand)                   │
│   365 │   │   │   fn(**fn_kwargs)                                                                │
│   366 │   │   elif PIPELINE_REGISTRY is not None and self.subcommand in pipeline_subcommands()   │
│ ❱ 367 │   │   │   run_pipeline(self.config)                                                      │
│   368 │   │   else:                                                                              │
│   369 │   │   │   self.config_init = self.parser.instantiate_classes(self.config)                │
│   370 │   │   │   getattr(self, f"{self.subcommand}")()                                          │
│                                                                                                  │
│ C:\Users\OV\anaconda3\envs\anomalib\Lib\site-packages\anomalib\cli\pipelines.py:38 in            │
│ run_pipeline                                                                                     │
│                                                                                                  │
│   35 │   if PIPELINE_REGISTRY is not None:                                                       │
│   36 │   │   subcommand = args.subcommand                                                        │
│   37 │   │   config = args[subcommand]                                                           │
│ ❱ 38 │   │   PIPELINE_REGISTRY[subcommand]().run(config)                                         │
│   39 │   else:                                                                                   │
│   40 │   │   msg = "Pipeline is not available"                                                   │
│   41 │   │   raise ValueError(msg)                                                               │
│                                                                                                  │
│ C:\Users\OV\anaconda3\envs\anomalib\Lib\site-packages\anomalib\pipelines\components\base\pipelin │
│ e.py:57 in run                                                                                   │
│                                                                                                  │
│   54 │   │   Args:                                                                               │
│   55 │   │   │   args (Namespace): Arguments to run the pipeline. These are the args returned    │
│   56 │   │   """                                                                                 │
│ ❱ 57 │   │   args = self._get_args(args)                                                         │
│   58 │   │   runners = self._setup_runners(args)                                                 │
│   59 │   │   redirect_logs(log_file)                                                             │
│   60 │   │   previous_results: PREV_STAGE_RESULT = None                                          │
│                                                                                                  │
│ C:\Users\OV\anaconda3\envs\anomalib\Lib\site-packages\anomalib\pipelines\components\base\pipelin │
│ e.py:44 in _get_args                                                                             │
│                                                                                                  │
│   41 │   │   │   parser = self.get_parser()                                                      │
│   42 │   │   │   args = parser.parse_args()                                                      │
│   43 │   │                                                                                       │
│ ❱ 44 │   │   with Path(args.config).open() as file:                                              │
│   45 │   │   │   return yaml.safe_load(file)                                                     │
│   46 │                                                                                           │
│   47 │   @abstractmethod                                                                         │
│                                                                                                  │
│ C:\Users\OV\anaconda3\envs\anomalib\Lib\pathlib.py:1044 in open                                  │
│                                                                                                  │
│   1041 │   │   """                                                                               │
│   1042 │   │   if "b" not in mode:                                                               │
│   1043 │   │   │   encoding = io.text_encoding(encoding)                                         │
│ ❱ 1044 │   │   return io.open(self, mode, buffering, encoding, errors, newline)                  │
│   1045 │                                                                                         │
│   1046 │   def read_bytes(self):                                                                 │
│   1047 │   │   """                                                                               │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
FileNotFoundError: [Errno 2] No such file or directory: 'tools\\benchmarking\\benchmark_params.yaml'

Code of Conduct

samet-akcay commented 3 months ago

@openvino-book, if you would like to use the benchmarking feature, you could use this sample config file: https://github.com/openvinotoolkit/anomalib/blob/main/tools/experimental/benchmarking/sample.yaml

The path that you are using is for older versions of anomalib, which is not available anymore.

Feel free to re-open this issue if you still have issues.

openvino-book commented 3 months ago

@openvino-book, if you would like to use the benchmarking feature, you could use this sample config file: https://github.com/openvinotoolkit/anomalib/blob/main/tools/experimental/benchmarking/sample.yaml

The path that you are using is for older versions of anomalib, which is not available anymore.

Feel free to re-open this issue if you still have issues.

@samet-akcay Thank you for your quick response!~ May I ask when to solve the document dismatch the path of the benchmark config file as below. Because I introduce anomalib in my book, the dismatching problem will mislead the reader. Please help.... 1718673375489