A project for detecting keyboard keys using YOLOv8, optimized for NVIDIA RTX 4060 (8GB VRAM).
Watch the full demonstration: YOLO Keyboard Key Detection in Action
- Train YOLOv8 models for keyboard key detection
- Inference on images and real-time webcam streams
- Easy integration with Roboflow datasets
- Optimized for consumer GPUs
.
├── scripts/
│ ├── train_keyboard_detector.py
│ └── test_inference.py
├── data/
│ └── keyboard_dataset/ # (excluded from repo, see below)
├── results/ # (excluded from repo)
├── requirements.txt
├── .gitignore
└── README.md
Dataset is NOT included in this repository.
- Download your dataset from Roboflow (export in YOLOv8 format).
- Place it in:
data/keyboard_dataset/ - Your folder should look like:
data/keyboard_dataset/ images/ train/ valid/ test/ labels/ train/ valid/ test/ data.yaml
-
Clone this repo:
git clone https://github.com/anishk85/yolo-keyboard-key-detection.git cd yolo_keyboard_project -
Create and activate a Python environment (optional but recommended):
python3 -m venv yolo_keyboard_env source yolo_keyboard_env/bin/activate -
Install dependencies:
pip install -r requirements.txt
Train your YOLO model with:
python3 scripts/train_keyboard_detector.py- Adjust parameters in
train_keyboard_detector.pyas needed.
Before training or inference, you can verify that your environment and dependencies are set up correctly:
python3 scripts/verify_installation.pyThis script will:
- Check your system info (CPU, RAM, Python version)
- Check GPU and CUDA availability
- Check all required Python libraries and their versions
- Test YOLO model loading and inference (CPU and GPU)
- Test GPU memory usage and recommend a batch size
If all tests pass, your system is ready for YOLO keyboard detection!
python3 scripts/test_inference.py --model <path_to_best.pt> --image <path_to_image>python3 scripts/test_inference.py --model <path_to_best.pt> --webcampython3 scripts/test_inference.py --list-cameras- Do NOT commit large datasets or model weights.
See.gitignorefor excluded files. - For best results, use a GPU.
- For dataset details and annotation format, see Roboflow documentation
This project is licensed under the MIT License.
