Skip to content

SaigeInferenceOption

  • #include <SaigeVisionAPI.h>

inference options struct

Public Attributes

Type Name
bool calcTime
(Common) Determines whether to display detailed timings for the inference API execution.
int batchSize
(Common) The number of images processed in one inference execution. This can only be set via SaigeHandleConfig when creating the inference handle.
const char * oversizedImageHandling
(SEG, IEN) Specifies how to handle images larger than the inspection size set in SaigeHandleConfig. Segmentation supports SAIGE_DO_NOT_INSPECT, SAIGE_RESIZE_TO_FIT, and SAIGE_CROP_INTO_TILES options. Image Enhancement supports SAIGE_DO_NOT_ENHANCE and SAIGE_CROP_INTO_TILES options.
int inspectionSizeWidth
(SEG, OCR, IEN) The width of the image used for inference. This can only be set via SaigeHandleConfig when creating the inference handle.
int inspectionSizeHeight
(SEG, OCR, IEN) The height of the image used for inference. This can only be set via SaigeHandleConfig when creating the inference handle.
float[ ] additionalScores
(CLS) The additional score values for each class. The value set at the nth index grants an additional score to the nth class.
bool calcClassActivationMap
(CLS) Calculates the class activation map if set to true during inference.
int[ ] maxNumOfDetectedObjects
(DET) Maximum number of detected objects to retrieve. If the number of detected objects exceeds this value, those with lower scores will be excluded from the final result.
bool calcScoremap
(SEG) Calculates the scoremap if set to true during inference.
bool calcObject
(SEG, IAD) Calculates segmented objects if set to true during inference.
bool calcObjectAreaAndApplyThreshold
(SEG, IAD) Calculates the area of segmented objects if set to true. Segmented objects with an area smaller than the object area threshold are excluded from the final result.
bool calcObjectScoreAndApplyThreshold
(SEG, IAD) Calculates the score of segmented objects if set to true. Segmented objects with a score lower than the object score threshold are excluded from the final result.
int[ ] objectBoundaryThresholdPerClass
(SEG) Object boundary threshold values per class. The larger the value at index n, the narrower the boundary of the mask and segmented object for class n.
int[ ] objectAreaThresholdPerClass
(SEG, DET) Object area threshold values per class. Objects detected as class n with an area smaller than this value are excluded from the final result.
double[ ] objectScoreThresholdPerClass
(SEG, DET) Object score threshold values per class. Objects detected as class n with a score lower than this value are excluded from the final result.
bool calcMask
(SEG, IAD) Calculates a mask of the same size as the original image if set to true during inference.
bool calcHeatmap
(IAD) Calculates a heatmap of the same size as the original image if set to true during inference.
double anomalyScoreThreshold
(IAD) If the score is greater than this value, the image is considered anomalous. Otherwise, it is considered normal. The optimal value found during training is set as the default.
double heatmapColorRangeMin
(IAD) When calculating the heatmap, pixels with scores lower than this value are clipped. The optimal value found during training is set as the default.
double heatmapColorRangeMax
(IAD) When calculating the heatmap, pixels with scores higher than this value are clipped. The optimal value found during training is set as the default.
double objectBoundaryThreshold
(IAD) The larger the value, the narrower the boundary of the mask and segmented object.
int objectAreaThreshold
(IAD) Segmented objects with an area smaller than this value are excluded from the final result.
double objectScoreThreshold
(IAD) Segmented objects with a score lower than this value are excluded from the final result.
double polygonScoreThreshold
(OCR) If the polygon score of a detected text area is lower than this value, it is excluded from the final result.
int textSizeRangeMin
(OCR) Minimum valid size for the detected text area. Text areas smaller than this value are excluded from the final result.
int textSizeRangeMax
(OCR) Maximum valid size for the detected text area. Text areas larger than this value are excluded from the final result.
int maxNumOfTextObjects
(OCR) Maximum number of text objects that can be detected at once. A value of 0 or lower indicates no limit.
double textScoreThreshold
(OCR) If the text score of a recognized text object is lower than this value, it is excluded from the final result.
SaigeTextFormatting textFormatting
(OCR) Option to specify the format of the text to be recognized.

Public Attributes Documentation

calcTime

(Common) Determines whether to display detailed timings for the inference API execution.

bool calcTime;

  • When set to true, you can view the time taken for image reading, deep learning inference, and post-processing separately.
  • When set to false, only the total time for inference API execution is displayed.
  • In the Image Enhancement feature, post-processing time is not measured separately.

