yolo_digital_screen_detector is an open-source Python tool for detecting and localizing digital screens (monitors, TVs, laptops, tablets, smartphones) in images using YOLO-based deep learning. The project provides fast, accurate detection and can automatically crop detected screen regions for further analysis, privacy masking, or OCR.
Clone this repository and install all dependencies:
git clone https://github.com/emirbaycan/yolo_digital_screen_detector.git cd yolo_digital_screen_detector pip install -r requirements.txt
Basic usage with default values:
python yolo_screen_model_test.py
Custom usage:
python yolo_screen_model_test.py \ --model path/to/your_model.pt \ --input path/to/your_image.png \ --output results/ \ --conf 0.6
Arguments:
--model
: Path to the trained YOLO model .pt
file (default: runs/detect/train10/weights/best.pt
)--input
: Input image file (default: camera_images/frame_1738193401.png
)--output
: Output file or directory (default: output.png
)--conf
: Detection confidence threshold (default: 0.5
)Example:
Detect and save output to a directory:
python yolo_screen_model_test.py --input my_image.jpg --output ./results/
Input image:
Detection result:
To train your own digital screen detection model:
Annotate your images
.txt
files with each image).Organize your dataset
images/
, labels/
)..txt
extension.Train with Ultralytics YOLO
yolo detect train data=data.yaml model=yolov8n.pt epochs=100 imgsz=640
All required packages are listed in requirements.txt
:
ultralytics>=8.0.0
torch>=1.8.0
opencv-python>=4.5.0
PyYAML>=5.4.0
av>=10.0.0
matplotlib>=3.6.0
Install with:
pip install -r requirements.txt
Bounding box annotation for screens was performed using LabelImg.
pip install labelImg
labelImg
.txt
files.Contributions, bug reports, and feature requests are welcome!
MIT License
Developed by Emir Baycan
GitHub
For questions, open an issue or contact via GitHub.