HomeIA e Machine LearningRilevatore di Anomalie dei Sensori — Autoencoder dal Vivo

🔧 Rilevatore di Anomalie dei Sensori — Autoencoder dal Vivo

Osserva un vero autoencoder neurale addestrarsi dal vivo tramite backpropagation per ricostruire letture normali simulate dei sensori, segnalando le anomalie tramite reali picchi di errore di ricostruzione che non è mai stato addestrato a comprimere bene.

IA e Machine Learning3DAdvanced60 FPS
ai-manufacturing-sensor-anomaly-autoencoder ↗ Open standalone

Informazioni su questa simulazione

This simulation runs a genuine encoder-decoder neural network (a five-input autoencoder with a three-unit bottleneck) entirely in your browser, training it live with hand-written backpropagation and stochastic gradient descent — no TensorFlow.js, no canned ML library, just forward and backward passes coded from the chain rule. It is fed a continuous stream of synthetic, correlated "normal operation" readings from five simulated machine sensors (temperature, vibration, pressure, current and RPM), and it learns, epoch by epoch, to compress and reconstruct that healthy pattern. Once trained, feeding it a reading it has never seen — a spike, a drift, a stuck sensor, a correlation break, or a noise burst — produces a measurably higher reconstruction error, which is exactly how real predictive-maintenance systems flag equipment faults before they cause downtime.

🔬 Cosa mostra

A live loss curve genuinely falling as backpropagation updates the network's weights every frame, a live reconstruction-error strip chart with an adjustable detection threshold, and a 3D machine rig whose five sensor nodes glow green-to-red based on each channel's real-time squared reconstruction error.

🎮 Come si usa

Let the network train for a few seconds until the loss curve flattens, then pick an anomaly type from the dropdown and click Inject to feed the trained network a fault pattern it has never seen. Watch the reconstruction error spike above the threshold line, adjust the threshold slider to change detection sensitivity, and use Reset to reinitialise the network and retrain from scratch.

💡 Lo sapevi?

Autoencoder-based anomaly detection needs zero labelled fault examples: it only ever trains on abundant "everything is fine" data. That is exactly why it is popular in industrial predictive maintenance, where real failures are rare, expensive to induce on purpose, and often different every time.

Domande frequenti

What is an autoencoder and how does it detect anomalies?

An autoencoder is a neural network trained to reconstruct its own input through a narrow bottleneck layer that forces it to learn a compressed representation of the data. When trained only on normal sensor readings, the network becomes very good at compressing and reconstructing the patterns it has seen, but poor at reconstructing patterns it has never encountered. Anomaly detection exploits this: feed the trained network any new reading and measure the reconstruction error, the mean squared difference between the input and the network's output. Normal readings reconstruct with low error; readings that fall outside the learned manifold reconstruct with high error, because the compressed bottleneck simply has no efficient code for them.

Why does the bottleneck layer matter?

If the hidden layer were as wide as the input, the network could learn a trivial identity mapping that copies every value straight through, and every input, normal or anomalous, would reconstruct with near zero error, making anomaly detection meaningless. This simulation's encoder compresses five sensor channels down to a 3-unit bottleneck before a mirrored decoder expands them back to five outputs. That narrow bottleneck forces the network to discover the low-dimensional structure that actually governs a healthy machine, its shared load cycle, and discard anything outside that structure.

How is this network actually trained in the browser?

Every animation frame, the simulation draws fresh synthetic normal readings, never real data files, runs them through the current network in a forward pass, computes the mean-squared reconstruction error against that same input as the training target, and then runs a full backward pass: the chain rule is applied layer by layer to compute gradients for every weight and bias, using tanh derivatives for the hidden layers and a plain linear derivative for the output layer, then every parameter is nudged by minus the learning rate times its gradient. This is genuine backpropagation and gradient descent, implemented from scratch in plain JavaScript with no machine-learning library, and you can watch the loss curve fall as training proceeds.

What anomaly types can I inject, and how do they differ?

Five failure modes are available: a Sensor Spike where one channel jumps abruptly by several normal standard deviations, a Sensor Drift where one channel slowly biases away from its healthy range, a Stuck Sensor where one channel freezes at a fixed value while the real load keeps changing, a Correlation Break where all sensors keep moving but stop moving together even though real machines have their sensors coupled through a shared physical load, and a Noise Burst where all channels become far noisier than anything seen in training. Because the network was never trained on any of these five patterns, every one of them typically produces a reconstruction error tens to hundreds of times higher than normal operation.

How should I set the detection threshold?

The threshold slider sets the reconstruction-error value above which the simulation flags ANOMALY DETECTED. Set it too low and ordinary noisy-but-healthy readings will trigger false alarms; set it too high and real faults will slip through undetected. A common practical approach, mirrored here, is to set the threshold a few standard deviations above the mean reconstruction error observed on validated normal data, then adjust it while watching the live error chart to balance sensitivity against false-alarm rate for the specific machine being monitored.

Why is the network only trained on normal operating data?

This is the defining trick of autoencoder-based anomaly detection: because true anomalies are rare, varied and often unseen in advance, it is usually impractical to collect a labelled dataset of every possible failure mode. Instead the network only ever needs examples of what normal looks like, which are abundant, and it learns anomaly detection as an unsupervised by-product of compressing that constantly generated normal data well. This simulation strictly separates its training generator, which only ever produces the healthy correlated sensor pattern, from its live anomaly-injection code path, so any high reconstruction error you see is a genuine, unrehearsed generalisation failure, not a memorised example.

Is the 3D visualisation showing real values?

Yes. The five glowing sensor nodes correspond to the network's five input channels, temperature, vibration, pressure, current and RPM, and each node's colour and glow intensity is driven directly by that channel's squared reconstruction error at the current instant, the actual reading minus the network's reconstruction, squared. The central housing's colour reflects the combined score against the current threshold. Nothing is scripted or pre-baked: every value comes from the live forward pass of the same network shown training in the loss chart.

⚙ Dietro le quinte

A 5→8→3→8→5 dense autoencoder trains live via hand-written backpropagation and SGD on synthetic correlated sensor data, then flags anomalies from genuine reconstruction-error spikes against an adjustable threshold.

AutoencoderBackpropagationAnomaly DetectionGradient DescentPredictive Maintenance

3D · renderer Three.js / WebGL · target 60 FPS · funziona interamente lato client, senza installazione

What did you find?

Add reproduction steps (optional)