Main Content

Label Signals Interactively or Automatically

In Signal Labeler, you can label a data set of single or multichannel signals, each of which is a member of your labeled signal set. For every label definition, you can label members in one of five ways:

  • Bulk Manual Labeling — Manually label any or all members in bulk by specifying a label value and, when necessary, its location.

  • Interactive Manual Labeling — Interactively label only members with signals that are plotted by manually setting label values and drawing their location.

  • Interactive Member by Member Labeling — Interactively label one member at a time.

  • Autolabeling with Inspection — Automatically label only members with signals that are plotted using Auto-Label and Inspect Plotted. Inspect the labeling, debug the autolabeling function, modify parameters, edit labels, and save the labeling when it is satisfactory.

  • Bulk Autolabeling — Automatically label any or all members in bulk using Auto-Label All Signals.

Tip

Use Custom Labeling Functions for any autolabeling workflow, or see Label Signal Peaks Automatically Using Peak Labeler to learn how to autolabel signal peaks.

Track and Save Labeling Progress

Throughout the labeling process, you can use the Dashboard to track your progress. Use this mode to analyze the accuracy and quality of the label distributions in your labeled signal set. You can also save and resume your labeling in a separate Signal Labeler session by exporting your labeled signal set and importing it to a different session. For more information, see Import Signals from the MATLAB Workspace and Export Labeled Signal Sets. If the data source of your labeled signal set is a datastore that points to files, and you want to start a new labeling session on a different machine, use setAlternateFileSystemRoots to change the path to the files before importing the labeled signal set to the app.

Label Signals Manually

Bulk Manual Labeling

Sometimes an attribute applies to several members, or an event occurs at the same time for several signals in your data set. To label a set of signals quickly, first select the label definition you want to apply in the Label Definitions browser. On the Labeler tab, in the Set Value section, specify the value that you want to assign to the label. Click Label All in the Set Value section. In the dialog box:

  • Specify the members you want to label by selecting Select Members and then checking the boxes next to their names. To apply the label to all members in the labeled signal set, select All Members.

  • Edit the label value if necessary.

  • For region-of-interest (ROI) labels, specify the region endpoints using the Location (Min) and Location (Max) fields.

  • For point labels, specify the point location using the Location field.

Bulk manual labeling dialog box

This action is equivalent to using setLabelValue at the command line.

Note

Bulk manual labeling is not supported for sublabels.

Interactive Manual Labeling

To label one or more members interactively, first choose the signals that you want to plot by selecting the check boxes next to their names in the Labeled Signal Set Browser. Select the label definition you want to apply in the Label Definitions browser. Draw Labels is automatically activated when a signal and an ROI or point label are selected. Specify the label value in the Set Value section of the Labeler tab, or assign the value after the label is drawn. Click the time plot to add the label:

  • For ROI labels, a thick animated dashed line appears that expands into a shaded region when you click and drag. (The animated frame indicates that the region is active.) Move and resize the active region until it encloses the ROI.

  • For point labels, an animated dashed (active) line appears for the point being labeled. Move the active line until it crosses the signal at the point of your choice.

To accept a label, click the Accept check mark next to the Label button, press Enter, or double-click the active region or line. The app automatically accepts a label when the next label is drawn. A label is added to the member and applies to any channel within that member.

Tip

To improve label placement, you can go to the Display tab and choose a zoom action or activate the panner to change the plot axes. To inspect an active label, you can go to the Labeler tab and choose Zoom to Label. This action adjusts the range of the x-axis to match the time limits of the selected label. This is particularly helpful when viewing the spectrum or spectrogram of a region delineated by a label's limits.

For an example of interactive manual labeling, see Label Signal Attributes, Regions of Interest, and Points.

Edit Labels

To edit an existing signal label, you can do any of these:

  • In the Labeled Signal Set Browser, select the label, right-click, and select Edit. Input the new values in the dialog box.

  • To edit an attribute label, double-click in a cell of the label viewer attribute table.

  • To edit an ROI or point label, select the label in the Labeled Signal Set Browser, the time plot, or the label viewer. The chosen label is highlighted in all three regions and in the spectrogram. Click the label in the time plot, spectrogram, or label viewer to make it active. You can then edit its value and location. To accept the changes, click the Accept check mark next to the Label button, press Enter, or double-click.

Label viewer

This action is equivalent to using setLabelValue at the command line.

Note

  • You must select a parent label before you can label an ROI or point sublabel manually.

  • To label an attribute sublabel manually, use the Labeled Signal Set Browser or the label viewer.

Interactive Member by Member Labeling

To speed up labeling and quickly navigate through the members in your data set, use the options in the Member Navigation section of the toolstrip. By default, Signal Labeler by default plots the first channel for each member. If you prefer, you can plot all channels or select the channels you want to plot using the Channel Selector. In the Channel Selection dialog box, select the check box next to the signals you want plotted for each multichannel member. To navigate through members, click the arrow buttons.

