|
--- |
|
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]) |
|
``` |