openvinotoolkit / open_model_zoo

Pre-trained Deep Learning models and demos (high quality and extremely fast)
https://docs.openvino.ai/latest/model_zoo.html
Apache License 2.0
4.1k stars 1.37k forks source link

[Bug?] NiftiImageReader raises TypeError exception #2483

Closed niihori closed 3 years ago

niihori commented 3 years ago
System information (version)
Detailed description

I am suspecting my careless mistake, but I report an issue below anyway.

When I ran accuracy checker with brain-tumor-segmentation-0001, it raised TypeError exception with the following message:

  File "D:\OpenVINO\python_venvs\openvino-2021.3_py37\lib\site-packages\accuracy_checker-0.8.6-py3.7.egg\accuracy_checker\data_readers\data_reader.py", line 504, in read
    nib_image = nib.load(str(get_path(self.data_source / data_id)))
TypeError: unsupported operand type(s) for /: 'str' and 'str'

Despite self.data_source should be the instance of pathlib.Path at line 504 of data_reader.py, it was actually 'str' since no NiftiImageReader's methods converted self.data_source from str to pathlib.Path. BaseReader.configure() was disappeared from NiftiImageReader as BaseReader.configure() was overridden by NiftiImageReader.configure().

If my inspection is really right, some of the other functions implemented in data_reader.py have the same implementation issue as well.

A workaround is to call super.configure() in NiftiImageReader.configure().

Steps to reproduce
  1. \model-optimizer\install_prerequisites\install_prerequisites_mxnet.bat
  2. (Comment out "shapely" and "editdistance" in \tools\accuracy_checker\requirements.in to prevent the installation errors on Windows)
  3. python.exe \tools\accuracy_checker\setup.py install
  4. python.exe \tools\downloader\downloader.py ^ --name brain-tumor-segmentation-0001
  5. python.exe \tools\downloader\converter.py ^ --mo \model-optimizer\mo.py ^ --name brain-tumor-segmentation-0001
  6. (Download the input and label images from the web site "Medical Segmentation Decathlon", and then save them in Task01_BrainTumour\imagesTr and Task01_BrainTumour\labelsTr folders, respectively)
  7. convert_annotation brats --data_dir Task01_BrainTumour --mask_channels_first True
  8. accuracy_check.exe -c accuracy-check.yml

Attached is my accuracy-check.yml. Some of the values specified in my yaml file may be wrong.

accuracy-check.yml.txt

Issue submission checklist
vladimir-dudnik commented 3 years ago

@niihori thanks for well formed issue report. @eaidova @eizamaliev could you please take a look at this? Is there something should be corrected on our side?

eaidova commented 3 years ago

@niihori thank you for your report. I prepared fix: https://github.com/openvinotoolkit/open_model_zoo/pull/2486