EfficientNet-PyTorch icon indicating copy to clipboard operation
EfficientNet-PyTorch copied to clipboard

allow to load pretrained weights when the include_top variable is False

Open kurnianggoro opened this issue 3 years ago • 1 comments

This merge request is related to the bug #278

The class initialization is failed when called using from_pretrained(.., include_top=False) function or when the number of classes is not equal to 1000, i.e. from_pretrained(.., num_classes=100).

This pull request allow to load the pre-trained weights even when the number of classes is not equal to 1000 or when the top classifier is ignored.

_fc.weight and _fc.bias will only be loaded when include_top=True and num_classes=1000 (default values)

kurnianggoro avatar May 25 '21 07:05 kurnianggoro

Why hasn't this been merged yet? A simple solution to a problem affecting many users.

spirosbax avatar Sep 06 '21 10:09 spirosbax