File size: 2,088 Bytes
02667ce |
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 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# YOLOv9 Card Detector
This model is a fine-tuned version of YOLOv9c trained to detect playing cards in images. It has been trained on the Set Cards dataset from Roboflow.
## Model Details
- **Base Model**: YOLOv9c
- **Task**: Object Detection
- **Target Class**: Cards
- **Training Dataset**: [Set Cards Dataset](https://universe.roboflow.com/tel-aviv/set_cards/dataset/1)
- **Image Size**: 512x512
- **Accuracy Metrics**: Evaluated at confidence threshold of 0.5
## Usage
```python
from transformers import AutoImageProcessor, AutoModelForObjectDetection
import torch
from PIL import Image
import requests
# Load model and processor
processor = AutoImageProcessor.from_pretrained("YOUR_USERNAME/yolov9-card-detector")
model = AutoModelForObjectDetection.from_pretrained("YOUR_USERNAME/yolov9-card-detector")
# Load image
image_url = "https://example.com/path/to/card_image.jpg"
image = Image.open(requests.get(image_url, stream=True).raw)
# Prepare image for the model
inputs = processor(images=image, return_tensors="pt")
# Make prediction
with torch.no_grad():
outputs = model(**inputs)
# Process results
results = processor.post_process_object_detection(
outputs,
threshold=0.5,
target_sizes=[(image.height, image.width)]
)[0]
# Display results
for score, label, box in zip(results["scores"], results["labels"], results["boxes"]):
box = [round(i, 2) for i in box.tolist()]
print(
f"Detected {model.config.id2label[label.item()]} with confidence "
f"{round(score.item(), 3)} at location {box}"
)
```
## Training
This model was fine-tuned from YOLOv9c using the Ultralytics framework. It was trained for 30 epochs with an image size of 512x512.
## License
This model is licensed under CC BY 4.0, following the dataset's licensing terms.
## Limitations
- The model is specifically trained to detect playing cards and may not perform well on other objects
- Performance may vary based on lighting conditions, card orientation, and image quality
- Best results are achieved with images similar to those in the training dataset
|