Git Product home page Git Product logo

pylon's Introduction

Official implementation of Pyramid Localization Network (PYLON)

an iScience's paper (read online):

@article{PREECHAKUL2022103933,
title = {Improved image classification explainability with high-accuracy heatmaps},
journal = {iScience},
volume = {25},
number = {3},
pages = {103933},
year = {2022},
issn = {2589-0042},
doi = {https://doi.org/10.1016/j.isci.2022.103933},
url = {https://www.sciencedirect.com/science/article/pii/S2589004222002036},
author = {Konpat Preechakul and Sira Sriswasdi and Boonserm Kijsirikul and Ekapol Chuangsuwanich},
keywords = {Artificial intelligence, Computer science, Signal processing}

CAM methods are used to produce heatmaps for explaining a deep classifier. However, these heatmaps come in low resolution hindering explainaibilty of the classifier.

PYLON extends the deep classifier allowing CAM methods to generate much higher resolution heatmaps resulting in much more accurate explanation.

High resolution heatmaps:

high resolution heatmaps

PYLON's architecture:

PYLON architecture

What's included

  • Pytorch implementation of PYLON (see pylon.py)
  • Additional results and heatmaps
  • Code to reproduce the main results

Additional results

NIH's Chest X-Ray 14

  1. Picked localization images (256 x 256) (~20)

  2. Picked localization images (512 x 512) (~20)

  3. All localization images (256 x 256) (~1000 images)

Reproducing results

Requirements

It was tested with Pytorch 1.7.1.

conda create -n pylon python=3.7
conda activate pylon
conda install pytorch=1.7.1 torchvision cudatoolkit=11.0 -c pytorch

Install other related libraries:

pip install -r requirements.txt

Preparing datasets

NIH's Chest X-Ray 14

You need to download the Chest X-Ray 14 dataset by yourself from https://nihcc.app.box.com/v/ChestXray-NIHCC.

Extract all the images into a single big directory data/nih14/images, containing 100k images.

VinDr-CXR

Download the DICOM version from Kaggle https://www.kaggle.com/c/vinbigdata-chest-xray-abnormalities-detection/overview

You need to convert them into PNG. The script is provided in scripts/convert_dcm_to_png.py. The conversion will not alter the aspect ratio it will aim for maximum 1024 either width or height.

Put all the PNG files into directory data/vin/images. The final directory structures:

Pascal VOC2012

Download the dataset from http://host.robots.ox.ac.uk/pascal/VOC/voc2012/. (Only train & val datasets)

Extract it to data/voc2012. You should see the following directory structures:

data/voc2012
- VOCdevkit

Run

The main run files are train_nih_run.py (see train_nih.py for reference), train_vin_run.py (see train_vin.py for reference), and train_voc_run.py (see train_voc.py for reference). The files describe experiments to be run. They are straightforward to edit. Make changes or read before you run:

NIH's Chest X-Ray 14

python train_nih_run.py

VinDr-CXR

python train_vin_run.py

Pascal VOC2012

python train_voc_run.py

In order to compare with a wide-range of CAM methods, run the following scripts:

python eval_cam.py

The results will be shown at eval_loc/<cam_mode>/<model_name>

See the stats

Stats will be available at eval_auc and eval_loc.

The figures will be available at figs/picked and figs/all.

Running in parallel

You can change the config in mlkitenv.json:

{
    # available GPUs 
    "cuda": [0],
    "num_workers": 8,
    # number of parallel jobs
    "global_lock": 1
}

pylon's People

Contributors

phizaz avatar

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.