pytorch / pytorch/vision

BUG: The torchvision.models.alexnet is incorrect

Open
#549 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

module: models topic: classification wontfix
Dominant language
Python
Stars
17.9k
Forks
7.3k
Avg merge
1d 15h
Merged PRs (30d)
13

Description

In self.classifier, the correct order of layers should be fc6-relu-dropout-fc7-relu-dropout-fc8, which means that dropout layer should be after the fc and relu layers.

This does not matter when inference. However, when you fine tune AlexNet model on other datasets, the incorrect layer sequence will result in an accuracy drop of 2 percents or more.

Can I make a PR to fix it? The pre-trained model URL need to update too.

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 torchvision/models/alexnet.py at the self.classifier definition referenced in the issue and compare its layer order with the stated AlexNet sequence. Check how the pretrained model URL is defined and used. Done means the classifier order is corrected and the pretrained model URL is updated consistently.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
computer-vision, machine-learning
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.