Results and deployment
Inference and edge deployment
How a trained model runs on a small device, and what Float32 and INT8 mean.
On this page
The idea in one minute
Inference is using a trained model on new data. Deployment is putting the model onto the device that will run it. On the edge that device is small: a single-board computer such as a Raspberry Pi, or a board such as the Arduino UNO Q.
Small devices have limited memory and processing power, so three things matter:
| What | Meaning | Why it matters |
|---|---|---|
| Model size | How much storage the model file needs | It must fit on the device |
| Memory (RAM) | How much working memory inference needs | Too much and the device can't run it |
| Latency | How long one prediction takes | Too slow and you miss events |
Float32 and INT8
A model's weights are numbers. PetalEdge saves every trained model in two forms:
| Precision | Each weight uses | Size | Speed | Accuracy |
|---|---|---|---|---|
| Float32 | 32-bit decimal number | Largest | Slower | The original |
| INT8 | 8-bit whole number | About 4 times smaller | Usually faster | Usually close to Float32, sometimes a little lower |
Turning Float32 into INT8 is called quantization. PetalEdge runs some of your training data through the model to choose the best INT8 scale.
A simple example
A Motion model has 58,000 weights.
- Float32: 58,000 × 4 bytes ≈ 232 KB.
- INT8: 58,000 × 1 byte ≈ 58 KB.
If the INT8 version scores 94 % and Float32 scores 95 %, INT8 is a good trade: a quarter of the size for one point of accuracy.
What happens on the device
- 1New dataImage, sensor window or sound
- 2PrepareSame processing as in training
- 3ModelRuns the neural network
- 4ResultLabel, number or objects
The data must be prepared exactly as it was during training (same window size, frequency or image size). Otherwise the model sees something it was never trained on.