model_builder module

class model_builder.Identity(features)

Bases: torch.nn.modules.module.Module

Identity network

This network is used to convert last layer of pre-trained network to the identity if feature_extractor flag is set.

Parameters

nn ([type]) – [description]

forward(y)

Defines the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

training: bool
class model_builder.build_models(model_name, out_classes, pretrained, requires_grad, in_channels, custom_pretrained=None, feature_extractor: bool = False)

Bases: object

build_densenet()

Generates densenet according the parameters initiliazed

Returns

Densenet model

Return type

torch.model

build_efficientnet()

Generates efficientnet according the parameters initiliazed

Returns

efficientnet model

Return type

torch.model

build_resnet()

Generates resnet according the parameters initiliazed

Returns

resnet model

Return type

torch.model

build_vgg()

Builds vgg according the parameters initiliazed

Returns

vgg model

Return type

torch.model

class model_builder.classifier(in_features, out_features)

Bases: torch.nn.modules.module.Module

forward(x, features)

Defines the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

training: bool