davidrmiller / neural2d

Neural net optimized for 2D image data
MIT License
142 stars 69 forks source link

Proposal: path_prefix directive in input data config file #19

Closed davidrmiller closed 9 years ago

davidrmiller commented 9 years ago

This is a proposal to modify the input data configuration file parser to look for lines that begin with:

 path_prefix =

Everything after the equals sign, except leading and trailing whitespace, will be prepended to the front of all subsequent image filenames, or until the next path_prefix directive.

This would allow us to simplify an input data config file from this:

../images/digits/test-1.bmp -1 -1 -1 -1 -1 1 -1 -1 -1 -1
../images/digits/test-2.bmp -1 -1 -1 -1 1 -1 -1 -1 -1 -1
../images/digits/test-3.bmp -1 -1 -1 -1 1 -1 -1 -1 -1 -1
. . .

to this:

path_prefix = ../images/digits/
test-1.bmp -1 -1 -1 -1 -1 1 -1 -1 -1 -1
test-2.bmp -1 -1 -1 -1 1 -1 -1 -1 -1 -1 
test-3.bmp -1 -1 -1 -1 1 -1 -1 -1 -1 -1 
. . .

Details

Initially the path prefix is a null string. Each time the path_prefix directive is encountered, the new prefix replaces the old one. If there is nothing after the equals sign or nothing besides whitepace, the prefix string is reset to null. To keep this modification as simple as possible, the prefix string cannot contain embedded spaces. Whitespace is optional between path_prefix and the equals sign.