Motion sensors are a cheap way to control lighting, but they are blind: lights turn on with delay, turn off when someone is still in the room, and ignore daylight. The result — 30% of energy is wasted. We, a team with over 5 years of experience in ML building automation (more than 50 completed projects), solve this problem differently: we train a model to predict occupancy and smoothly adjust brightness to real conditions. The system pays for itself in 2–4 years, and staff comfort increases — no harsh switching or flicker.
In one project for an office building of 2500 m², we implemented a system based on Edge ML. We installed 12 Raspberry Pi 4 units connected to a DALI network. The Random Forest model was trained on 3 months of historical data and achieved 94% occupancy accuracy. Energy consumption dropped by 45%.
How AI Solves Blind Lighting
Classic PIR sensors provide a binary signal: "motion/no motion." They cannot distinguish a person from a cat, do not remember history, and do not know that at 3:00 PM the meeting room is usually occupied. Our approach — an ML model on time series — collects data from sensors (PIR, ultrasound, CO2, lux) and builds a probabilistic forecast. The Random Forest model yields 95% occupancy accuracy — 1.5 times more accurate than typical PIR (70%). Daylight harvesting based on autoregression reduces brightness when natural light reaches 500 lux — an extra 15% savings.
System Architecture
-
Sensor layer: PIR/ultrasonic presence sensors (accuracy 90–95%), lux sensors for daylight harvesting, CO2 sensors for indirect occupancy estimation, optionally cameras with people counting.
-
Edge ML: On a DALI controller or local Raspberry Pi: occupancy prediction (Random Forest on temporal patterns), daylight model (AutoRegressive on historical lux + weather forecast), adaptive dimming (RL agent maintains target illuminance of 300–500 lux).
-
Control Layer: DALI (Digital Addressable Lighting Interface) — standard protocol for lighting control. Group and individual luminaire control.
What the System Does
- Turns off lighting when no people are present after N minutes (adaptive timeout per zone, considering return probability).
- Reduces brightness when daylight is sufficient — the model predicts illuminance one hour ahead.
- Pre-lights before people arrive (based on calendar/patterns).
- Emergency lighting when motion is detected in dark periods — with smooth ramp-up to 20%.
- Automatic calibration: the model retrains every week on new data, adapting to seasonality.
Why Choose ML Over Simple Timers?
Timers are inflexible: on Friday evening the office is empty, but lights stay on until 11:00 PM. An ML model analyzes occupancy over the last 8 weeks and predicts empty zones with probability 0.97 — lights turn off 40 minutes earlier. The "last person leaves" scenario saves up to 8% of total consumption. Plus, the model suppresses false triggers from drafts and animals — detection accuracy does not drop. The ML model cuts energy consumption by 30–50%, which is 2–3 times more than timers (10–20%).
Impact Metrics
| Indicator |
Value |
Comment |
| Electricity savings |
30–50% |
Depending on zone and season |
| System payback period |
2–4 years |
For objects from 500 m² |
| Occupancy detection accuracy |
92–96% |
On labeled data from 10 zones |
| Employee comfort improvement |
– |
Discomfort complaints reduced by 70% |
Comparison of Lighting Control Approaches
| Parameter |
Timers |
PIR Sensors |
ML Approach |
| Schedule flexibility |
Low |
Medium |
High |
| Daylight harvesting |
No |
No |
Yes |
| Occupancy accuracy |
– |
70% |
95% |
| Energy savings |
10–20% |
20–30% |
30–50% |
| Seasonal adaptation |
No |
No |
Yes |
What's Included in the Work
-
Site survey: audit of current lighting system, zone diagrams, illuminance measurements, historical sensor data collection.
-
ML solution design: model selection (Random Forest, LSTM, Prophet), hyperparameter tuning, simulation on synthetic data.
-
Installation and integration: edge controller setup, connection via DALI/Modbus, model deployment through ONNX Runtime. Integration with BMS via BACnet, Modbus, KNX is possible.
-
Calibration and A/B test: 2–3 weeks of parallel operation, comparison with existing logic.
-
Staff training and documentation: handover of dashboard (Grafana), API for BMS integration.
Ready to estimate savings for your building? Contact us for a preliminary calculation.
Timeline: 4–8 weeks
Leave a request for a savings calculation — we will assess your facility in 2 days and calculate payback. We guarantee at least 30% reduction in energy consumption.
DALI — standard IEC 62386 for digital lighting control.
Edge AI and Optimization: How to Deploy Models Without Cloud?
Imagine: your face recognition model has 4 seconds latency on Jetson Orin, the battery runs out in an hour, and the model crashes with OOM. We are a team of Edge AI engineers with 5+ years in production — we have optimized over 150 models for edge devices. Without profiling and proper choice of quantization or distillation, the project is doomed. The gap between research code and edge deployment is a separate engineering discipline; we help you master it in 2–16 weeks turnkey. Edge AI and model optimization services are not just export, but systematic work with hardware.
Why Simply Exporting a Model Doesn't Work?
A PyTorch model with float32 and batch_size=32 is not ready for edge. Typical problems:
- ResNet-50 in fp32 occupies 98 MB, inference on Cortex-A78 — 380 ms. After INT8 quantization via
torch.ao.quantization — 24 MB, 95 ms. Export to ONNX + TensorRT on Jetson — 28 ms.
- YOLOv8m on Raspberry Pi 5 in fp32 — 2.8 fps. TFLite INT8 — 9.4 fps. With XNNPACK delegate — 14 fps (1.5× faster than pure INT8).
- Transformer encoder on mobile CPU: MobileBERT in fp16 via CoreML on iPhone 15 — 18 ms/inference.
distilbert-base-uncased in ONNX — 42 ms.
The problem is not choosing "quantize or not" — the right path is determined by the device, task, and acceptable metric degradation. We offer an assessment of your project: within 24 hours we will tell you how feasible it is to speed up the model.
How to Choose Quantization Method for Your Task?
PTQ (Post-Training Quantization) — a quick path. Take a trained model, run a calibration dataset (200–1000 samples), get INT8 or INT4 weights. Tools: torch.ao.quantization, ONNX Runtime quantization tool, bitsandbytes. Accuracy degradation: 0.5–2% on classification. Red zone — small object detection and segmentation, where PTQ gives -4–8% mAP.
QAT (Quantization-Aware Training) — training with simulated quantization noise. More expensive (retraining), but degradation 0.1–0.5%. Justified when PTQ is unacceptable. In PyTorch — torch.ao.quantization.prepare_qat().
GPTQ / AWQ — for LLMs. AWQ better preserves quality at 4-bit quantization. llm-compressor from Neural Magic or autoawq are the main libraries.
| Method |
Implementation Time |
Accuracy Degradation |
Tools |
| PTQ |
1–2 days |
0.5–2% (up to 8% on detection) |
torch.ao, ONNX RT, bitsandbytes |
| QAT |
1–3 weeks |
0.1–0.5% |
torch.ao.prepare_qat, TF Quantization |
| GPTQ/AWQ |
3–7 days |
1–3% (LLM) |
autoawq, llm-compressor |
Potential savings from choosing the right method can be substantial — for example, reducing cloud inference costs by up to 70% when deploying to edge. Project cost is calculated individually based on model complexity and target platform.
When to Use Pruning vs Distillation?
Structural pruning removes channels or layers. torch.nn.utils.prune — basic tool. For transformers — attention head pruning (LTP, movement pruning). Result: ResNet-50 after removing 40% of channels with fine-tuning — -35% size, -28% latency, -1.2% top-1 accuracy.
Knowledge distillation — train a small student to mimic a large teacher. Classic via KLDivLoss on soft labels. Feature distillation on intermediate layers is more effective. Hugging Face DistilBERT: 66M vs 110M parameters, -40% latency, -3% on GLUE. This is a model compression technique.
Combined approach: distillation → pruning → QAT. Gives maximum effect on limited hardware. We recorded a case where a client achieved 70% reduction in cloud compute spend after moving to edge with this pipeline.
Target Platforms and Tools
| Platform |
Preferred Format |
Tool |
Specifics |
| NVIDIA Jetson |
TensorRT engine |
trtexec, torch2trt |
INT8 calibration, DLA offload |
| Apple Silicon / iOS |
CoreML (.mlmodel) |
coremltools |
ANE (Neural Engine) automatically |
| Android |
TFLite (.tflite) |
tf.lite.TFLiteConverter |
GPU delegate, NNAPI |
| x86 CPU |
ONNX + ORT |
onnxruntime |
AVX-512, VNNI |
| Arm Cortex |
TFLite / ONNX |
ort-arm, tflite |
XNNPACK, NEON |
| Qualcomm NPU |
QNN (.dlc) |
Qualcomm AI Hub |
Hexagon DSP |
TensorRT — the main tool for NVIDIA edge. TRT builds a graph with operator fusion, selects optimal kernels. On Jetson AGX Orin YOLOv8m in TRT INT8 gives 78 fps vs 22 fps in fp16 PyTorch — 3.5× improvement.
Practical Case: How We Detected Defects on a Production Line (Our Client)
Task: real-time scratch detection on metal, 30 fps, camera to Jetson Xavier NX (16GB). Original model YOLOv8l mAP50 0.91, server inference 28 ms, on Jetson in fp16 — 110 ms (9 fps). Not suitable.
Optimization steps we performed for our client:
- Switch to YOLOv8m — mAP50 0.887 (-2.3%), 68 ms
- Export to TensorRT FP16 via
yolo export format=engine half=True — 31 ms (32 fps)
- INT8 calibration on 500 frames — 22 ms (45 fps), mAP50 0.879
Result: 3.5% degradation at 5× speedup. Client received engine and documentation. We guarantee metric will not drop below agreed threshold — specified in contract.
Example model profiling (layer latency)
Profile slice of YOLOv8m on Jetson Xavier NX (fp16):
- Convolution (layer 1–5): 12 ms
- Bottleneck (layer 6–10): 8 ms
- Head (detection): 11 ms
Bottleneck is the last layers of the head. After quantizing the head separately, head latency dropped to 4 ms.
What is Included in the Work?
- Report on model profiling on target device (layer latency, bottlenecks)
- Selection and justification of optimization methods (quantization / pruning / distillation)
- Optimized model (TensorRT engine / TFLite / CoreML / ONNX)
- Configs for reproducibility (scripts, Docker image, instructions)
- Testing on real device (at least 10,000 inferences)
- Training of your team (2 hours online)
- 1 month support after delivery
How to Order Model Optimization
- Submit a request on the website or contact us in any convenient way.
- We perform free profiling of your model on the target device within 24 hours.
- We prepare an optimization plan with trade-off estimates (speed vs quality).
- You approve the plan — we start work.
- After completion, we deliver the optimized model, configs, and documentation.
- We train your team and provide monthly support.
Timeline: optimization of an existing model — 2–4 weeks. Development from scratch for edge — 6–16 weeks.
Get a consultation — we will evaluate your model for free and offer a plan within 24 hours. Order free profiling now. For complex projects, contact our engineering team to discuss custom optimisation strategies.