Update README.md
Browse files
README.md
CHANGED
@@ -1,12 +1,20 @@
|
|
1 |
---
|
2 |
license: mit
|
|
|
|
|
|
|
|
|
|
|
3 |
---
|
4 |
# MaskFormer-Germination
|
5 |
Fine-tuned MaskFormer for germination instance segmentation.
|
6 |
|
7 |
## Details
|
8 |
- **Base Model**: `facebook/maskformer-swin-tiny-coco`
|
9 |
-
- **Classes**:
|
|
|
|
|
|
|
10 |
- **Training Data**: 18 images, 31+ annotations per image
|
11 |
- **Epochs**: 5
|
12 |
- **Final Loss**: 1.655
|
@@ -21,8 +29,8 @@ from transformers import MaskFormerForInstanceSegmentation, MaskFormerImageProce
|
|
21 |
import torch
|
22 |
from PIL import Image
|
23 |
|
24 |
-
processor = MaskFormerImageProcessor.from_pretrained("
|
25 |
-
model = MaskFormerForInstanceSegmentation.from_pretrained("
|
26 |
model.eval()
|
27 |
|
28 |
image = Image.open("path/to/image.jpg")
|
@@ -32,4 +40,4 @@ with torch.no_grad():
|
|
32 |
results = processor.post_process_instance_segmentation(outputs, target_sizes=[(image.height, image.width)])[0]
|
33 |
for score, label, mask in zip(results["scores"], results["labels"], results["masks"]):
|
34 |
if score > 0.5 and label in [1, 2]:
|
35 |
-
print(f"Label: {label}, Score: {score:.3f}, Mask shape: {mask.shape}")
|
|
|
1 |
---
|
2 |
license: mit
|
3 |
+
pipeline_tag: image-segmentation
|
4 |
+
tags:
|
5 |
+
- instance-segmentation
|
6 |
+
- maskformer
|
7 |
+
- germination
|
8 |
---
|
9 |
# MaskFormer-Germination
|
10 |
Fine-tuned MaskFormer for germination instance segmentation.
|
11 |
|
12 |
## Details
|
13 |
- **Base Model**: `facebook/maskformer-swin-tiny-coco`
|
14 |
+
- **Classes**:
|
15 |
+
- `0`: Background
|
16 |
+
- `1`: Normal
|
17 |
+
- `2`: Abnormal
|
18 |
- **Training Data**: 18 images, 31+ annotations per image
|
19 |
- **Epochs**: 5
|
20 |
- **Final Loss**: 1.655
|
|
|
29 |
import torch
|
30 |
from PIL import Image
|
31 |
|
32 |
+
processor = MaskFormerImageProcessor.from_pretrained("Dreamy0/GermiNet-instance-segmentation-maskformer")
|
33 |
+
model = MaskFormerForInstanceSegmentation.from_pretrained("Dreamy0/GermiNet-instance-segmentation-maskformer")
|
34 |
model.eval()
|
35 |
|
36 |
image = Image.open("path/to/image.jpg")
|
|
|
40 |
results = processor.post_process_instance_segmentation(outputs, target_sizes=[(image.height, image.width)])[0]
|
41 |
for score, label, mask in zip(results["scores"], results["labels"], results["masks"]):
|
42 |
if score > 0.5 and label in [1, 2]:
|
43 |
+
print(f"Label: {label} ({model.config.id2label[label]}), Score: {score:.3f}, Mask shape: {mask.shape}")
|