SaigeVision C/C++  1.4.7
SaigeVision API document for C/C++
ClassifierTestDLL.h
Go to the documentation of this file.
1 
4 #pragma once
5 
6 #ifdef __linux__
7  #define DLLTYPE_CLASSIFICATION
8 #elif _WIN32
9  #ifdef DLLEXPORT_CLASSIFICATION
10  #define DLLTYPE_CLASSIFICATION extern "C" __declspec(dllexport)
11  #else
12  #define DLLTYPE_CLASSIFICATION extern "C" __declspec(dllimport)
13  #endif
14 #endif
15 
16 #include "CommonHeaderDLL.h"
17 
56 typedef void* ClsTestHandle;
71 typedef void* ClsTestResult;
72 
79 DLLTYPE_CLASSIFICATION ClsTestHandle SR_CreateClsTestHandle(const char* filePath);
80 
87 DLLTYPE_CLASSIFICATION ClsTestHandle SR_CreateClsTestHandleByWideCharPath(const wchar_t* filePath);
88 
92 DLLTYPE_CLASSIFICATION ClsTestResult SR_MakeClsTestResult();
105  int GPUNumber,
106  int batchSize = 1);
107 
110  eAlgorithmType* algoType);
111 
113 DLLTYPE_CLASSIFICATION eErrorType SR_PrintClsTestParameters(ClsTestHandle handle);
114 
150  int* numberOfClasses);
151 
157  int* len);
158 
165  const int classIdx,
166  wchar_t* className);
167 
174  const int classIdx,
175  char* className);
176 
183  const int classIdx,
184  int* classColor);
189  int* height,
190  int* width);
191 
211  int* additionalScores);
212 
220  int numOfClasses,
221  int* additionalScores,
222  bool writeOnModelFile = true);
238  float* forwardTimeLimit); /* milliseconds */
239 
246  bool* bIsToUseForwardTimeLimit);
247 
257  float* forwardTimeLimit, /* milliseconds */
258  bool* bIsToUseForwardTimeLimit);
259 
267  float forwardTimeLimit, /* milliseconds */
268  bool writeOnModelFile = true);
269 
277  bool bIsToUseForwardTimeLimit,
278  bool writeOnModelFile = true);
279 
290  float forwardTimeLimit, /* milliseconds */
291  bool bIsToUseForwardTimeLimit,
292  bool writeOnModelFile = true);
325  const char* imagePath,
326  ClsTestResult clsTestResult);
333  const wchar_t* imagePath,
334  ClsTestResult clsTestResult);
343  const unsigned char* imageData,
344  const int height,
345  const int width,
346  ClsTestResult clsTestResult);
355  const unsigned char* imageData,
356  const int height,
357  const int width,
358  ClsTestResult clsTestResult);
367  const unsigned int* imageData,
368  const int height,
369  const int width,
370  ClsTestResult clsTestResult);
380  int numberOfImages,
381  unsigned char** imageData,
382  int* heights,
383  int* widths,
384  ClsTestResult* clsTestResults);
394  int numberOfImages,
395  unsigned char** imageData,
396  int* heights,
397  int* widths,
398  ClsTestResult* clsTestResults);
399 
409  int numberOfImages,
410  unsigned int** imageData,
411  int* heights,
412  int* widths,
413  ClsTestResult* clsTestResults);
414 
422  int numberOfObjects,
423  SR_SegmentedObject* segmentedObjects,
424  ClsTestResult* clsTestResults);
462 DLLTYPE_CLASSIFICATION eErrorType SR_GetClsTestResultScore(ClsTestResult clsTestResult,
463  const int numClasses,
464  int* scores,
465  bool includeAddScore = false);
466 
471 DLLTYPE_CLASSIFICATION eErrorType SR_GetClsTestResultClass(ClsTestResult clsTestResult,
472  int* classIdx);
473 
478 DLLTYPE_CLASSIFICATION eErrorType SR_GetClsTestInspectionTime(ClsTestResult clsTestResult,
479  long* inspectionTimeInLong); /* milliseconds */
484 DLLTYPE_CLASSIFICATION eErrorType SR_GetClsTestInspectionTimeInDouble(ClsTestResult clsTestResult,
485  double* inspectionTimeInDouble); /* milliseconds */
486 
491 DLLTYPE_CLASSIFICATION eErrorType SR_GetClsTestLoadImageTime(ClsTestResult clsTestResult,
492  long* imageLoadingTimeInLong); /* milliseconds */
497 DLLTYPE_CLASSIFICATION eErrorType SR_GetClsTestLoadImageTimeInDouble(ClsTestResult clsTestResult,
498  double* imageLoadingTimeInDouble); /* milliseconds */
508 DLLTYPE_CLASSIFICATION eErrorType SR_DestroyClsTestHandle(ClsTestHandle handle);
509 
511 DLLTYPE_CLASSIFICATION eErrorType SR_DeleteClsTestResult(ClsTestResult clsTestResult);
519 
522 
523 /***********************************************************
524 * For SaigeVision software
525 ***********************************************************/
526 /* Apply classification algorithms to a single image via multi byte char path.
527 * Users can get an activation map after apply this function.
528 */
529 DLLTYPE_CLASSIFICATION eErrorType SR_ApplyClsTestFromImageFileWithActivationMap(ClsTestHandle handle,
530  const char* imagePath,
531  ClsTestResult clsTestResultOutput);
532 
533 /* Apply classification algorithms to a single image via wide char path.
534 * Users can get an activation map after apply this function.
535 */
536 DLLTYPE_CLASSIFICATION eErrorType SR_ApplyClsTestFromImageFileWithActivationMapByWideCharPath(ClsTestHandle handle,
537  const wchar_t* imagePath,
538  ClsTestResult clsTestResultOutput);
539 
540 /* Get the shape (width, height) of the activation map*/
541 DLLTYPE_CLASSIFICATION eErrorType SR_GetClsTestActivationMapShape(ClsTestHandle handle,
542  int* activationMapWidthOutput,
543  int* activationMapHeightOutput);
544 
545 /* Get the float pointer of the activation map*/
546 DLLTYPE_CLASSIFICATION eErrorType SR_GetClsTestActivationMap(ClsTestHandle handle,
547  float* activationMapOutput);
548 
549 
550 #ifdef SR_USE_DEPRECATED_FUNCTIONS
551 /***********************************************************
552 * These functions will be deprecated in version 2.0.0
553 ***********************************************************/
554 /* This function behaves identically with SR_GetClsTestOneClassNameWithWideChar*/
555 DLLTYPE_CLASSIFICATION eErrorType SR_GetClsTestOneClassName(ClsTestHandle handle, const int index, wchar_t* classNameOutput);
556 
557 /* This function behaves identically with SR_GetClsTestOneClassNameWithMultiByteChar*/
558 DLLTYPE_CLASSIFICATION eErrorType SR_GetClsTestOneClassNameWith1byteCharacter(ClsTestHandle handle, const int index, char* classNameOutput);
559 #endif
SR_DestroyClsTestHandle
eErrorType SR_DestroyClsTestHandle(ClsTestHandle handle)
Destruct a ClsTestHandle.
ClsTestHandle
void * ClsTestHandle
Classification file handler.
Definition: ClassifierTestDLL.h:56
SR_GetClsTestOneClassNameWithWideChar
eErrorType SR_GetClsTestOneClassNameWithWideChar(ClsTestHandle handle, const int classIdx, wchar_t *className)
Get a wide char name of certain class by given index.
SR_GetClsTestOneClassColor
eErrorType SR_GetClsTestOneClassColor(ClsTestHandle handle, const int classIdx, int *classColor)
Get a color of certain class by given index.
SR_GetClsTestInspectionTimeInDouble
eErrorType SR_GetClsTestInspectionTimeInDouble(ClsTestResult clsTestResult, double *inspectionTimeInDouble)
Get the inspection time.
eAlgorithmType
eAlgorithmType
Enumerator indicating a type of model.
Definition: CommonHeaderDLL.h:49
SR_CreateClsTestHandleByWideCharPath
ClsTestHandle SR_CreateClsTestHandleByWideCharPath(const wchar_t *filePath)
Create a ClsTestHandle via wide char path.
SR_CreateClsTestHandle
ClsTestHandle SR_CreateClsTestHandle(const char *filePath)
Create a ClsTestHandle via multi byte char path.
SR_GetClsTestNumberOfClasses
eErrorType SR_GetClsTestNumberOfClasses(ClsTestHandle handle, int *numberOfClasses)
Get the number of classes.
SR_SetClsTestAdditionalScore
eErrorType SR_SetClsTestAdditionalScore(ClsTestHandle handle, int numOfClasses, int *additionalScores, bool writeOnModelFile=true)
Set Additional scores.
SR_GetClsTestOneClassNameWithMultiByteChar
eErrorType SR_GetClsTestOneClassNameWithMultiByteChar(ClsTestHandle handle, const int classIdx, char *className)
Get a multi byte char name of certain class by given index.
SR_SegmentedObject
Struct describing features of a segmentation object.
Definition: CommonHeaderDLL.h:108
SR_GetClsTestMedianImageSize
eErrorType SR_GetClsTestMedianImageSize(ClsTestHandle handle, int *height, int *width)
Get the median value of image sizes used for training.
SR_GetClsTestResultScore
eErrorType SR_GetClsTestResultScore(ClsTestResult clsTestResult, const int numClasses, int *scores, bool includeAddScore=false)
Get scores for each class.
SR_ApplyClsTestFromMultiple8bitCharColorArrays
eErrorType SR_ApplyClsTestFromMultiple8bitCharColorArrays(ClsTestHandle handle, int numberOfImages, unsigned char **imageData, int *heights, int *widths, ClsTestResult *clsTestResults)
Apply classification algorithm to 3-channels(BGR) images by 8-bit data (Batch inspection mode).
SR_GetClsTestLoadImageTimeInDouble
eErrorType SR_GetClsTestLoadImageTimeInDouble(ClsTestResult clsTestResult, double *imageLoadingTimeInDouble)
Get the image loading time.
SR_ApplyClsTestFromMultipleUnsignedIntColorArrays
eErrorType SR_ApplyClsTestFromMultipleUnsignedIntColorArrays(ClsTestHandle handle, int numberOfImages, unsigned int **imageData, int *heights, int *widths, ClsTestResult *clsTestResults)
Apply classification algorithm to 4-channels(BGRA) images by 8-bit data (Batch inspection mode).
SR_GetClsTestAlgorithmType
eErrorType SR_GetClsTestAlgorithmType(ClsTestHandle handle, eAlgorithmType *algoType)
Get a algorithm type(ex, standard, deep) of a classification model.
SR_LoadClsTestNetworkInGPU
eErrorType SR_LoadClsTestNetworkInGPU(ClsTestHandle handle, int GPUNumber, int batchSize=1)
Allocate required cpu & gpu memory.
SR_GetClsTestMaxStrLenOfClassName
eErrorType SR_GetClsTestMaxStrLenOfClassName(ClsTestHandle handle, int *len)
Get a maximum length of class name.
SR_DeleteClsTestResult
eErrorType SR_DeleteClsTestResult(ClsTestResult clsTestResult)
Destruct a ClsTestResult.
SR_SetClsTestIsToUseForwardTimeLimit
eErrorType SR_SetClsTestIsToUseForwardTimeLimit(ClsTestHandle handle, bool bIsToUseForwardTimeLimit, bool writeOnModelFile=true)
Set the boolean whether the current model is using time limit or not.
SR_ApplyClsTestFrom8bitCharGrayArray
eErrorType SR_ApplyClsTestFrom8bitCharGrayArray(ClsTestHandle handle, const unsigned char *imageData, const int height, const int width, ClsTestResult clsTestResult)
Apply classification algorithm to 1-channel image by 8-bit data.
SR_MakeClsTestResult
ClsTestResult SR_MakeClsTestResult()
Construct a ClsTestResult.
SR_ApplyClsTestFromImageFile
eErrorType SR_ApplyClsTestFromImageFile(ClsTestHandle handle, const char *imagePath, ClsTestResult clsTestResult)
Apply classification algorithm to image by file path.
SR_GetClsTestForwardTimeLimitVariables
eErrorType SR_GetClsTestForwardTimeLimitVariables(ClsTestHandle handle, float *forwardTimeLimit, bool *bIsToUseForwardTimeLimit)
Get the Forward time limit variables.
SR_ApplyClsTestFromUnsignedIntColorArray
eErrorType SR_ApplyClsTestFromUnsignedIntColorArray(ClsTestHandle handle, const unsigned int *imageData, const int height, const int width, ClsTestResult clsTestResult)
Apply classification algorithm to 4-channels(BGRA) image by 8-bit data.
SR_SetClsTestForwardTimeLimit
eErrorType SR_SetClsTestForwardTimeLimit(ClsTestHandle handle, float forwardTimeLimit, bool writeOnModelFile=true)
Set the Forward time limit.
SR_GetClsTestInspectionTime
eErrorType SR_GetClsTestInspectionTime(ClsTestResult clsTestResult, long *inspectionTimeInLong)
Get the inspection time.
SR_ApplyClsTestFromSegmentedObjects
eErrorType SR_ApplyClsTestFromSegmentedObjects(ClsTestHandle handle, int numberOfObjects, SR_SegmentedObject *segmentedObjects, ClsTestResult *clsTestResults)
Apply classification algorithm to SR_SegmentedObject::croppedImage (Batch inspection mode).
SR_GetClsTestAdditionalScore
eErrorType SR_GetClsTestAdditionalScore(ClsTestHandle handle, int *additionalScores)
Get Additional scores.
SR_GetClsTestResultClass
eErrorType SR_GetClsTestResultClass(ClsTestResult clsTestResult, int *classIdx)
Get final class index.
SR_GetClsTestLoadImageTime
eErrorType SR_GetClsTestLoadImageTime(ClsTestResult clsTestResult, long *imageLoadingTimeInLong)
Get the image loading time.
CommonHeaderDLL.h
Header file for Commonly used variables.
SR_GetClsTestIsToUseForwardTimeLimit
eErrorType SR_GetClsTestIsToUseForwardTimeLimit(ClsTestHandle handle, bool *bIsToUseForwardTimeLimit)
Get the boolean whether the current model is using time limit or not.
SR_WriteClsTestOptionsOnModelFile
eErrorType SR_WriteClsTestOptionsOnModelFile(ClsTestHandle handle)
Write inspection options(Forward time limit, Additional scores) on model file.
SR_SetClsTestOptionsAsDefault
eErrorType SR_SetClsTestOptionsAsDefault(ClsTestHandle handle)
Reset inspection options(Forward time limit, Additional scores) as default values.
eErrorType
eErrorType
Enumerator indicating error codes.
Definition: CommonHeaderDLL.h:25
SR_PrintClsTestParameters
eErrorType SR_PrintClsTestParameters(ClsTestHandle handle)
Print a model parameters (Classification's class information, inspection options.....
SR_SetClsTestForwardTimeLimitVariables
eErrorType SR_SetClsTestForwardTimeLimitVariables(ClsTestHandle handle, float forwardTimeLimit, bool bIsToUseForwardTimeLimit, bool writeOnModelFile=true)
Set the Forward time limit variables.
SR_ApplyClsTestFrom8bitCharColorArray
eErrorType SR_ApplyClsTestFrom8bitCharColorArray(ClsTestHandle handle, const unsigned char *imageData, const int height, const int width, ClsTestResult clsTestResult)
Apply classification algorithm to 3-channels(BGR) image by 8-bit data.
SR_ApplyClsTestFromMultiple8bitCharGrayArrays
eErrorType SR_ApplyClsTestFromMultiple8bitCharGrayArrays(ClsTestHandle handle, int numberOfImages, unsigned char **imageData, int *heights, int *widths, ClsTestResult *clsTestResults)
Apply classification algorithm to 1-channel images by 8-bit data (Batch inspection mode).
SR_GetClsTestForwardTimeLimit
eErrorType SR_GetClsTestForwardTimeLimit(ClsTestHandle handle, float *forwardTimeLimit)
Get the Forward time limit.
SR_ApplyClsTestFromImageFileByWideCharPath
eErrorType SR_ApplyClsTestFromImageFileByWideCharPath(ClsTestHandle handle, const wchar_t *imagePath, ClsTestResult clsTestResult)
Apply classification algorithm to image by file path.
ClsTestResult
void * ClsTestResult
Classification inspection results handler.
Definition: ClassifierTestDLL.h:71