Model Deployment
Deploying an Audio model
Choose a target device and precision, and build a package that runs your Audio model outside Studio.
Try it in StudioOn this page
Goal
By the end of this page you will have downloaded a deployment package for your trained Audio model.
Steps
- Open Deployment in the left menu.
- Under Target Device, choose where the model will run:
- Generic tf lite: a cross-platform TensorFlow Lite package (.pe) for any computer that runs Python.
- Raspberry Pi: a .pxe package for a Raspberry Pi.
- Arduino UNO Q: a .pxe package for the Linux side of an Arduino UNO Q.
- Under Precision, choose Unoptimized (float32) or Quantized (int8). Studio marks the precision it Recommended and shows how each one scored. See Choosing Float32 or INT8.
- Check the estimates for flash (model size), RAM and latency. Some values are estimates; the page says when a value is not measured on hardware.
- Select Build Deployment Package. The build appears in Build history with its status.
- When the build is ready, select Download Latest Build.
Which package for which model
| Your processing block | Generic tf lite (.pe) | Raspberry Pi / Arduino UNO Q (.pxe) |
|---|---|---|
| MFCC | ✓ | ✓ |
| Spectrogram | ✓ | ✓ |
| Raw Data | ✓ | ✓ |
| Audio (MFE) | ✓ | Use Generic tf lite |
The .pxe packages compute the features on the device, and they support the MFCC, Spectrogram and Raw Data processing blocks. For a model that uses Audio (MFE), build the Generic tf lite package.
Studio builds these packages. Whether each one has been tested on a real device is shown in the Hardware section.
What is inside the Generic tf lite package
| File | Contents |
|---|---|
model.tflite | The trained model, in the precision you chose |
labels.txt | Your labels, in the model's output order |
dsp_config.json | The processing block and its settings |
manifest.json | Input shape, labels and other details the runtime needs |
inference.py | Python code that loads the model and runs it on features |
The .pe package expects features, not raw sound. Your program records 1 second of audio, computes the features with the same settings as in dsp_config.json (for example MFE with 40 filters), and passes them to inference.py. The output is one score per label.
Result
You have a package file for your model, ready to copy to your device.
Tips
- Deploy the model you tested. If you retrain, build a new package.
- Pick INT8 for small devices when its score is close to Float32; it is about four times smaller.
- Make sure the device records audio at the same Frequency (Hz) as your impulse (16000 for audio recorded in Studio).