File size: 1,103 Bytes
c7691a2
 
 
 
 
 
 
 
 
2bab2fe
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
c7691a2
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
---
language:
- en
pipeline_tag: image-classification
tags:
- cards
- computervision
- imageclassification
---

# Cards Image Classification Model

This model is trained to classify images of cards using a custom dataset.

## Model Details

- Architecture: ResNet18
- Dataset: Cards Image Dataset-Classification
- Number of Classes: 53
- Training Epochs: 25
- Optimizer: Adam
- Loss Function: CrossEntropyLoss

## Usage

To use this model, follow the example code below:

```python
from transformers import AutoModelForImageClassification, AutoFeatureExtractor
from PIL import Image
import requests

model_name = "sabrilben/cards_image_classification"
model = AutoModelForImageClassification.from_pretrained(model_name)
feature_extractor = AutoFeatureExtractor.from_pretrained(model_name)

url = "path/to/image.jpg"
image = Image.open(requests.get(url, stream=True).raw)
inputs = feature_extractor(images=image, return_tensors="pt")
outputs = model(**inputs)
logits = outputs.logits
predicted_class_idx = logits.argmax(-1).item()
print("Predicted class:", model.config.id2label[predicted_class_idx])
```