pytorch / pytorch/vision

`CocoDetection()` doesn't work using some train and validation images with some annotations

Open
#8,845 1 comment 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

🚀 The feature

CocoDetection() doesn't work using stuff_train2017_pixelmaps with stuff_train2017.json and using stuff_val2017_pixelmaps with stuff_val2017.json as shown below:

from torchvision.datasets import CocoDetection

pms_stf_train2017_data = CocoDetection(
    root="data/coco/anns/stuff_trainval2017/stuff_train2017_pixelmaps",
    annFile="data/coco/anns/stuff_trainval2017/stuff_train2017.json"
)

pms_stf_val2017_data = CocoDetection(
    root="data/coco/anns/stuff_trainval2017/stuff_val2017_pixelmaps",
    annFile="data/coco/anns/stuff_trainval2017/stuff_val2017.json"
)

pms_stf_train2017_data[0] # Error

pms_stf_val2017_data[0] # Error

FileNotFoundError: [Errno 2] No such file or directory: '/.../data/coco/anns/stuff_trainval2017/stuff_train2017_pixelmaps/000000000009.jpg'

FileNotFoundError: [Errno 2] No such file or directory: '/../data/coco/anns/stuff_trainval2017/stuff_val2017_pixelmaps/000000000139.jpg'

And, CocoDetection() doesn't work using panoptic_train2017 with panoptic_train2017.json and using panoptic_val2017 and panoptic_val2017.json as shown below:

from torchvision.datasets import CocoDetection

pan_train2017_data = CocoDetection(
    root="data/coco/anns/panoptic_trainval2017/panoptic_train2017",
    annFile="data/coco/anns/panoptic_trainval2017/panoptic_train2017.json"
) # Error

pan_val2017_data = CocoDetection(
    root="data/coco/anns/panoptic_trainval2017/panoptic_val2017",
    annFile="data/coco/anns/panoptic_trainval2017/panoptic_val2017.json"
) # Error

KeyError: 'id'

Motivation, pitch

So, CocoDetection() should support for them.

Alternatives

No response

Additional context

No response

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 torchvision.datasets.CocoDetection entry point and reproduce the provided stuff and panoptic dataset examples. Inspect how their image paths and annotation identifiers are interpreted, then verify that the listed train and validation datasets load and can retrieve their first item without the reported errors.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.