Downloads · 30 days
3
1% of all-time downloads
fateme1380/segformer-mineral-500-final
segformer-mineral-500-final is a machine learning model from fateme1380. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
SegFormer-b0 fine-tuned on 499 mineral microscopy images with 7 classes (ore minerals + waste):
Downloads · 30 days
3
1% of all-time downloads
All-time downloads
251
Public
Parameters
3.7M
893 MB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors14.9 MB · 100%
From the Hugging Face model README
SegFormer-b0 fine-tuned on 499 mineral microscopy images with 7 classes (ore minerals + waste):
| Color (R,G,B) | Class Name (Persian) | Class Name (English) |
|---|---|---|
| (0, 0, 0) | باطله | Waste / Gangue |
| (100,150,100) | مگنتیت | Magnetite |
| (50,70,100) | پیریت | Pyrite |
| (100,60,60) | گوئتیت | Goethite |
| (60,30,80) | پیروتیت | Pyrrhotite |
| (100,30,10) | هماتیت | Hematite |
| (200,40,40) | کالکوپیریت | Chalcopyrite |
from transformers import AutoImageProcessor, AutoModelForSemanticSegmentation
from PIL import Image
import torch
processor = AutoImageProcessor.from_pretrained("fateme1380/segformer-mineral-500-final")
model = AutoModelForSemanticSegmentation.from_pretrained("fateme1380/segformer-mineral-500-final")
image = Image.open("your_mineral_image.jpg")
inputs = processor(images=image, return_tensors="pt")
with torch.no_grad():
outputs = model(**inputs)
logits = outputs.logits
pred = torch.nn.functional.interpolate(logits, size=image.size[::-1], mode="bilinear", align_corners=False)
pred = pred.argmax(dim=1)[0].cpu().numpy()
# حالا pred یه آرایه است که هر پیکسل مقدار 0 تا 6 داره (مطابق جدول بالا)