Real-Time Rock, Paper, Scissors Recognition Using YOLOv5
This project is a real-time hand gesture recognition system built with YOLOv5, capable of detecting and classifying rock, paper, and scissors using a webcam feed.
🎓 This was my official school project, and it means a lot to me — it marks my hands-on dive into real-world AI development. I'm passionate about building smart systems, and this project reflects my interest in solving interactive problems using machine learning.
- ✅ Real-time detection of rock, paper, and scissors gestures
- 📸 Custom dataset creation with varied lighting and angles
- 🏷️ Manual image annotation using LabelImg and Label Studio
- 💻 Model trained locally on a personal laptop (YOLOv5, mAP@0.5 = 0.96)
- ⚡ Real-time webcam detection with OpenCV (20–30 FPS)
- 📄 Full documentation of setup, training, troubleshooting, and deployment
- Python 3.12
- PyTorch
- YOLOv5
- OpenCV
- LabelImg, Label Studio
- Anaconda (virtual environment)
- Windows (training environment)
📂 rock-paper-scissors-yolov5/
├── 📂 data
├── 📂 models
├── 📂 scripts/
│ ├── split.py # Optional: dataset splitter
│ └── gen-data-yaml.py # Script to generate data.yaml
├── 📂 utils
│ ├── classes.txt # Class names (e.g., rock, paper, scissors)
│ └── data.yaml # Dataset config file for YOLOv5
├── detect.py # Detection script
├── requirements.txt # Requirements needed to be downloaded
├── train.py # Training script
├── val.py # Validation script
├── export.py
-
Data Collection
Hand gesture images (rock, paper, scissors) were captured manually using a webcam. -
Annotation
Bounding boxes were drawn manually using LabelImg and exported in YOLO format. -
Training
- Model: YOLOv5s
- Epochs: 25
- Batch Size: 16
- Input Size: 640x640
- Achieved mAP@0.5: 0.96
-
Deployment
The trained model was used for live webcam detection using OpenCV on Windows.
You can read the full technical documentation and implementation guide below:
📄 Download the PDF Report Report.pdf
Follow the steps below to run the real-time Rock, Paper, Scissors recognition system on your own machine.
git clone https://github.com/Prosperteni/Real-Time-Rock-Paper-Scissors-Recognition-Using-YOLOv5.git
cd Real-Time-Rock-Paper-Scissors-Recognition-Using-YOLOv5
pip install -r requirements.txtThe trained YOLOv5 model weights (best.pt) are too large to be stored on GitHub directly.
📦 Download best.pt from Google Drive
After downloading, place the best.pt file into your project folder:
📂Real-Time-Rock-Paper-Scissors-Recognition-Using-YOLOv5/
└── best.pt
Make sure your webcam is connected. Then run:
python detect.py --weights best.pt --source 0--source 0 refers to the webcam.
You can also test an image or video by changing the source:
--source path/to/image.jpg or --source path/to/video.mp4
Download the dataset from the following link and place it into the main project folder (e.g., dataset/):
📂 Real-Time-Rock-Paper-Scissors-Recognition-Using-YOLOv5/
└── 📂 dataset
Make sure the folder structure matches what your config file (data.yaml) expects.
If you want to retrain the model using your own dataset:
python train.py --img 640 --batch 16 --epochs 50 --data datasets/data.yaml --weights best.ptNote: Make sure your dataset is correctly formatted and data.yaml is set up properly.

