Git Product home page Git Product logo

hungntt / xai_thyroid Goto Github PK

View Code? Open in Web Editor NEW
46.0 2.0 6.0 2.06 MB

Classification and Object Detection XAI methods (CAM-based, backpropagation-based, perturbation-based, statistic-based) for thyroid cancer ultrasound images

License: Creative Commons Zero v1.0 Universal

Python 100.00%
explainable-ai explainable-artificial-intelligence explainable-machine-learning explainable-ml medical-ai medical-image-processing medical-imaging thyroid thyroid-ultrasound-image computer-vision object-detection python

xai_thyroid's Introduction

img_2.png

Towards XAI in Thyroid Tumor Diagnosis

Our paper is accepted and presented as a long presentation at Health Intelligence Workshop (W3PHIAI-23) at AAAI-23.

Source code for XAI Thyroid - an XAI object detection problem

  1. Install environment
pip install -r requirements.txt

Move the model to model/src/ folder.

  1. Instruct the parameters to be run with each algorithm
python main.py --help
  1. Command line example with algorithms Arguments options:
  • --config-path: path to the configuration file
  • --method: XAI method to run (options: eLRP, GradCAM, GradCAM++, RISE, LIME, DRISE, KDE, DensityMap, AdaSISE)
  • --image-path: path to the image to be processed
  • --stage: stage of the algorithm to be run (options: first_stage, second_stage, default: first_stage)
  • --threshold: threshold of output values to visualize
  • --output-path: path to the output directory

For example, to run the XAI algorithms on images in test_images folder:

  • GradCAM

In first stage:

python main.py --config-path xAI_config.json --method GradCAM --image-path data/test_images/ --output-path results/

In second stage:

python main.py --config-path xAI_config.json --method GradCAM --image-path data/test_images/ --stage second_stage --output-path results/
  • GradCAM++

In first stage:

python main.py --config-path xAI_config.json --method GradCAM++ --image-path data/test_images/ --output-path results/

In second stage:

python main.py --config-path xAI_config.json --method GradCAM++ --image-path data/test_images/ --stage second_stage --output-path results/

Note: To change input, change the path to new data and path to xml file in xAI_config.json

Applicability

img_1.png • Region Proposal Generation (Which proposals are generated by the model during the model’s first stage?): Kernel Density Estimation (KDE), Density map (DM).

• Classification (Which features of an image make the model classify an image containing a nodule(s) at the model’s second stage?): LRP, Grad-CAM, Grad-CAM++, LIME, RISE, Ada-SISE, D-RISE.

• Localization (Which features of an image does the model consider to detect a specific box containing a nodule at the model’s second stage?): D-RISE.

Results

img.png

Citation

If you find this repository helpful for your research. Please cite our paper as a small support for us too :)

@article{nguyen2023towards,
  title={Towards Trust of Explainable AI in Thyroid Nodule Diagnosis},
  author={Nguyen, Truong Thanh Hung and Truong, Van Binh and Nguyen, Vo Thanh Khang and Cao, Quoc Hung and Nguyen, Quoc Khanh},
  journal={arXiv preprint arXiv:2303.04731},
  year={2023}
}

xai_thyroid's People

Contributors

binh24399 avatar dependabot[bot] avatar hungntt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

xai_thyroid's Issues

egg_info error occurs when installing matplotlib from requirments.txt file

Hello, I'm getting this error while trying to install the packages from requirements.txt
Note: Python 3.9.13, pip is upgraded as well as setuptools

Collecting matplotlib==3.0.3
  Using cached matplotlib-3.0.3.tar.gz (36.6 MB)
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [47 lines of output]
      ============================================================================
      Edit setup.cfg to change the build options

      BUILDING MATPLOTLIB
                  matplotlib: yes [3.0.3]
                      python: yes [3.9.13 (tags/v3.9.13:6de2ca5, May 17 2022,
                              16:36:42) [MSC v.1929 64 bit (AMD64)]]
                    platform: yes [win32]

      REQUIRED DEPENDENCIES AND EXTENSIONS
                       numpy: yes [version 1.26.2]
            install_requires: yes [handled by setuptools]
                      libagg: yes [pkg-config information for 'libagg' could not
                              be found. Using local copy.]
                    freetype: no  [The C/C++ header for freetype
                              (freetype2\ft2build.h) could not be found.  You may
                              need to install the development package.]
                         png: no  [The C/C++ header for png (png.h) could not be
                              found.  You may need to install the development
                              package.]
                       qhull: yes [pkg-config information for 'libqhull' could not
                              be found. Using local copy.]

      OPTIONAL SUBPACKAGES
                 sample_data: yes [installing]
                    toolkits: yes [installing]
                       tests: no  [skipping due to configuration]
              toolkits_tests: no  [skipping due to configuration]

      OPTIONAL BACKEND EXTENSIONS
                         agg: yes [installing]
                       tkagg: yes [installing; run-time loading from Python Tcl /
                              Tk]
                      macosx: no  [Mac OS-X only]
                   windowing: yes [installing]

      OPTIONAL PACKAGE DATA
                        dlls: no  [skipping due to configuration]

      ============================================================================
                              * The following required packages can not be built:
                              * freetype, png
                              * Please check http://gnuwin32.sourceforge.net/packa
                              * ges/freetype.htm for instructions to install
                              * freetype
                              * Please check http://gnuwin32.sourceforge.net/packa
                              * ges/libpng.htm for instructions to install png
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

Any solutions please? Thank you
PS: I looked for matplotlib's ==3.0.3 dependencies requirements, and it supports python =>3.5

Help

Schermata 2024-02-29 alle 11 06 37

Hi, I need some help. I have these two errors. The first when I install requirements.txt and the second in main with invalid syntax. How could I do? Thank you very much

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.