Spectral features
The Spectral features block extracts frequency and power characteristics of a signal. Low-pass and high-pass filters can also be applied to filter out unwanted frequencies. It is great for analyzing repetitive patterns in a signal, such as movements or vibrations from an accelerometer.
GitHub repository containing all DSP block code: edgeimpulse/processing-blocks.
Filtering out high frequencies from an accelerometer for movement detection

Spectral analysis parameters

  • Scale axes: Multiplies axes by this number to scale data from the sensor
  • Type: Type of filter to apply to the raw data (low-pass, high-pass, or none)
  • Cut-off frequency: Cut-off frequency of the filter in hertz
  • Order: Order of the Butterworth filter
Spectral power
  • FFT length: The FFT size
  • No. of peaks: Number of spectral power peaks to extract
  • Peaks threshold: Minimum threshold to extract a peak (frequency domain normalized to [0, 1])
  • Power edges: Splits the power spectral density in various buckets (V**2/Hz unit)

How does the spectral features block work?

The spectral analysis block generates 3 types of features per axis:
  • The root mean square of the filter output (1 scalar value)
  • The frequency and height of spectral power peaks
  • The average power spectral density for each bucket
The raw signal is first scaled up or down based on the Scale axes value and offset by its mean value. A Butterworth filter is then applied (except if None selected); the order of the filter indicates how steep the slope is at the cut-off frequency.
At this point the root mean square of the filter output is added to the features' list.
The filter output is then used to extract:
  • Spectral power peaks: after performing the FFT, the No. of peaks peaks with the highest magnitude are stored in the features' list (frequency and height). Peaks threshold can be tuned to define a minimum value to extract a peak.
  • PSD for each bucket: after computing the power spectral density, the signal is divided in power buckets, defined by the Power edges parameter. Each sample frequency of the PSD is added to a power bucket. The power buckets are then averaged and added to the features' list. This process allows to extract a power representation of the signal.

Number of generated features

Let's consider an input signal with 3 axis and the following parameters:
  • No. of peaks = 3
  • Power edges = 0.1, 0.5, 1.0, 2.0, 5.0
The number of generated features per axis is:
  • 1 value for RMS of the filter output
  • 6 values for power peaks (frequency & height for each peak)
  • 4 values for power buckets (number of Power edges - 1)
33 features are generated in total for the input signal.
Last modified 18d ago