Skip to content

Hrishikesh332/XRay_Efficient

Repository files navigation

Federated Chest X-Ray Classification

This project implements federated learning for binary chest x-ray classification across 3 hospital silos using Flower framework and EfficientNetB0.

Challenge Details

  • Task - Binary classification (No Finding vs Any Finding)
  • Metric - AUROC
  • Dataset - NIH Chest X-Ray (non-IID split across 3 hospitals)
  • Model - EfficientNetB0 with custom Layer

Project Structure

coldstart/
├── pyproject.toml          # Project configuration and Flower federation settings
├── README.md               # This file
├── coldstart/
│   ├── __init__.py
│   ├── models.py           # EfficientNetB0 model architecture
│   ├── dataset.py          # Dataset loading and preprocessing
│   ├── client_app.py       # Federated client logic
│   ├── server_app.py       # Federated server and strategy
│   └── utils.py            # Utility functions (metrics, etc.)
└── requirements.txt        # Python dependencies

##PPT

PPT

Major Improvement over the EfficientNet B0 model

Applied Differential learning rates - classifier (12x), first conv (2.5x), backbone (0.12x)

Learning rate scheduler - 15% linear warmup + cosine decay (min_lr=0.05)

Optimizer - AdamW with weight_decay=1e-4, amsgrad=True

Focal Loss (gamma=2.0, alpha=1.0) with class weighting

Adaptive gradient clipping - 3.0 (warmup) → 1.5 (after)

Mixed precision training (FP16) with GradScaler

Batch size increased from 16 to 32

Metrics

AUROC

My Image

Training and Loss

My Image

Local Development

  1. Install dependencies:
pip install -e .
  1. Run simulation locally:
flwr run . local-simulation

Cluster Deployment

  1. Sync to cluster:
scp -P 32605 -r coldstart/ team04@129.212.178.168:~/
  1. SSH into cluster:
ssh team04@129.212.178.168 -p 32605
  1. Submit GPU job:
cd ~/coldstart
./submit-job.sh "flwr run . cluster-gpu" --gpu --name xray-fed
  1. Monitor logs:
tail -f ~/logs/job*_xray-fed.out

Model Architecture

  • Backbone: EfficientNetB0 (pretrained on ImageNet)
  • Input: 128x128 grayscale images
  • Output: Binary classification (sigmoid activation)
  • Loss: Binary Cross-Entropy
  • Optimizer: Adam with learning rate scheduling

Federated Strategy

  • Algorithm - FedAvg with weighted averaging
  • Aggregation - Based on number of samples per client
  • Client sampling - All 3 hospitals per round

Data Augmentation

  • Random horizontal flip
  • Random rotation (±10 degrees)
  • Random brightness/contrast adjustment
  • Normalization (ImageNet stats)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published