Warning

Setting this to true may slow down overall inference time. It is recommended to set this to false for actual inspections.

See also: SaigeGetInferenceResultInspectionTime, SAIGE_SET_CALC_TIME

batchSize

(Common) The number of images processed in one inference execution. This can only be set via SaigeHandleConfig when creating the inference handle.

int batchSize;

See also: SaigeHandleConfig.batchSize

oversizedImageHandling

(SEG, IEN) Specifies how to handle images larger than the inspection size set in SaigeHandleConfig. Segmentation supports SAIGE_DO_NOT_INSPECT, SAIGE_RESIZE_TO_FIT, and SAIGE_CROP_INTO_TILES options. Image Enhancement supports SAIGE_DO_NOT_ENHANCE and SAIGE_CROP_INTO_TILES options.

const char * oversizedImageHandling;

Option Description
SAIGE_DO_NOT_INSPECT Inference is not performed, and an error is raised.
SAIGE_DO_NOT_ENHANCE Inference is not performed, and an error is raised.
SAIGE_RESIZE_TO_FIT Resizes the image, maintaining the aspect ratio,

so that it does not exceed the inspection size, then performs inference. SAIGE_CROP_INTO_TILES | Crops the image into patches based on the inspection size, performs inference on each patch, and combines the results.

See also: SaigeHandleConfig.inspectionSizeWidth, SaigeHandleConfig.inspectionSizeHeight

inspectionSizeWidth

(SEG, OCR, IEN) The width of the image used for inference. This can only be set via SaigeHandleConfig when creating the inference handle.

int inspectionSizeWidth;

See also: SaigeHandleConfig.inspectionSizeWidth

inspectionSizeHeight

(SEG, OCR, IEN) The height of the image used for inference. This can only be set via SaigeHandleConfig when creating the inference handle.

int inspectionSizeHeight;

See also: SaigeHandleConfig.inspectionSizeHeight

additionalScores

(CLS) The additional score values for each class. The value set at the nth index grants an additional score to the nth class.

float[] additionalScores;

Each additional score value must be a floating-point number between 0 and 100.

See also: SaigeGetInferenceResultScore

calcClassActivationMap

(CLS) Calculates the class activation map if set to true during inference.

bool calcClassActivationMap;

Warning

Setting this to true will slow down the overall inference time and disable inference optimization. It is recommended to set this to false for actual inspections.

See also: SaigeGetInferenceResultClassActivationMap

maxNumOfDetectedObjects

(DET) Maximum number of detected objects to retrieve. If the number of detected objects exceeds this value, those with lower scores will be excluded from the final result.

int[] maxNumOfDetectedObjects;

See also: SAIGE_SET_MAX_NUM_OF_DETECTED_OBJECTS

calcScoremap

(SEG) Calculates the scoremap if set to true during inference.

bool calcScoremap;

See also: SaigeGetInferenceResultScoremapSEG, SAIGE_SET_CALC_SCOREMAP

calcObject

(SEG, IAD) Calculates segmented objects if set to true during inference.

bool calcObject;

See also: SaigeSegmentedObject, SAIGE_SET_CALC_OBJECT

calcObjectAreaAndApplyThreshold

(SEG, IAD) Calculates the area of segmented objects if set to true. Segmented objects with an area smaller than the object area threshold are excluded from the final result.

bool calcObjectAreaAndApplyThreshold;

See also: SaigeSegmentedObject::area, SAIGE_SET_CALC_OBJECT_AREA_AND_APPLY_THRESHOLD

calcObjectScoreAndApplyThreshold

(SEG, IAD) Calculates the score of segmented objects if set to true. Segmented objects with a score lower than the object score threshold are excluded from the final result.

bool calcObjectScoreAndApplyThreshold;

See also: SaigeSegmentedObject::score, SAIGE_SET_CALC_OBJECT_SCORE_AND_APPLY_THRESHOLD

objectBoundaryThresholdPerClass

(SEG) Object boundary threshold values per class. The larger the value at index n, the narrower the boundary of the mask and segmented object for class n.

int[] objectBoundaryThresholdPerClass;

  • The value at index 0 corresponds to the OK class, has no effect, and cannot be set.
  • Valid only when calcObject is set to true.

See also: SaigeSegmentedObject, SaigeDrawSegmentedObjects, SAIGE_SET_OBJECT_BOUNDARY_THRESHOLD

objectAreaThresholdPerClass

(SEG, DET) Object area threshold values per class. Objects detected as class n with an area smaller than this value are excluded from the final result.

int[] objectAreaThresholdPerClass;

  • Applies to segmented objects in SEG and detected objects in DET.
  • The value at index 0 corresponds to the OK class, has no effect, and cannot be set.
  • Valid only when calcObject is set to true in SEG.

See also: SAIGE_SET_OBJECT_AREA_THRESHOLD

objectScoreThresholdPerClass

(SEG, DET) Object score threshold values per class. Objects detected as class n with a score lower than this value are excluded from the final result.

double[] objectScoreThresholdPerClass;

  • Applies to segmented objects in SEG and detected objects in DET.
  • Score range for segmented objects is 0 to 255, and for detected objects, it is 0 to 100.
  • The value at index 0 corresponds to the OK class, has no effect, and cannot be set.
  • Valid only when calcObject is set to true in SEG.

See also: SAIGE_SET_OBJECT_SCORE_THRESHOLD

calcMask

(SEG, IAD) Calculates a mask of the same size as the original image if set to true during inference.

bool calcMask;

See also: SaigeGetInferenceResultMask, SAIGE_SET_CALC_MASK

calcHeatmap

(IAD) Calculates a heatmap of the same size as the original image if set to true during inference.

bool calcHeatmap;

See also: SaigeGetInferenceResultHeatmap, SAIGE_SET_CALC_HEATMAP

anomalyScoreThreshold

(IAD) If the score is greater than this value, the image is considered anomalous. Otherwise, it is considered normal. The optimal value found during training is set as the default.

double anomalyScoreThreshold;

See also: SaigeGetInferenceResultAnomalyScores, SAIGE_SET_ANOMALY_SCORE_THRESHOLD

heatmapColorRangeMin

(IAD) When calculating the heatmap, pixels with scores lower than this value are clipped. The optimal value found during training is set as the default.

double heatmapColorRangeMin;

See also: SaigeGetInferenceResultHeatmap, SaigeDrawHeatmap, SAIGE_SET_HEATMAP_COLOR_RANGE

heatmapColorRangeMax

(IAD) When calculating the heatmap, pixels with scores higher than this value are clipped. The optimal value found during training is set as the default.

double heatmapColorRangeMax;

See also: SaigeGetInferenceResultHeatmap, SaigeDrawHeatmap, SAIGE_SET_HEATMAP_COLOR_RANGE

objectBoundaryThreshold

(IAD) The larger the value, the narrower the boundary of the mask and segmented object.

double objectBoundaryThreshold;

  • When calculating the mask, pixels with scores above this threshold are set to 1, and those below are set to 0.
  • Valid only when calcObject is set to true.

See also: SaigeSegmentedObject, SaigeDrawSegmentedObjects, SAIGE_SET_OBJECT_BOUNDARY_THRESHOLD

objectAreaThreshold

(IAD) Segmented objects with an area smaller than this value are excluded from the final result.

int objectAreaThreshold;

  • Valid only when calcObject is set to true.

See also: SaigeSegmentedObject::area, SaigeGetInferenceResultSegmentedObjects, SAIGE_SET_OBJECT_AREA_THRESHOLD

objectScoreThreshold

(IAD) Segmented objects with a score lower than this value are excluded from the final result.

double objectScoreThreshold;

  • Valid only when calcObject is set to true.

See also: SaigeSegmentedObject::score, SaigeGetInferenceResultSegmentedObjects, SAIGE_SET_OBJECT_SCORE_THRESHOLD

polygonScoreThreshold

(OCR) If the polygon score of a detected text area is lower than this value, it is excluded from the final result.

double polygonScoreThreshold;

See also: SaigeTextObject

textSizeRangeMin

(OCR) Minimum valid size for the detected text area. Text areas smaller than this value are excluded from the final result.

int textSizeRangeMin;

See also: SaigeTextObject

textSizeRangeMax

(OCR) Maximum valid size for the detected text area. Text areas larger than this value are excluded from the final result.

int textSizeRangeMax;

See also: SaigeTextObject

maxNumOfTextObjects

(OCR) Maximum number of text objects that can be detected at once. A value of 0 or lower indicates no limit.

int maxNumOfTextObjects;

See also: SaigeTextObject

textScoreThreshold

(OCR) If the text score of a recognized text object is lower than this value, it is excluded from the final result.

double textScoreThreshold;

See also: SaigeTextObject

textFormatting

(OCR) Option to specify the format of the text to be recognized.

SaigeTextFormatting textFormatting;

See also: SaigeTextFormatting