how to use the model
Browse files
README.md
CHANGED
|
@@ -73,4 +73,28 @@ accuracy: 0.737093690248566 -->
|
|
| 73 |
|------|-------|
|
| 74 |
| Macro | 0.4972 |
|
| 75 |
| Micro | 0.7371 |
|
| 76 |
-
| Weighted | 0.7371 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 73 |
|------|-------|
|
| 74 |
| Macro | 0.4972 |
|
| 75 |
| Micro | 0.7371 |
|
| 76 |
+
| Weighted | 0.7371 |
|
| 77 |
+
|
| 78 |
+
|
| 79 |
+
## How to use
|
| 80 |
+
|
| 81 |
+
This model is designed for image classification. Here's how you can use it:
|
| 82 |
+
|
| 83 |
+
```python
|
| 84 |
+
from transformers import AutoImageProcessor, AutoModelForImageClassification
|
| 85 |
+
import torch
|
| 86 |
+
from PIL import Image
|
| 87 |
+
|
| 88 |
+
model_name = "eligapris/v-mdd-2000"
|
| 89 |
+
processor = AutoImageProcessor.from_pretrained(model_name)
|
| 90 |
+
model = AutoModelForImageClassification.from_pretrained(model_name)
|
| 91 |
+
|
| 92 |
+
image = Image.open("path_to_your_image.jpg")
|
| 93 |
+
inputs = processor(images=image, return_tensors="pt")
|
| 94 |
+
|
| 95 |
+
with torch.no_grad():
|
| 96 |
+
outputs = model(**inputs)
|
| 97 |
+
|
| 98 |
+
logits = outputs.logits
|
| 99 |
+
predicted_class_idx = logits.argmax(-1).item()
|
| 100 |
+
print("Predicted class:", model.config.id2label[predicted_class_idx])
|