iVS3D v2.0.0
Loading...
Searching...
No Matches
NN::NeuralNetFactory Class Reference

Factory class for creating NeuralNet instances. This abstracts from the underlying inference engine (e.g., ONNX Runtime). More...

#include <NeuralNetFactory.h>

Static Public Member Functions

static tl::expected< NeuralNetPtr, NeuralErrorcreate (const std::string &modelPath, bool useGpu=false, int gpuId=0)
 Create a NeuralNet instance from a model file.
 

Detailed Description

Factory class for creating NeuralNet instances. This abstracts from the underlying inference engine (e.g., ONNX Runtime).

Member Function Documentation

◆ create()

tl::expected< NN::NeuralNetPtr, NN::NeuralError > NN::NeuralNetFactory::create ( const std::string &  modelPath,
bool  useGpu = false,
int  gpuId = 0 
)
static

Create a NeuralNet instance from a model file.

Parameters
modelPathThe path to the model file (e.g., ONNX model).
useGpuWhether to use CUDA for inference (default: false).
gpuIdThe GPU ID to use if CUDA is enabled (default: 0).
Returns
tl::expected<NeuralNetPtr, NeuralError> A pointer to the created NeuralNet or an error object.

This method loads the model from the specified path and creates an instance of NeuralNet. If the model cannot be loaded or the creation fails, an error object is returned.


The documentation for this class was generated from the following files: