pytorch / pytorch/vision

GoogleNet is secretly transforming input

Open
#4,136 5 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

Hello!

I recently noticed that I might be doing image normalization twice in my experiments.
The documentation says that the default value of the transform_input parameter is False.

So when calling

model = torchvision.models.googlenet(pretrained=True)

I would probably expect the model not to do any input transformations, but accidentally it does (permalink) until you directly specify transform_input=False. So in case of pretrained=True and not-specified transform_input model suddenly sets its value to True:

    if pretrained:
        if 'transform_input' not in kwargs:
            kwargs['transform_input'] = True

It is confusing for me. This thing is only happens in GoogleNet.

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/googlenet.py at the pretrained handling around line 41, and compare it with the linked GoogleNet documentation for transform_input. Reproduce the pretrained=True case without specifying transform_input, then confirm the behavior matches the documented default and update the relevant coverage if the repository has it.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
computer-vision
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.