pytorch / pytorch/vision

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

Open
#9,008 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
17.9k
Forks
7.3k
Avg merge
1d 15h
Merged PRs (30d)
13

Description

🐛 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:

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the datasets.CelebA entry point and inspect how the stored bounding-box metadata relates to the cropped and resized image returned by celeba[8]. Reproduce the ninth-image example, then verify that the returned coordinates describe the object within the 178x218 image and add or update coverage for this case.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
computer-vision
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.