IdxFileLoader 1.1.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package IdxFileLoader --version 1.1.0                
NuGet\Install-Package IdxFileLoader -Version 1.1.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="IdxFileLoader" Version="1.1.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add IdxFileLoader --version 1.1.0                
#r "nuget: IdxFileLoader, 1.1.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install IdxFileLoader as a Cake Addin
#addin nuget:?package=IdxFileLoader&version=1.1.0

// Install IdxFileLoader as a Cake Tool
#tool nuget:?package=IdxFileLoader&version=1.1.0                

IdxFileLoader

Loading idx files in .NET from datasets like MNIST.

Samples

One example for loading idx files and retrieving the images and labels is in the samples subfolder.

Load first image to 2-D byte buffer:

await using var idxImageFile = await IdxImageFile.LoadAsync("./train-images.idx3-ubyte");
var buffer = await idxImageFile.ReadImageBufferAsync();

Load first label as byte value:

await using var idxLabelFile = await IdxLabelFile.LoadAsync("./train-labels.idx1-ubyte");
var label = await idxLabelFile.ReadLabelAsync();

Open GZip files directly is also possible:

await using var idxImageFile = await IdxImageFile.LoadAsync(
    new GZipStream(File.OpenRead("./train-images-idx3-ubyte.gz"), CompressionMode.Decompress));
await using var idxLabelFile = await IdxLabelFile.LoadAsync(
    new GZipStream(File.OpenRead("./train-labels-idx1-ubyte.gz"), CompressionMode.Decompress));

Console.WriteLine($"Image Count: {idxImageFile.ImageCount}");
Console.WriteLine($"Label Count: {idxLabelFile.LabelCount}");
Product Compatible and additional computed target framework versions.
.NET net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.0.0 89 8/5/2024
1.1.0 210 8/4/2023
1.0.0 168 6/21/2023