LogoLogo
HomeDocsAPIProjectsForum
  • Getting Started
    • For beginners
    • For ML practitioners
    • For embedded engineers
  • Frequently asked questions
  • Tutorials
    • End-to-end tutorials
      • Continuous motion recognition
      • Responding to your voice
      • Recognize sounds from audio
      • Adding sight to your sensors
        • Collecting image data from the Studio
        • Collecting image data with your mobile phone
        • Collecting image data with the OpenMV Cam H7 Plus
      • Object detection
        • Detect objects using MobileNet SSD
        • Detect objects with FOMO
      • Sensor fusion
      • Sensor fusion using Embeddings
      • Processing PPG input with HR/HRV Features Block
      • Industrial Anomaly Detection on Arduino® Opta® PLC
    • Advanced inferencing
      • Continuous audio sampling
      • Multi-impulse
      • Count objects using FOMO
    • API examples
      • Running jobs using the API
      • Python API Bindings Example
      • Customize the EON Tuner
      • Ingest multi-labeled data using the API
      • Trigger connected board data sampling
    • ML & data engineering
      • EI Python SDK
        • Using the Edge Impulse Python SDK with TensorFlow and Keras
        • Using the Edge Impulse Python SDK to run EON Tuner
        • Using the Edge Impulse Python SDK with Hugging Face
        • Using the Edge Impulse Python SDK with Weights & Biases
        • Using the Edge Impulse Python SDK with SageMaker Studio
        • Using the Edge Impulse Python SDK to upload and download data
      • Label image data using GPT-4o
      • Label audio data using your existing models
      • Generate synthetic datasets
        • Generate image datasets using Dall·E
        • Generate keyword spotting datasets
        • Generate physics simulation datasets
        • Generate audio datasets using Eleven Labs
      • FOMO self-attention
    • Lifecycle Management
      • CI/CD with GitHub Actions
      • OTA Model Updates
        • with Nordic Thingy53 and the Edge Impulse APP
      • Data Aquisition from S3 Object Store - Golioth on AI
    • Expert network projects
  • Edge Impulse Studio
    • Organization hub
      • Users
      • Data campaigns
      • Data
      • Data transformation
      • Upload portals
      • Custom blocks
        • Transformation blocks
        • Deployment blocks
          • Deployment metadata spec
      • Health Reference Design
        • Synchronizing clinical data with a bucket
        • Validating clinical data
        • Querying clinical data
        • Transforming clinical data
        • Buildling data pipelines
    • Project dashboard
      • Select AI Hardware
    • Devices
    • Data acquisition
      • Uploader
      • Data explorer
      • Data sources
      • Synthetic data
      • Labeling queue
      • AI labeling
      • CSV Wizard (Time-series)
      • Multi-label (Time-series)
      • Tabular data (Pre-processed & Non-time-series)
      • Metadata
      • Auto-labeler [Deprecated]
    • Impulse design & Experiments
    • Bring your own model (BYOM)
    • Processing blocks
      • Raw data
      • Flatten
      • Image
      • Spectral features
      • Spectrogram
      • Audio MFE
      • Audio MFCC
      • Audio Syntiant
      • IMU Syntiant
      • HR/HRV features
      • Building custom processing blocks
        • Hosting custom DSP blocks
      • Feature explorer
    • Learning blocks
      • Classification (Keras)
      • Anomaly detection (K-means)
      • Anomaly detection (GMM)
      • Visual anomaly detection (FOMO-AD)
      • Regression (Keras)
      • Transfer learning (Images)
      • Transfer learning (Keyword Spotting)
      • Object detection (Images)
        • MobileNetV2 SSD FPN
        • FOMO: Object detection for constrained devices
      • NVIDIA TAO (Object detection & Images)
      • Classical ML
      • Community learn blocks
      • Expert Mode
      • Custom learning blocks
    • EON Tuner
      • Search space
    • Retrain model
    • Live classification
    • Model testing
    • Performance calibration
    • Deployment
      • EON Compiler
      • Custom deployment blocks
    • Versioning
  • Tools
    • API and SDK references
    • Edge Impulse CLI
      • Installation
      • Serial daemon
      • Uploader
      • Data forwarder
      • Impulse runner
      • Blocks
      • Himax flash tool
    • Edge Impulse for Linux
      • Linux Node.js SDK
      • Linux Go SDK
      • Linux C++ SDK
      • Linux Python SDK
      • Flex delegates
    • Edge Impulse Python SDK
  • Run inference
    • C++ library
      • As a generic C++ library
      • On your desktop computer
      • On your Zephyr-based Nordic Semiconductor development board
    • Linux EIM Executable
    • WebAssembly
      • Through WebAssembly (Node.js)
      • Through WebAssembly (browser)
    • Docker container
    • Edge Impulse firmwares
  • Edge AI Hardware
    • Overview
    • MCU
      • Nordic Semi nRF52840 DK
      • Nordic Semi nRF5340 DK
      • Nordic Semi nRF9160 DK
      • Nordic Semi nRF9161 DK
      • Nordic Semi nRF9151 DK
      • Nordic Semi nRF7002 DK
      • Nordic Semi Thingy:53
      • Nordic Semi Thingy:91
    • CPU
      • macOS
      • Linux x86_64
    • Mobile Phone
    • Porting Guide
  • Integrations
    • Arduino Machine Learning Tools
    • NVIDIA Omniverse
    • Embedded IDEs - Open-CMSIS
    • Scailable
    • Weights & Biases
  • Pre-built datasets
    • Continuous gestures
    • Running faucet
    • Keyword spotting
    • LiteRT (Tensorflow Lite) reference models
  • Tips & Tricks
    • Increasing model performance
    • Data augmentation
    • Inference performance metrics
    • Optimize compute time
    • Adding parameters to custom blocks
    • Combine Impulses
  • Concepts
    • Glossary
    • Data Engineering
      • Audio Feature Extraction
      • Motion Feature Extraction
    • ML Concepts
      • Neural Networks
        • Layers
        • Activation Functions
        • Loss Functions
        • Optimizers
          • Learned Optimizer (VeLO)
        • Epochs
      • Evaluation Metrics
    • Edge AI
      • Introduction to edge AI
      • What is edge computing?
      • What is machine learning (ML)?
      • What is edge AI?
      • How to choose an edge AI device
      • Edge AI lifecycle
      • What is edge MLOps?
      • What is Edge Impulse?
      • Case study: Izoelektro smart grid monitoring
      • Test and certification
    • What is embedded ML, anyway?
    • What is edge machine learning (edge ML)?
