Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HVS 420/240 Quality Control

Flacara Electric Romania

Automated visual inspection system for HVS 420 and HVS 240 connectors. Detects missing pins, surface defects, and missing components, with real-time display and telemetry in Grafana.


Requirements

  • Python 3.10+
  • Docker Desktop (for Grafana + InfluxDB)
  • Windows 10/11

Install Python dependencies:

pip install -r requirements.txt

Quick Start

1. Start Docker Desktop

Make sure Docker Desktop is running (green icon in system tray).

2. Start the telemetry stack

docker compose up -d

3. Start the application

python main.py

Web Interfaces

Service URL Username Password
Grafana (dashboards) http://localhost:3000 admin admin
InfluxDB (database) http://localhost:8086 admin hvs-admin-2024

Grafana: after login, go to Dashboards → HVS → HVS 420/240 Quality Control


Project Structure

HVS QUALITY CONTROL/
│
├── main.py                    # Entry point — starts the application
├── config.yaml                # All settings (camera, model, thresholds, InfluxDB)
├── requirements.txt           # Python dependencies
├── docker-compose.yml         # InfluxDB + Grafana
│
├── core/
│   ├── camera.py              # Webcam / folder / Basler / IDS input
│   ├── detector.py            # YOLOv8 inference or automatic mock fallback
│   ├── decision.py            # PASS/FAIL rules (thresholds from config.yaml)
│   └── trainer.py             # YOLOv8 model training
│
├── ui/
│   └── main_window.py         # PyQt6 graphical interface (HMI)
│
├── data/
│   ├── influx_client.py       # Writes inspection results to InfluxDB
│   ├── fallback_log.jsonl     # Local log when InfluxDB is unavailable
│   └── hvs_system.log         # Application log
│
├── assets/
│   ├── images/                # Flacara Electric logo
│   └── flacara/               # Connector documentation images
│
└── grafana/
    └── provisioning/
        ├── datasources/       # Auto-configures InfluxDB datasource in Grafana
        └── dashboards/        # Dashboard JSON — provisioned automatically

How It Works

Detection Engine

  • If models/hvs420.pt exists → uses YOLOv8 (real inference)
  • If not found → uses Mock (simulation with configurable probabilities)

The mock is useful for testing the UI without a camera or trained model.

PASS/FAIL Rules

All thresholds are configured in config.yaml, under the decision section:

  • minimum number of detected pins
  • minimum confidence score
  • required components present (locking ring, cable entry, sealing)
  • no visual defects (scratch, deformation)

Telemetry

Every inspection result is automatically sent to InfluxDB. Grafana reads from InfluxDB and displays dashboards in real time (10-second refresh).

If InfluxDB is not running, data is saved locally to data/fallback_log.jsonl — nothing is lost.


Configuration (config.yaml)

Mock speed (simulated inspections)

mock:
  pass_rate: 0.80                  # 80% of inspections are PASS
  inspection_interval_ms: 1500     # delay between inspections (ms) — 0 = as fast as possible

Camera

camera:
  source: 0                        # 0 = first webcam
  source_type: webcam              # webcam | folder | basler | ids

YOLOv8 Model

model:
  path: models/hvs420.pt           # place trained model here
  confidence_threshold: 0.60
  device: cpu                      # cpu | cuda | mps

Training a YOLOv8 Model

  1. Place labeled images in assets/training/
  2. Open the application → toolbar → Train button
  3. The model is saved automatically to models/hvs420.pt
  4. Restart the application — real inference will activate automatically

Shutdown

docker compose down        # stops Grafana + InfluxDB (data is preserved)
docker compose down -v     # stops and deletes all stored data

Grafana Dashboard Panels

Panel Description
Total Inspected Total inspection count in the selected time range
Passed / Failed PASS and FAIL counters
Pass Rate % PASS percentage — gauge with red/yellow/green thresholds
Avg Confidence Average detection confidence score
Avg Inference Time Average processing time per frame (ms)
PASS/FAIL over Time Time-series chart of PASS vs FAIL per minute
Live Pass Rate Gauge showing recent pass rate trend
Confidence Trend Confidence score evolution over time
Inference Time Processing time evolution over time
PASS vs FAIL Distribution Donut chart of overall proportion
Inspections per Minute Bar chart of throughput

Technology Stack

Component Technology
Graphical interface PyQt6
Object detection YOLOv8 (Ultralytics)
Telemetry database InfluxDB 2.7
Dashboards Grafana 11
Containerization Docker Compose
Image processing OpenCV, NumPy

About

Automated visual inspection system for HVS 420/240 connectors. YOLOv8, PyQt6, InfluxDB, Grafana. Built for Flacara Electric Romania.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages