SqueezeBrains SDK 1.18
cs_common.h
1#pragma once
2namespace sb_cs
3{
13 public enum class SbError :int {
168 //N.B. Fino a 251999 i codici di errore sono riservati ai socket SB_ERR_SOCKET_xxxxx
169 // Se si cambia modificare anche la funzione sb_err_socket
189 }; // group_cs_error
191
199 public ref class SbVersion {
200 public:
201 int major;
202 int minor;
203 int vminor;
209 String^ ToString() override;
210 internal:
211 SbVersion(const sb_t_version* const src);
212 SbError CopyFromNative(const sb_t_version* const version);
213 };
214
218 public enum class SbDeviceType :int
219 {
225 };
226
230 public enum class SbFrameworkType :int
231 {
236 };
237
241 public ref class SbCommon
242 {
243 public:
255 String^ ErrorMsg();
263 static String^ FormatError(SbError error);
264 internal:
266 };
267
271 public ref class SbTime
272 {
273 public:
278 signed long long Get();
283 void Set(signed long long sec);
290 String^ ToString() override;
291 SbTime();
296 SbTime(signed long long sec);
297 internal:
298 signed long long sec = 0;
299 };
300
308 public ref class SbDefines
309 {
310 public:
315 static const String^ SbSolutionExt = SB_SOLUTION_EXT;
340 static String^ SbDelimiter = SB_DELIMITER;
341 }; // group_cs_defines
343
344 sb_t_err sb_trace_printf(int type, int code, const char* p_file, const char* p_function, int line, const char* p_format, ...);
345 #define sb_trace_inf(p_format, ...) sb_trace_printf(0, 0, __FILE__, __FUNCTION__, __LINE__, p_format, ##__VA_ARGS__)
346 #define sb_trace_err(p_format, ...) sb_trace_printf(2, 0, __FILE__, __FUNCTION__, __LINE__, p_format, ##__VA_ARGS__)
347
348 #define CHECK_NULL_RETURN(ptr) { if (!(ptr)) { \
349 sb_trace_err("%s is NULL pointer", #ptr); \
350 return SbError::SB_ERR_NULL_POINTER; \
351 } \
352 }
353 #define CHECK_FN_RETURN_ERR(function){ SbError __err; \
354 __err = function; \
355 if (__err != SbError::SB_ERR_NONE) { \
356 sb_trace_err("%s failed, err=%d-\"%s\"", #function, __err, sb_err_format((sb_t_err)__err));\
357 return(__err); \
358 } \
359 }
360 #define CHECK_FN_RETURN_AND_SET_ERR(function){ SbError __err; \
361 __err = function; \
362 if (__err != SbError::SB_ERR_NONE) { \
363 sb_trace_err("%s failed, err=%d-\"%s\"", #function, __err, sb_err_format((sb_t_err)__err));\
364 error = __err; \
365 return(__err); \
366 } \
367 }
368 #define CHECK_FN_RETURN_NULL(function){ SbError __err; \
369 __err = function; \
370 if (__err != SbError::SB_ERR_NONE) { \
371 sb_trace_err("%s failed, err=%d-\"%s\"", #function, __err, sb_err_format((sb_t_err)__err));\
372 return(nullptr); \
373 } \
374 }
375 #define CHECK_FN_RETURN_NULL_AND_SET_ERR(function){ SbError __err; \
376 __err = function; \
377 if (__err != SbError::SB_ERR_NONE) { \
378 sb_trace_err("%s failed, err=%d-\"%s\"", #function, __err, sb_err_format((sb_t_err)__err));\
379 error = __err; \
380 return(nullptr); \
381 } \
382 }
383 // group_cs
385}
Common class
Definition: cs_common.h:242
String ErrorMsg()
Returns the error message of the last operation.
static String FormatError(SbError error)
Returns the error message.
SbError Error()
Returns the error code of the last operation. If no error SbError.SB_ERR_NONE is returned.
Defines class
Definition: cs_common.h:309
static int SbFrameworksMaxNumber
Maximum number of frameworks compatible with a device.
Definition: cs_common.h:335
static String SbDelimiter
Delimiter of the field in a string
Definition: cs_common.h:340
static const String SbDlPreTrainingExt
Extension of the Squeezebrains pre - trained network weights file
Definition: cs_common.h:320
static int SbDevicesMaxNumber
Maximum number of computational devices managed by the sb library.
Definition: cs_common.h:330
static const String SbSolutionExt
Solution file extension
Definition: cs_common.h:315
static float SbValueNotSet
Value of the prediction in case it is undefined.
Definition: cs_common.h:325
Time class
Definition: cs_common.h:272
void Set(signed long long sec)
Set the time.
signed long long Get()
Returns the time.
SbTime(signed long long sec)
Constructor.
String ToString() override
Formats time in a readable string.
Version class that wraps the sb_t_version structure
Definition: cs_common.h:199
int major
major number, changes when there are new features
Definition: cs_common.h:201
int build_major
build_major number, changes every time the library is built
Definition: cs_common.h:204
int vminor
vminor number, changes on internal improvement which doesn't modify the interface
Definition: cs_common.h:203
int minor
minor number, changes when the interface is no longer compatible
Definition: cs_common.h:202
String ToString() override
SbError
Enum error codes
Definition: cs_common.h:13
@ SB_ERR_SOCKET_RECEIVE
Socket receive function has returned an error.
@ SB_ERR_IMAGE_CIRCULARITY
The image circularity type is wrong.
@ SB_ERR_PROJECT_LOAD_MODE
The project was loaded with the wrong load parameter.
@ SB_ERR_IMAGE_CHANNELS
The image has a wrong number of channels.
@ SB_ERR_DL_PRE_TRAINING_FILE_NOT_FOUND
Deep Learning pre-training file not found.
@ SB_ERR_THREAD
Thread management error.
@ SB_ERR_LIBRARY_FUNCTION_ADDRESS
Could not locate the function.
@ SB_ERR_NONE
No errors.
@ SB_ERR_DL_TILING_MODE
Wrong tiling mode.
@ SB_ERR_SOCKET_ACCEPT
Socket accept has returned an error.
@ SB_ERR_VERSION_FORMAT
Version is not formatted properly.
@ SB_ERR_IMAGE_RESOLUTION
The image has a wrong resolution.
@ SB_ERR_LICENSE_NOT_FOUND
License key not found.
@ SB_ERR_SENTINEL
Sentinel key returns an error.
@ SB_ERR_DIR_RENAME
An error occurred renaming the folder.
@ SB_ERR_INITIALIZE
You must call the initialize function.
@ SB_ERR_FILE_WRITE
An error occurred writing the file.
@ SB_ERR_SVL_CHOOSE_FEATURES_FAST
Choose features failed to find a common combination for fast.
@ SB_ERR_FILE_NOT_EXIST
The file doesn't exist.
@ SB_ERR_NO_CLASSIFIED_IMAGE
There aren't classified images.
@ SB_ERR_FILE_NAME_LENGHT
File name too long.
@ SB_ERR_DL_PRE_TRAINING_FEATURES_MULTIPLIER
The feature multiplier parameter of pre-training file is different from that of the project.
@ SB_ERR_IMAGE_RESIZE
Image resize function returns an error.
@ SB_ERR_FILE_OPEN
An error occurred opening the file.
@ SB_ERR_SENTINEL_MASTER_KEY
Sentinel LDK Master key not present.
@ SB_ERR_IMAGE_WARP
Image warp function returns an error.
@ SB_ERR_SAMPLE_NOT_FOUND
No sample found.
@ SB_ERR_IMAGE_FORMAT
The image format is wrong.
@ SB_ERR_DECRYPT
An error occurred decrypting data.
@ SB_ERR_STRING_UTF8
String does not conform to UTF-8 format.
@ SB_ERR_FILE_VERSION
The file has no version.
@ SB_ERR_SOCKET_SET_PARAMETER
Set socket parameter has returned an error.
@ SB_ERR_SOCKET_TIMEOUT
Timeout sending or receiving data on socket.
@ SB_ERR_PATH_SIZE
the path name exceeds the maximum size
@ SB_ERR_IMAGE_SIZE
Image has a wrong data size.
@ SB_ERR_MODEL_NAME
There are two models with the same name.
@ SB_ERR_LICENSE_MACHINE_ID_MATCH
Machine id doesn't match.
@ SB_ERR_SVL_WAS_NOT_DONE
The SVL wasn't done.
@ SB_ERR_SENTINEL_RUN_TIME
Sentinel_LDK_Run-time is not running.
@ SB_ERR_PROJECT_NOT_FOUND
Project not found.
@ SB_ERR_SAMPLE_OUT_OF_IMAGE
The sample is out of image.
@ SB_ERR_DL_TRAINING_DATA_MISSING
Deep Learning training data missing.
@ SB_ERR_SOCKET_INVALID_IP
IP address is invalid.
@ SB_ERR_FILE_FORMAT
Wrong data file format.
@ SB_ERR_SVL_WRONG
SVL is wrong.
@ SB_ERR_IMAGE_DECODE
An error occurred decoding image.
@ SB_ERR_DL_OPENVINO_DATA_NOT_EXIST
OpenVino weights not exist.
@ SB_ERR_LICENSE_VERSION
License is incompatible with the library version.
@ SB_ERR_SAMPLE_WRONG
The sample has wrong data.
@ SB_ERR_ROI_DEFECTS
The defects ROI is wrong.
@ SB_ERR_SOCKET_SELECT
Socket select function has returned an error.
@ SB_ERR_LIBRARY_OPEN
Could not load the dynamic library or the shared object.
@ SB_ERR_SOCKET_BIND
An error occurred binding the socket.
@ SB_ERR_SCALE_NOT_FOUND
The scale is not found.
@ SB_ERR_FILE_REMOVE
Error removing a file.
@ SB_ERR_LICENSE_SAME_MACHINE_ID
Two licenses have the same machine id.
@ SB_ERR_DL_ROI_DEFECTS_NOT_SET
Not enough ROI defects area in SVL or validation image dataset for at least one model....
@ SB_ERR_SVL_CHOOSE_FEATURES
Choose features failed to find a good combination.
@ SB_ERR_DL_INPAINTER_NOT_FOUND
Deep Learning inpainter network file not found.
@ SB_ERR_NO_FEATURES_AVAILABLE
No features available for the data set.
@ SB_ERR_FILE_EMPTY
File is empty.
@ SB_ERR_CLS
The function of a classifier has returned an error.
@ SB_ERR_SVL_PERTURBATION
A perturbation has not been defined properly.
@ SB_ERR_DL_INPAINTER_NOT_ASSIGNED
Deep Learing Inpainter network path is not assigned.
@ SB_ERR_MODEL_NOT_FOUND
The model of the sample is unknown or not assigned.
@ SB_ERR_NOT_IMPLEMENTED
The function isn't implemented.
@ SB_ERR_WARP_POINT_NOT_FOUND
Point isn't found in the lut.
@ SB_ERR_LICENSE_MARKER
Marker of the TCP/IP license protocol is wrong.
@ SB_ERR_DL_NETWORK_FILE_NOT_FOUND
Deep Learning Network file not found.
@ SB_ERR_NO_FILE_FOUND
No file found in the folder.
@ SB_ERR_SAMPLE_NUMBER
Too few samples to execute the training.
@ SB_ERR_SVL_VALIDATION_DATASET
The SVL images dataset is too small to extract a validation dataset.
@ SB_ERR_DL_PRE_TRAINING_NETWORK_TYPE
The network type of pre-training file is different from that of the project.
@ SB_ERR_SOCKET_MAC
Error while looking for a valid MAC address.
@ SB_ERR_STRUCT_HEADER_WRONG_VERSION
The version of the structure sb_t_struct_header is wrong.
@ SB_ERR_DIR_REMOVE
An error occurred removing the folder.
@ SB_ERR_LICENSE_DISABLED
License is disabled.
@ SB_ERR_DL_FRAMEWORK
Impossible to execute the requested operation: Deep Learning Framework not installed or corrupted.
@ SB_ERR_IMAGE_DEPTH
The image has a wrong bit depth.
@ SB_ERR_BUFFER_SIZE
The buffer has an insufficient size.
@ SB_ERR_SAMPLE_DISTANCE
There are two samples closer than the minimum distance set.
@ SB_ERR_NO_POINT_FOUND
Point isn't found.
@ SB_ERR_INSUFFICIENT_FREE_MEMORY
Insufficient free memory to complete the svl.
@ SB_ERR_FILE_COPY
Error copying a file.
@ SB_ERR_DL_PRE_TRAINING_IMAGE_CHANNELS
The image number of channels of pre-training file is different from that of the project.
@ SB_ERR_DL_PRE_TRAINING_FILE_NOT_VALID
Deep Learning pre-training file is not valid.
@ SB_ERR_LICENSE
The license isn't valid.
@ SB_ERR_SAMPLE_BACKGROUND
Too few background samples to execute the training. Increase the analysis ROI or reduce the scale.
@ SB_ERR_MODEL_NOT_TRAINED
The model is not trained.
@ SB_ERR_CLS_CREATE
The function for the creation of the classifier has returned an error.
@ SB_ERR_SOCKET_LISTEN
Socket listen function has returned an error.
@ SB_ERR_WRONG_PARAMETER
The function has been called with a parameter with a wrong value.
@ SB_ERR_CLS_PREDICT
The predict function has returned an error.
@ SB_ERR_LICENSE_WAIT_SERVER
Waiting to contact the license server.
@ SB_ERR_LICENSE_TYPE
The license type is unknown.
@ SB_ERR_ROI_BOUNDING_BOX
Wrong roi bounding box.
@ SB_ERR_LIBRARY_DEPENDENCIES
Library dependencies not satisfied to execute the requested operation.
@ SB_ERR_DIR_CREATE
An error occurred creating the folder.
@ SB_ERR_LICENSE_TRAINING
License error: training is disabled.
@ SB_ERR_IMAGE_COMPRESSION
The image compression type is wrong.
@ SB_ERR_SOCKET_INVALID_PORT
Port isn't a valid number.
@ SB_ERR_IMAGE_ENCODE
An error occurred encoding image.
@ SB_ERR_DL_TILING_RANGE
It is not possible to calculate the range with the set values.
@ SB_ERR_CLS_NOT_TRAINED
The training wasn't done.
@ SB_ERR_DIR_NOT_EXIST
The directory doesn't exist.
@ SB_ERR_FILE_NAME
Wrong file name: too long or unknown extension.
@ SB_ERR_SAMPLES_GT_TOO_MANY
Too many ground truth samples.
@ SB_ERR_UUID
The generation of UUID has returned an error or invalid UUID.
@ SB_ERR_LICENSE_MAIL_ADDRESS
Mail address in the license file is wrong.
@ SB_ERR_MODEL_NAME_UNDEFINED
A sample does not have the model name defined.
@ SB_ERR_ENCRYPT
An error occurred encrypting data.
@ SB_ERR_MEMORY_LEAK
There is a memory leak.
@ SB_ERR_FILE_NAME_EMPTY
File name is empty.
@ SB_ERR_LICENSE_FILE
License file error (not exist, not readable, wrong format, wrong mail address)
@ SB_ERR_LICENSE_CODE
Code of the TCP/IP license protocol is wrong.
@ SB_ERR_IMAGE_TYPE
Unknown image type, should be a sb_t_image_info_type enum value.
@ SB_ERR_FILE_SAVE
An error occurred saving the file.
@ SB_ERR_LICENSE_FEATURES_NUMBER
Number of features is greater than the maximum allowed for the current license configuration.
@ SB_ERR_NULL_POINTER
Function has been called with a NULL pointer.
@ SB_ERR_DL_NO_LABELED_IMAGES
No labeled images.
@ SB_ERR_DL_ONNX_CONVERSION
Error in conversion in onnx format.
@ SB_ERR_STRING_EMPTY
String empty.
@ SB_ERR_RPF_NAME_EMPTY
The name of solution file is empty.
@ SB_ERR_DL_ROI_NOT_SET
Not enough ROI analysis area in SVL or validation image dataset. Increase the analysis ROI or the til...
@ SB_ERR_LEVELS_ENABLED
There are no levels enabled.
@ SB_ERR_SOCKET_CREATE
An error occurred creating the socket.
@ SB_ERR_IMAGE_WIDTH_STEP
Image has a wrong width_step value.
@ SB_ERR_DL_PRE_TRAINING_BORDERS_EXTENSION_MODE
The borders extension mode of pre-training file is different from that of the project.
@ SB_ERR_SOCKET_CONNECT
An error occurred connecting the socket.
@ SB_ERR_STRUCT_HEADER_WRONG_SIZE
The dimension of the structure sb_t_struct_header is wrong.
@ SB_ERR_LICENSE_CORRUPTED
License file is corrupted.
@ SB_ERR_MODELS_NUMBER
There aren't models, or the number of the models isn't the expected one, or exceeded the maximum mode...
@ SB_ERR_NVIDIA_NVML
Nvidia NVML returns an error getting gpu information.
@ SB_ERR_MACHINE_ID
Machine id has a wrong format.
@ SB_ERR_LEVELS_NUMBER
There aren't levels, or the number of the levels isn't the expected one, or exceeded the maximum leve...
@ SB_ERR_STRUCT_HEADER_WRONG_CODE
The code of the structure sb_t_struct_header is wrong.
@ SB_ERR_DIR_EXIST
Checking the existence of the folder gave error.
@ SB_ERR_DL_INTERNAL
Internal Deep Learning error.
@ SB_ERR_IMAGE_CREATE
An error occurred creating the image.
@ SB_ERR_NO_LEVELS_AVAILABLE
No levels available to be processed.
@ SB_ERR_IMAGE_LOAD
An error occurred loading the image.
@ SB_ERR_DL_PRE_TRAINING_INPUT_SIZE
The input image size of pre-training file is different from that of the project.
@ SB_ERR_SENTINEL_TOO_MANY_KEYS
Too many keys connected to the pc.
@ SB_ERR_PROJECT_TYPE
Wrong project type.
@ SB_ERR_CLS_TRAINING
The training function has returned an error.
@ SB_ERR_DL_PRE_TRAINING_IMAGE_FORMAT
The image format of pre-training file is different from that of the project.
@ SB_ERR_DL_NOT_SUPPORTED
Deep Learning module are not supported.
@ SB_ERR_SOCKET_CLOSED
Socket is closed.
@ SB_ERR_LICENSE_VM
License isn't allowed on Virtual Machine.
@ SB_ERR_SOCKET
A socket function has returned an error.
@ SB_ERR_XML
Error parsing xml file.
@ SB_ERR_DL_PRE_TRAINING_LOSS_FN
The loss function of pre-training file is different from that of the project.
@ SB_ERR_FILE_EXTENSION
Wrong file extension.
@ SB_ERR_VERSION
Unmanaged version.
@ SB_ERR_DL_INPUT_NETWORK_SIZE
Deep Learning wrong input network size.
@ SB_ERR_SOCKET_IOCTL
Socket ioctl function has returned an error.
@ SB_ERR_MODEL_DISABLED
A model is disabled.
@ SB_ERR_INVALID_MAIL_ADDRESS
Mail address has a wrong format.
@ SB_ERR_ROI
The ROI is wrong.
@ SB_ERR_IMAGE_SIZE_CIRCULAR
Image resolution is smaller than the minimum allowed to handle circularity, reduce the scale or incre...
@ SB_ERR_SOCKET_SEND
Socket send function has returned an error.
@ SB_ERR_DL_PRE_TRAINING_MODELS_NUMBER
The models number of pre-training file is different from that of the project.
@ SB_ERR_FILE_READ
An error occurred reading the file.
@ SB_ERR_LICENSE_MODELS_NUMBER
Number of models is greater than the maximum allowed for the current license configuration.
@ SB_ERR_BASE64_SIZE
The dimension of the base64 buffer isn't 4 bytes aligned.
@ SB_ERR_DL_FREEZE_NOT_PRE_TRAINED
You cannot run SVL from scratch with freeze_mode enabled and pre-training disabled.
@ SB_ERR_DL_CUDA_OUT_OF_MEMORY
CUDA Out Of Memory (OOM). Insufficient free GPU memory to execute the operation. Try reducing the bat...
@ SB_ERR_SAMPLE_SCALE
The sample scale is wrong.
@ SB_ERR_MALLOC
The function that allocates memory gave error
@ SB_ERR_MODELS_ENABLED
There are no models enabled.
@ SB_ERR_XML_NODE_NOT_FOUND
An xml node was not found.
@ SB_ERR_LICENSE_EXPIRED
License is expired.
@ SB_ERR_INTERNAL
Internal error.
SbFrameworkType
Framework type that wraps the sb_t_framework_type enum
Definition: cs_common.h:231
SbDeviceType
Device type that wraps the sb_t_device_type enum
Definition: cs_common.h:219
@ SB_FRAMEWORK_TYPE_OPENVINO
OpenVino framework.
@ SB_FRAMEWORK_TYPE_PYTORCH
Pytorch framework.
@ SB_FRAMEWORK_TYPE_SB
SqueezeBrains framework.
@ SB_FRAMEWORK_TYPE_NONE
Framework not defined.
@ SB_DEVICE_CPU
CPU device.
@ SB_DEVICE_IGPU_INTEL
GPU Integrated Intel device.
@ SB_DEVICE_DGPU_INTEL
GPU Discrete Intel device.
@ SB_DEVICE_NONE
Device not defined.
@ SB_DEVICE_GPU_NVIDIA
GPU NVidia device.
sb_t_err
Errors code enum.
Definition: sb.h:6230
#define SB_VALUE_NOT_SET
Value of the prediction in case it is undefined.
Definition: sb.h:7027
#define SB_DELIMITER
Use this define as delimiter.
Definition: sb.h:6685
#define SB_SOLUTION_EXT
Extension of the SqueezeBrains solution file.
Definition: sb.h:9721
#define SB_DEVICES_MAX_NUMBER
Maximum number of computational devices managed by the sb library.
Definition: sb.h:11226
#define SB_PRE_TRAINING_EXT
Extension of the SqueezeBrains pre-training network file.
Definition: sb.h:10957
SB Namespace
Definition: cs_common.h:3
Defines the version.
Definition: sb.h:6773