Note

Typically, members in a data set to be labeled are homogeneous and have the same number of channels. If your data set contains members with a different number of channels, the Channel Selection window displays only as many channels as present in the member with the smallest number of channels.

To apply a label to plotted signals, proceed as described in Interactive Manual Labeling.

Tip

To quickly navigate through a signal, activate the panner and click the arrow buttons. You can adjust the width of the region of interest and advance the signal one axis width at a time.

To visualize the spectrum or spectrogram of a plotted signal, see Customize Labeling View. For more information about spectrogram options, see Spectrogram Computation in Signal Labeler.

Label Signals Automatically

Autolabeling with Inspection

To automatically label only members with signals that are plotted, first choose the signals that you want to plot by selecting the check boxes next to their names in the Labeled Signal Set Browser. Create a definition for the label you want to apply or select one from the Label Definitions browser. The Automate Value gallery shows the Custom Labeling Functions that you can use with the definition. Choose a function from the gallery, click Auto-Label, and select Auto-Label and Inspect Plotted. This action takes you to the Signal Labeler autolabeling mode.

Autolabeling mode

When in the autolabeling mode, you can run the selected function on the whole signal or run it within a time range of your choice.

Tip

The Run Time Limits section of the Autolabel tab shows the time range used by the autolabeling function and defaults to the entire signal. The range values change if you zoom in or specify values before running the autolabeling function. To reset the range to the entire signal, press the spacebar or click the Fit to View button on the Display tab.

After running the function, you can inspect the labeling results. If the results are not satisfactory, you can undo the labeling action, modify the autolabeling function, and label the signal again. You can edit label values and locations either on the time plot or on the label viewer. You can also remove labels, but if you remove labels you lose the ability to undo the previous labeling action. When you are satisfied with the results, click Save Labels to save the labeling and exit the autolabeling mode.

Note

For easier label inspection, the autolabeling mode displays only the labels generated during the current function call.

Bulk Autolabeling

To autolabel a set of signals using a labeling function, start by creating a signal label definition that you want to apply or by selecting one from the Label Definitions browser. The Automate Value gallery shows the Custom Labeling Functions that you can use with the definition. Choose a function from the gallery, click Auto-Label, and select Auto-Label Signals. Signal Labeler prompts you to select the members you want to label and specify any optional input arguments to the labeling function. For multichannel members, you must select only one signal to use for labeling.

For examples of autolabeling functions, see Custom Labeling Functions.

Bulk autolabeling dialog box

Note

You can undo the last automated custom labeling you performed. However, you lose this ability once you add, modify, or delete any labels or label definitions.

For examples of bulk autolabeling, see Automate Signal Labeling with Custom Functions and Label Spoken Words in Audio Signals.

Label Signal Peaks Automatically Using Peak Labeler

To autolabel signal peaks using Peak Labeler, start by selecting or creating a numeric point label definition. In the Automate Value gallery, select Peak Labeler and click Auto-Label. You can label peaks in bulk or interactively. Signal Labeler uses the MATLAB® functions islocalmax and islocalmin to find and label local maxima and minima. Peak Labeler returns the location of each peak and the numeric value of its amplitude.

Note

You can select multiple members for peak labeling, but you can label only one channel of each member at a time. By default, Signal Labeler chooses the first channel of each selected member, but you can select which signal of the member you want to use for labeling.

Peak Finder dialog box

Note

You can undo the last automated peak labeling action. However, you lose this ability once you add, modify, or delete any labels or label definitions.

  • You can choose to label all the peaks or valleys in the selected signal that satisfy the specified conditions. Alternatively, you can label a specific number of peaks or valleys that satisfy the specified conditions, sorted in order of descending prominence. For more information about peak prominence, see Prominence. Peak Labeler by default labels three peaks.

  • If a local maximum or minimum value is repeated consecutively, the peak or valley belongs to a flat region. For a signal with flat peak or valley regions, you can choose to label the center of the region, the first point of the region, the last point of the region, or all points in the region.

  • You can choose to label only those peaks or valleys with prominence larger than a specified value. You can also specify the width of the window centered on a peak or valley that is used to measure its prominence.

    • If you do not specify a window width, the Peak Labeler algorithm uses the entire signal as the window.

    • For a flat peak or valley region, the window is centered at the midpoint of the region.

  • You can select to label only those peaks separated by a specified distance. The Peak Labeler algorithm:

    1. Chooses the most prominent peak in the signal and ignores all peaks within the specified distance.

    2. Repeats the procedure for the most prominent remaining peak.

    3. Iterates until it runs out of peaks to consider.

Tip

If you label peaks in a signal using Peak Labeler and then move one of the labels, Signal Labeler still shows the amplitude value returned by Peak Labeler. To update the amplitude:

  1. Read the new value on the data cursor you used to move the point label.

  2. Edit the label.

  3. Enter the new value in the Value field of the dialog box that appears.

