File size: 2,697 Bytes
be438c9
4ba39db
be438c9
 
adcb03b
dfaf406
 
 
be438c9
 
 
 
670f65a
dfaf406
0963ed0
dfaf406
78277c0
dfaf406
 
 
 
 
 
 
 
3bae55c
dfaf406
 
 
 
 
 
 
 
 
6f3e13a
dfaf406
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
---
license: cc-by-nc-4.0
pipeline_tag: image-segmentation
tags:
- arxiv:2402.03166
- artery-vein
- retinal-imaging
- segmentation
- model_hub_mixin
- pytorch_model_hub_mixin
---

# RRWNet HRF

This repo contains the the official weights of the RRWNet model trained on the HRF dataset, from the paper ["RRWNet: Recursive Refinement Network for Effective Retinal Artery/Vein Segmentation and Classification"](https://doi.org/10.1016/j.eswa.2024.124970), by José Morano, Guilherme Aresta, and Hrvoje Bogunović, published in _Expert Systems with Applications_ (2024).

[[`arXiv`](https://arxiv.org/abs/2402.03166)] [`ESWA`](https://doi.org/10.1016/j.eswa.2024.124970)]  [[`GitHub`](https://github.com/j-morano/rrwnet)] [[`BibTeX`](#citation)]


![Overview](overview.png)



## RRWNet models

Model | Dataset | Resolution | Weights
--- | --- | --- | ---
RRWNet | RITE | 720x576 (original) | [Download](https://huggingface.co/j-morano/rrwnet-rite)
RRWNet | HRF | 1024 width (resized) | [Download](https://huggingface.co/j-morano/rrwnet-hrf)

Please note that the size of the images used for training is important when using the weights for predictions.


## Usage

The model can be loaded using the `PyTorchModelHubMixin` from the `huggingface_hub` package and the code from the `model.py` file in our repo (<https://github.com/j-morano/rrwnet>), which can be downloaded from [here](https://raw.githubusercontent.com/j-morano/rrwnet/refs/heads/main/model.py).

```python
from huggingface_hub import PyTorchModelHubMixin
from model import RRWNet as RRWNetModel


class RRWNet(RRWNetModel, PyTorchModelHubMixin):
    def __init__(self, input_ch=3, output_ch=3, base_ch=64, iterations=5):
        super().__init__(input_ch, output_ch, base_ch, iterations)


model = RRWNet.from_pretrained("j-morano/rrwnet-hrf")
```


## Preprocessing

Models are trained using enhanced images and masks.
You can preprocess the images offline using the `preprocessing.py` script in the repo.
The script will enhance the images and masks and save them in the specified directory.

```bash
python3 preprocessing.py --images-path data/images/ --masks-path data/masks/ --save-path data/enhanced
```


## Citation

If you use this code, the weights, the preprocessed data, or the predictions in your research, we would greatly appreciate it if you give a star to the repo and cite our work:

```
@article{morano2024rrwnet,
    title={RRWNet: Recursive Refinement Network for Effective Retinal Artery/Vein Segmentation and Classification},
    author={Morano, Jos{\'e} and Aresta, Guilherme and Bogunovi{\'c}, Hrvoje},
    journal={Expert Systems with Applications},
    year={2024},
    doi={10.1016/j.eswa.2024.124970}
}
```