Skip to content

zaid-deltaX/GUI-APP-PYTHON

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

YOLO Object Detection GUI Application

A lightweight desktop application for detecting objects in webcam streams and image files using YOLOv8 and PyQt5.

The application is implemented in app/main.py, and uses app/gui.py for the graphical interface and app/detector.py for YOLO inference.

Features

  • Real-time webcam object detection
  • Image file detection with YOLO annotations
  • Camera selection and refresh support
  • Bounding boxes and confidence scores displayed on video frames
  • Simple PyQt5 GUI for Windows-style desktop use

Project Structure

  • app/main.py — application entry point
  • app/gui.py — PyQt5 user interface and camera handling
  • app/detector.py — YOLO model loading and inference
  • app/utils.py — image conversion helper for Qt
  • models/ — model storage folder
  • screenshots/ — UI example screenshots
  • requirements.txt — Python dependencies

Requirements

  • Python 3.8+ recommended
  • PyQt5
  • opencv-python
  • ultralytics

Setup

  1. Clone the repository:
git clone <repository-url>
cd edgeai-app-GUI
  1. Create and activate a virtual environment:
python3 -m venv venv
source venv/bin/activate
  1. Install dependencies:
pip install -r requirements.txt

Run the Application

With the virtual environment active:

python app/main.py

Usage

  • Click Start Webcam to begin live detection from the selected camera.
  • Click Stop Webcam to end the camera feed.
  • Click Open Image to choose a static image file and run YOLO detection.
  • Click Refresh Cameras if your camera list changes.

Screenshots

Main Dashboard

Main Dashboard

Real-Time Detection

Real-Time Detection

Notes

  • The application loads the YOLO model from app/yolov8n.pt.
  • If you do not have a webcam attached, use Open Image to test detection on local images.
  • setup.sh is a helper script that installs the required Python packages.

Packaging and Service Installation

This project can be packaged as a .deb installer for Ubuntu and configured to run automatically as a systemd service.

Part 1 — Create a .deb Package

  1. Create the package directory structure:
mkdir -p edgeai-app_1.0/DEBIAN
mkdir -p edgeai-app_1.0/opt/edgeai-app
mkdir -p edgeai-app_1.0/usr/local/bin
  1. Copy the application files into the package layout:
cp -r ./* edgeai-app_1.0/opt/edgeai-app/
  1. Create the launcher script at edgeai-app_1.0/usr/local/bin/edgeai-app:
cat > edgeai-app_1.0/usr/local/bin/edgeai-app <<'EOF'
#!/bin/bash

source /home/mohammad/virtual_environments/yolo/bin/activate
export QT_QPA_PLATFORM=xcb
python3 /opt/edgeai-app/app/main.py
EOF
  1. Create the package metadata file at edgeai-app_1.0/DEBIAN/control:
Package: edgeai-app
Version: 1.0
Section: base
Priority: optional
Architecture: amd64
Maintainer: Mohammad
Description: YOLO Object Detection GUI Application
  1. Set the launcher permissions and build the package:
chmod +x edgeai-app_1.0/usr/local/bin/edgeai-app
chmod -R 755 edgeai-app_1.0
dpkg-deb --build edgeai-app_1.0
  1. Install the package:
sudo dpkg -i edgeai-app_1.0.deb
  1. Run the application:
edgeai-app
  1. Remove the package:
sudo dpkg -r edgeai-app
sudo dpkg --purge edgeai-app

Note: Replace /home/mohammad/virtual_environments/yolo/bin/activate with your actual virtual environment path if different.

Part 2 — Create a systemd Service

Create the service file at /etc/systemd/system/edgeai-app.service:

[Unit]
Description=YOLO Edge AI GUI Application
After=graphical.target

[Service]
Type=simple
User=mohammad
WorkingDirectory=/opt/edgeai-app/app
Environment=DISPLAY=:0
Environment=QT_QPA_PLATFORM=xcb
Environment=XAUTHORITY=/home/mohammad/.Xauthority
ExecStart=/home/mohammad/virtual_environments/yolo/bin/python3 /opt/edgeai-app/app/main.py
Restart=always
RestartSec=5

[Install]
WantedBy=graphical.target

Service Management Commands

Reload the service definition:

sudo systemctl daemon-reload

Enable auto-start on boot:

sudo systemctl enable edgeai-app.service

Start the service now:

sudo systemctl start edgeai-app.service

Check status:

sudo systemctl status edgeai-app.service

Stop the service:

sudo systemctl stop edgeai-app.service

Disable auto-start:

sudo systemctl disable edgeai-app.service

View live service logs:

journalctl -u edgeai-app.service -f

Key Parameters Explained

  • After=graphical.target
    • Start after the graphical desktop session is ready.
  • User=mohammad
    • Run the service as this user.
  • ExecStart
    • Command used to launch the application.
  • Restart=always
    • Automatically restart if the app crashes.
  • WantedBy=graphical.target
    • Start the service during graphical boot.

Notes

  • The .deb installer places the application under /opt/edgeai-app and the launcher at /usr/local/bin/edgeai-app.
  • Update all hard-coded paths for your own Ubuntu user and virtual environment locations.
  • The desktop service assumes an X11 session; if you use Wayland, adjust display settings accordingly.

Common Issues

Qt xcb Plugin Error

Possible causes:

  • Missing Qt dependencies
  • OpenCV Qt conflicts
  • Wayland/X11 configuration issues

Suggested fixes:

sudo apt install libxcb-xinerama0 libxkbcommon-x11-0

Use:

export QT_QPA_PLATFORM=xcb

Camera Not Detected

Verify available devices:

ls /dev/video*

or

v4l2-ctl --list-devices

Service Fails to Start

Check logs:

journalctl -u edgeai-app.service -f

Verify:

  • Virtual environment path
  • Python interpreter path
  • Display environment variables
  • User permissions

About

A simple Object Detection GUI built with Python, PyQt5, OpenCV, and YOLOv8. It supports webcam detection, image detection, multiple camera selection, and real-time inference display. The app itself is secondary - the focus is on packaging and deployment.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors