MS Thesis Project

A Lightweight Defense Against Label-Flipping Poisoning Attacks in Federated Learning for Diabetic Retinopathy Detection

Three-model deep ensemble (MobileNetV2 · EfficientNetB0 · ResNet50V2) with temperature-scaled calibration and federated learning security.

Overview

This project applies a three-model Deep Ensemble architecture to diabetic retinopathy (DR) severity grading and frames it inside a Federated Learning (FL) pipeline that is robust to label-flipping poisoning attacks. Instead of relying on a single network, the ensemble averages calibrated softmax probabilities from three complementary CNN backbones, which stabilizes predictions and limits the damage a poisoned client can inflict.

Backbone 1

MobileNetV2

Lightweight, deployment-friendly feature extractor.

Backbone 2

EfficientNetB0

Efficient compound-scaled architecture.

Backbone 3

ResNet50V2

Deep residual capacity with identity short-cuts.

Ensemble + Calibration Pipeline

Retinal Image → Preprocessing → { MobileNetV2 | EfficientNetB0 | ResNet50V2 } → Softmax ×3 → Averaged Probabilities → Temperature Scaling (T=1.5) → DR Class

Temperature scaling (calibration.json) sharpens the ensemble confidence so the reported probability matches real-world accuracy — essential for a clinical screening tool.

Security Contribution

In federated training, a malicious participant can flip labels on its local data to poison the global model. This thesis proposes a lightweight defense that combines ensemble-based aggregation with robust confidence checks, providing higher accuracy under label-flipping attacks than a single-model FL baseline, at a fraction of the computational cost of Byzantine-robust aggregation schemes.

Live demo note: Hugging Face free-tier does not permit hosting Gradio/Docker applications. The fully functional web app (app.py) and the three trained models are freely downloadable from the model repository below, or deployable on any free host (Replit, Render, Hugging Face PRO).

Get Started

  1. Download the models from the model repository.
  2. Install dependencies: pip install -r requirements.txt
  3. Run the app locally: python app.py — a Gradio interface opens in your browser.
git clone https://huggingface.co/Haris-83/dr-screening-tool
cd dr-screening-tool
pip install -r requirements.txt
python app.py

View Model Repository Deploy Instructions

Repository Contents

app.py
Gradio web app — 3-model ensemble inference + Grad-CAM explainability
~47 KB
mobilenetv2.h5
MobileNetV2 weights (fine-tuned on DR dataset)
10 MB
efficientnetb0.h5
EfficientNetB0 weights (fine-tuned on DR dataset)
21 MB
resnet50v2.h5
ResNet50V2 weights (fine-tuned on DR dataset)
101 MB
calibration.json
Temperature value for calibrated inference
T = 1.5
requirements.txt
tensorflow, gradio, numpy, pillow
deps
README.md
Full model card, usage and citation
docs