mlcommons / croissant

Croissant is a high-level format for machine learning datasets that brings together four rich layers.
https://mlcommons.org/croissant
Apache License 2.0
346 stars 38 forks source link

[NeurIPS]How to define (jpg, json) pairs #676

Open MehreenMehreen opened 1 month ago

MehreenMehreen commented 1 month ago

This is a basic question. I have images (jpg files) and an image's annotation in a json file. Both files share a common name, e.g., cat.jpg and cat.json.

How do I define this pairing in Croissant? Help would be appreciated.

benjelloun commented 1 month ago

Hi Mehreen,

If I understand your example correctly, you need to create two FileSets, one for images and one for annotations. Each of those would come from a separate archive fileObject (or different subdirectories).

You can then define a RecordSet with an "id" property for each one of them that extracts "cat" from the filename (similar to the hash property in the PASS dataset:

https://github.com/mlcommons/croissant/blob/0f95e04763557929e4f4c6711c108c0d9cf7b818/datasets/1.0/pass/metadata.json#L212

You can then join the two recordSets on their "id" properties.

Hope this helps, Omar