Instructions to use pamixsun/segformer_for_optic_disc_cup_segmentation with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use pamixsun/segformer_for_optic_disc_cup_segmentation with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-segmentation", model="pamixsun/segformer_for_optic_disc_cup_segmentation")# Load model directly from transformers import AutoImageProcessor, SegformerForSemanticSegmentation processor = AutoImageProcessor.from_pretrained("pamixsun/segformer_for_optic_disc_cup_segmentation") model = SegformerForSemanticSegmentation.from_pretrained("pamixsun/segformer_for_optic_disc_cup_segmentation") - Inference
- Notebooks
- Google Colab
- Kaggle
Model Card for Model ID
This SegFormer model has undergone specialized fine-tuning on the REFUGE challenge dataset, a public benchmark for semantic segmentation of anatomical structures in retinal fundus images. The fine-tuning enables expert-level segmentation of the optic disc and optic cup, two critical structures for ophthalmological diagnosis.
Model Details
Model Description
Uses
This pretrained model enables semantic segmentation of key anatomical structures, namely, the optic disc and optic cup, in retinal fundus images. It takes fundus images as input and outputs the segmentation results.
Bias, Risks, and Limitations
The model has undergone specialized training and fine-tuning exclusively using retinal fundus images, with the objective to perform semantic segmentation of anatomical structures including the optic disc and optic cup. Therefore, in order to derive optimal segmentation performance, it is imperative to ensure that only fundus images are entered as inputs to this model.
How to Get Started with the Model
Use the code below to get started with the model.
import cv2
import torch
import numpy as np
from torch import nn
from transformers import AutoImageProcessor, SegformerForSemanticSegmentation
image = cv2.imread('./example.jpg')
image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
processor = AutoImageProcessor.from_pretrained("pamixsun/segformer_for_optic_disc_cup_segmentation")
model = SegformerForSemanticSegmentation.from_pretrained("pamixsun/segformer_for_optic_disc_cup_segmentation")
inputs = processor(image, return_tensors="pt")
with torch.no_grad():
outputs = model(**inputs)
logits = outputs.logits.cpu()
upsampled_logits = nn.functional.interpolate(
logits,
size=image.shape[:2],
mode="bilinear",
align_corners=False,
)
pred_disc_cup = upsampled_logits.argmax(dim=1)[0].numpy().astype(np.uint8)
Citation [optional]
BibTeX:
[More Information Needed]
APA:
[More Information Needed]
Model Card Contact
- Downloads last month
- 5,806