Skip to content

Torchvision bounding boxes do not match the images, becuase the bboxes are from the pre-cropped, pre-resized version. #9008

@yaoshiang

Description

@yaoshiang

🐛 Describe the bug

CelebA bounding boxes were calculated on the so called "in-the-wild" images, prior to cropping and resizing. But torchvision.datasets returns the version that is cropped to 178x218. So for example, on the ninth image, the bbox is outside the image size.

CODE TO REPRO

from torchvision import datasets

celeba = datasets.CelebA(root="./celeba", target_type="bbox", download=True, split="train")

print(celeba[8])

(<PIL.JpegImagePlugin.JpegImageFile image mode=RGB size=178x218>,
tensor([600, 274, 343, 475]))

Versions

collect_env.py crashed on me but here's the version:

Using Python 3.12.8 environment at: XXX
Name: torchvision
Version: 0.21.0
Location: XXX
Requires: numpy, pillow, torch
Required-by:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions