Edge AI Vision Inspection + Industrial IoT Sensor Gateway (Vehicle / Factory / City)
A productionβminded, open framework to build Edge AI systems that combine vision inspection, sensor telemetry, and industrial I/O on rugged hardware. It ships a Streamlit dashboard (19+ tabs), a SQLite backbone, Model Packs, Fleet, and a Benchmark Matrix to accelerate PoCs β pilots β deployments.
- π οΈ Support System Integrators and SMEs with demoβready tools
- π€ Collaborate on R&D and ProofβofβConcepts
- π Promote industrial AI adoption across Thailand & SEA markets
Use it as a base to build your own PoC, integrate with IIoT, or contribute modules β the repo helps you accelerate timeβtoβdemo and validate value at the edge.
- Localβfirst & offlineβtolerant: onβdevice inference, logs, KPIs (privacyβpreserving).
- Open & modular: Python + Streamlit with plugin API; no lockβin.
- Fast timeβtoβdemo: preβwired 19βtab dashboard (Traceability, Yield, Fleet, Benchmarks).
- Lifecycleβready: Model Packs (versioned) + Fleet (devices, deployments, events).
- Best runtime per device: Benchmark Matrix picks ONNX/OpenVINO/TensorRT by latency and accuracy.
- From anomalies to rules: Triage + ROC/AβB to promote to deterministic pass/fail.
| Feature | Open-Source Starter Kit | Commercial Offering |
|---|---|---|
| Real-time AI Inference (YOLO, etc.) | β Yes | β Yes |
| Dashboard UI (Streamlit/Grafana) | β Yes | β Yes |
| OTA Agent | β Yes | β Enhanced |
| Health Monitoring | β CLI Tool | β Web Dashboard |
| AI Agent Automation (Recovery, Adapter) | β Yes | β Advanced |
| Odoo / Cloud / AWS Integration | π‘ Manual | β Plug-in Ready |
| Hardware Acceleration Support | π‘ Generic | β Tuned Drivers |
| Long-term Support + SLA | β | β Yes |
| Turnkey Packaging (VM/Image) | β | β Yes |
| Mode | Description |
|---|---|
| Standalone | Fully offline, singleβbox; dashboard & sensor integration |
| Edge-to-Cloud | MQTT sync to MES/BI; CSV/Parquet export or other IoT platforms |
| Vehicle AI | Add GPS/CANbus for on-road deployments |
| Containerized | docker compose -f packaging/docker-compose.yml up --build |
- π¦ Smart Logistics β Detect vehicles or goods, monitor temperature/vibration
- π Factory Automation β Visual inspection + machine health monitoring
- ποΈ Smart Cities β Public space detection, traffic analytics, air quality
- π Use Cases: Real-world Edge AI applications in factories, vehicles, and smart cities
- π€ Contributing Guide: How to get involved and contribute to this project
- SQLite backbone for onβdevice metadata (devices, deployments, inspections, benchmarks, events, lineage) β default DB path
data/edgekit.db(some builds usedata/edge.db; both are supported). - SQLβbacked tabs: π Data Traceability, π Yield & Quality, π°οΈ Fleet.
- Model Packs with validate/smokeβtest hooks + policies for staged/shadow/rollback.
- Benchmark Matrix now schemaβagnostic (supports
engineormodel) and persists best runtime/size. - Triage Queue wired to local anomalies with save/load state.
- New/verified modules per E2E probe: Anomaly Log Viewer, Inference Balance, Benchmark Panel, FineβTuning, MultiβCamera, Saliency/XAI, Health Check, Inspection Rules, Pipeline Builder, I/O Connectors, Governance policy, FewβShot FineβTuning, Examples, MES Export.
- ROC assist + A/B helpers for setting inspection thresholds
- Gateway sidecar (stub) for MQTTβMES/Cloud and CDC table for safe sync
- Plugin API so integrators can add custom pre/post/rule steps
- Dockerfile + dockerβcompose and a CI scaffold.
- Probe summary: 25 passed, 0 failed β see
probes/e2e_check.py. - Vision AI Lifecycle Loop End-to-end data β labeling β retraining β deployment cycle integrated into the dashboard.
- Label Review Tab Review AI predictions, correct labels, and store feedback in SQLite with βLow Confidence Onlyβ filtering.
- Model Retraining Tab Export labeled datasets into versioned folders (
/datasets/vX/) and trigger local retraining scripts. - Model Sync (OTA) Pull new model versions from a local Git repository and activate updated
.onnxmodels. - SQLite Auto-Schema | Automatically initializes
inspection_logsschema for tamper-evident traceability and inspection logging. - Modularized Dashboard Tabs | Each function encapsulated as a module (
dashboard/*.py) for scalable UI extension. - Improved Inference Pipeline | Supports multi-camera input, live capture, preprocessing, and model benchmarking.
- Industrial Integration Ready | Data can be exported to MES, SFC, or cloud dashboards (via MQTT / REST).
- Camera Input & Preprocessing: Integrates USB/IP cameras and stream normalization.
- Inference: Supports both ONNX and PyTorch models for flexible runtime benchmarking.
- Postprocessing + SQLite Logging: Every prediction is timestamped and recorded in
inspection_logs. - Label Review & Retraining: Enables closed-loop retraining with labeled data export and trigger automation.
- Model Sync (OTA): Local Git pull and model activation for secure on-premises updates.
- π Quick Start β KPIs + latest inspections & events
- π Inference β recent inference rows (schemaβadaptive)
- π₯ Live Camera Feed β lists endpoints from
config/cameras.yaml - π· MultiβCam Feeds β 3βcolumn camera grid
- π Log Viewer β lookback filter; CSV/table; tail preview; download
- π Benchmark Matrix β best runtime/size persisted to DB
- π Yield & Quality β PASS/FAIL, Pareto, trend (SQL)
- π¦ Model Packs β versioned packs, hooks, policies
- π°οΈ Fleet β devices, deployments, events (SQL)
- β Inspection Rules β thresholds & rule sets
- π§± Pipeline Builder β preβmodelβpostβrulesβoutputs
- βοΈ I/O Connectors β files, MQTT/MES stubs
- π§° Triage Queue β anomalies β labeling β promote to rule
- π Governance β policy, export guardrails
- π οΈ FewβShot FineβTuning β list examples & spec
- π§ͺ Health Check β table existence/counts; filesystem checks
- π Examples β downloadable artifacts
- π Data Traceability β unitβlevel lineage (SQL / compat view)
- π€ MES Export β
mes_latest.csvexport helper - ποΈ Label Review β Review and correct AI predictions, save to SQLite
- π Model Retraining β Export reviewed data and trigger retraining scripts
- π‘ Model Sync (OTA) β Pull latest model from local Git repo and activate
The three SQLβbacked tabs read from
data/edge.db. The Log Viewer is a simple stub; most analytics live in the SQL pages.
Dashboard Tabs SQLβbacked analytics Ops, lifecycle & dev Capture & monitoring
Tabs render fully when their inputs/resources exist (DB rows, config files, folders). Placeholders are shown otherwise.
Project Structure (consolidated)
sintrones-edge-ai-starter-kit/
β
βββ app.py # Main Streamlit dashboard entry (tabs + dispatch)
β
βββ core/ # Core DB & schema helpers (WAL, SQLite interface)
β βββ schema.sql # Base schema definition
β βββ db_helper.py # SQLite connection & commit utilities
β
βββ dashboard/ # 22 modular Streamlit tabs (each with def render())
β βββ label_tab.py # Label Review
β βββ retrain_tab.py # Model Retraining
β βββ model_sync_tab.py # Model OTA Sync
β βββ benchmark_matrix.py # run_matrix(), record_benchmark(), best_engine()
β βββ triage.py # build_queue_from_anomalies(), save_queue(), add_triage_item()
β βββ ... (existing tabs)
β
βββ db/ # Local database components
β βββ sqlite_utils.py # Auto-create and handle inspection_logs schema
β
βββ retrain/ # Model retraining pipeline
β βββ retrain.py # Example retraining trigger (placeholder)
β
βββ tools/ # Development utilities
β βββ patch_app_tabs.py # Script to auto-patch new tabs into app.py
β
βββ config/ # Configuration files
β βββ app_config.yaml # DB paths, model paths, labels, thresholds
β βββ cameras.yaml # Camera & stream configuration
β βββ inspection_rules.yaml # Rules for classification thresholds
β βββ connectors/ # I/O or MQTT connector definitions
β βββ policy.yaml # Policy and governance settings
β
βββ rules/ # Rule helpers for ROC, A/B, inspection logic
β
βββ gateway/ # MQTT / OPC-UA sidecar (edge telemetry stub)
β
βββ pipelines/ # Configurable AI / vision pipelines
β
βββ quality/ # Quality analysis modules
β βββ triage.py # Queue builder & anomaly manager
β
βββ models/ # Active & fine-tuned models
β βββ model.onnx # Active ONNX model (in use)
β βββ finetune/ # Fine-tuned models
β βββ fewshot/ # Few-shot learning artifacts
β βββ packs/ # Packaged model bundles
β
βββ models_repo/ # Local Git repo for OTA model sync (pull + activate)
β
βββ datasets/ # Auto-exported reviewed datasets (v1, v2, ...)
β
βββ bench/ # Benchmark tools and matrix records
β βββ benchmark_matrix.py # run_matrix(), record_benchmark(), best_engine()
β
βββ xai_results/ # Explainability (saliency maps, Grad-CAM outputs)
β
βββ benchmarks/ # Stored benchmark artifacts
β
βββ examples/ # Runnable examples (scripts / demo configs)
β
βββ logs/ # Inspection logs (JSONL, anomalies, events)
β
βββ data/
βββ edgekit.db # Primary SQLite DB (or edge.db in older builds)
---
Install & Run (deterministic)
```bash
# Create a virtualenv and install deps
python3 -m venv .venv && source .venv/bin/activate
pip install -r requirements.txt
# Initialize SQLite (idempotent)
python scripts/init_sqlite.py
# Launch dashboard
streamlit run app.py
EndβtoβEnd Dummy Data Use the E2E seeder & probe to populate SQLite and validate tab queries quickly:
python tools/e2e/generate_dummy_data.py # seeds devices, inspections, benchmarks, events
python tools/e2e/e2e_probe.py # prints samples for the same queries the tabs useAfter seeding, Yield & Quality, Fleet, Data Traceability, Benchmark Matrix, Log Viewer will show data.
- Vision Inspection (Factory QA) β multiβcamera inference, anomaly triage, promoteβtoβrule, unitβlevel traceability, yield dashboards.
- Industrial IoT Sensor Gateway β MQTT/OPCβUA/Modbus ingestion, PASS/FAIL triggers, PLC handshake, trend KPIs, export to BI.
- Vehicle AI (Fleet / Transit / Logistics) β onβdevice vision + CAN/GNSS, event publishing, OTA model updates.
- SmartβCity Edge β edge vision + environmental sensors, privacyβpreserving analytics, intermittentβconnectivity friendly.
- π§± Pipeline Builder β define full flow in
recipes/pipeline.yaml(pre β model β post β rules β outputs) - π¦ Model Packs β import / validate models, attach pipelines & benchmarks
- π Benchmark Matrix β persist best runtime / accuracy / size metrics into model pack
- π°οΈ Fleet β manage staged or shadow rollouts (policy-driven deployments)
- π Inference / π· Multi-Cam β real-time capture, inference, and logging to SQLite
- π Log Viewer / π Data Traceability β inspect historical results and correlate with unit-level metadata (serial, station, shift, vendor, model@version, outcome)
- π§° Triage Queue β review anomalies, assign priorities, and label for retraining (Promote β β Rule)
- ποΈ Label Review β refine AI predictions manually; save corrections to SQLite
- π Model Retraining β export labeled data to /datasets/vX and trigger retrain script
- π‘ Model Sync (OTA) β pull updated ONNX model from local Git repo and activate
- π Yield & Quality β monitor yield %, DPPM, Pareto, and long-term drift trends; iterate continuously
[ Camera Input ]
β
[ Preprocessing ]
β
[ Inference β SQLite Logging ]
β
[ Label Review (Human-in-the-loop) ]
β
[ Export to /datasets/vX ]
β
[ Retraining Trigger ]
β
[ Local Git Pull + Model Sync ]
β
[ Updated ONNX Model Deployment ]
β
[ Continuous Yield & Trend Feedback ]
Adds human feedback and on-premise model evolution for adaptive inspection.
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Streamlit UI β
β βββ Quick Start / Health / Examples β
β βββ Inference / Multi-Camera / Benchmark β
β βββ Label Review / Retraining / OTA Model Sync (NEW) β
β βββ Logs / Rules / Governance / Fleet β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βΌ
ββββββββββββββββββββββββββββ
β Edge AI Pipeline β
β (camera β preprocess β β
β infer β log β feedback)β
ββββββββββββββββββββββββββββ
β
βΌ
ββββββββββββββββββββββββββββ
β SQLite / Local Storage β
β (tamper-evident logs) β
ββββββββββββββββββββββββββββ
β
βΌ
ββββββββββββββββββββββββββββ
β Retraining + OTA Sync β
β (continuous learning) β
ββββββββββββββββββββββββββββ
- Events:
logs/events.jsonl(one JSON per line; includests,unit_id,result,station_id, β¦) - Images:
logs/anomalies|pass|fail|samples/*.jpg(.json)where sidecar JSON includes metadata (timestamp, unit_id, station_id, camera_id, model@ver, result, defect, score, label).
Added support for a full closed-loop AI lifecycle directly inside the dashboard:
- Review β Label β Export β Retrain β Deploy via OTA
- Local SQLite-based feedback storage and automatic schema creation
- Retraining integrated with versioned datasets under
/datasets/vX/ - Local OTA model synchronization via
models_repoandmodel_sync_tab.py
db_path: db/inspection_logs.db
images_base_dir: data/images
labels: ["OK", "scratch", "missing_screw", "dent", "misalignment"]
confidence_threshold: 0.75
models_repo_path: models_repo
active_model_path: models/model.onnxmodel_packs/<name>/<version>/modelpack.yaml
model_id: defect-detector
version: 1.2.0
artifacts:
onnx: artifacts/model.onnx
runtime:
preferred: onnxruntime
benchmarks:
"2025-09-12":
onnxruntime: {fps: 30.0, latency_ms: 33.0, size: "640"}
pipeline: recipes/pipeline.yaml
metrics: {f1: 0.82}
train: {data_commit: 25c1f3...} # if using DVC/Git-LFSe2e_bootstrap_pipeline_v31.pyβ deterministic seeding for demostab_health_probe.pyβ prints readiness of tables/folders for each tabfix_streamlit_width_api.pyβ repoβwide Streamlit width migrationapply_ui_tweaks_env_footer.pyβ remove/move the βEnvironmentβ panelcompat_views.sqlβ safe views powering Inference & Traceability
pytest tests/- Agents, OTA model switch, loggers, schema adapters.
- GitHub Actions scaffolded in
.github/workflows/*.
- docs/USE_CASES.md β realβworld factory/vehicle/city use cases
- docs/CONTRIBUTING.md β contribution workflow
- docs/LEGACY_MIGRATION.md β old β new paths & commands
π’ Community & Contact
- Website
- LinkedIn π¬ Want a hardware demo kit? Contact Sintrones
MIT β suitable for research, pilots, and production starters.