Skip to content

Data and training

Preparing a good dataset

The data you collect matters more than any setting. Here is how to collect data a model can learn from.

On this page

The idea in one minute

A model can only learn what your examples show it. A good dataset has:

  1. Enough examples of every label.
  2. Balanced labels: roughly the same number of examples for each one.
  3. Correct labels: every example has the right name.
  4. Variety: different people, places, lighting, devices and background noise.
  5. The real conditions: data recorded the same way the device will see it later.

Checklist

CheckWhy it mattersTip
Enough examplesToo few and the model guessesStart with 20–50 per label, add more if results are poor
Balanced labelsThe model favours the label it sees mostIf one label has 200 examples and another 20, record more of the small one
A "nothing" labelTeaches the model what to ignoreidle for Motion, noise for Audio, background images for Image
Clean labelsOne wrong label teaches the wrong thingCheck a few random samples per label
VarietyThe model must work outside your deskRecord different people and places
Same sensor and settingsA model trained on one sampling rate may fail on anotherKeep the same device and frequency throughout

A simple example

You want to recognise three gestures. Your first dataset:

LabelRecordingsProblem
wave40–
circle38–
idle6Far too few

The model will rarely predict idle, so it will call every small movement a gesture. Record about 30 more idle recordings, including small natural movements like typing or scratching, and train again.

Labels in PetalEdge

  • Image: you draw a box around every object and give it a label.
  • Motion: each recording gets one label. By default the label is the text before the first . in the file name, so wave.01.csv becomes wave.
  • Audio: each clip gets a label when you upload or record it.

Where you use this in PetalEdge