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
Update README.md
Browse files
README.md
CHANGED
|
@@ -55,6 +55,7 @@ import cv2
|
|
| 55 |
import torch
|
| 56 |
import numpy as np
|
| 57 |
|
|
|
|
| 58 |
from transformers import AutoImageProcessor, SegformerForSemanticSegmentation
|
| 59 |
|
| 60 |
image = cv2.imread('./example.jpg')
|
|
@@ -66,7 +67,7 @@ model = SegformerForSemanticSegmentation.from_pretrained("pamixsun/segformer_for
|
|
| 66 |
inputs = processor(image, return_tensors="pt")
|
| 67 |
|
| 68 |
with torch.no_grad():
|
| 69 |
-
outputs =
|
| 70 |
logits = outputs.logits.cpu()
|
| 71 |
|
| 72 |
upsampled_logits = nn.functional.interpolate(
|
|
|
|
| 55 |
import torch
|
| 56 |
import numpy as np
|
| 57 |
|
| 58 |
+
from torch import nn
|
| 59 |
from transformers import AutoImageProcessor, SegformerForSemanticSegmentation
|
| 60 |
|
| 61 |
image = cv2.imread('./example.jpg')
|
|
|
|
| 67 |
inputs = processor(image, return_tensors="pt")
|
| 68 |
|
| 69 |
with torch.no_grad():
|
| 70 |
+
outputs = model(**inputs)
|
| 71 |
logits = outputs.logits.cpu()
|
| 72 |
|
| 73 |
upsampled_logits = nn.functional.interpolate(
|