Beatmup
Beatmup::NNets Namespace Reference

Neural nets inference on GPU using OpenGL. More...

Classes

class  Classifier
 Image classifier base class. More...
 
class  Conv2D
 2D convolution operation computed on GPU. More...
 
class  Dense
 Dense (linear) layer. More...
 
class  DeserializedModel
 Model reconstructed from a serialized representation. More...
 
class  ImageSampler
 Image preprocessing operation. More...
 
class  InferenceTask
 Task running inference of a Model. More...
 
class  Model
 Neural net model. More...
 
class  InferenceTimeError
 Wrapper for exceptions occuring during the model inference. More...
 
class  AbstractOperation
 Abstract neural net operation (layer). More...
 
class  SpatialFilteringMixin
 Generates GLSL fragment shader code sampling a local neighborhood around the current texture coordinates for further filtering. More...
 
class  ActivationFunctionMixin
 A mixin implementing activation functions in GLSL. More...
 
class  CpuOperation
 Operation computed on CPU. More...
 
class  Pooling2D
 2D pooling operation computed on GPU. More...
 
class  Softmax
 Softmax layer. More...
 
class  Size
 Operation 3D input/output size. More...
 
class  Storage
 3D tensor stored in a set of textures. More...
 

Enumerations

enum class  ActivationFunction { DEFAULT , BRELU6 , SIGMOID_LIKE }
 Activation function specification. More...
 

Functions

ActivationFunction activationFunctionFromString (const std::string &str)
 Returns a zero padding value from a string. More...
 
Size::Padding paddingFromString (const std::string &str)
 Returns a zero padding value from a string. More...
 

Variables

static const bool CONV2D_OP_DESERIALIZABLE = Conv2D::initDeserializer()
 
static const bool DENSE_OP_DESERIALIZABLE = Dense::initDeserializer()
 
static const bool IMAGESAMPLER_OP_DESERIALIZABLE = ImageSampler::initDeserializer()
 
static const bool POOLING2D_OP_DESERIALIZABLE = Pooling2D::initDeserializer()
 
static bool SOFTMAX_OP_DESERIALIZABLE = Softmax::initDeserializer()
 

Detailed Description

Neural nets inference on GPU using OpenGL.

Enumeration Type Documentation

◆ ActivationFunction

Activation function specification.

Enumerator
DEFAULT 

default activation: 0..1 bounded ReLU (identity clipped to 0..1 range)

BRELU6 

0.167 times identity clipped to 0..1 range

SIGMOID_LIKE 

piecewise-linear sigmoid approximation

Definition at line 401 of file operation.h.

401  {
402  DEFAULT, //!< default activation: 0..1 bounded ReLU (identity clipped to 0..1 range)
403  BRELU6, //!< 0.167 times identity clipped to 0..1 range
404  SIGMOID_LIKE //!< piecewise-linear sigmoid approximation
405  };
@ SIGMOID_LIKE
piecewise-linear sigmoid approximation
@ DEFAULT
default activation: 0..1 bounded ReLU (identity clipped to 0..1 range)
@ BRELU6
0.167 times identity clipped to 0..1 range

Function Documentation

◆ activationFunctionFromString()

ActivationFunction Beatmup::NNets::activationFunctionFromString ( const std::string &  str)

Returns a zero padding value from a string.

The conversion is case-insensitive. Raises an exception if cannot interpret the string.

Parameters
[in]strThe input string

Definition at line 329 of file operation.cpp.

329  {
330  const std::string lc = StringUtils::lowercase(str);
331  if (lc == "default")
332  return ActivationFunction::DEFAULT;
333  if (lc == "brelu6")
334  return ActivationFunction::BRELU6;
335  if (lc == "sigmoid_like")
336  return ActivationFunction::SIGMOID_LIKE;
337  throw InvalidArgument("Invalid activation function: " + str);
338  return ActivationFunction::DEFAULT;
339 }
std::string lowercase(const std::string &str)
Converts a string to lower case (latin letters only).
JNIEnv jobject jstring str

◆ paddingFromString()

Size::Padding Beatmup::NNets::paddingFromString ( const std::string &  str)

Returns a zero padding value from a string.

The conversion is case-insensitive. Raises an exception if cannot interpret the string.

Parameters
[in]strThe input string.

Definition at line 703 of file storage.cpp.

703  {
704  const std::string lc = StringUtils::lowercase(str);
705  if (lc == "valid")
706  return Size::Padding::VALID;
707  if (lc == "same")
708  return Size::Padding::SAME;
709  throw InvalidArgument("Invalid padding: " + str);
710  return Size::Padding::VALID;
711 }

Variable Documentation

◆ CONV2D_OP_DESERIALIZABLE

const bool Beatmup::NNets::CONV2D_OP_DESERIALIZABLE = Conv2D::initDeserializer()
static

Definition at line 166 of file conv2d.h.

◆ DENSE_OP_DESERIALIZABLE

const bool Beatmup::NNets::DENSE_OP_DESERIALIZABLE = Dense::initDeserializer()
static

Definition at line 105 of file dense.h.

◆ IMAGESAMPLER_OP_DESERIALIZABLE

const bool Beatmup::NNets::IMAGESAMPLER_OP_DESERIALIZABLE = ImageSampler::initDeserializer()
static

Definition at line 116 of file image_sampler.h.

◆ POOLING2D_OP_DESERIALIZABLE

const bool Beatmup::NNets::POOLING2D_OP_DESERIALIZABLE = Pooling2D::initDeserializer()
static

Definition at line 116 of file pooling2d.h.

◆ SOFTMAX_OP_DESERIALIZABLE

bool Beatmup::NNets::SOFTMAX_OP_DESERIALIZABLE = Softmax::initDeserializer()
static

Definition at line 76 of file softmax.h.