--- language: - id - sw - ta - tr - zh - en license: cc-by-4.0 size_categories: - 1K English translation of the `hypothesis` created using Bing Translate * `left_img` --> PIL Image * `right_img`--> PIL Image * `resized_left_img` --> PIL Image resized * `resized_right_img` --> PIL Image resized * `vertically_stacked_img` --> PIL image that contains the left and right resized images stacked vertically with a black gutter of `10px` * `horizontally_stacked_img` --> PIL image that contains the left and right resized images stacked horizontally with a black gutter of `10px` The images were resized using [`img2dataset`](https://github.com/rom1504/img2dataset/blob/main/img2dataset/resizer.py):
Show code snippet ```python Resizer( image_size=640, resize_mode=ResizeMode.keep_ratio, resize_only_if_bigger=True, ) ```
### How to read the images Due to a [bug](https://github.com/huggingface/datasets/issues/4796), the images cannot be stored as PIL.Image.Images directly but need to be converted to dataset.Images-. Hence, to load them, this additional step is required: ```python from datasets import Image, load_dataset ds = load_dataset("floschne/marvl", split="sw") ds.map( lambda sample: { "left_img_t": [Image().decode_example(img) for img in sample["left_img"]], "right_img_t": [Image().decode_example(img) for img in sample["right_img"]], "resized_left_img_t": [ Image().decode_example(img) for img in sample["resized_left_img"] ], "resized_right_img_t": [ Image().decode_example(img) for img in sample["resized_right_img"] ], "vertically_stacked_img_t": [ Image().decode_example(img) for img in sample["vertically_stacked_img"] ], "horizontally_stacked_img_t": [ Image().decode_example(img) for img in sample["horizontally_stacked_img"] ], }, remove_columns=[ "left_img", "right_img", "resized_left_img", "resized_right_img", "vertically_stacked_img", "horizontally_stacked_img", ], ).rename_columns( { "left_img_t": "left_img", "right_img_t": "right_img", "resized_left_img_t": "resized_left_img", "resized_right_img_t": "resized_right_img", "vertically_stacked_img_t": "vertically_stacked_img", "horizontally_stacked_img_t": "horizontally_stacked_img", } ) ```