--- license: apache-2.0 tags: - image-segmentation - vision - fundus - optic disc - optic cup widget: - src: >- https://huggingface.co/pamixsun/swinv2_tiny_for_glaucoma_classification/resolve/main/example.jpg example_title: fundus image --- # Model Card for Model ID This model utilizes a Swin Transformer architecture and has undergone supervised fine-tuning on retinal fundus images from the [REFUGE challenge dataset](https://refuge.grand-challenge.org/). It is specialized in automated analysis of retinal fundus photographs for glaucoma detection. By extracting hierarchical visual features from input fundus images in a cross-scale manner, the model is able to effectively categorize each image as either glaucoma or non-glaucoma. Extensive experiments demonstrate that this model architecture achieves state-of-the-art performance on the REFUGE benchmark for fundus image-based glaucoma classification. To obtain optimal predictions, it is recommended to provide this model with standardized retinal fundus photographs captured using typical fundus imaging protocols. ## Model Details ### Model Description - **Developed by:** [Xu Sun](https://pamixsun.github.io) - **Shared by:** [Xu Sun](https://pamixsun.github.io) - **Model type:** Image classification - **License:** Apache-2.0 ## Uses his 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. ```python import cv2 import torch 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 = self.seg_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 - pamixsun@gmail.com