Template Class DarkNet

Class Documentation

template<typename OutputLayerType = ann::CrossEntropyError<>, typename InitializationRuleType = ann::RandomInitialization, size_t DarkNetVersion = 19>
class mlpack::models::DarkNet

Definition of a DarkNet CNN.

tparam OutputLayerType

The output layer type used to evaluate the network.

tparam InitializationRuleType

Rule used to initialize the weight matrix.

tparam DaknetVer

Version of DarkNet.

Public Functions

DarkNet()

Create the DarkNet model.

DarkNet(const size_t inputChannel, const size_t inputWidth, const size_t inputHeight, const size_t numClasses = 1000, const std::string &weights = "none", const bool includeTop = true)

DarkNet 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.

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

  • weights – One of ‘none’, ‘imagenet’(pre-training on ImageNet) or path to weights.

  • includeTop – Must be set to true if weights are set.

DarkNet(const std::tuple<size_t, size_t, size_t> inputShape, const size_t numClasses = 1000, const std::string &weights = "none", const bool includeTop = true)

DarkNet 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.

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

  • weights – One of ‘none’, ‘imagenet’(pre-training on ImageNet) or path to weights.

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

Get Layers of the model.

void LoadModel(const std::string &filePath)

Load weights into the model.

void SaveModel(const std::string &filePath)

Save weights for the model.