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.
- Python 3.10+
- Docker Desktop (for Grafana + InfluxDB)
- Windows 10/11
Install Python dependencies:
pip install -r requirements.txt
Make sure Docker Desktop is running (green icon in system tray).
docker compose up -d
python main.py
| 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
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
- If
models/hvs420.ptexists → 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.
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)
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.
mock:
pass_rate: 0.80 # 80% of inspections are PASS
inspection_interval_ms: 1500 # delay between inspections (ms) — 0 = as fast as possiblecamera:
source: 0 # 0 = first webcam
source_type: webcam # webcam | folder | basler | idsmodel:
path: models/hvs420.pt # place trained model here
confidence_threshold: 0.60
device: cpu # cpu | cuda | mps- Place labeled images in
assets/training/ - Open the application → toolbar → Train button
- The model is saved automatically to
models/hvs420.pt - Restart the application — real inference will activate automatically
docker compose down # stops Grafana + InfluxDB (data is preserved)
docker compose down -v # stops and deletes all stored data
| 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 |
| Component | Technology |
|---|---|
| Graphical interface | PyQt6 |
| Object detection | YOLOv8 (Ultralytics) |
| Telemetry database | InfluxDB 2.7 |
| Dashboards | Grafana 11 |
| Containerization | Docker Compose |
| Image processing | OpenCV, NumPy |