Set "image" column type to image instead

#2
by lhoestq HF staff - opened

Congrats on releasing this dataset ! I believe it can be quite impactful for the research community :)

Just opening this PR to set the correct type for the "image" column, this will show the images in the Dataset Viewer and directly get you PIL Images in python:

In [1]: from datasets import load_dataset

In [2]: ds = load_dataset("huanqia/MM-IQ", streaming=True, split="test", revision="refs/pr/2")
README.md: 100%|██████████████████| 6.94k/6.94k [00:00<00:00, 9.10MB/s]

In [3]: next(iter(ds))
Out[3]: 
{'category': 'Temporal Movement',
 'question': 'Choose the most appropriate option from the four given choices to fill in the question mark, so that it presents a certain regularity:',
 'question_en': 'Choose the most appropriate option from the four given choices to fill in the question mark, so that it presents a certain regularity:',
 'question_zh': '从所给四个选项中,选择最合适的一个填入问号处,使之呈现一定的规律性:',
 'image': <PIL.PngImagePlugin.PngImageFile image mode=RGB size=435x486>,
 'MD5': '6ac21bde690fbc63ac30fc509a841225',
 'data_id': 0,
 'answer': 'B',
 'split': 'test'}
huanqia changed pull request status to merged

Thank you for your kind suggestion. I have merged your request.

here is the documentation on Pandas + images btw, if you want to create parquet files with the "image" type directly :)

https://huggingface.co/docs/hub/en/datasets-pandas#image-methods-and-parquet
https://github.com/lhoestq/pandas-image-methods

here is the documentation on Pandas + images btw, if you want to create parquet files with the "image" type directly :)

https://huggingface.co/docs/hub/en/datasets-pandas#image-methods-and-parquet
https://github.com/lhoestq/pandas-image-methods

Thank you.

Sign up or log in to comment