MCPcopy Create free account
hub / github.com/lukemelas/EfficientNet-PyTorch / from_pretrained

Method from_pretrained

efficientnet_pytorch/model.py:209–216  ·  view source on GitHub ↗
(cls, model_name, advprop=False, num_classes=1000, in_channels=3)

Source from the content-addressed store, hash-verified

207
208 @classmethod
209 def from_pretrained(cls, model_name, advprop=False, num_classes=1000, in_channels=3):
210 model = cls.from_name(model_name, override_params={'num_classes': num_classes})
211 load_pretrained_weights(model, model_name, load_fc=(num_classes == 1000), advprop=advprop)
212 if in_channels != 3:
213 Conv2d = get_same_padding_conv2d(image_size = model._global_params.image_size)
214 out_channels = round_filters(32, model._global_params)
215 model._conv_stem = Conv2d(in_channels, out_channels, kernel_size=3, stride=2, bias=False)
216 return model
217
218 @classmethod
219 def get_image_size(cls, model_name):

Callers 2

netFunction · 0.80
main_workerFunction · 0.80

Calls 4

load_pretrained_weightsFunction · 0.85
get_same_padding_conv2dFunction · 0.85
from_nameMethod · 0.80
round_filtersFunction · 0.70

Tested by 1

netFunction · 0.64