Handle Creation¶
handle creation
Classes¶
| Type | Name |
|---|---|
| struct | SaigeHandleConfig Structure containing configuration settings for the inference handle, which can impact GPU memory and inference time. |
Public Types¶
| Type | Name |
|---|---|
| typedef void * | SaigeInferenceHandle A handle used to manage information and perform inference. |
| typedef void * | SaigeInferenceResult A handle used to manage inference results. |
Public Attributes¶
| Type | Name |
|---|---|
| constexpr int | kProjectTypeCLS = = 0 Constant value indicating Classification project. |
| constexpr int | kProjectTypeDET = = 1 Constant value indicating Detection project. |
| constexpr int | kProjectTypeSEG = = 2 Constant value indicating Segmentation project. |
| constexpr int | kProjectTypeIAD = = 3 Constant value indicating Anomaly Detection project. |
| constexpr int | kProjectTypeOCR = = 4 Constant value indicating OCR project. |
| constexpr int | kProjectTypeIEN = = 5 Constant value indicating IEN project. |
Public Functions¶
| Type | Name |
|---|---|
| int | SaigeCreateInferenceHandle (SaigeInferenceHandle * handle, const int projectType, const char * modelFilePath, const int deviceIndex, SaigeHandleConfig * config, const unsigned int flags) Creates an inference handle. |
| int | SaigeCreateInferenceResult (SaigeInferenceResult * result) Creates a result handle. |
Macros¶
| Type | Name |
|---|---|
| define | SAIGE_SET_BATCH_SIZE 0x01 (CLS, DET, SEG, IAD) Flag to set batch size for inference. Used when batch inference API is applied. |
| define | SAIGE_SET_INSPECTION_SIZE 0x02 (SEG, OCR) Flag to set the width and height of images for inference. |
| define | SAIGE_OPTIMIZE_HANDLE 0x04 (Common) Flag to apply optimization to the inference handle. Applying inference optimization reduces inference time but may slightly alter results. |
Public Types Documentation¶
SaigeInferenceHandle¶
A handle used to manage information and perform inference.
void * SaigeInferenceHandle;
SaigeInferenceResult¶
A handle used to manage inference results.
void * SaigeInferenceResult;
Public Attributes Documentation¶
kProjectTypeCLS¶
Constant value indicating Classification project.
constexpr int kProjectTypeCLS;
kProjectTypeDET¶
Constant value indicating Detection project.
constexpr int kProjectTypeDET;
kProjectTypeSEG¶
Constant value indicating Segmentation project.
constexpr int kProjectTypeSEG;
kProjectTypeIAD¶
Constant value indicating Anomaly Detection project.
constexpr int kProjectTypeIAD;
kProjectTypeOCR¶
Constant value indicating OCR project.
constexpr int kProjectTypeOCR;
kProjectTypeIEN¶
Constant value indicating IEN project.
constexpr int kProjectTypeIEN;
Public Functions Documentation¶
SaigeCreateInferenceHandle¶
Creates an inference handle.
int SaigeCreateInferenceHandle (
SaigeInferenceHandle * handle,
const int projectType,
const char * modelFilePath,
const int deviceIndex,
SaigeHandleConfig * config,
const unsigned int flags
)
Ensure that the project type and model file path are correctly set according to the intended task. An error will occur if the specified project type and the project information in the model file do not match.
Parameters:
handle[out] The inference handle to use.projectTypeInteger value representing the project type.modelFilePathPath to the model file.deviceIndexIndex of the device to use for inference. Use the GPU index (non-negative integer) for GPU or -1 for CPU.configStructure containing inference handle configuration settings.flagsItems to configure.
Returns:
errorCode Returns 0 on success, or an error code if an error occurs.
See also: SaigeInferenceHandle, SaigeHandleConfig, SaigeDestroyInferenceResult
SaigeCreateInferenceResult¶
Creates a result handle.
int SaigeCreateInferenceResult (
SaigeInferenceResult * result
)
Parameters:
result[out] The result handle to use.
Returns:
errorCode Returns 0 on success, or an error code if an error occurs.
See also: SaigeInferenceResult, SaigeDestroyInferenceResult
Macro Definition Documentation¶
SAIGE_SET_BATCH_SIZE¶
(CLS, DET, SEG, IAD) Flag to set batch size for inference. Used when batch inference API is applied.
#define SAIGE_SET_BATCH_SIZE 0x01
SAIGE_SET_INSPECTION_SIZE¶
(SEG, OCR) Flag to set the width and height of images for inference.
#define SAIGE_SET_INSPECTION_SIZE 0x02
SAIGE_OPTIMIZE_HANDLE¶
(Common) Flag to apply optimization to the inference handle. Applying inference optimization reduces inference time but may slightly alter results.
#define SAIGE_OPTIMIZE_HANDLE 0x04