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 |
|---|---|
| int | kProjectTypeCLS = = 0 Constant value indicating Classification project. |
| int | kProjectTypeDET = = 1 Constant value indicating Detection project. |
| int | kProjectTypeSEG = = 2 Constant value indicating Segmentation project. |
| int | kProjectTypeIAD = = 3 Constant value indicating Anomaly Detection project. |
| int | kProjectTypeOCR = = 4 Constant value indicating OCR project. |
| 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.
int kProjectTypeCLS;
kProjectTypeDET¶
Constant value indicating Detection project.
int kProjectTypeDET;
kProjectTypeSEG¶
Constant value indicating Segmentation project.
int kProjectTypeSEG;
kProjectTypeIAD¶
Constant value indicating Anomaly Detection project.
int kProjectTypeIAD;
kProjectTypeOCR¶
Constant value indicating OCR project.
int kProjectTypeOCR;
kProjectTypeIEN¶
Constant value indicating IEN project.
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