NNModelInfoExport
class NNModelInfoInstanceUtil
{
public:
NNModelInfoInstanceUtil(
std::string modelName,
nn_create_model_func_t createFunc,
nn_create_model_func_with_args_t createFuncWithArgs,
std::string testImage, std::shared_ptr<NNRect> testImageRoi);
};
#define REGISTER_MODEL_INFO(wrapName, modelName, createFunc, createFuncWithArgs) \
static auto wrapName = std::make_shared<NNModelInfoInstanceUtil>(modelName, createFunc, createFuncWithArgs, "", nullptr);
#define REGISTER_MODEL_INFO_WITH_TEST_IMAGE(wrapName, modelName, createFunc, createFuncWithArgs, testImage) \
static auto wrapName = std::make_shared<NNModelInfoInstanceUtil>(modelName, createFunc, createFuncWithArgs, testImage, nullptr);
#define REGISTER_MODEL_INFO_WITH_TEST_IMAGE_AND_ROI(wrapName, modelName, createFunc, createFuncWithArgs, testImage, testImageRoi) \
static auto wrapName = std::make_shared<NNModelInfoInstanceUtil>(modelName, createFunc, createFuncWithArgs, testImage, testImageRoi);
Introduction to the Class
Utility class for creating and managing instances of `NNModelInfo`.
The `NNModelInfoInstanceUtil` class is a utility class that provides a convenient way to create and manage instances of the `NNModelInfo` class. It encapsulates the construction of `NNModelInfo` objects with the necessary parameters, allowing for easy registration of model information.
Introduction to the Class's Methods
NNModelInfoInstanceUtil(std::string modelName, nn_create_model_func_t createFunc, nn_create_model_func_with_args_t createFuncWithArgs, std::string testImage, std::shared_ptr<NNRect> testImageRoi)
brief: Constructor. Initializes an `NNModelInfoInstanceUtil` object with the specified parameters.
param
modelName: The name of the neural network model.
createFunc: A function pointer to a function that creates an instance of the model without arguments.
createFuncWithArgs: A function pointer to a function that creates an instance of the model with a vector of arguments.
testImage: The path to the test image used for the model.
testImageRoi: A shared pointer to an `NNRect` object representing the region of interest (ROI) for the test image (optional, can be `nullptr`).
Introduction to the macros
REGISTER_MODEL_INFO(wrapName, modelName, createFunc, createFuncWithArgs)
brief: Macro for registering model information without a test image or ROI. This macro creates a static shared pointer of type `NNModelInfoInstanceUtil` with the specified parameters, allowing for easy registration of model information without the need to manually create and manage `NNModelInfo` instances.
param
wrapName: The name of the static shared pointer variable.
modelName: The name of the neural network model.
createFunc: A function pointer to a function that creates an instance of the model without arguments.
createFuncWithArgs: A function pointer to a function that creates an instance of the model with a vector of arguments.
REGISTER_MODEL_INFO_WITH_TEST_IMAGE(wrapName, modelName, createFunc, createFuncWithArgs, testImage)
brief: Macro for registering model information with a test image but without an ROI. This macro creates a static shared pointer of type `NNModelInfoInstanceUtil` with the specified parameters, including a test image. It allows for easy registration of model information along with a test image.
param
wrapName: The name of the static shared pointer variable.
modelName: The name of the neural network model.
createFunc: A function pointer to a function that creates an instance of the model without arguments.
createFuncWithArgs: A function pointer to a function that creates an instance of the model with a vector of arguments.
testImage: The path to the test image used for the model.
REGISTER_MODEL_INFO_WITH_TEST_IMAGE_AND_ROI(wrapName, modelName, createFunc, createFuncWithArgs, testImage, testImageRoi)
brief: Macro for registering model information with a test image and an ROI. This macro creates a static shared pointer of type `NNModelInfoInstanceUtil` with the specified parameters, including a test image and its region of interest (ROI). It allows for easy registration of model information along with both a test image and its ROI.
param
wrapName: The name of the static shared pointer variable.
modelName: The name of the neural network model.
createFunc: A function pointer to a function that creates an instance of the model without arguments.
createFuncWithArgs: A function pointer to a function that creates an instance of the model with a vector of arguments.
testImage: The path to the test image used for the model.
testImageRoi: A shared pointer to an `NNRect` object representing the region of interest (ROI) for the test image (optional, can be `nullptr`).