|
Download README.md from Oamitai/set-detector: direct link, hf CLI and curl.
- Browser
- Download file 2.09 kB
-
https://huggingface.co/Oamitai/set-detector/resolve/main/README.md
- Command line
-
hf download hf://Oamitai/set-detector/README.md
-
curl -L -o README.md https://huggingface.co/Oamitai/set-detector/resolve/main/README.md
2.09 kB
| # 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 | |