---
title: MLObjectDetector.DataSource
framework: createml
role: symbol
role_heading: Enumeration
path: createml/mlobjectdetector/datasource
---

# MLObjectDetector.DataSource

A data source for an object detector.

## Declaration

```swift
enum DataSource
```

## Overview

Overview You use a data source to specify the training dataset for an MLObjectDetector training session. An object-detector data source represents a set of images and an annotation for each object in an image. Each object annotation consists of the object’s name, or label, and its location in the image. A single image can have multiple objects and, therefore, multiple annotations. For example, you can train an object detector with images of dining tables, along with annotations for bananas, croissants, and beverages. Each image can have one or more instances of an object, or any combination of objects.

## Topics

### Creating a data source

- [MLObjectDetector.DataSource.directoryWithImagesAndJsonAnnotation(at:)](createml/mlobjectdetector/datasource/directorywithimagesandjsonannotation(at:).md)
- [MLObjectDetector.DataSource.directoryWithImages(at:annotationFile:)](createml/mlobjectdetector/datasource/directorywithimages(at:annotationfile:).md)
- [MLObjectDetector.DataSource.table(_:imageColumn:annotationColumn:)](createml/mlobjectdetector/datasource/table(_:imagecolumn:annotationcolumn:).md)

### Getting the annotated file names

- [gatherAnnotatedFileNames()](createml/mlobjectdetector/datasource/gatherannotatedfilenames().md)

### Getting the data frame

- [MLObjectDetector.DataSource.frame(_:imageColumn:annotationColumn:)](createml/mlobjectdetector/datasource/frame(_:imagecolumn:annotationcolumn:).md)

### Retrieving the data

- [imagesWithObjectAnnotations()](createml/mlobjectdetector/datasource/imageswithobjectannotations().md)

### Splitting the data

- [stratifiedSplit(proportions:seed:annotationColumn:)](createml/mlobjectdetector/datasource/stratifiedsplit(proportions:seed:annotationcolumn:).md)

## See Also

### Supporting types

- [MLObjectDetector.AnnotationType](createml/mlobjectdetector/annotationtype.md)
- [MLObjectDetector.ModelParameters](createml/mlobjectdetector/modelparameters-swift.struct.md)
