transfer {cito}R Documentation

Transfer learning

Description

creates a 'transfer' 'citolayer' object that is used by create_architecture.

Usage

transfer(
  name = c("alexnet", "inception_v3", "mobilenet_v2", "resnet101", "resnet152",
    "resnet18", "resnet34", "resnet50", "resnext101_32x8d", "resnext50_32x4d", "vgg11",
    "vgg11_bn", "vgg13", "vgg13_bn", "vgg16", "vgg16_bn", "vgg19", "vgg19_bn",
    "wide_resnet101_2", "wide_resnet50_2"),
  pretrained = TRUE,
  freeze = TRUE
)

Arguments

name

The name of the pretrained model

pretrained

if FALSE, random weights are used instead of the pretrained weights

freeze

if TRUE, the weights of the pretrained model (except the "classifier" part at the end) aren't changed in the training anymore. Only works if pretrained=TRUE

Details

This function creates a 'transfer' 'citolayer' object that is passed to the create_architecture function. With this object the pretrained models that are available in the 'torchvision' package can be used in cito. When 'freeze' is set to TRUE, only the weights of the last part of the network (consisting of one or more linear layers) are adjusted in the training. There mustn't be any other citolayers before the transfer citolayer object when calling create_architecture. If there are any citolayers after the transfer citolayer, the linear classifier part of the pretrained model is replaced with the specified citolayers.

Value

S3 object of class "transfer" "citolayer"

Author(s)

Armin Schenk

See Also

create_architecture


[Package cito version 1.1 Index]