Powered by GitBook
On this page
  • What is data augmentation?
  • Enabling data augmentation
  • Workflow for using data augmentation
  • Data augmentation and deployment
  1. Tips & Tricks

Data augmentation

PreviousIncreasing model performanceNextInference performance metrics

Last updated 1 year ago

What is data augmentation?

Data augmentation is a method that can help improve the accuracy of machine learning models. A data augmentation system makes small, random changes to your training data during the training process.

Being exposed to these variations during training can help prevent your model from taking shortcuts by "memorizing" superficial clues in your training data, meaning it may better reflect the deep underlying patterns in your dataset.

Data augmentation will not work with every dataset

As with most things in machine learning, data augmentation is effective for some datasets and models but not for others. While experimenting with data augmentation, bear in mind that it is not guaranteed to provide results. Data augmentation is likely to make the biggest difference when used with small datasets. Large datasets may already contain enough variation that the model is able to identify the true underlying patterns and avoid overfitting to the training data.

Enabling data augmentation

Edge Impulse provides easy to use data augmentation options for several types of data. It is currently available for audio spectrogram data (generated by the MFCC and MFE blocks) and image data when used with Transfer Learning blocks.

If data augmentation is available for the data type you are working with, you can enable it via a checkbox in the Neural Network block. For example, here are the data augmentation options for audio data:

Workflow for using data augmentation

Here is a step-by-step guide to making the most out of the data augmentation features in Edge Impulse.

1. Train a Neural Network block without data augmentation

As mentioned above, there's no guarantee that data augmentation will improve the performance of your model. Before you start experimenting, it's important to train a model without data augmentation. You can use this model's performance as a baseline to understand whether data augmentation improves your model.

First up, create a Neural Network block, and then try to get the best possible performance from your model without enabling augmentation.

2. Train a second Neural Network block with the same settings

It's helpful to be able to compare both models side by side. To allow this, create a second neural network block with the same settings as the first.

3. Enable data augmentation

In your new Neural Network block, check the Data augmentation checkbox. If there are options, leave the defaults in place.

4. Increase the number of training cycles

Often, the beneficial effects of data augmentation are only seen after training a network for longer. Increase the number of training cycles your network trains for. A good rule of thumb might be to double the number of training cycles compared to your baseline model. You can look at the training output after your first run to determine if the model still seems to be improving and can be trained longer.

📘 A note on training cycles During training, Edge Impulse automatically saves the model with the best loss score. This means you can train a model for as many training cycles as you like and you will always end up with the best possible version.

5. Compare and iterate

Now that you've trained a model with data augmentation, compare it to your baseline model by checking the numbers in the Neural Network block. If it's more accurate or has a lower loss value, augmentation was successful.

Whether it was successful or not, you may be able to find settings that work better. If available, you can try other combinations of data augmentation options. You can also try adjusting the architecture of your model. Since data augmentation can help prevent overfitting, you may be able to improve accuracy by increasing the size of your model while applying augmentation.

6. Check the models using your test dataset

Once you have a couple of model variants, you can use the Analyze optimizations tool on the Deployment tab to apply them to your test dataset and examine them side by side. In the following example, the model with data augmentation was >4% more accurate on the test dataset:

📘 Hidden benefits You might find that a model trained with data augmentation performs better on your test dataset even if its accuracy during training is similar, so it's always worth checking your models against test data.

It's also worth comparing the confusion matrices for each model. Data augmentation may affect your model's performance on different labels in different ways. For example, precision may improve for one pair of classes but be reduced for another.

Once you've compared models and found the one that works best, delete the others from your Impulse before deploying.

📘 Versioning You can use Edge Impulse's Versioning feature to save the state of your Impulse at this point, so that you can restore it if you wish to perform more experimentation. You can find it in the Versioning tab in the left menu.

Data augmentation and deployment

Data augmentation occurs only during training. It will have no impact on the memory usage or latency of your model once it has been deployed.

An example of data augmentation options for an audio classification model.
A performance comparison between models trained both with and without data augmentation.