Template Class YOLO

Class Documentation

template<typename OutputLayerType = ann::NegativeLogLikelihood<>, typename InitializationRuleType = ann::RandomInitialization>
class mlpack::models::YOLO

Definition of a YOLO object detection models.

tparam OutputLayerType

The output layer type used to evaluate the network.

tparam InitializationRuleType

Rule used to initialize the weight matrix.

tparam YOLOVersion

Version of YOLO model.

Public Functions

YOLO()

Create the YOLO model.

YOLO(const size_t inputChannel, const size_t inputWidth, const size_t inputHeight, const std::string yoloVersion = "v1-tiny", const size_t numClasses = 20, const size_t numBoxes = 2, const size_t featureSizeWidth = 7, const size_t featureSizeHeight = 7, const std::string &weights = "none", const bool includeTop = true)

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

  • yoloVersion – Version of YOLO model.

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

  • numBoxes – Number of bounding boxes per image.

  • featureSizeWidth – Width of output feature map.

  • featureSizeHeight – Height of output feature map.

  • weights – One of ‘none’, ‘voc’(pre-training on VOC-2012) or path to weights.

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

YOLO(const std::tuple<size_t, size_t, size_t> inputShape, const std::string yoloVersion = "v1-tiny", const size_t numClasses = 1000, const size_t numBoxes = 2, const std::tuple<size_t, size_t> featureShape = {7, 7}, const std::string &weights = "none", const bool includeTop = true)

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

  • yoloVersion – Version of YOLO model.

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

  • numBoxes – Number of bounding boxes per image.

  • featureShape – A twp-valued tuple indicating width and height of output feature map.

  • weights – One of ‘none’, ‘voc’(pre-training on VOC) 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.