YAML Metadata Warning:empty or missing yaml metadata in repo card
Check out the documentation for more information.
Adaptive Cross-Attention Multimodal OCT Classifier
Patent-pending · Provisional Specification Filed (India, Feb 2026)
Interpretable, uncertainty-aware retinal disease diagnosis from 2D OCT B-scans using bidirectional cross-attention fusion of visual and vascular-geometric features.
Architecture Overview
| Stage | Module | Output |
|---|---|---|
| Preprocessing | CLAHE + Sato tubeness | float32 [0,1] 512×512 |
| Vessel segmentation | SoftUNet (Dice+BCE) | Prob map 512×512 |
| Geometric encoder | 8 metrics · median-agg · CorrectionMLP | g ∈ ℝ⁶⁴ |
| Visual backbone | EfficientNetV2-S (timm) | F ∈ ℝ¹²⁸⁰×⁷×⁷ |
| CAFM | Bidirectional cross-attention (geo↔vis) | z ∈ ℝ⁵¹² |
| Classifier | MLP + MC Dropout T=20 + Temp Scaling | probs + σ |
| XAI | GradCAM + Otsu adaptive threshold | saliency PNG |
| Rationale | Z-score → phrase lookup | clinical string |
Classes: CNV · DME · DRUSEN · NORMAL
Dataset: Kermany OCT 2017 (84,495 images)
Quick Start
pip install -r requirements.txt
# 1. Train UNet (provide vessel mask labels)
python -m train.precompute_prob_maps --data_dir data/kermany --output_dir prob_maps
# 2. Train classifier
python -m train.train --data_dir data/kermany --prob_maps_dir prob_maps --output_dir weights
# 3. Launch API
python run_api.py
API Endpoints
| Method | Endpoint | Description |
|---|---|---|
| GET | /health |
Service health + device |
| GET | /classes |
Class list |
| GET | /metrics/normative |
Normative μ ± σ for z-scores |
| POST | /predict |
Single OCT image → full JSON |
| POST | /predict/batch |
Up to 16 images |
Response includes: predicted class, calibrated confidence, epistemic uncertainty, 8 vascular metrics, normative z-scores, GradCAM saliency (base64 PNG), clinical rationale.
Novel Contributions (Patent Claims)
- Bidirectional CAFM — mutual geo↔vis cross-attention for 2D OCT fusion
- Segmentation-Robust Geometric Encoder — multi-threshold median aggregation + residual CorrectionMLP
- Adaptive-Threshold GradCAM — Otsu thresholding on normalised CAM (replaces fixed τ=0.5)
- MC Dropout + Temperature Calibration — calibrated confidence + epistemic uncertainty
- Vascular-Feature-Linked Clinical Rationale — z-score → phrase lookup by (class, metric, direction)
Citation
@misc{oct_cafm_2026,
title = {Adaptive Cross-Attention Multimodal OCT Classifier},
year = {2026},
note = {Patent pending (India provisional)},
url = {https://github.com/ARNiteshKumar/adaptive-crossattention-oct-classifier}
}
License
Apache 2.0 — see LICENSE.
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support