Template Class ResNet

Class Documentation

template<typename OutputLayerType = ann::CrossEntropyError<>, typename InitializationRuleType = ann::RandomInitialization, size_t ResNetVersion = 18>
class mlpack::models::ResNet

Definition of a ResNet CNN.

tparam OutputLayerType

The output layer type used to evaluate the network.

tparam InitializationRuleType

Rule used to initialize the weight matrix.

tparam ResNetVersion

Version of ResNet.

Public Functions

ResNet()

Create the ResNet model.

ResNet(const size_t inputChannel, const size_t inputWidth, const size_t inputHeight, const bool includeTop = true, const bool preTrained = false, const size_t numClasses = 1000)

ResNet constructor intializes input shape and number of classes.

Parameters
  • inputChannels – Number of input channels of the input image.

  • inputWidth – Width of the input image.

  • inputHeight – Height of the input image.

  • includeTop – Must be set to true if preTrained is set to true.

  • preTrained – True for pre-trained weights of ImageNet, default is false.

  • numClasses – Optional number of classes to classify images into, only to be specified if includeTop is true, default is 1000.

ResNet(std::tuple<size_t, size_t, size_t> inputShape, const bool includeTop = true, const bool preTrained = false, const size_t numClasses = 1000)

ResNet constructor intializes input shape and number of classes.

Parameters
  • inputShape – A three-valued tuple indicating input shape. First value is number of channels (channels-first). Second value is input height. Third value is input width.

  • preTrained – True for pre-trained weights of ImageNet, default is false.

  • numClasses – Optional number of classes to classify images into, only to be specified if includeTop is true.

inline ann::FFN<OutputLayerType, InitializationRuleType> &GetModel()

Get Layers of the model.

void LoadModel(const std::string &filePath)

Load weights into the model and assumes the internal matrix to be.

void SaveModel(const std::string &filepath)

Save weights for the model and assumes the internal matrix to be.