PokerVision is a computer-vision project that detects and classifies playing cards in real time using a YOLO-based model.
It combines synthetic dataset generation, YOLO training, and live detection through a webcam.
- 🎨 Synthetic dataset generator with realistic card positioning and lighting
- 🧠 YOLOv8/YOLO11-based card detection and classification
- 💻 Real-time webcam inference at ~30 FPS
- 🃏 Support for normal, inverted, and real card variants
- 🔄 Easy retraining and dataset regeneration
PokerVision/
├── data/
│ ├── backgrounds/ # Background images for synthetic data
│ ├── generated/ # Auto-generated images (ignored by git)
│ ├── raw_cards/ # Source card images (normal, inverted, real)
│ └── yolo_dataset/ # YOLO-formatted dataset (train/val images & labels)
│
├── runs/ # YOLO training results (ignored by git)
├── src/
│ ├── dataset_gen/ # Dataset generation scripts
│ ├── realtime/ # Real-time detection (webcam_demo.py)
│ ├── training/ # (Future) model training utils
│ └── utils/ # Shared helper functions
│
├── weights/ # Model checkpoints (ignored by git)
├── cards.yaml # YOLO dataset config
├── requirements.txt # Python dependencies
├── .gitignore
└── README.md
git clone https://github.com/Yufan3/PokerVision.git
cd PokerVisionconda create -n pokervision python=3.10 -y
conda activate pokervisionpip install -r requirements.txtpython -m src.utils.check_cudaGenerate a synthetic dataset by combining random backgrounds and card variants:
python -m src.dataset_gen.generate_datasetThe generated data and YOLO labels will appear under:
data/generated/
data/yolo_dataset/🏋️♂️ Model Training Train a YOLO model using your dataset:
yolo detect train model=yolo11s.pt data=cards.yaml epochs=100 imgsz=640 batch=16 device=0After training, the best weights will be saved at:
runs/detect/train*/weights/best.pt🎥 Real-Time Detection Run live card detection using your webcam:
python src/realtime/webcam_demo.py
Press Q to exit the window.🪪 License
This project is open-source under the MIT License. See LICENSE for details.