| --- |
| license: cc-by-nc-4.0 |
| tags: |
| - medical-imaging |
| - diabetic-retinopathy |
| - domain-generalization |
| - pytorch |
| pipeline_tag: image-classification |
| library_name: pytorch |
| --- |
| |
| # GradeEye four-ch-morph |
|
|
| 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.7789 | 12 | |
| | `lodo_ddr_convnext_tiny_best_ema.safetensors` | `lodo_ddr_convnext_tiny_best.safetensors` | `convnext_tiny` | varies | 0.7702 | 7 | |
| | `lodo_eyepacs_convnext_tiny_best_ema.safetensors` | `lodo_eyepacs_convnext_tiny_best.safetensors` | `convnext_tiny` | varies | 0.7833 | 3 | |
| | `lodo_messidor2_convnext_tiny_best_ema.safetensors` | `lodo_messidor2_convnext_tiny_best.safetensors` | `convnext_tiny` | varies | 0.7395 | 2 | |
|
|
| ## 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_morph`. |
| - Producer: `gradeeye/seg-unet-bcedice`. |
| - Exact method: The BCE+Dice U-Net raw sigmoid probability map after 3x3 elliptical morphological opening, 3x3 elliptical closing, and Gaussian blur (sigma=0.5). It remains a continuous [0,1] soft-probability map, not a morphological gradient or edge channel. |
| - The resulting tensor is `(4, 384, 384)` in channel-first layout. |
| - This is the only one of the three published four-channel variants with morphological post-processing; it is not a gradient or edge channel. |
|
|
| ## 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). |
|
|