iVS3D v2.0.0
Loading...
Searching...
No Matches
NN Namespace Reference

NN Neural Network Library containing Tensor and NeuralNet classes for inference. More...

Namespaces

namespace  Util
 Namespace for utility functions related to neural networks and tensors.
 

Classes

struct  is_std_array
 Checks if a type is a std::array. More...
 
struct  is_std_array< std::array< U, N > >
 
struct  map_array_traits
 Traits for mapping a function over a std::array. More...
 
class  NeuralError
 Represents an error that occurred in the neural network module and contains the error type and message. More...
 
class  NeuralNet
 Abstract base class for neural networks. More...
 
class  NeuralNetFactory
 Factory class for creating NeuralNet instances. This abstracts from the underlying inference engine (e.g., ONNX Runtime). More...
 
class  OrtNeuralNet
 A class that implements the NeuralNet interface using ONNX Runtime. More...
 
struct  ReduceArgMax
 Reduces a Tensor by finding the index of the maximum value along a specified axis. More...
 
struct  ReduceArgMin
 Reduces a Tensor by finding the index of the minimum value along a specified axis. More...
 
struct  ReduceMax
 Reduces a Tensor by computing the maximum value along a specified axis. More...
 
struct  ReduceMin
 Reduces a Tensor by computing the minimum value along a specified axis. More...
 
struct  ReduceSum
 Reduces a Tensor by summing its elements along a specified axis. More...
 
class  Tensor
 A Tensor represents a N-dimensional array containing elements of the same type. Can be used as input and output for inference. More...
 

Typedefs

using NeuralNetPtr = std::shared_ptr< NeuralNet >
 Smart pointer type for managing NeuralNet instances.
 
using Shape = std::vector< int64_t >
 Shape of a N-dimensional Tensor represented as the size in each dimension. Can be -1 in case of dynamic dimensions.
 
template<typename T >
using decay_t = typename std::decay< T >::type
 Remove cv/ref qualifiers and decay to check std::array<T, N>
 

Enumerations

enum class  ErrorCode
 Error codes for the neural network module. More...
 
enum class  TensorType
 TensorType encapsulates the supported data types of tensor elements. The supported types are: More...
 

Functions

int64_t shapeNumElements (const Shape &shape)
 Calculates the number of elements from a given Shape.
 
int64_t shapeToStride (const Shape &shape, uint64_t axis)
 Calculates the stride to iterate elements in a given axis.
 
std::string shapeToString (const Shape &shape)
 Creates a human-readable string from the given shape.
 
constexpr const char * toString (TensorType type)
 Convert the TensorType to a human-readable string.
 

Detailed Description

NN Neural Network Library containing Tensor and NeuralNet classes for inference.

Contains the Tensor class for representing N-dimensional arrays with various data types. The Tensor class supports operations like reshaping, mapping, reducing, and converting to/from cv::Mat.

A factory handles model loading and abstracts the underlying inference engine (e.g., ONNX Runtime).

Author
Dominik Wüst (domin.nosp@m.ik.w.nosp@m.uest@.nosp@m.iosb.nosp@m..frau.nosp@m.nhof.nosp@m.er.de)
Date
May 2025

Function Documentation

◆ shapeNumElements()

int64_t NN::shapeNumElements ( const Shape shape)

Calculates the number of elements from a given Shape.

Returns

shape[0] * shape[1] * ... * shape[N-1]
Parameters
shapeThe shape object.
Returns
int64_t The number of elements in a Tensor with that shape.

◆ shapeToStride()

int64_t NN::shapeToStride ( const Shape shape,
uint64_t  axis 
)

Calculates the stride to iterate elements in a given axis.

Parameters
shapeThe shape of the tensor to iterate.
axisThe axis to iterate. This must be in range [0,shape.size()-1]!
Returns
int64_t the stride (stepsize) to iterate the given axis.

◆ shapeToString()

std::string NN::shapeToString ( const Shape shape)

Creates a human-readable string from the given shape.

Parameters
shapeThe shape to convert.
Returns
std::string A string with the shapes elements in printable form.

◆ toString()

constexpr const char * NN::toString ( TensorType  type)
constexpr

Convert the TensorType to a human-readable string.

Parameters
typeThe TensorType to convert.
Returns
constexpr const char* Returns a string representation of the type.