Inference Result¶
Inference result!
Classes¶
| Type | Name |
|---|---|
| struct | SaigeRotatedBox Structure containing information about a rotatable rectangle. |
| struct | SaigeDetectedObject Structure containing information about a detected area from Object Detection (DET). |
| struct | SaigeEllipse Structure containing information about an ellipse. |
| struct | SaigeSegmentedObject Structure containing information about a detected area from Segmentation (SEG) or Anomaly Detection (IAD). |
| struct | SaigeTextObject SaigeTextObject. |
Public Functions¶
| Type | Name |
|---|---|
| int | SaigeGetInferenceResultScore (SaigeInferenceResult result, float * scores, bool includeAddScore) (CLS) Retrieves an array of scores per class. |
| int | SaigeGetInferenceResultClass (SaigeInferenceResult result, int * classIndex) (CLS) Retrieves the index of the class with the highest final score, including additional score. |
| int | SaigeGetInferenceResultClassActivationMap (SaigeInferenceResult result, unsigned char ** classActivationMap) (CLS) Retrieves the class activation map array. |
| int | SaigeGetInferenceResultNumOfDetectedObjects (SaigeInferenceResult result, int * numOfObjects) (DET) Retrieves the number of detected objects from Object Detection. |
| int | SaigeGetInferenceResultDetectedObjects (SaigeInferenceResult result, SaigeDetectedObject * detectedObjects) (DET) Retrieves an array of detected objects from Object Detection. |
| int | SaigeGetInferenceResultNumOfSegmentedObjects (SaigeInferenceResult result, int * num) Retrieves the number of segmented objects detected by Segmentation (SEG) or Anomaly Detection (IAD). |
| int | SaigeGetInferenceResultSegmentedObjects (SaigeInferenceResult result, SaigeSegmentedObject * segObjects) Retrieves an array of segmented objects detected by Segmentation (SEG) or Anomaly Detection (IAD). |
| int | SaigeGetInferenceResultMask (SaigeInferenceResult result, unsigned char ** mask) Retrieves a Mask array from Segmentation (SEG) or Anomaly Detection (IAD). |
| int | SaigeGetInferenceResultScoremapSEG (SaigeInferenceResult result, unsigned char ** scoremap) Retrieves the Scoremap array for Segmentation (SEG). |
| int | SaigeGetInferenceResultIsOversized (SaigeInferenceResult result, bool * isOversized) Checks if the input image size exceeded the inspection size set in SaigeHandleConfig. |
| int | SaigeGetInferenceResultAnomalyScores (SaigeInferenceResult result, double * anomalyScore, double * minScore, double * maxScore) Retrieves three types of scores for Anomaly Detection (IAD). |
| int | SaigeGetInferenceResultIsNg (SaigeInferenceResult result, bool * isNg) Retrieves the normal/abnormal classification result for the image in Anomaly Detection (IAD). |
| int | SaigeGetInferenceResultScoremapIAD (SaigeInferenceResult result, float ** scoremap) Retrieves the Scoremap array for Anomaly Detection (IAD). |
| int | SaigeGetInferenceResultHeatmap (SaigeInferenceResult result, float ** heatmap) SaigeGetInferenceResultHeatmap. |
| int | SaigeGetInferenceResultNumOfTextObjects (SaigeInferenceResult result, int * num) SaigeGetInferenceResultNumOfTextObjects. |
| int | SaigeGetInferenceResultEnhancedImage (SaigeInferenceResult result, unsigned char ** image) SaigeGetInferenceResultEnhancedImage. |
| int | SaigeGetInferenceResultTextObjects (SaigeInferenceResult result, SaigeTextObject * textObjects) SaigeGetInferenceResultTextObjects. |
| int | SaigeGetInferenceResultInspectionTime (SaigeInferenceResult result, long long * imreadTime, long long * inferenceTime, long long * postProcessingTime) SaigeGetInferenceResultInspectionTime. |
| int | SaigeGetInferenceResultProductId (SaigeInferenceResult result, const char ** productId, unsigned int * length) SaigeGetInferenceResultProductId. |
Public Functions Documentation¶
SaigeGetInferenceResultScore¶
(CLS) Retrieves an array of scores per class.
int SaigeGetInferenceResultScore (
SaigeInferenceResult result,
float * scores,
bool includeAddScore
)
Parameters:
resultThe result handle containing inference results.scores[out] Array containing scores for each class.includeAddScoreIf set totrue, retrieves scores including additional scores. iffalse, retrieves original scores only.
Returns:
errorCode Returns 0 on success, or an error code if there is a failure.
SaigeGetInferenceResultClass¶
(CLS) Retrieves the index of the class with the highest final score, including additional score.
int SaigeGetInferenceResultClass (
SaigeInferenceResult result,
int * classIndex
)
Parameters:
resultThe result handle containing inference results.classIndex[out] Index of the class with the highest score.
Returns:
errorCode Returns 0 on success, or an error code if there is a failure.
SaigeGetInferenceResultClassActivationMap¶
(CLS) Retrieves the class activation map array.
int SaigeGetInferenceResultClassActivationMap (
SaigeInferenceResult result,
unsigned char ** classActivationMap
)
- The class activation map is a heatmap that shows which image areas contributed most to a specific classification.
- Pixel values range from 0 to 255, with higher values indicating a greater contribution to the classification result.
- Shape is (original image height
H, original image widthW). - Internally, this is represented as a 1D array using row-major order. The value at row
i, columnjis located atdata[W*i + j].
Parameters:
resultThe result handle containing inference results.classActivationMap[out] Array containing the class activation map.
Returns:
errorCode Returns 0 on success, or an error code if there is a failure.
SaigeGetInferenceResultNumOfDetectedObjects¶
(DET) Retrieves the number of detected objects from Object Detection.
int SaigeGetInferenceResultNumOfDetectedObjects (
SaigeInferenceResult result,
int * numOfObjects
)
Parameters:
resultThe result handle containing inference results.numOfObjects[out] The number of detected objects.
Returns:
errorCode Returns 0 on success, or an error code if there is a failure.
SaigeGetInferenceResultDetectedObjects¶
(DET) Retrieves an array of detected objects from Object Detection.
int SaigeGetInferenceResultDetectedObjects (
SaigeInferenceResult result,
SaigeDetectedObject * detectedObjects
)
Parameters:
resultThe result handle containing inference results.detectedObjects[out] Array of detected objects.
Returns:
errorCode Returns 0 on success, or an error code if there is a failure.
SaigeGetInferenceResultNumOfSegmentedObjects¶
Retrieves the number of segmented objects detected by Segmentation (SEG) or Anomaly Detection (IAD).
int SaigeGetInferenceResultNumOfSegmentedObjects (
SaigeInferenceResult result,
int * num
)
Parameters:
resultThe result handle containing inference results.num[out] The number of detected segmented objects.
Returns:
errorCode Returns 0 on success, or an error code if there is a failure.
SaigeGetInferenceResultSegmentedObjects¶
Retrieves an array of segmented objects detected by Segmentation (SEG) or Anomaly Detection (IAD).
int SaigeGetInferenceResultSegmentedObjects (
SaigeInferenceResult result,
SaigeSegmentedObject * segObjects
)
Parameters:
resultThe result handle containing inference results.segObjects[out] Array of detected segmented objects.
Returns:
errorCode Returns 0 on success, or an error code if there is a failure.
SaigeGetInferenceResultMask¶
Retrieves a Mask array from Segmentation (SEG) or Anomaly Detection (IAD).
int SaigeGetInferenceResultMask (
SaigeInferenceResult result,
unsigned char ** mask
)
- (IAD) Pixels classified as normal are 0, while those classified as abnormal are 1.
- (SEG) Pixels classified as
OKclass are 0, while those classified under other classes are represented by their class index. - The array shape is (image height
H, image widthW). - This is a single pointer 1D array with row-major order. For row
iand columnj, the value isdata[W*i + j].
Parameters:
resultThe result handle containing inference results.mask[out] The Mask array.
Returns:
errorCode Returns 0 on success, or an error code if there is a failure.
SaigeGetInferenceResultScoremapSEG¶
Retrieves the Scoremap array for Segmentation (SEG).
int SaigeGetInferenceResultScoremapSEG (
SaigeInferenceResult result,
unsigned char ** scoremap
)
- Scoremap for SEG, which differs from that of IAD.
- Shape is (number of classes including
OK, image heightH, image widthW). - If pixel
(i, j)is predicted as classc, then(c, i, j)contains the score as an integer in the range 0–255. - This is a single pointer 1D array with row-major order, where the value for class
c, rowi, columnjisdata[W*H*c + W*i + j].
Parameters:
resultThe result handle containing inference results.scoremap[out] The Scoremap array.
Returns:
errorCode Returns 0 on success, or an error code if there is a failure.
SaigeGetInferenceResultIsOversized¶
Checks if the input image size exceeded the inspection size set in SaigeHandleConfig.
int SaigeGetInferenceResultIsOversized (
SaigeInferenceResult result,
bool * isOversized
)
Parameters:
resultThe result handle containing inference results.isOversized[out]trueif the input image size exceeded the inspection size, otherwisefalse.
Returns:
errorCode Returns 0 on success, or an error code if there is a failure.
SaigeGetInferenceResultAnomalyScores¶
Retrieves three types of scores for Anomaly Detection (IAD).
int SaigeGetInferenceResultAnomalyScores (
SaigeInferenceResult result,
double * anomalyScore,
double * minScore,
double * maxScore
)
Parameters:
resultThe result handle containing inference results.anomalyScore[out] The representative anomaly score of the image.minScore[out] The minimum pixel-level score in the image.maxScore[out] The maximum pixel-level score in the image.
Returns:
errorCode Returns 0 on success, or an error code if there is a failure.
SaigeGetInferenceResultIsNg¶
Retrieves the normal/abnormal classification result for the image in Anomaly Detection (IAD).
int SaigeGetInferenceResultIsNg (
SaigeInferenceResult result,
bool * isNg
)
Parameters:
resultThe result handle containing inference results.isNg[out]trueif the image is classified as abnormal,falseif normal.
Returns:
errorCode Returns 0 on success, or an error code if there is a failure.
SaigeGetInferenceResultScoremapIAD¶
Retrieves the Scoremap array for Anomaly Detection (IAD).
int SaigeGetInferenceResultScoremapIAD (
SaigeInferenceResult result,
float ** scoremap
)
- Scoremap specific to IAD, different from SEG’s scoremap.
- Each pixel's score is represented as a non-negative floating-point number.
- The array shape is (image height
H, image widthW). - This is a single pointer 1D array with row-major order, where the value for row
iand columnjisdata[W*i + j].
Parameters:
resultThe result handle containing inference results.scoremap[out] The Scoremap array.
Returns:
errorCode Returns 0 on success, or an error code if there is a failure.
SaigeGetInferenceResultHeatmap¶
SaigeGetInferenceResultHeatmap.
int SaigeGetInferenceResultHeatmap (
SaigeInferenceResult result,
float ** heatmap
)
- Returns a Heatmap array that is normalized between
heatmapColorRangeMinandheatmapColorRangeMax. Each pixel value is represented as a floating-point number within the range 0 to 1. - The shape is (image height
H, image widthW). - Implemented as a single pointer 1D array in row-major order. Thus, the value at row
iand columnjisdata[W*i + j].
Parameters:
resultThe result handle containing inference results.heatmap[out] The Heatmap array.
Returns:
errorCode Returns 0 on success, or an error code if there is a failure.
SaigeGetInferenceResultNumOfTextObjects¶
SaigeGetInferenceResultNumOfTextObjects.
int SaigeGetInferenceResultNumOfTextObjects (
SaigeInferenceResult result,
int * num
)
Retrieves the number of detected text areas in the image analyzed by OCR.
Parameters:
resultThe handle containing inference results.num[out] The number of detected text areas.
Returns:
errorCode Returns 0 on successful execution, or an error code if an error occurs.
SaigeGetInferenceResultEnhancedImage¶
SaigeGetInferenceResultEnhancedImage.
int SaigeGetInferenceResultEnhancedImage (
SaigeInferenceResult result,
unsigned char ** image
)
Retrieves the enhanced quality image for Image Enhancement (IEN) results.
Parameters:
resultThe handle containing inference results.image[out] The pointer to store the enhanced image data.
Returns:
errorCode Returns 0 on successful execution, or an error code if an error occurs.
SaigeGetInferenceResultTextObjects¶
SaigeGetInferenceResultTextObjects.
int SaigeGetInferenceResultTextObjects (
SaigeInferenceResult result,
SaigeTextObject * textObjects
)
Retrieves an array of detected text areas (SaigeTextObject) from OCR inference results.
Parameters:
resultThe handle containing inference results.textObjects[out] The output array of SaigeTextObject structures. This array should be allocated with at least the number of elements returned by SaigeGetInferenceResultNumOfTextObjects.
Returns:
errorCode Returns 0 on successful execution, or an error code if an error occurs.
SaigeGetInferenceResultInspectionTime¶
SaigeGetInferenceResultInspectionTime.
int SaigeGetInferenceResultInspectionTime (
SaigeInferenceResult result,
long long * imreadTime,
long long * inferenceTime,
long long * postProcessingTime
)
Retrieves the time spent on various stages of the inference API execution, measured in milliseconds.
Parameters:
resultThe handle containing inference results.imreadTime[out] Time spent reading the image.inferenceTime[out] Time spent on image preprocessing and deep learning inference.postProcessingTime[out] Time spent on post-processing.
Returns:
errorCode Returns 0 on successful execution, or an error code if an error occurs.
See also: SaigeInferenceOption::calcTime
SaigeGetInferenceResultProductId¶
SaigeGetInferenceResultProductId.
int SaigeGetInferenceResultProductId (
SaigeInferenceResult result,
const char ** productId,
unsigned int * length
)
Retrieves the Product ID used or generated during inference execution.
Parameters:
resultThe handle containing inference results.productId[out] Pointer to the Product ID string.length[out] Length of the Product ID string.
Returns:
errorCode Returns 0 on successful execution, or an error code if an error occurs.
See also: SaigeInferFromByteArrayWithProductId