I pondered this question for a long time and went with ProtocolBuffer to store metadata for my images. For each image, for example. Image00012.jpg, I store the metadata in Image00012.jpg.pbmd. When I have my .proto version of the file installed, the Python class and the C ++ class are automatically generated. It works very well and requires me to spend some time parsing (obviously better than writing a custom reader for YAML files).
RestRisiko raises a good question about how I should handle metadata inaccessible. The good thing about ProtocolBuffer is that it supports optional / required fields. This solves my problem on this front.
The reason I think XML and INI are not suitable for this purpose is because many of my metadata are complex (color distribution, ...) and require some storage setup. ProtocolBuffer allows me to write a proto declaration. In addition, the metadata file size and parsing speed are clearly superior to my manual reading / writing of XML.
source share