Skip to main content

Data Quality and Integrity- The Signal-to-Noise Ratio (SNR)

In edge computing, data integrity is paramount. A single mislabeled sample or a biased dataset can lead to thousands of false triggers in the field, where remote updates may be difficult or impossible. The most critical metric for an eFabric™ developer during data collection is the Signal-to-Noise Ratio (SNR).


The "Garbage In, Garbage Out" (GIGO) Principle

The GIGO principle is amplified at the edge. If the training data contains "noise" that is incorrectly labeled as a "signal," the model will faithfully learn that noise. Every sample in the eFabric™ Dataset Manager must be verified. For audio, this means ensuring the "Keyword" is not cut off at the start or end of the clip.

The Science of GIGO: Signal Integrity

To truly master edge AI, a developer must treat data collection with the same rigor as circuit design. In the eFabric™ ecosystem, we emphasize Signal Integrity because the neural network's ability to generalize depends entirely on the mathematical clarity of the training samples. A model is only as robust as its cleanest sample.

A. The SNR Goal: Deciphering the 15dB Benchmark

The Signal-to-Noise Ratio (SNR) measures the strength of the desired signal (e.g., your keyword) relative to the background noise.

  • The Threshold: For "Always-On" keyword spotting, your positive training samples should aim for a minimum SNR of 15dB.

  • Why 15dB? At this level, the "shape" of the sound is distinct enough for a CNN to identify spectral features without being obscured by the "static" of the environment.

  • The Calculation:

    SNRdB=10log10(PsignalPnoise)\mathrm{SNR}_{dB} = 10 \log_{10}\left(\frac{P_{signal}}{P_{noise}}\right)
    • If your SNR is too low (<5dB), the model begins to treat the noise as part of the keyword itself, leading to high False Rejection Rates in the field.

B. Nyquist-Shannon Sampling Theorem: Avoiding Aliasing

When converting an analog sound or vibration into a digital format, the Sampling Rate is your most critical variable.

  • The Theorem: To accurately reconstruct a signal, your sampling rate must be at least twice the highest frequency (fmaxf_{max}) present in the signal. This is known as the Nyquist Rate.

  • The Danger of Aliasing: If you sample too slowly, high-frequency "peaks" are misinterpreted by the system as low-frequency "ghost" signals. This is called Aliasing. It creates phantom data that can trigger your model incorrectly.

  • eFabric™ Optimization: eFabric™ defaults to a 16kHz sampling rate.

    • According to Nyquist, this perfectly captures signals up to 8kHz.

    • Why 8kHz? Most human speech intelligence is contained below 4kHz and the majority of industrial mechanical vibrations (motor humming, bearing clicks) occur well below the 8kHz limit. This provides a "sweet spot" of high fidelity and low compute cost.

⚠️Technical Tip

“If you are targeting ultrasonic sounds or very high-speed turbine vibrations above 8kHz, you will need to adjust the hardware clock settings in the Hardware menu to support higher sampling rates.”

C. Practical Tips for Data Curation

  • Uniformity: Never mix different sampling rates (e.g., some at 16kHz and some at 44.1kHz) in the same project. eFabric™ will flag this to prevent "spectral shifting" during training.

  • Headroom: Ensure your recordings don't "clip" (hit the maximum volume level). Clipped audio squares off the waveform, creating artificial harmonics that confuse the neural network's feature extractor.

  • The "Silence" Factor: Always include 200ms of "Environmental Silence" before and after your keyword in a sample. This allows the model's Sliding Window to "see" the beginning and end of the pattern clearly.


Balanced vs. Unbalanced Datasets

In the eFabric™ Factory, a model’s ability to make fair, accurate decisions is rooted in Data Symmetry. For developers, managing class distribution is a critical engineering task. A model trained on an Unbalanced Dataset will naturally gravitate toward the "easiest" mathematical solution—which is often to predict the majority class (the "Negative" class) every time.

A. The Majority Class Trap

If you provide 5,000 samples of general office background noise and only 50 samples of your "Keyword," the neural network will achieve 99% accuracy by simply ignoring the keyword altogether. In the TinyML world, we call this a "Lazy Model." It has high accuracy on paper but zero utility in the field because its Recall for the actual event is nearly zero.

B. The Imbalance Ratio (IR) Metric

To avoid this, we quantify the health of our dataset using the Imbalance Ratio (IR). This is a simple but vital calculation for every eFabric™ project:

