Skip to content

bias_downsample=False ResNet constructor #6811

@wyli

Description

@wyli

Currently, the bias_downsample=False argument is contradicting with pretraining, as it is hard coded to be not pretrained in ResNet constructor:

model: ResNet = ResNet(block, layers, block_inplanes, bias_downsample=not pretrained, **kwargs)
    if pretrained:
        # Author of paper zipped the state_dict on googledrive,
        # so would need to download, unzip and read (2.8gb file for a ~150mb state dict).
        # Would like to load dict from url but need somewhere to save the state dicts.
        raise NotImplementedError(
            "Currently not implemented. You need to manually download weights provided by the paper's author"
            " and load then to the model with `state_dict`. See https://github.com/Tencent/MedicalNet"
        )
    return model

When manually loading MedicalNet weights, the downsample bias terms raise errors as they are not present in the loaded weights. It is also not possible to remove bias_downsample by setting pretrained=True, this raises NotImplementedError.
So, can you please remove the hard coding from the model constructor in the source code?

Originally posted by @acerdur in #5477 (comment)

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions