Image dataset best practices?

segments-bert
Wed, 16 Feb 2022 15:16:03 +0000

Hey @mariosasko , this is great! Before, I used the dataset.map() approach described in the blogpost mentioned by @nielsr. Now I can skip that and just push to the hub like this:

features = datasets.Features({
    'name': datasets.Value('string'),
    'image': datasets.Image(),
})

dataset_dict = {
    'name': ['cat.jpg'],
    'image': ['cat.jpg']
}

dataset = datasets.Dataset.from_dict(dataset_dict, features)
dataset.push_to_hub('segments-bert/image-upload-test')

A few additional questions:

There is no difference between the dataset.map() approach and this approach, in how the images end up in the parquet files, right?

Do I understand correctly that the image bytes are stored in decoded form in the parquet files, i.e. not in their original .jpg or .png format? I assume so, given this comment by @lhoestq .

Would it make sense to add a generic “File” feature, besides the existing Image and Audio features? I’m asking because our data labeling platform also supports video and point cloud labeling, for which the data comes in a variety of file formats (.pcd, .bin, .mp4, …). Would be nice to push such datasets to the hub as well.