This repository contains code for training a YOLOv8 model on a large dataset of playing cards to create a poker hand detection system using Python. It includes a setup for using a webcam live feed to make real-time predictions and identify poker hands.
- Real-time detection of poker hands using a webcam.
- Pre-trained YOLOv8 model for quick setup.
- Easy-to-follow training process for custom datasets.
- Integration with CUDA for accelerated performance.
You can skip the training steps and use the pre-trained model provided in the model/ directory.
Download the dataset from the following link:
https://universe.roboflow.com/augmented-startups/playing-cards-ow27d/dataset/4/download/yolov8
Add the dataset to your Google Drive with the following hierarchy:
Download and run the training notebook:
https://github.com/mrkrisgee/poker_hand_detection/tree/main/train
Once training is complete, download the "best" model from:
/runs/detect/train/weights/best.pt
Ensure you have Anaconda installed on your system. Anaconda simplifies package management and deployment.
Create and activate a new conda environment by running the following commands in your terminal:
conda create -n yolov8
conda activate yolov8
Clone this repository to your local machine and navigate into the project directory:
git clone https://github.com/mrkrisgee/poker_hand_detection.git
cd poker_hand_detection
Move the best.pt model to the /poker_hand_detection/model/ directory and rename it to playingCards.pt.
Install the required Python packages using pip:
pip install -r requirements.txt
If you have an NVIDIA GPU and want to utilize CUDA for acceleration, download and install the CUDA toolkit from the NVIDIA CUDA Downloads page.
https://developer.nvidia.com/cuda-downloads
To execute the poker_hand_detection script, run:
poker_hand_detector.py
- Ultralytics YOLOv8: YOLOv8 is a real-time object detection model developed by Ultralytics.
- Alex Bewley: For providing the SORT (Simple Online and Realtime Tracking) algorithm used for object tracking.
- Murtaza Hassan: For his comprehensive Object Detection 101 course