Update README.md
Browse files
README.md
CHANGED
@@ -1,3 +1,95 @@
|
|
1 |
---
|
2 |
license: apache-2.0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
license: apache-2.0
|
3 |
+
tags:
|
4 |
+
- image-segmentation
|
5 |
+
- vision
|
6 |
+
- fundus
|
7 |
+
- optic disc
|
8 |
+
- optic cup
|
9 |
+
widget:
|
10 |
+
- src: >-
|
11 |
+
https://huggingface.co/pamixsun/swinv2_tiny_for_glaucoma_classification/resolve/main/example.jpg
|
12 |
+
example_title: fundus image
|
13 |
---
|
14 |
+
# Model Card for Model ID
|
15 |
+
|
16 |
+
<!-- Provide a quick summary of what the model is/does. -->
|
17 |
+
|
18 |
+
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/).
|
19 |
+
It is specialized in automated analysis of retinal fundus photographs for glaucoma detection.
|
20 |
+
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.
|
21 |
+
To obtain optimal predictions, it is recommended to provide this model with standardized retinal fundus photographs captured using typical fundus imaging protocols.
|
22 |
+
|
23 |
+
## Model Details
|
24 |
+
|
25 |
+
### Model Description
|
26 |
+
|
27 |
+
<!-- Provide a longer summary of what this model is. -->
|
28 |
+
|
29 |
+
- **Developed by:** [Xu Sun](https://pamixsun.github.io)
|
30 |
+
- **Shared by:** [Xu Sun](https://pamixsun.github.io)
|
31 |
+
- **Model type:** Image classification
|
32 |
+
- **License:** Apache-2.0
|
33 |
+
|
34 |
+
## Uses
|
35 |
+
|
36 |
+
<!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
|
37 |
+
|
38 |
+
The pretrained model provides glaucoma classification functionality solely based on analysis of retinal fundus images.
|
39 |
+
You may directly utilize the raw model without modification to categorize fundus images as either glaucoma or non-glaucoma.
|
40 |
+
This model is specialized in extracting discriminative features from fundus images to identify glaucoma manifestations.
|
41 |
+
However, to achieve optimal performance, it is highly recommended to fine-tune the model on a representative fundus image dataset prior to deployment in real-world applications.
|
42 |
+
|
43 |
+
## Bias, Risks, and Limitations
|
44 |
+
|
45 |
+
<!-- This section is meant to convey both technical and sociotechnical limitations. -->
|
46 |
+
|
47 |
+
The model is specialized in analyzing retinal fundus images, and is trained exclusively on fundus image datasets to classify images as glaucoma or non-glaucoma.
|
48 |
+
Therefore, to obtain accurate predictions, it is crucial to only input fundus images when using this model.
|
49 |
+
Feeding other types of images may lead to meaningless results.
|
50 |
+
In summary, this model expects fundus images as input for glaucoma classification.
|
51 |
+
For the best performance, please adhere strictly to this input specification.
|
52 |
+
|
53 |
+
## How to Get Started with the Model
|
54 |
+
|
55 |
+
Use the code below to get started with the model.
|
56 |
+
|
57 |
+
```python
|
58 |
+
import cv2
|
59 |
+
import torch
|
60 |
+
|
61 |
+
from transformers import AutoImageProcessor, Swinv2ForImageClassification
|
62 |
+
|
63 |
+
image = cv2.imread('./example.jpg')
|
64 |
+
image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
|
65 |
+
|
66 |
+
processor = AutoImageProcessor.from_pretrained("pamixsun/swinv2_tiny_for_glaucoma_classification")
|
67 |
+
model = Swinv2ForImageClassification.from_pretrained("pamixsun/swinv2_tiny_for_glaucoma_classification")
|
68 |
+
|
69 |
+
inputs = processor(image, return_tensors="pt")
|
70 |
+
|
71 |
+
with torch.no_grad():
|
72 |
+
logits = model(**inputs).logits
|
73 |
+
|
74 |
+
# model predicts either glaucoma or non-glaucoma.
|
75 |
+
predicted_label = logits.argmax(-1).item()
|
76 |
+
print(model.config.id2label[predicted_label])
|
77 |
+
|
78 |
+
```
|
79 |
+
|
80 |
+
## Citation [optional]
|
81 |
+
|
82 |
+
<!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
|
83 |
+
|
84 |
+
**BibTeX:**
|
85 |
+
|
86 |
+
[More Information Needed]
|
87 |
+
|
88 |
+
**APA:**
|
89 |
+
|
90 |
+
[More Information Needed]
|
91 |
+
|
92 |
+
|
93 |
+
## Model Card Contact
|
94 |
+
|
95 |
+
- pamixsun@gmail.com
|