pytorch / pytorch/vision

Getting an error when modifying the faster_rcnn model to add inception_v3 backbone model

Open
#3,083 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

I was following this tutorial Modifying the model to add a different backbone. When I replace the mobilenet_v2 model with inception_v3, the code does not work and gives the following error:

  File "/home/gpu-user/projects/building-outline-detection/src/models/faster_rcnn/vision/engine.py", line 46, in train_one_epoch
    loss_dict = model(images, targets)
  File "/home/gpu-user/miniconda3/envs/faster_rcnn/lib/python3.8/site-packages/torch/nn/modules/module.py", line 727, in _call_impl
    result = self.forward(*input, **kwargs)
  File "/home/gpu-user/miniconda3/envs/faster_rcnn/lib/python3.8/site-packages/torchvision/models/detection/generalized_rcnn.py", line 99, in forward
    proposals, proposal_losses = self.rpn(images, features, targets)
  File "/home/gpu-user/miniconda3/envs/faster_rcnn/lib/python3.8/site-packages/torch/nn/modules/module.py", line 727, in _call_impl
    result = self.forward(*input, **kwargs)
  File "/home/gpu-user/miniconda3/envs/faster_rcnn/lib/python3.8/site-packages/torchvision/models/detection/rpn.py", line 330, in forward
    features = list(features.values())
AttributeError: 'InceptionOutputs' object has no attribute 'values'

I am using the following environment:

  • Ubuntu 18.04.4 LTS
  • CUDA Version: 10.2
  • Python: 3.8.6
  • Pytorch: 1.7.0

It will be great if someone can help me in resolving this issue.
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

Start with the linked tutorial and compare the MobileNetV2 and InceptionV3 backbone setup, then trace the failure from vision/engine.py into torchvision/models/detection/rpn.py. Determine why InceptionOutputs is passed where the RPN expects features, and verify that the modified Faster R-CNN model can complete training without this AttributeError.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
computer-vision, machine-learning
Issue type
Bug
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.