Skip to content

.dat input file format

David R. Miller edited this page Jul 2, 2015 · 2 revisions

The .dat file format allows direct input of single or double precision floating point values into the neural net.

The .dat file format is specific to neural2d. The file begins with a header as shown below. Binary floating point data starts at the file offset specified by offsetToData. The header fields and floating point data are stored in big-endian byte order.

struct datHeader
{
    uint32_t magic;             // 0x6c89f6ad
    uint32_t width;             // >= 1
    uint32_t height;            // >= 1
    uint32_t numChannels;       // >= 1
    uint32_t bytesPerElement;   // 4 (single) or 8 (double) precision
    uint32_t offsetToData;      // >= sizeof(datHeader)
};

The offsetToData field allows the user to extend the header to allow space for storing any kind of user-defined information. Neural2d ignores this space.

Starting at the file offset specified by offsetToData, the input data is stored in binary form, big-endian, four (single precision) or eight (double precision) bytes per item, in row-major order. The total file size = offsetToData + numChannels * width * height * bytesPerElement.

Clone this wiki locally