Code Monkey home page Code Monkey logo

poker_hand_detection's Introduction

Real-time Poker Hand Detection with YOLOv8 via Webcam

Webcam Feed

Table of Contents

Overview

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.

Features

  • 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.

Usage

You can skip the training steps and use the pre-trained model provided in the model/ directory.

1. Training the Model

Download the Playing Cards Image Dataset

Download the dataset from the following link:

https://universe.roboflow.com/augmented-startups/playing-cards-ow27d/dataset/4/download/yolov8

Organize Dataset in Google Drive

Add the dataset to your Google Drive with the following hierarchy:

Train the Model

Download and run the training notebook:

https://github.com/mrkrisgee/poker_hand_detection/tree/main/train

Retrieve and Download the Best Model

Once training is complete, download the "best" model from:

/runs/detect/train/weights/best.pt

2. Making Real-time Predictions

Prerequisites

Ensure you have Anaconda installed on your system. Anaconda simplifies package management and deployment.

Create a Virtual Environment

Create and activate a new conda environment by running the following commands in your terminal:

conda create -n yolov8
conda activate yolov8

Clone the repository

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 Trained Model and Rename it

Move the best.pt model to the /poker_hand_detection/model/ directory and rename it to playingCards.pt.

Install Necessary Packages

Install the required Python packages using pip:

pip install -r requirements.txt

Download CUDA Toolkit

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

Run the Script

To execute the poker_hand_detection script, run:

poker_hand_detector.py

References

  • 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

poker_hand_detection's People

Contributors

mrkrisgee avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.