voxel51 / fiftyone

Refine high-quality datasets and visual AI models
https://fiftyone.ai
Apache License 2.0
8.72k stars 550 forks source link

[BUG] Square aspect in tiling for grouped datasets #3070

Closed clane9 closed 1 year ago

clane9 commented 1 year ago

System information

Describe the problem

I'm creating a grouped dataset containing images and videos with wide aspects. I noticed that for grouped datasets, the aspect in the tiling view is fixed to be square. Whereas in standard datasets, the native image aspect is used for each tile. Ideally, I would like to see the native aspect used by default for all images and groups.

Thanks in advance! Fiftyone is a great tool btw I love it.

Code to reproduce issue

from pathlib import Path

import fiftyone as fo
import numpy as np
from PIL import Image

dataset = fo.Dataset("aspect_test", persistent=True, overwrite=True)
# Remove group to see correct images
dataset.add_group_field("group", default="img")

img_dir = Path("aspect_test_images")
img_dir.mkdir(exist_ok=True)

samples = []
for ii in range(10):
    group = fo.Group()
    img = Image.fromarray((np.ones((50, 200, 3)) * [255, 0, 0]).astype("uint8"))
    img_path = img_dir / f"img_{ii:02d}.png"
    img.save(img_path)
    sample = fo.Sample(filepath=img_path, group=group.element("img"))
    samples.append(sample)

dataset.add_samples(samples)

Other info/logs

Example with group:

Screen Shot 2023-05-17 at 3 38 50 PM

Example without group:

Screen Shot 2023-05-17 at 3 39 36 PM

What areas of FiftyOne does this bug affect?

Willingness to contribute

The FiftyOne Community encourages bug fix contributions. Would you or another member of your organization be willing to contribute a fix for this bug to the FiftyOne codebase?

benjaminpkane commented 1 year ago

This will be fixed in the next release. Stay tuned!

clane9 commented 1 year ago

That's great! Will be looking out for it. Closing the issue.