For an example that uses Peak Labeler, see Example: Label Points and Regions of Interest in Signal.

Label Bounded Regions Automatically Using Threshold Labeler

To autolabel signal regions using Threshold Labeler, first define a logical ROI label. With the label definition selected in the Label Definitions browser, select Threshold Labeler from the Automate Value gallery, and click Auto-Label. Signal Labeler uses sigrangebinmask to label the bounded regions given a threshold or range.

Threshold Labeler dialog box

You can specify the following parameters for the Threshold Labeler:

  • Bound — Specify the bound of the signal region to label as a scalar for a Threshold or a set of upper and lower bounds for Ranges.

  • Relationship — Select Above, Equal, or Below to label the signal regions that are greater than, equal to, or less than the threshold value, respectively. If you specify the Bound as Ranges, select Inside or Outside to label the regions that are inside of or outside of the specified intervals.

  • Interval Type — Select Closed to include the Bound in the range to label and Open to exclude the bound. This parameter does not apply if you specify Relationship as Equal. If you specified Ranges for the Bound, then you can also select Open Left to include only the upper bound in the labeled range, or select Open Right to include only the lower bound.

  • Minimum Length — Minimum length for signal regions within the target range or intervals.

For an example that uses Threshold Labeler, see Example: Label Points and Regions of Interest in Signal.

Label Regions in Audio Signals Automatically

To use the Speech Detector, Speech to Text, and Sound Classifier autolabeling functions, you must install Audio Toolbox™.

Speech Detector

To label speech regions using Speech Detector, first define a logical ROI label. With the label definition selected in the Label Definitions browser, select Speech Detector from the Automate Value gallery. Click Auto-Label and select Auto-Label All Signals. In the dialog box, select the signal(s) you want to label, specify these parameters, and then click OK.

  • Window Length — Length of analysis window in seconds.

  • Overlap Percent — Length of overlap between adjacent windows as a percentage of window length. You must specify a value in the range [0, 100).

  • Merge Distance — Merge distance between adjacent detected speech regions in seconds. If you specify Auto, the merge distance is equal to five times the window length.

Note

Speech Detector uses the detectSpeech (Audio Toolbox) function to detect speech segments in an audio signal.

Speech to Text

To label spoken words using Speech to Text, first define a string ROI label. With the label definition selected in the Label Definitions browser, select Speech to Text from the Automate Value gallery. Click Auto-Label and select Auto-Label All Signals. In the dialog box, select the signal(s) you want to label, specify these parameters, and then click OK.

  • Service Name — Speech service to use to transcribe audio signal. Select Amazon, Google, IBM, Microsoft, or wav2vec 2.0.

  • Options — Additional options for the selected cloud service. Specify options as comma-separated name-value arguments. For more information about options, refer to the documentation of the corresponding cloud service. This parameter does not apply if Service Name is wav2vec 2.0.

  • Segmentation — Option to segment and label words or sentences

Note

The wav2vec 2.0 transcriber requires Deep Learning Toolbox™ and downloading the pretrained model. The third-party cloud services require downloading the extended Audio Toolbox functionality from File Exchange. For more information, see speech2text (Audio Toolbox).

Sound Classifier

To label sounds using Sound Classifier, first define a string ROI label. With the label definition selected in the Label Definitions browser, select Sound Classifier from the Automate Value gallery. Click Auto-Label and select Auto-Label All Signals. In the dialog box, select the signal(s) you want to label, specify these parameters, and then click OK.

  • Probability Confidence Threshold — Threshold for reporting sounds. Specify a value in the range (0,1).

  • Minimum Sound Separation — Minimum separation between consecutive regions of the same detected sound in seconds. Regions closer than the minimum sound separation are merged.

  • Minimum Sound Duration — Minimum duration of detected sound regions in seconds. Regions shorter than the minimum sound duration are discarded.

  • Specificity of Sound Classes — The specificity of the reported sound classes. Select High, Low, or None.

    • High — Use specific sound classes as labels instead of general categories.

    • Low — Use the most general categories as labels instead of specific sound classes.

    • None — Use the most likely label for a sound, regardless of its specificity.

  • Include or Exclude Sounds — Option to specify which sound classes to include or exclude when classifying. Select Include All Sounds, Include Specified Sounds, or Exclude Specified Sounds. For Include Specified Sounds and Exclude Specified Sounds:

    • Select Select Sound Classes from Tree to choose the classes from a tree representing the AudioSet ontology.

    • Select Type Sound Classes to enter each class on a new line in a text box.

    For more information about the AudioSet ontology and the classes supported by the YAMNet classifier, see yamnetGraph (Audio Toolbox).

Note

Sound Classifier uses the classifySound (Audio Toolbox) function to classify sounds in an audio signal. This functionality requires Deep Learning Toolbox and downloading the pretrained YAMNet model. For more information about downloading the pretrained model, see Download YAMNet (Audio Toolbox).

See Also

Apps

Functions

Related Examples

More About