pytorch / pytorch/vision

PyTorch standard Coco dataset (datasets.CocoDetection) not compatible with Faster R-CNN object detection model

Open
#8,353 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

Hi,
I am trying to train and evaluate pre-trained Faster R-CNN model with standard coco dataset. I am getting the following error

TypeError: RandomIoUCrop() requires input sample to contain tensor or PIL images and bounding boxes. Sample can also contain masks.

Here are the high level steps

  1. Downloaded the COCO 2017 dataset
  2. Prepared PyTorch dataset using standard steps from https://pytorch.org/vision/main/auto_examples/transforms/plot_transforms_e2e.html#sphx-glr-auto-examples-transforms-plot-transforms-e2e-py
  3. Training and evaluating Faster R-CNN model using steps from https://pytorch.org/tutorials/intermediate/torchvision_tutorial.html

Here is colab notebook
https://colab.research.google.com/drive/1Tbu2Thf-thn0lLG12dM3bq_BMZDihX2Y?usp=sharing

Any help will be appreciated. Thanks.

Versions

Hi,
I am trying to train and evaluate pre-trained Faster R-CNN model with standard coco dataset. I am getting the following error

TypeError: RandomIoUCrop() requires input sample to contain tensor or PIL images and bounding boxes. Sample can also contain masks.

Here are the high level steps

  1. Downloaded the COCO 2017 dataset
  2. Prepared PyTorch dataset using standard steps from https://pytorch.org/vision/main/auto_examples/transforms/plot_transforms_e2e.html#sphx-glr-auto-examples-transforms-plot-transforms-e2e-py
  3. Training and evaluating Faster R-CNN model using steps from https://pytorch.org/tutorials/intermediate/torchvision_tutorial.html

Here is colab notebook
https://colab.research.google.com/drive/1Tbu2Thf-thn0lLG12dM3bq_BMZDihX2Y?usp=sharing

Any help will be appreciated. Thanks.

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

Reproduce the failure using the linked Colab notebook and trace the sample passed from datasets.CocoDetection through RandomIoUCrop into Faster R-CNN. Compare the transform example and detection tutorial to identify the expected image and bounding-box sample structure; done means standard COCO preparation runs through training and evaluation without the TypeError.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
computer-vision, machine-learning
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.