Torchvision models

Model providing helper funtions to create TorchVision Deep Learning models.

TorchVision pages:

Import

from ikomia.dnn.torch import models

Functions

faster_rcnn([train_mode, use_pretrained, ...])

Create Torchvision Faster RCNN model for training or inference.

mask_rcnn([train_mode, use_pretrained, ...])

Create Torchvision Mask RCNN model for training or inference.

mnasnet([train_mode, use_pretrained, ...])

Create Torchvision MnasNet model for training or inference.

resnet([model_name, train_mode, ...])

Create Torchvision ResNet model for training or inference.

resnext([model_name, train_mode, ...])

Create Torchvision ResNeXt model for training or inference.

Details

ikomia.dnn.torch.models.faster_rcnn(train_mode=False, use_pretrained=True, input_size=800, classes=2)

Create Torchvision Faster RCNN model for training or inference.

Parameters
  • model_name (str) – model name

  • train_mode (boolean) – True or False

  • use_pretrained (boolean) – True to do transfer learning from pre-trained model, False to train from scratch

  • input_size (int) – input image size

  • classes (int) – number of classes in the dataset

Returns

model object

ikomia.dnn.torch.models.mask_rcnn(train_mode=False, use_pretrained=True, input_size=800, classes=2)

Create Torchvision Mask RCNN model for training or inference.

Parameters
  • model_name (str) – model name

  • train_mode (boolean) – True or False

  • use_pretrained (boolean) – True to do transfer learning from pre-trained model, False to train from scratch

  • input_size (int) – input image size

  • classes (int) – number of classes in the dataset

Returns

model object

ikomia.dnn.torch.models.mnasnet(train_mode=False, use_pretrained=False, feature_extract=False, classes=2)

Create Torchvision MnasNet model for training or inference.

Parameters
  • model_name (str) – model name

  • train_mode (boolean) – True or False

  • use_pretrained (boolean) – True to do transfer learning from pre-trained model, False to train from scratch

  • feature_extract (boolean) – transfer learning only, True to keep pre-trained features (train last layers only), False to train all layers

  • classes (int) – number of classes in the dataset

Returns

model object

ikomia.dnn.torch.models.resnet(model_name='resnet50', train_mode=False, use_pretrained=False, feature_extract=False, classes=2)

Create Torchvision ResNet model for training or inference.

Parameters
  • model_name (str) – model name

  • train_mode (boolean) – True or False

  • use_pretrained (boolean) – True to do transfer learning from pre-trained model, False to train from scratch

  • feature_extract (boolean) – transfer learning only, True to keep pre-trained features (train last layers only), False to train all layers

  • classes (int) – number of classes in the dataset

Returns

model object

ikomia.dnn.torch.models.resnext(model_name='resnext50', train_mode=False, use_pretrained=False, feature_extract=False, classes=2)

Create Torchvision ResNeXt model for training or inference.

Parameters
  • model_name (str) – model name

  • train_mode (boolean) – True or False

  • use_pretrained (boolean) – True to do transfer learning from pre-trained model, False to train from scratch

  • feature_extract (boolean) – transfer learning only, True to keep pre-trained features (train last layers only), False to train all layers

  • classes (int) – number of classes in the dataset

Returns

model object