SaigeVision C/C++ 1.5.0
SaigeVision API document for C/C++
 
Loading...
Searching...
No Matches
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
56typedef void* ClsTestHandle;
71typedef void* ClsTestResult;
72
79DLLTYPE_CLASSIFICATION ClsTestHandle SR_CreateClsTestHandle(const char* filePath);
80
87DLLTYPE_CLASSIFICATION eErrorType SR_CreateClsTestHandle_ErrorType(ClsTestHandle* clsTestHandle, const char* filePath);
88
95DLLTYPE_CLASSIFICATION ClsTestHandle SR_CreateClsTestHandleByWideCharPath(const wchar_t* filePath);
96
103DLLTYPE_CLASSIFICATION eErrorType SR_CreateClsTestHandleByWideCharPath_ErrorType(ClsTestHandle* clsTestHandle, const wchar_t* filePath);
104
108DLLTYPE_CLASSIFICATION ClsTestResult SR_MakeClsTestResult();
109
114DLLTYPE_CLASSIFICATION eErrorType SR_MakeClsTestResult_ErrorType(ClsTestResult* clsTestResult);
127 int GPUNumber,
128 int batchSize = 1);
129
132 eAlgorithmType* algoType);
133
136
172 int* numberOfClasses);
173
179 int* len);
180
187 const int classIdx,
188 wchar_t* className);
189
196 const int classIdx,
197 char* className);
198
205 const int classIdx,
206 int* classColor);
207
215 int* trainedVersionMajor,
216 int* trainedVersionMinor,
217 int* trainedVersionPatch);
222 int* height,
223 int* width);
224
244 int* additionalScores);
245
253 int numOfClasses,
254 int* additionalScores,
255 bool writeOnModelFile = true);
270DLLTYPE_CLASSIFICATION eErrorType SR_GetClsTestIsToStoreActivationMap(ClsTestHandle handle, bool* isToStoreCam);
271
272DLLTYPE_CLASSIFICATION eErrorType SR_SetClsTestIsToStoreActivationMap(ClsTestHandle handle, bool isToStoreCam, bool writeOnModelFile = true);
273
289 float* forwardTimeLimit); /* milliseconds */
290
297 bool* bIsToUseForwardTimeLimit);
298
308 float* forwardTimeLimit, /* milliseconds */
309 bool* bIsToUseForwardTimeLimit);
310
318 float forwardTimeLimit, /* milliseconds */
319 bool writeOnModelFile = true);
320
328 bool bIsToUseForwardTimeLimit,
329 bool writeOnModelFile = true);
330
341 float forwardTimeLimit, /* milliseconds */
342 bool bIsToUseForwardTimeLimit,
343 bool writeOnModelFile = true);
376 const char* imagePath,
377 ClsTestResult clsTestResult);
384 const wchar_t* imagePath,
385 ClsTestResult clsTestResult);
394 const unsigned char* imageData,
395 const int height,
396 const int width,
397 ClsTestResult clsTestResult);
406 const unsigned char* imageData,
407 const int height,
408 const int width,
409 ClsTestResult clsTestResult);
418 const unsigned int* imageData,
419 const int height,
420 const int width,
421 ClsTestResult clsTestResult);
431 int numberOfImages,
432 unsigned char** imageData,
433 int* heights,
434 int* widths,
435 ClsTestResult* clsTestResults);
445 int numberOfImages,
446 unsigned char** imageData,
447 int* heights,
448 int* widths,
449 ClsTestResult* clsTestResults);
450
460 int numberOfImages,
461 unsigned int** imageData,
462 int* heights,
463 int* widths,
464 ClsTestResult* clsTestResults);
465
473 int numberOfObjects,
474 SR_SegmentedObject* segmentedObjects,
475 ClsTestResult* clsTestResults);
512DLLTYPE_CLASSIFICATION eErrorType SR_GetClsTestClassifiedResult(ClsTestResult clsTestResult, SR_ClassifiedResult* classifiedResult);
513
522DLLTYPE_CLASSIFICATION eErrorType SR_GetClsTestResultScore(ClsTestResult clsTestResult,
523 const int numClasses,
524 int* scores,
525 bool includeAddScore = false);
526
533DLLTYPE_CLASSIFICATION eErrorType SR_GetClsTestResultClass(ClsTestResult clsTestResult,
534 int* classIdx);
535
540DLLTYPE_CLASSIFICATION eErrorType SR_GetClsTestInspectionTime(ClsTestResult clsTestResult,
541 long* inspectionTimeInLong); /* milliseconds */
547 double* inspectionTimeInDouble); /* milliseconds */
548
553DLLTYPE_CLASSIFICATION eErrorType SR_GetClsTestLoadImageTime(ClsTestResult clsTestResult,
554 long* imageLoadingTimeInLong); /* milliseconds */
560 double* imageLoadingTimeInDouble); /* milliseconds */
570DLLTYPE_CLASSIFICATION eErrorType SR_GetClsTestROI(ClsTestResult clsTestResult,
571 int* xROI, int* yROI, int* wROI, int* hROI);
572
580DLLTYPE_CLASSIFICATION eErrorType SR_DestroyClsTestHandle(ClsTestHandle handle);
581
583DLLTYPE_CLASSIFICATION eErrorType SR_DeleteClsTestResult(ClsTestResult clsTestResult);
591
594
595/***********************************************************
596* For SaigeVision software
597***********************************************************/
598/* Apply classification algorithms to a single image via multi byte char path.
599* Users can get an activation map after apply this function.
600*/
601DLLTYPE_CLASSIFICATION eErrorType SR_ApplyClsTestFromImageFileWithActivationMap(ClsTestHandle handle,
602 const char* imagePath,
603 ClsTestResult clsTestResultOutput);
604
605/* Apply classification algorithms to a single image via wide char path.
606* Users can get an activation map after apply this function.
607*/
608DLLTYPE_CLASSIFICATION eErrorType SR_ApplyClsTestFromImageFileWithActivationMapByWideCharPath(ClsTestHandle handle,
609 const wchar_t* imagePath,
610 ClsTestResult clsTestResultOutput);
611
612// todo cam: 아래 두개 함수는 이 헤더파일에서 위치 옮겨야 하고 (지금은 for saigevision software 아래에 있음), 예제 파일에 쓰여야 함
613// 그리고,, input rect 받아오는 함수가 하나 있어야 함,, classifier 내부에서 저장도 해야 하고,,, (roi 적용돼서 실제로 검사에 사용된 x,y,w,h 리턴해주는 함수)
614
615/* Get the shape (width, height) of the activation map*/
616DLLTYPE_CLASSIFICATION eErrorType SR_GetClsTestActivationMapShape(ClsTestHandle handle,
617 int* activationMapWidthOutput,
618 int* activationMapHeightOutput);
619
620/* Get the float pointer of the activation map*/
621DLLTYPE_CLASSIFICATION eErrorType SR_GetClsTestActivationMap(ClsTestHandle handle,
622 float* activationMapOutput);
623
624
625#ifdef SR_USE_DEPRECATED_FUNCTIONS
626/***********************************************************
627* These functions will be deprecated in version 2.0.0
628***********************************************************/
629/* This function behaves identically with SR_GetClsTestOneClassNameWithWideChar*/
630DLLTYPE_CLASSIFICATION eErrorType SR_GetClsTestOneClassName(ClsTestHandle handle, const int index, wchar_t* classNameOutput);
631
632/* This function behaves identically with SR_GetClsTestOneClassNameWithMultiByteChar*/
633DLLTYPE_CLASSIFICATION eErrorType SR_GetClsTestOneClassNameWith1byteCharacter(ClsTestHandle handle, const int index, char* classNameOutput);
634#endif
eErrorType SR_GetClsTestMedianImageSize(ClsTestHandle handle, int *height, int *width)
Get the median value of image sizes used for training.
eErrorType SR_WriteClsTestOptionsOnModelFile(ClsTestHandle handle)
Write inspection options(Forward time limit, Additional scores) on model file.
eErrorType SR_GetClsTestAlgorithmType(ClsTestHandle handle, eAlgorithmType *algoType)
Get a algorithm type(ex, standard, deep) of a classification model.
eErrorType SR_PrintClsTestParameters(ClsTestHandle handle)
Print a model parameters (Classification's class information, inspection options.....
eErrorType SR_SetClsTestOptionsAsDefault(ClsTestHandle handle)
Reset inspection options(Forward time limit, Additional scores) as default values.
eErrorType SR_GetClsTestROI(ClsTestResult clsTestResult, int *xROI, int *yROI, int *wROI, int *hROI)
Get ROI.
Header file for Commonly used variables.
eAlgorithmType
Enumerator indicating a type of model.
Definition: CommonHeaderDLL.h:56
eErrorType
Enumerator indicating error codes.
Definition: CommonHeaderDLL.h:30
eErrorType SR_SetClsTestAdditionalScore(ClsTestHandle handle, int numOfClasses, int *additionalScores, bool writeOnModelFile=true)
Set Additional scores.
eErrorType SR_GetClsTestAdditionalScore(ClsTestHandle handle, int *additionalScores)
Get Additional scores.
eErrorType SR_GetClsTestOneClassColor(ClsTestHandle handle, const int classIdx, int *classColor)
Get a color of certain class by given index.
eErrorType SR_GetClsTrainedVersion(ClsTestHandle handle, int *trainedVersionMajor, int *trainedVersionMinor, int *trainedVersionPatch)
Get a trained version of model file, -1 means before v1.4.8.
eErrorType SR_GetClsTestOneClassNameWithWideChar(ClsTestHandle handle, const int classIdx, wchar_t *className)
Get a wide char name of certain class by given index.
eErrorType SR_GetClsTestMaxStrLenOfClassName(ClsTestHandle handle, int *len)
Get a maximum length of class name.
eErrorType SR_GetClsTestNumberOfClasses(ClsTestHandle handle, int *numberOfClasses)
Get the number of classes.
eErrorType SR_GetClsTestOneClassNameWithMultiByteChar(ClsTestHandle handle, const int classIdx, char *className)
Get a multi byte char name of certain class by given index.
eErrorType SR_GetClsTestForwardTimeLimitVariables(ClsTestHandle handle, float *forwardTimeLimit, bool *bIsToUseForwardTimeLimit)
Get the Forward time limit variables.
eErrorType SR_SetClsTestForwardTimeLimitVariables(ClsTestHandle handle, float forwardTimeLimit, bool bIsToUseForwardTimeLimit, bool writeOnModelFile=true)
Set the Forward time limit variables.
eErrorType SR_GetClsTestForwardTimeLimit(ClsTestHandle handle, float *forwardTimeLimit)
Get the Forward time limit.
eErrorType SR_SetClsTestIsToUseForwardTimeLimit(ClsTestHandle handle, bool bIsToUseForwardTimeLimit, bool writeOnModelFile=true)
Set the boolean whether the current model is using time limit or not.
eErrorType SR_GetClsTestIsToUseForwardTimeLimit(ClsTestHandle handle, bool *bIsToUseForwardTimeLimit)
Get the boolean whether the current model is using time limit or not.
eErrorType SR_SetClsTestForwardTimeLimit(ClsTestHandle handle, float forwardTimeLimit, bool writeOnModelFile=true)
Set the Forward time limit.
eErrorType SR_CreateClsTestHandle_ErrorType(ClsTestHandle *clsTestHandle, const char *filePath)
Create a ClsTestHandle via multi byte char path.
void * ClsTestHandle
Classification file handler.
Definition: ClassifierTestDLL.h:56
eErrorType SR_MakeClsTestResult_ErrorType(ClsTestResult *clsTestResult)
Construct a ClsTestResult.
eErrorType SR_CreateClsTestHandleByWideCharPath_ErrorType(ClsTestHandle *clsTestHandle, const wchar_t *filePath)
Create a ClsTestHandle via wide char path.
void * ClsTestResult
Classification inspection results handler.
Definition: ClassifierTestDLL.h:71
ClsTestResult SR_MakeClsTestResult()
Construct a ClsTestResult.
ClsTestHandle SR_CreateClsTestHandleByWideCharPath(const wchar_t *filePath)
Create a ClsTestHandle via wide char path.
ClsTestHandle SR_CreateClsTestHandle(const char *filePath)
Create a ClsTestHandle via multi byte char path.
eErrorType SR_DeleteClsTestResult(ClsTestResult clsTestResult)
Destruct a ClsTestResult.
eErrorType SR_DestroyClsTestHandle(ClsTestHandle handle)
Destruct a ClsTestHandle.
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.
eErrorType SR_ApplyClsTestFromImageFileByWideCharPath(ClsTestHandle handle, const wchar_t *imagePath, ClsTestResult clsTestResult)
Apply classification algorithm to image by file path.
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).
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).
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.
eErrorType SR_ApplyClsTestFromImageFile(ClsTestHandle handle, const char *imagePath, ClsTestResult clsTestResult)
Apply classification algorithm to image by file path.
eErrorType SR_ApplyClsTestFromSegmentedObjects(ClsTestHandle handle, int numberOfObjects, SR_SegmentedObject *segmentedObjects, ClsTestResult *clsTestResults)
Apply classification algorithm to SR_SegmentedObject::croppedImage (batch-inspection).
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).
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.
eErrorType SR_GetClsTestInspectionTime(ClsTestResult clsTestResult, long *inspectionTimeInLong)
Get the inspection time.
eErrorType SR_GetClsTestResultScore(ClsTestResult clsTestResult, const int numClasses, int *scores, bool includeAddScore=false)
Get scores for each class.
eErrorType SR_GetClsTestLoadImageTime(ClsTestResult clsTestResult, long *imageLoadingTimeInLong)
Get the image loading time.
eErrorType SR_GetClsTestLoadImageTimeInDouble(ClsTestResult clsTestResult, double *imageLoadingTimeInDouble)
Get the image loading time.
eErrorType SR_GetClsTestClassifiedResult(ClsTestResult clsTestResult, SR_ClassifiedResult *classifiedResult)
Get SR_ClassifiedResult.
eErrorType SR_GetClsTestInspectionTimeInDouble(ClsTestResult clsTestResult, double *inspectionTimeInDouble)
Get the inspection time.
eErrorType SR_GetClsTestResultClass(ClsTestResult clsTestResult, int *classIdx)
Get final class index.
eErrorType SR_LoadClsTestNetworkInGPU(ClsTestHandle handle, int GPUNumber, int batchSize=1)
Allocate required cpu & gpu memory.
Struct describing result of classification.
Definition: CommonHeaderDLL.h:289
Struct describing features of a segmentation object.
Definition: CommonHeaderDLL.h:122