Problem
Retinal disease severity can be subtle in early stages, while manual grading requires specialist time and consistent interpretation.
Retinal disease severity can be subtle in early stages, while manual grading requires specialist time and consistent interpretation.
A comparative medical-imaging study using Swin Transformer, Vision Transformer and a YOLO11 classification checkpoint across five encoded fundus-image labels.
The repository documents data balancing, augmentation and class-wise confusion matrices. Conflicting YOLO and specificity artifacts are excluded from the portfolio claims, and no model is presented as clinically best.

Diabetic retinopathy grading is difficult because visual differences between neighboring severity levels can be subtle and clinically important. This comparative project organizes Kaggle fundus photographs into five labels, rebalances a heavily dominant class through downsampling, adds targeted augmentation to minority classes, and creates stratified train, validation and test folders. The repository then compares three image-classification families—Swin Transformer, Vision Transformer and YOLO11—to examine where transformer features and a fast classification backbone succeed or fail across the severity spectrum.
The Swin experiment fine-tunes a pretrained base model on 224 by 224 images with AdamW, cosine scheduling, mixed precision, early stopping and experiment tracking. The ViT path adds balanced class weights, focal loss with label smoothing, and mixup regularization to address class imbalance; the YOLO notebook trains a pretrained classification checkpoint with early stopping. Saved confusion matrices show a consistent pattern: both transformer models recognize classes 3 and 4 more reliably than class 0, making early-class discrimination the clearest unresolved modeling challenge.
The repository supports an honest model-comparison case study, but not a defensible claim that one model is clinically best. The Swin and ViT matrices use different presentations, no independent test-set report is committed, and augmentation occurs before the image-level split, creating a risk that related variants cross partitions. The stored YOLO confusion matrix carries unrelated condition labels, while the specificity chart contains values outside its valid range. The portfolio therefore emphasizes pipeline design, imbalance handling and class-wise error analysis rather than overall superiority or deployment readiness.
Five-class fundus-image organization with a stratified 70/20/10 split design.
Majority-class downsampling and targeted minority-class augmentation.
Pretrained Swin Base with AdamW, mixed precision and early stopping.
ViT Base with balanced focal loss, label smoothing and mixup.
Class-wise confusion-matrix analysis instead of a single headline score.