--- license: mit pipeline_tag: image-segmentation tags: - instance-segmentation - maskformer - germination --- # MaskFormer-Germination Fine-tuned MaskFormer for germination instance segmentation. ## Details - **Base Model**: `facebook/maskformer-swin-tiny-coco` - **Classes**: - `0`: Background - `1`: Normal - `2`: Abnormal - **Training Data**: 18 images, 31+ annotations per image - **Epochs**: 5 - **Final Loss**: 1.655 - **Batch Size**: 2 - **Learning Rate**: 5e-5 - **Steps**: 45 - **Runtime**: ~26 minutes ## Usage ```python from transformers import MaskFormerForInstanceSegmentation, MaskFormerImageProcessor import torch from PIL import Image processor = MaskFormerImageProcessor.from_pretrained("Dreamy0/GermiNet-instance-segmentation-maskformer") model = MaskFormerForInstanceSegmentation.from_pretrained("Dreamy0/GermiNet-instance-segmentation-maskformer") model.eval() image = Image.open("path/to/image.jpg") inputs = processor(images=image, return_tensors="pt") with torch.no_grad(): outputs = model(**inputs) results = processor.post_process_instance_segmentation(outputs, target_sizes=[(image.height, image.width)])[0] for score, label, mask in zip(results["scores"], results["labels"], results["masks"]): if score > 0.5 and label in [1, 2]: print(f"Label: {label} ({model.config.id2label[label]}), Score: {score:.3f}, Mask shape: {mask.shape}")