pytorch / pytorch/vision

Train pretrained faster RCNN with resnet101 FPN as backbone

Open
#993 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement help wanted module: models
Dominant language
Python
Stars
17.9k
Forks
7.3k
Avg merge
1d 15h
Merged PRs (30d)
13

Description

I want to use pretrain faster rcnn of resnet101 FPN to train with my own dataset.
But, it fails to download pretrain faster-rcnn model of resnet101 FPN.
This is my code of model part:
backbone =torchvision.models.detection.backbone_utils.resnet_fpn_backbone('resnet101','False')
model_urls ={'resnet101_fpn':'https://download.pytorch.org/models/fasterrcnn_resnet101_fpn_coco-258fb6c6.pth'}
state_dict = load_state_dict_from_url(model_urls['resnet101_fpn'])
model = FasterRCNN(backbone,num_classes=2)

The error looks like this:

Downloading: "https://download.pytorch.org/models/resnet101-5d3b4d8f.pth" to /home/user/.cache/torch/checkpoints/resnet101-5d3b4d8f.pth
100%|###############################################################| 178728960/178728960 [00:07<00:00, 23374182.30it/s]
Downloading: "https://download.pytorch.org/models/fasterrcnn_resnet101_fpn_coco-258fb6c6.pth" to /home/user/.cache/torch/checkpoints/fasterrcnn_resnet101_fpn_coco-258fb6c6.pth
Traceback (most recent call last):
File "detect.py", line 59, in
state_dict = load_state_dict_from_url(model_urls['resnet101_fpn'])
File "/home/user/miniconda/envs/py36/lib/python3.6/site-packages/torch/hub.py", line 433, in load_state_dict_from_url
_download_url_to_file(url, cached_file, hash_prefix, progress=progress)
File "/home/user/miniconda/envs/py36/lib/python3.6/site-packages/torch/hub.py", line 349, in _download_url_to_file
u = urlopen(url)
File "/home/user/miniconda/envs/py36/lib/python3.6/urllib/request.py", line 223, in urlopen
return opener.open(url, data, timeout)
File "/home/user/miniconda/envs/py36/lib/python3.6/urllib/request.py", line 532, in open
response = meth(req, response)
File "/home/user/miniconda/envs/py36/lib/python3.6/urllib/request.py", line 642, in http_response
'http', request, response, code, msg, hdrs)
File "/home/user/miniconda/envs/py36/lib/python3.6/urllib/request.py", line 570, in error
return self._call_chain(*args)
File "/home/user/miniconda/envs/py36/lib/python3.6/urllib/request.py", line 504, in _call_chain
result = func(*args)
File "/home/user/miniconda/envs/py36/lib/python3.6/urllib/request.py", line 650, in http_error_default
raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 403: Forbidden

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

Begin with the shown resnet_fpn_backbone and load_state_dict_from_url calls and verify the reported URL response. Check the torchvision Faster R-CNN and ResNet-FPN model entry points; done means the pretrained ResNet-101 FPN path works for a custom dataset or the issue documents the confirmed limitation.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
computer-vision, machine-learning
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 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.