Updated February 8, 2021

Some AI datasets have directories where each directory represents a class. A particular directory can contain a large number of files. Because of time and memory constrains you may want to train your model using a smaller number of files.

We detail how to move the first n files from a directory into a new directory.
This is done for each directory (class) in the dataset.

We also show how to get a random sample of n items from a directory.

Example — The keywords Dataset

The dataset “keywords” can be downloaded from:

I created a folder, “Dataset” on my…

Ron Mourant

TinyML, AI, Edge Impulse, Arduino, Raspberry Pi, Pickleball

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store