| --- |
| license: cc-by-nc-4.0 |
| tags: |
| - medical-imaging |
| - diabetic-retinopathy |
| - domain-generalization |
| - pytorch |
| pipeline_tag: image-classification |
| library_name: pytorch |
| --- |
| |
| # GradeEye four-ch-soft |
|
|
| This repository contains GradeEye CORN ordinal diabetic-retinopathy classifiers using the `convnext_tiny` backbone at 384x384 resolution, with 4-channel input and a 4-threshold ordinal head. The `_ema.safetensors` file is the **primary** artifact: the paper's reported evaluation metrics were generated using the EMA state dict. The unsuffixed `.safetensors` file is the corresponding raw `model_state_dict` secondary artifact. |
|
|
| ## Checkpoints |
|
|
| | Primary EMA weights | Raw secondary weights | Architecture | Held-out fold | Best QWK | Epoch | |
| |---|---|---|---|---:|---:| |
| | `lodo_aptos_convnext_tiny_best_ema.safetensors` | `lodo_aptos_convnext_tiny_best.safetensors` | `convnext_tiny` | varies | 0.7716 | 5 | |
| | `lodo_ddr_convnext_tiny_best_ema.safetensors` | `lodo_ddr_convnext_tiny_best.safetensors` | `convnext_tiny` | varies | 0.7775 | 7 | |
| | `lodo_eyepacs_convnext_tiny_best_ema.safetensors` | `lodo_eyepacs_convnext_tiny_best.safetensors` | `convnext_tiny` | varies | 0.7950 | 9 | |
| | `lodo_messidor2_convnext_tiny_best_ema.safetensors` | `lodo_messidor2_convnext_tiny_best.safetensors` | `convnext_tiny` | varies | 0.7415 | 5 | |
|
|
| ## Preprocessing |
|
|
| 1. Resize the RGB fundus image to 384x384 using the same offline preprocessing pipeline. |
| 2. Convert RGB to float in [0,1] and apply ImageNet normalization: mean=(0.485, 0.456, 0.406), std=(0.229, 0.224, 0.225). |
| 3. Append one auxiliary channel in [0,1] after RGB normalization. It is not ImageNet-normalized. |
|
|
| ### Fourth-channel construction |
|
|
| - Source pool: `segmentation_pooled_soft`. |
| - Producer: `gradeeye/seg-unet-bcedice`. |
| - Exact method: Raw sigmoid probability map from the BCE+Dice-trained U-Net; uint16 PNG divided by 65535 to [0,1]. No morphological post-processing. |
| - The resulting tensor is `(4, 384, 384)` in channel-first layout. |
| - No opening, closing, or Gaussian blur is applied in this variant. |
|
|
| ## Loading |
|
|
| ```python |
| import json |
| from modeling import load_model |
| |
| config = json.load(open('config.json')) |
| model = load_model('lodo_eyepacs_convnext_tiny_best_ema.safetensors', config) |
| # model(x) returns CORN logits with shape (batch, 4) |
| ``` |
|
|
| Install `torch`, `timm`, and `safetensors`, and make the GradeEye source repository available on `PYTHONPATH`. |
|
|
| ## Intended use and limitations |
|
|
| These weights are released for research and reproducibility only. They are not validated for clinical diagnosis or treatment decisions. Performance varies substantially by held-out dataset and should not be interpreted as clinical-grade generalization. |
|
|
| Source code and paper materials: [https://github.com/ahmed-farhanur-rashid/gradeeye](https://github.com/ahmed-farhanur-rashid/gradeeye). |
|
|