IR=NmajorityNminorityIR = \frac{N_{majority}}{N_{minority}}
  • Optimal (IR < 3): This is the "Sweet Spot." The model has enough diverse examples of both classes to draw a sharp Decision Boundary.

  • Marginal (3 < IR < 10): At this level, the model begins to require specialized weighting or advanced augmentation to prevent bias.

  • Critical (IR > 10): This dataset is "Class-Skewed." The model will likely suffer from high False Rejections (ignoring the keyword) because it hasn't seen enough positive variations to generalize.

C. Strategic Balancing Techniques

If you find your dataset is unbalanced, eFabric™ provides two primary paths for correction:

  • Oversampling the Minority (Positive) Class: Instead of just duplicating clips (which leads to overfitting), eFabric™ uses Synthetic Variance. By applying subtle shifts in pitch, gain and time to your 50 keyword samples, we can "mathematically expand" them into 500 unique samples that keep the model challenged.

  • Undersampling the Majority (Negative) Class: Sometimes, less is more. If you have 20 hours of background noise but only 5 minutes of your target event, it is more effective to select the most diverse 30 minutes of noise rather than using the full 20 hours. This focuses the model's "attention" on the actual differences between signal and noise.

📊 Data Insight: Precision-Recall Trade-offs

"An unbalanced dataset doesn't just 'bias' a model; it skews the Precision-Recall Curve. If your negative class is too small, your model will have high Recall (it catches everything) but low Precision (it triggers on everything, including silence).”

D. The Role of "Near-Miss" Data

A perfectly balanced dataset of "Silence" vs. "Keyword" is still a weak model. To be truly robust, the negative class should include Acoustic Distractors—sounds that are 90% similar to the keyword but are technically incorrect.

  • Example: If your keyword is "Hey Meritech," your negative class should include clips of "Hey Mary" or "Hello Meritech." These "Near-Misses" force the model to learn the fine-grained details of the phonetic pattern.

Data Diversity and Real-World Robustness

In the "Always-On" world, a model is only as good as its ability to handle the unpredictable. While a balanced dataset (previous section) provides a mathematical foundation, Data Diversity provides the "immunity" your model needs to survive in high-variance environments. For eFabric™ developers, this means moving beyond laboratory-recorded data and embracing the "messiness" of reality.

A. The Dimensionality of Diversity

To build a truly robust model, you must account for variance across three primary dimensions:

  • Subject Variance (The "Who"):
    • Acoustic Features: Voices vary by pitch, timbre and resonance.
    • The eFabric™ Requirement: Collect samples from a wide demographic—different genders, age groups and accents. A model trained only on adult male voices will often fail to recognize the same keyword spoken by a child or a person with a high-pitched voice.
  • Environmental Variance (The "Where"):
    • The Transfer Function: Sound and vibration change based on the physical space. A "Keyword" in an empty hallway has a different Acoustic Transfer Function (reverb) than the same keyword in a carpeted living room.
    • Noise Profiles: You must include "Negative Data" from the actual deployment site. If the target is a kitchen appliance, include the hum of a refrigerator and the clinking of silverware.
  • Hardware Variance (The "How"):
    • Sensor Tolerance: No two microphones or accelerometers are identical. Tiny variations in sensitivity or frequency response can shift the model's perception.
    • Gain Variation: Train your model using samples recorded at varying distances from the sensor to ensure it remains responsive whether the user is 1 meter or 5 meters away.

B. Handling Covariate Shift

In technical terms, lack of diversity leads to Covariate Shift. This occurs when the "Probability Distribution" of the features the model sees in the field is different from what it saw during training.

  • The Symptom: Your model has 99% accuracy in the eFabric™ Factory but drops to 60% when tested on a physical prototype in a noisy office.

  • The Cure: Out-of-Distribution (OOD) Testing. During the engineering phase, intentionally set aside a "Test Set" that includes speakers or environments the model has never seen during training. This is the only true measure of Generalization.

C. The "Near-Miss" Strategy for Robustness

Robustness is built by teaching the model what to ignore. We recommend a dedicated category in your negative class for "Near-Misses":

  • Phonetic Near-Misses: For the keyword "Hey eFabric", include recordings of "Hey Fabric", "Hey Electronic" or "A Fabric".
  • Mechanical Near-Misses: For an industrial vibration model, include samples of a tool being dropped or a door slamming—events that are loud and sudden but do not represent a motor failure.
💡 The Transfer Function

"Don't just record clean data and add noise later. Whenever possible, record your 'Positive Samples' through the actual housing of your device. The physical plastic or metal casing acts as a filter that significantly changes the signal's signature."