This library offers a set of models (with pretrained weights) for the segmentation of lesions in fundus images. As of now, four lesions are segmented:
1. Cotton Wool Spot
2. Exudates
3. Hemmorrhages
4. Microaneurysms
pip install .
Check the notebooks for detailed examples.
from fundus_lesions_toolkit.models import segment
from fundus_lesions_toolkit.constants import DEFAULT_COLORS, LESIONS
from fundus_lesions_toolkit.utils.images import open_image
from fundus_lesions_toolkit.utils.visualization import plot_image_and_mask
img = open_image(img_path)
pred = segment(img, device='cpu', weights='ALL')
plot_image_and_mask(img, pred, alpha=0.8, title='My segmentation', colors=DEFAULT_COLORS, labels=LESIONS)
Currently, only a single model is made available (unet
with a resnest50
encoder). More will come regularly.
Models are trained with different publicly available datasets:
It also includes models trained with all the data combined.
This library is only a hub to access pure PyTorch trained models.