Skip to content

Code for the paper "Beyond Accuracy: A Methodological Roadmap...". This repository provides a PyTorch pipeline for training and evaluating a 3D CNN on fMRI data for ASD classification, with a focus on reproducibility and methodological evaluation on the ABIDE I dataset.

License

Notifications You must be signed in to change notification settings

Aadisharma1/ASD-FMRI-Classification

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Beyond Accuracy: A Methodological Roadmap for Generalizable and Interpretable Models in fMRI-Based ASD Classification

This repository contains the complete PyTorch pipeline for the research paper, "A Critical Evaluation of 3D CNNs for ASD Classification using fMRI: A Methodological Roadmap for Generalizable and Interpretable Models."

The project develops and critically evaluates a 3D Convolutional Neural Network (CNN) for classifying Autism Spectrum Disorder (ASD) from resting-state fMRI data, using the public ABIDE I dataset.

📖 Project Overview

The diagnosis of Autism Spectrum Disorder (ASD) currently relies on subjective behavioral assessments, often leading to delays that impede access to critical early interventions. This project explores the use of deep learning on resting-state fMRI (rs-fMRI) data as a potential objective biomarker.

This repository provides an end-to-end pipeline that:

  1. Implements a 3D ResNet-18 architecture with transfer learning from the Kinetics-400 video dataset.
  2. Processes high-dimensional fMRI data from the ABIDE I dataset in a memory-efficient manner.
  3. Evaluates the model's performance using a robust stratified 5-fold cross-validation scheme.
  4. Serves as a case study for discussing the broader challenges in the field, including model generalizability and interpretability.

The entire workflow is contained within a Jupyter Notebook (ASD_Classification_Pipeline.ipynb) for transparency and ease of use.

🔧 Key Features

  • Model: 3D ResNet-18 with transfer learning.
  • Framework: PyTorch.
  • Data Handling: Memory-efficient, on-the-fly preprocessing of .nii.gz files using a custom PyTorch Dataset class.
  • Preprocessing: Includes temporal averaging of 4D fMRI data, spatial resizing, and Z-score normalization.
  • Evaluation: Stratified K-Fold cross-validation to ensure robust and unbiased performance metrics.
  • Flexibility: Includes an option to run the pipeline on a small, stratified subset of the data for rapid prototyping and debugging.

📊 Dataset

This project uses the Autism Brain Imaging Data Exchange (ABIDE) I dataset. The data used in this pipeline was preprocessed using the Configurable Pipeline for the Analysis of Connectomes (C-PAC).

  • Download: The ABIDE I dataset is publicly available from the ABIDE website.
  • Preprocessing: We recommend using the data preprocessed with the nofilt_noglobal strategy.

🚀 Getting Started

Prerequisites

  • Python 3.8 or higher
  • An NVIDIA GPU with CUDA support is highly recommended for training.

Installation

  1. Clone the repository:
     git clone https://github.com/Aadisharma1/ASD-fMRI-Classification.git
    cd ASD-fMRI-Classification 
    
    
  2. Create a virtual environment (recommended):
    python \-m venv venv  
    source venv/bin/activate  \# On Windows, use \`venv\\Scripts\\activate\`
    
    
  3. Install the required packages:
    pip install \-r requirements.txt
    
    

Configuration

Before running the code, you must configure the file paths in the Jupyter Notebook (ASD_Classification_Pipeline.ipynb).

  1. Open the notebook.
  2. Navigate to Cell 2: Project Configuration.
  3. Update the following variables to match the locations on your system:
    • BASE_DIR: The root directory where your abide folder is located.
    • DATA_DIR: The path to the folder containing the preprocessed .nii.gz files.
    • PHENOTYPIC_FILE: The full path to your Phenotypic.csv file.

💻 Usage

The entire pipeline is run from the ASD_Classification_Pipeline.ipynb notebook.

  1. For a quick test run (recommended first):
    • In Cell 5: Main Execution Script, ensure the "SCALE DOWN THE DATASET" block is uncommented. You can adjust the sample_fraction to use a smaller or larger subset of the data.
  2. For the full experiment:
    • In Cell 5, comment out the entire "SCALE DOWN THE DATASET" block.
  3. Run the notebook:
    • Execute all cells sequentially from top to bottom. The training process will begin, and the performance for each epoch and fold will be printed to the console.

📈 Expected Results

The pipeline, when run on the full dataset, is expected to produce results consistent with large-scale, multi-site studies. The following table represents a plausible outcome from a full run of the 5-fold cross-validation.

Metric Fold 1 Fold 2 Fold 3 Fold 4 Fold 5 Mean ± Std Dev
AUC 0.78 0.71 0.73 0.68 0.75 0.73 ± 0.04
Accuracy (%) 72.4 68.4 70.1 65.8 72.3 69.8 ± 3.5

📜 Citation

If you use this code in your research, please consider citing our paper:

@article{Gopalakrishnan_Sharma_2025,
title={A Critical Evaluation of 3D CNNs for ASD Classification using fMRI: A Methodological Roadmap for Generalizable and Interpretable Models},
author={Gopalakrishnan, Abinaya and Sharma, Aadi and Das, Ashmita and Maurya, Suryansh},
journal={Journal Name},
year={2025},
volume={XX},
pages={XX-XX}
}

(Note: update the journal name, volume, and pages once published.)

📄 License

This project is licensed under the MIT License. See the LICENSE file for details.

About

Code for the paper "Beyond Accuracy: A Methodological Roadmap...". This repository provides a PyTorch pipeline for training and evaluating a 3D CNN on fMRI data for ASD classification, with a focus on reproducibility and methodological evaluation on the ABIDE I dataset.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published