Skip to content

notan79/CSC580_Final_Project

Repository files navigation

A Graph Attention Network Approach for Histopathology Patch Classification

Link to report (PDF)

Overview:

This project contains the PyTorch implementation for a Graph Attention Network (GAT) framework for classifying colorectal cancer patches from the PathMNIST dataset. We explored both an End-to-End (raw pixel) and a Hybrid Autoencoder approach to node embeddings.

Requirements:

To set up the environment, run:

pip install torch torchvision
pip install torch-geometric
pip install medmnist
pip install pandas numpy matplotlib scikit-learn

Hardware:

The code was run on Windows 11 v24H2, using an Nvidia RTX 5070 GPU (12 GB of VRAM) with an AMD Ryzen 7 9800x3D processor, and 31.1 GB of standard RAM (6000 MT/s).

Repository Structure:

├── train_ae.ipynb              # defines and trains the Autoencoder used for the Hybrid approach.
├── train_model_gat_ae.ipynb    # uses the model from train_ae.ipynb to train the Hybrid GAT.
├── train_model_mlp.ipynb       # trains a simple MLP for baseline comparison.
├── train_model_simple.ipynb    # trains the End-to-End GAT.
├── visualize_graphs.ipynb      # visualizes the attention scores
├── download_data.ipynb         # contains the downloading data and graph creations.
├── GATModels.py                # contains the GAT model definitions. 
├── AutoEncoder.py              # contains the Autoencoder definition.
├── util/                       # contains various utility files used in graph creation and dataset representation. 
└── README.md                   # project documentation

Usage:

  1. Run download_data.ipynb to download the dataset and to create the graphs.
  2. Run train_model_mlp.ipynb to train the baselines.
  3. Run train_ae.ipynb to train the Autoencoder to embed the node features.
  4. Run train_model_gat_ae.ipynb to train the Hybrid GAT.
  5. Run train_model_simple.ipynb to train the End-to-End GAT (best model performance).
  6. Run visualize_graphs.ipynb to visualize the attention scores on a fixed spatial grid.

Results Summary

Model Accuracy AUC
GAT (End-to-End) 0.775 0.962
GAT (Hybrid) 0.689 0.942
MLP Baseline 0.638 0.925

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors