pymic.net.cls package

Submodules

pymic.net.cls.torch_pretrained_net module

class pymic.net.cls.torch_pretrained_net.BuiltInNet(params)

Bases: Module

Built-in Network in Pytorch for classification. Parameters should be set in the params dictionary that contains the following fields:

Parameters:
  • input_chns – (int) Input channel number, default is 3.

  • pretrain – (bool) Using pretrained model or not, default is True.

  • update_mode – (str) The strategy for updating layers: “all” means updating all the layers, and “last” (by default) means updating the last layer, as well as the first layer when input_chns is not 3.

forward(x)

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.

get_parameters_to_update()
training: bool
class pymic.net.cls.torch_pretrained_net.MobileNetV2(params)

Bases: BuiltInNet

MobileNetV2 for classification. Parameters should be set in the params dictionary that contains the following fields:

Parameters:
  • input_chns – (int) Input channel number, default is 3.

  • pretrain – (bool) Using pretrained model or not, default is True.

  • update_mode – (str) The strategy for updating layers: “all” means updating all the layers, and “last” (by default) means updating the last layer, as well as the first layer when input_chns is not 3.

get_parameters_to_update()
training: bool
class pymic.net.cls.torch_pretrained_net.ResNet18(params)

Bases: BuiltInNet

ResNet18 for classification. Parameters should be set in the params dictionary that contains the following fields:

Parameters:
  • input_chns – (int) Input channel number, default is 3.

  • pretrain – (bool) Using pretrained model or not, default is True.

  • update_mode – (str) The strategy for updating layers: “all” means updating all the layers, and “last” (by default) means updating the last layer, as well as the first layer when input_chns is not 3.

get_parameters_to_update()
training: bool
class pymic.net.cls.torch_pretrained_net.VGG16(params)

Bases: BuiltInNet

VGG16 for classification. Parameters should be set in the params dictionary that contains the following fields:

Parameters:
  • input_chns – (int) Input channel number, default is 3.

  • pretrain – (bool) Using pretrained model or not, default is True.

  • update_mode – (str) The strategy for updating layers: “all” means updating all the layers, and “last” (by default) means updating the last layer, as well as the first layer when input_chns is not 3.

get_parameters_to_update()
training: bool

Module contents