Skip to content

OPF File Format

Gustavo Rosa edited this page Apr 20, 2021 · 10 revisions

LibOPF

The original LibOPF file format can be depicted as following:

<# of samples> <# of labels> <# of features>
<0> <label> <feature 1 from sample 0> <feature 2 from sample 0> ...
<1> <label> <feature 1 from sample 1> <feature 2 from sample 1> ...
.
.
.
<n-1> <label> <feature 1 from sample n-1> <feature 2 from sample n-1> ... 

Note that the file must be binary with no blank spaces (ASCII representation just for illustration). Additionally, note that LibOPF labels starts from 1 instead of 0.

OPFython

In OPFython, we almost adopt the same file format as LibOPF. For the sake of easiness, we do not include the header line (# samples, # classes, and # features) and we load files from the following extensions: .txt, .csv and .json, instead of the binary format.

Additionally, please note that we index labels within [0, n-1] instead of [1, n]. Nevertheless, our conversion package utils/converter already performs such an indexing when converting LibOPF files to our extensions.