Transformers
ONNX
Safetensors
swinv2_segmenter
retinal-fundus
artery-vein-segmentation
medical-imaging
ophthalmology
swinv2
custom_code
Instructions to use JonathanFhima/RLAD-SwinV2-Large with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use JonathanFhima/RLAD-SwinV2-Large with Transformers:
# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("JonathanFhima/RLAD-SwinV2-Large", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
Document the standard AutoModel(trust_remote_code=True) loading path; update weights path reference
Browse files
README.md
CHANGED
|
@@ -46,6 +46,24 @@ python infer.py fundus.png out/
|
|
| 46 |
Writes `out/mask.png` (arteries red, veins blue) and `out/overlay.png`
|
| 47 |
(blended with the input). Runs in `bfloat16`, the precision the model was trained in.
|
| 48 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 49 |
For a full pipeline from a raw fundus image to vasculature biomarkers, see the
|
| 50 |
[RLAD + PVBM end-to-end tutorial](https://colab.research.google.com/github/aim-lab/PVBM/blob/main/rlad_pvbm_tutorial.ipynb),
|
| 51 |
which feeds this model's output into [PVBM](https://github.com/aim-lab/PVBM).
|
|
@@ -75,7 +93,7 @@ Artery/vein Dice score, averaged across the same local, external, and out-of-dis
|
|
| 75 |
## License
|
| 76 |
|
| 77 |
The code (`LUNetv2.py`, `infer.py`) is Apache 2.0. The weights
|
| 78 |
-
(`
|
| 79 |
training set mixes in subsets that are themselves non-commercial or
|
| 80 |
restricted:
|
| 81 |
|
|
|
|
| 46 |
Writes `out/mask.png` (arteries red, veins blue) and `out/overlay.png`
|
| 47 |
(blended with the input). Runs in `bfloat16`, the precision the model was trained in.
|
| 48 |
|
| 49 |
+
The model itself loads the standard Hugging Face way - `transformers.AutoModel`
|
| 50 |
+
with `trust_remote_code=True` downloads the code, config, and weights directly,
|
| 51 |
+
no manual file handling needed:
|
| 52 |
+
|
| 53 |
+
```python
|
| 54 |
+
import torch
|
| 55 |
+
from transformers import AutoModel
|
| 56 |
+
|
| 57 |
+
model = AutoModel.from_pretrained(
|
| 58 |
+
"JonathanFhima/RLAD-SwinV2-Large", trust_remote_code=True
|
| 59 |
+
).to("cuda").to(torch.bfloat16).eval()
|
| 60 |
+
```
|
| 61 |
+
|
| 62 |
+
`infer.py` still has the actual pre/post-processing (resize, pad, normalize,
|
| 63 |
+
threshold, color-code) — use its `preprocess_image`, `create_vessel_mask`,
|
| 64 |
+
and `blend_overlay` alongside a model loaded this way, or just call
|
| 65 |
+
`infer.load_model(...)` to get both steps at once.
|
| 66 |
+
|
| 67 |
For a full pipeline from a raw fundus image to vasculature biomarkers, see the
|
| 68 |
[RLAD + PVBM end-to-end tutorial](https://colab.research.google.com/github/aim-lab/PVBM/blob/main/rlad_pvbm_tutorial.ipynb),
|
| 69 |
which feeds this model's output into [PVBM](https://github.com/aim-lab/PVBM).
|
|
|
|
| 93 |
## License
|
| 94 |
|
| 95 |
The code (`LUNetv2.py`, `infer.py`) is Apache 2.0. The weights
|
| 96 |
+
(`model.safetensors`) are non-commercial, research use only — the
|
| 97 |
training set mixes in subsets that are themselves non-commercial or
|
| 98 |
restricted:
|
| 99 |
|