This package is now used for loading training files of THE MNIST DATABASE
The testing data are take from here
First include the package in your Swift package, then import IDX
in the files where you want to use it.
import IDX
To load a IDX file, juste create a IDX
object,
let file = try Data(contentsOf: <#T##URL#>)
let dataset = try IDX(file)
The initializer will parse the file and extract data information from it, then will verify the data length.
To get the number of data check the count
property.
To access a vector, matrice or image data use the subscript.
// Access the first image in the data set
let image = dataset[0]
If you ever want to get the file raw data use the
data
property
If you find a bug or would like a particuliar feature open a isssue. Pull request are more than accepted.
You can use the project for commercial purposes, but you're not allowed to sell it as is. I will not be responsible for any of your usage of this package.