A data source for an image classifier.
- macOS 10.14+
- Xcode 10.0+
- Create ML
Use a data source to provide training or testing data to an image classifier.
To train a model programmatically with an
MLImage instance, initialize a data source with the URL of the directory that contains the data. Use either
MLImage to do this, depending on whether your images are grouped by directory or by file name. See the respective creation methods for details about how to arrange your image files in each case.
When you train a model using
MLImage, you don’t initialize a data source directly. Instead, you drag the directory containing your data from a Finder window into the live view. The builder automatically chooses the correct kind of data source based on how your images are arranged inside that directory, looking for either labeled directories or labeled files.