8000 GitHub - anguyen8/nearest-neighbor-XAI
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

anguyen8/nearest-neighbor-XAI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PCNN: Probable-Class Nearest-Neighbor Explanations Improve
Fine-Grained Image Classification Accuracy for AIs and Humans

Transactions on Machine Learning Research

Giang Nguyen1*, Valerie Chen2, Mohammad Reza Taesiri3, Anh Nguyen1

*Corresponding author · 1Auburn University · 2Carnegie Mellon University · 3University of Alberta

PCNN teaser figure


📜 Abstract

Nearest neighbors are traditionally used either to make final predictions (e.g. k-NN, SVMs) or to provide supporting evidence for a model’s decision.
PCNN takes a new path: we keep a pretrained image classifier C intact, then let an image comparator S

  1. compare the query image against nearest neighbors drawn from each of the top-most probable classes, and
  2. re-weight C’s logits in a Product-of-Experts style.

This simple plug-in consistently boosts accuracy on CUB-200, Cars-196, and Dogs-120.
A user study further shows that lay users make more accurate decisions when viewing PCNN’s probable-class neighbors versus seeing only top‑1‑class examples (prior work).


🗺️ Table of Contents

  1. Pre‑requisites & Pretrained Models
  2. Training Image‑Comparator Networks
  3. Testing — Binary Classification & Re-ranking
  4. Qualitative Visualizations
  5. Human‑Study Data
  6. Citation

Pre‑requisites & Pretrained Models


Training Image‑Comparator Networks

CUB‑200

  1. In params.py set
    global_training_type = "CUB"
    self.set = "train"
  2. Launch:
    sh train_cub.sh

Cars‑196 & Dogs‑120

Same recipe; just set
global_training_type = "CARS" or "DOGS".


Testing — Binary Classification & Re‑ranking

CUB‑200

  1. Edit params.py:
    global_training_type = "CUB"
    self.set = "test"
  2. Run:
    sh test_cub.sh

Cars‑196 & Dogs‑120

Swap global_training_type to "CARS" or "DOGS" and execute the matching script to reproduce the main‑paper table:

Main accuracy table


Qualitative Visualizations

The following commands assume CUB‑200; substitute "CARS" / "DOGS" as needed.

What you’ll see How to run
Corrections made by S python cub_visualize_corrections.py
Training pairs used by S python cub_visualize_training_nns.py
Failure cases of S
(set VISUALIZE_COMPARATOR_CORRECTNESS=True)
python cub_infer.py
Attention heat‑maps
(set VISUALIZE_COMPARATOR_HEATMAPS=True)
python cub_infer.py

Human‑Study Data

All stimuli for our CUB‑200 and Cars‑196 user studies are available at:
https://drive.google.com/drive/folders/1yNIOfypfy1vvI3Q3MAq9LNIVlyQ3WY-V


Citation

@article{
nguyen2024pcnn,
title={{PCNN}: Probable-Class Nearest-Neighbor Explanations Improve Fine-Grained Image Classification Accuracy for {AI}s and Humans},
author={Giang Nguyen and Valerie Chen and Mohammad Reza Taesiri and Anh Nguyen},
journal={Transactions on Machine Learning Research},
issn={2835-8856},
year={2024},
url={https://openreview.net/forum?id=OcFjqiJ98b},
note={}
}

🖼️ Questions? Open an issue or email nguyengiangbkhn@gmail.com 🖼️

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •  
0