Main Content

Labeling Radar Signals with Signal Labeler

This example shows how to label the main time and frequency features of pulse radar signals. This step facilitates the process of creating complete and accurate data sets to train artificial intelligence (AI) models. Signal Labeler eases this task in two ways. In manual mode, synchronized time and time-frequency views help users identify frequency features such as the waveform type, which can be either Rectangular, LinearFM, or SteppedFM in this example. In automated mode, users can register functions that measure pulse repetition frequency (PRF), pulse width, duty cycle, and pulse bandwidth and only correct mistakes instead of labeling all signals from scratch. A built-in dashboard helps track the labeling progress and assess the quality of the labels.

Import Data into Signal Labeler

The radar signals to be labeled in this example are stored in individual MAT-files. Each file contains a data variable x and a corresponding sample rate variable Fs.

Open Signal Labeler. On the Labeler tab, click Import and select From Folders in the Members list. In the dialog box, select the directory with radar signal files. To specify the signal variables that you want to read, click Specify and enter x. Add time information: Choose the Working in option and select Time from the drop-down list. Select Sample Rate Variable From Files in the list and enter Fs. Click Import. The imported files appear in the Labeled Signal Set Browser. Plot the signals by selecting the check boxes next to their names.

Define Labels

Create a label definition for the signal waveform type.

  1. Create a string attribute label to label the waveform type. Click Add on the Labeler tab and select Add Label Definition.

  2. In the dialog box, specify the Label Name as WaveFormType, select a Label Type of Attribute, enter the Data Type as string.

  3. Click OK.

Repeat 1–3 to create attribute label definitions for PRF, duty cycle, and bandwidth. Modify the label name for each and set the data type as numeric.

Create a region-of-interest (ROI) label for pulsewidth that corresponds to the regions showing initial and final crossings used to compute each pulsewidth. Specify Label Name as PulseWidth, Label Type as ROI, and Data Type as numeric. The label definitions appear in the Label Definitions browser.

Create Custom Autolabeling Functions

Create four Custom Labeling Functions to label the PRF, bandwidth, duty cycle, and pulsewidth. (Code for the computePRF, computeBandWidth, computeDutyCycle and computePulseWidth functions appears later in the example). To create each function, in the Labeler tab, click Automate Value and select Add Custom Function. Signal Labeler shows a dialog box asking for the name, description, and label type of the function.

  1. For the function that computes the PRF, enter computePRF in the Name field and select Attribute as the Label Type. You can leave the Description field empty or you can enter your own description.

  2. For the function that computes the bandwidth, enter computeBandWidth in the Name field and select Attribute as the Label Type. You can leave the Description field empty or you can enter your own description.

  3. For the function that computes the duty cycle, enter computeDutyCycle in the Name field and select Attribute as the Label Type. You can leave the Description field empty or you can enter your own description.

  4. For the function that computes the pulsewidth, enter computePulseWidth in the Name field and select ROI as the Label Type. You can leave the Description field empty or you can enter your own description.

If you already have written the functions, and the functions are in the current folder or in the MATLAB® path, Signal Labeler adds the functions to the gallery. If you have not written the functions, Signal Labeler opens blank templates in the Editor for you to type or paste the code. Save the files. Once you save the files, the functions appear in the gallery.

Label Waveform Type, PRF, Bandwidth, Duty Cycle, and Pulsewidth

Set the waveform type of each signal:

  1. In the Labeled Signal Set Browser, select the check box next to radarData1.

  2. Click the Display tab and select Spectrogram in the Views section. The app displays a set of axes with the signal spectrogram and a Spectrogram tab with options to control the view.

  3. Click the Spectrogram tab and set the overlap percentage to 99.

  4. The spectrogram shows the signal waveform is rectangular. In the label viewer attribute table, double-click the cell below WaveFormType and type Rectangular.

  5. Repeat this manual labeling step for all the signals in the dataset.

This is an example of a Rectangular waveform:

This is an example of a LinearFM waveform:

This is an example of a SteppedFM waveform:

