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

1Auburn University, 2Carnegie Mellon University, 3University of Alberta
Published to Transactions on Machine Learning Research in August, 2024
Paper
Code

Abstract

We present a new class of nearest-neighbor explanations (called Probable-Class Nearest Neighbors or PCNN) and show a novel utility of the XAI method: To improve predictions of a frozen, pretrained classifier \( C \). Our method consistently improves fine-grained image classification accuracy on CUB-200, Cars-196, and Dogs-120. Also, a human study finds that showing lay-users our PCNN explanations improves their decision accuracy over showing only the top-1 class examples (as in prior work).

Given an input image \(x\) and a black-box, pretrained classifier \(C\) that predicts the label for \(x\). Prior works (a) often show only the nearest neighbors from the top-1 predicted class as explanations for the decision, which often fools humans into accepting wrong decisions (here, Caspian Tern) due to the similarity between the input and top-1 class examples. Instead, including extra nearest neighbors (b) from top-2 to top-\(K\) classes improves not only human accuracy on this binary distinction task but also AI's accuracy on standard fine-grained image classification tasks (see how below).


Method

We train an image comparator network, denoted as \( \mathbf{S} \), to determine whether two images belong to the same class by assessing their similarity \( \mathbf{S}(x, nn) \). \( \mathbf{S} \) will be used later for re-ranking the top-\( K \) predicted classes by the pretrained classifier \( \mathbf{C} \).

Sampling Method

PCNN-based sampling: For each training-set image \( x \), we sample nearest-neighbor images from the groundtruth class of \( x \) to form positive pairs. To sample hard, negative pairs: Per non-groundtruth class among the top-predicted (most probable) classes from \( \mathbf{C}(x) \), we take the nearest image to the input. We then use such pairs to train an image comparator \( \mathbf{S} \).

Reranking Process

Product of Experts (Classifier × Comparator) re-ranking algorithm: In test, from each class among the top-predicted classes by the classifier \( \mathbf{C} \), we find the nearest neighbor \( nn \) to the query \( x \) and compute a sigmoid similarity score \( \mathbf{S}(x, nn) \), which weights the original \( \mathbf{C}(x) \) probabilities, re-ranking the labels.


Our proposed re-ranking algorithm improves the performance of frozen, pretrained classifiers Icon

Our re-ranking algorithm using \( \mathbf{S} \) significantly improves the top-1 classification accuracy over pretrained image classifiers on CUB-200, Cars-196, and Dogs-120.

Table 1: Our Product of Experts models consistently improve the top-1 classification accuracy (%) over pretrained classifiers on all 3 ResNet architectures and 3 datasets. "Pre-trained" column specifies the dataset models were pre-trained before fine-tuning on the target dataset. See below qualitative samples of how our method corrects wrong predictions of pretrained classifiers \( \mathbf{C} \).
Dataset Pre-trained RN18 RN18 × S RN34 RN34 × S RN50 RN50 × S
CUB-200 iNaturalist N/A N/A N/A N/A 85.83 88.59 ( +2.76 )
ImageNet 60.22 71.09 ( +10.87 ) 62.81 74.59 ( +11.78 ) 62.98 74.46 ( +11.48 )
Cars-196 ImageNet 86.17 88.27 ( +2.10 ) 82.99 86.02 ( +3.03 ) 89.73 91.06 ( +1.33 )
Dogs-120 ImageNet 78.75 79.58 ( +0.83 ) 82.58 83.62 ( +1.04 ) 85.82 86.31 ( +0.49 )

PCNN improves human decision-making accuracy on image classification Icon

We conduct a human study and find that PCNN explanations help humans improve their decision-making accuracy over showing top-1-class nearest neighbors (in previous work).

Human Experiments
In both experiments, humans are asked whether the input image is Caspian Tern given that input, a model prediction, and either top-1 class examples (top) or PCNN explanations (bottom). When given only examples from the top-1 class, humans tend to accept the prediction, not knowing there are other very visually similar birds. Yet, the top-5 classes provide humans with a broader context which leads to better accuracy.
Human Accuracy
Users often accept when top-1 neighbors are presented, leading to high accuracy when the AI is correct (left) and extremely poor accuracy when AI is wrong (right). PCNN ameliorates this limitation of the top-1 examples.

Try our human study now! Icon


Rationale for Disclosure of Project Contributions

Transparency in authorship is a cornerstone of academic integrity. In writing this disclosure, I aim to clearly attribute the contributions made by each author involved in this project. This practice is essential to ensure that credit is given where it is due, and it aligns with my strong stance against the practice of gifted authorship, where individuals are listed as authors without having made substantial contributions to the work.

Disclosure of Project Contributions

The contributions of each author to this project are detailed as follows:

  • Giang Nguyen: Giang has been the lead author of this project, contributing the majority of the technical work. He consistently generated new ideas, executed experiments, and brought his findings to group meetings for discussion.
  • Valerie Chen: Valerie joined the team at the outset and constantly provided valuable insights and feedback on the project's direction, particularly during the first year of the project. She also made significant contributions to the writing and editing of the paper.
  • Mohammad Reza Taesiri: Mohammad made contributions to the implementation of the human study, specifically building the interactive interface above based on specifications from Giang. Despite joining the project later, his work was important in bolstering the paper, adding a key component that made the paper complete.
  • Anh Totti Nguyen: Anh, Giang's PhD advisor, has been involved in the project since its inception. He provided guidance and mentorship to Giang, helping to shape the project's direction and refine its contributions and writing. While Giang proposed the reranking algorithms, both Giang and Anh worked together to further refine them, ultimately achieving the best performance on the 3 datasets.

BibTeX

@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={}
    }