← Back to the chapter · Previous detail · Next detail →
Technical detail · Edge Processing: Aggregation Decisions
Anomaly evidence from a local model
# Example: Anomaly detection at edge
model = load_tflite_model("anomaly_detector.tflite")
def infer_anomaly(sensor_data):
prediction = model.predict(sensor_data)
if prediction["anomaly_score"] > 0.85:
return {"anomaly": True, "score": prediction["anomaly_score"],
"features": sensor_data}
return None # Normal - don't transmit