Compute and label the PRF of the input signals.

  1. Select PRF in the Label Definitions browser.

  2. In the Automate Value gallery, select computePRF.

  3. Click Auto-Label and select Auto-Label All Signals. In the dialog box that appears, click OK.

Repeat the above steps for bandwidth, duty cycle and pulsewidth by selecting the corresponding label definition and autolabeling function.

Signal Labeler computes and labels all signals, but displays labels only for the signals whose check boxes are selected.

Validate Labeled Signals

View your labeling progress and verify the computed label values are correct. Select WaveFormType in the Label Definitions browser and click the Dashboard in the Labeler tab.

The plot on the left shows the labeling progress, which is 100% as all signals are labeled with the WaveFormType label. The plot on the right shows the number of signals with labels for each label value. You can use the Label Distribution pie chart to assess the accuracy of your labeling and confirm the results are as expected.

Next, validate that all pulsewidth label values are distributed around 5e-5. To look at time distribution of pulsewidth label values, click Definition Selection on the Dashboard tab and select PulseWidth. Click on the time distribution plot and on the Dashboard tab, set Bins to 3, X Min to 4e-5 and X Max to 6e-5. All signals have a pulsewidth distributed around 5e-5.

Close the dashboard.

Export Labeled Signals

Export the labeled signals to train AI models. On the Labeler tab, click Export and select Labeled Signal Set To File. In the dialog box that appears, give the name radarDataLss.mat to the labeled signal set and add an optional short description. Click Export.

Go back to the MATLAB® Command Window. Load the labeled signal set and create signal and label datastores from the labeled signal set. Create a combined datastore with the signal and label datastores. Use read or readall to get signal-label pairs that you can use to train AI models.

load radarDataLss.mat
[signalDS,labelDs] = ls.createDatastores('WaveFormType');
combineDs = combine(signalDS,labelDs);

Summary

In this example, you saw how to label the main time and frequency features of noisy pulse radar signals. You saw how to use synchronized time and time-frequency views to identify frequency features such as the waveform type. You saw how to register custom autolabeling functions to label the PRF, pulse width, duty cycle, and pulse bandwidth. You saw how to use the built-in dashboard to track labeling progress and assess the quality of the labels.

Supporting Functions

computePRF Function: Calculate the pulse repetition frequency

The computePRF function computes and labels the PRF of the input signal. It uses the pulseperiod function.

function [labelVal,labelLoc] = computePRF(x,t,parentLabelVal,parentLabelLoc,varargin)
% Function to calculate pulse repetition frequency of a radar pulse

if~isreal(x)
    x = abs(x);
end
pri = pulseperiod(x,t);
labelVal = 1/pri(1);
labelLoc = [];
end

computeBandWidth Function: Calculate the pulse bandwidth

The computeBandWidth function computes and labels the bandwidth of the input signal. It uses the obw function.

function [labelVal,labelLoc] = computeBandWidth(x,t,parentLabelVal,~,varargin)
% Function to calculate occupied bandwidth of a radar pulse
if~isreal(x)
    x = abs(x);
end
fs = 1/mean(diff(t));
labelVal = obw(x,fs);
labelLoc = [];
end

computeDutyCycle Function: Calculate the pulse duty cycle

The computeDutyCycle function computes and labels the duty cycle of the input signal. It uses the dutycycle function.

function [labelVal,labelLoc] = computeDutyCycle(x,t,parentLabelVal,parentLabelLoc,varargin)
% Function to calculate duty cycle of a radar pulse
if~isreal(x)
    x = abs(x);
end
labelVal = dutycycle(x,t);
labelLoc = [];
end

computePulseWidth Function: Calculate the pulse width

The computePulseWidth function computes and labels the pulsewidth of the input signal. It uses the pulsewidth function.

function [labelVal,labelLoc] = computePulseWidth(x,t,parentLabelVal,parentLabelLoc,varargin)
% Function to calculate pulse width of a radar pulse
if~isreal(x)
    x = abs(x);
end
[pw,ic,fc] = pulsewidth(x,t);
labelVal = pw(1);
labelLoc = [ic(1) fc(1)];
end