SqueezeBrains SDK 1.18
|
Generic functions. More...
Data Structures | |
struct | sb_t_version |
Defines the version. More... | |
struct | sb_t_memory_info |
Memory information. More... | |
struct | sb_t_frameworks |
Frameworks list. More... | |
struct | sb_t_device_info |
Information about a computing device. More... | |
struct | sb_t_devices_info |
List of computing devices available on the machine. More... | |
struct | sb_t_info |
General information about sb library and computing devices like CPU and GPUs. More... | |
struct | sb_t_bgra |
Defines the color in the format BGRA. More... | |
struct | sb_t_rgba |
Defines the color in the format RGBA. More... | |
Macros | |
#define | SB_INIT_ONLY_HW_LICENSE_KEY "ONLY_HW_KEY" |
Use this define with sb_init in order to manage only hardware license keys. More... | |
#define | SB_INIT_ONLY_SB_LICENSE_KEY "ONLY_SB_KEY" |
Use this define with sb_init in order to manage only SqueezeBrains software license keys. More... | |
#define | SB_INIT_NO_LICENSE_KEY "NO_KEY" |
Use this define with sb_init in order to not manage license keys. More... | |
#define | SB_DELIMITER ";" |
Use this define as delimiter. More... | |
#define | SB_FRAMEWORKS_MAX_NUMBER 4 |
Maximum number of frameworks associable to a device managed by the sb library. More... | |
#define | SB_VALUE_NOT_SET 1000000.0f |
Value of the prediction in case it is undefined. More... | |
#define | SB_PAR_MODELS_NUM 64 |
Maximum number of models. | |
#define | SB_PAR_PERTURBATIONS_NUM 16 |
Maximum number of perturbation of a sample. | |
#define | SB_PAR_STRING_LEN 64 |
Maximum length, in byte, of a parameter string. | |
#define | SB_IMAGE_NAME_STRING_LEN 128 |
Maximum length, in byte, of the image name string. | |
#define | SB_PAR_LEVELS_NUM 32 |
Maximum scales levels number to be used for Surface. | |
#define | SB_PAR_LEVEL_SCALE_GRANULARITY 0.50f |
Scale granularity for multi-scale defects detection. | |
#define | SB_PAR_LEVEL_SCALE_MIN 1.0f |
Minimum scale factor of surface. | |
#define | SB_PAR_LEVEL_SCALE_MAX 16.0f |
Maximum scale factor of surface. | |
#define | SB_PAR_RETINA_OBJ_SIZE_MIN 24 |
Minimum value of sb_t_par_model::obj_size. | |
#define | SB_PAR_RETINA_OBJ_SIZE_MAX 1024 |
Maximum value of sb_t_par_model::obj_size. | |
#define | SB_PAR_RETINA_OBJ_STRIDE_COARSE_MIN 4 |
Minimum value of sb_t_par_model::obj_stride_coarse. | |
#define | SB_PAR_RETINA_OBJ_STRIDE_COARSE_MAX 32 |
Maximum value of sb_t_par_model::obj_stride_coarse. | |
#define | SB_PAR_RETINA_OBJ_STRIDE_FINE_MIN 1 |
Minimum value of sb_t_par_model::obj_stride_fine. | |
#define | SB_PAR_RETINA_OBJ_STRIDE_FINE_MAX 8 |
Maximum value of sb_t_par_model::obj_stride_fine. | |
#define | SB_PAR_RETINA_OBJ_DISTANCE_MIN 4 |
Minimum value of sb_t_par_model::obj_min_distance. | |
#define | SB_PAR_RETINA_NUM_OCCURRENCES_MIN -1 |
Minimum value of sb_t_par_model::num_occurrences. | |
#define | SB_SAMPLE_SCALE_GRANULARITY 0.25f |
Scale granularity for multi-scale objects detection. | |
#define | SB_SAMPLE_SCALE_MIN 1.0f |
Minimum scale factor of samples. | |
#define | SB_SAMPLE_SCALE_MAX 32.0f |
Maximum scale factor of samples. | |
#define | SB_DL_SCALE_MIN 0.1f |
#define | SB_DL_SCALE_MAX 32.0f |
#define | SB_DL_SCALE_GRANULARITY 0.01f |
Granularity of the value of sb_t_svl_dl_tiling_par::scale parameter and of sb_project_set_scale_offset_par function parameter. | |
#define | SB_SVL_DL_INPUT_SDINET0_SIZE_DEFAULT 331 |
Default sb_t_svl_dl_par_network::input_size value for SB_NETWORK_TYPE_SDINET0 network. | |
#define | SB_SVL_DL_INPUT_SDINET0_SIZE_MIN 128 |
Minimum sb_t_svl_dl_par_network::input_size value for SB_NETWORK_TYPE_SDINET0 network. | |
#define | SB_SVL_DL_INPUT_SDINET0_SIZE_MAX 512 |
Maximum sb_t_svl_dl_par_network::input_size value for SB_NETWORK_TYPE_SDINET0 network. | |
#define | SB_SVL_DL_BATCH_SIZE_MIN 4 |
Minimum value of sb_t_svl_dl_par::batch_size parameter. | |
#define | SB_SVL_DL_BATCH_SIZE_MAX 512 |
Maximum value of sb_t_svl_dl_par::batch_size parameter. | |
#define | SB_SVL_DL_VALIDATION_PERCENTAGE_MIN 0.0f |
Minimum value of sb_t_svl_dl_par::validation_percentage parameter. | |
#define | SB_SVL_DL_VALIDATION_PERCENTAGE_MAX 0.5f |
Maximum value of sb_t_svl_dl_par::validation_percentage parameter. | |
#define | SB_SVL_DL_LEARNING_RATE_MIN 0.000001f |
Minimum value of sb_t_svl_dl_par::learning_rate parameter. | |
#define | SB_SVL_DL_LEARNING_RATE_MAX 0.01f |
Maximum value of sb_t_svl_dl_par::learning_rate parameter. | |
#define | SB_SVL_DL_LEARNING_RATE_DEFAULT 0.001f |
Default value of sb_t_svl_dl_par::learning_rate parameter. | |
#define | SB_SVL_DL_NUM_TILES_MIN 1 |
Minimum value of sb_t_svl_dl_tiling_par::num_tiles parameter. | |
#define | SB_SVL_DL_NUM_TILES_MAX 64 |
Maximum value of sb_t_svl_dl_tiling_par::num_tiles parameter. | |
#define | SB_SVL_DL_FEATURES_MULTIPLIER_MIN 0.5f |
Minimum value of sb_t_svl_dl_par_network::features_multiplier parameter. | |
#define | SB_SVL_DL_FEATURES_MULTIPLIER_MAX 1.5f |
Maximum value of sb_t_svl_dl_par_network::features_multiplier parameter. | |
#define | SB_SVL_DL_FEATURES_MULTIPLIER_GRANULARITY 0.1f |
Granularity of sb_t_svl_dl_par_network::features_multiplier parameter. | |
#define | SB_SVL_DL_FEATURES_MULTIPLIER_DEFAULT 1.0f |
Default value of sb_t_svl_dl_par_network::features_multiplier parameter. | |
#define | SB_SVL_DL_PERTURBATION_SCALE_MIN 0.0f |
Minimum value of sb_t_svl_dl_par_perturbation::delta_scale parameter. | |
#define | SB_SVL_DL_PERTURBATION_SCALE_MAX 0.5f |
Maximum value of sb_t_svl_dl_par_perturbation::delta_scale parameter. | |
#define | SB_SVL_DL_PERTURBATION_SHIFT_MIN 0.0f |
Minimum value of sb_t_svl_dl_par_perturbation::shift_horizontal and sb_t_svl_dl_par_perturbation.shift_vertical parameters. | |
#define | SB_SVL_DL_PERTURBATION_SHIFT_MAX 0.5f |
Maximum value of sb_t_svl_dl_par_perturbation::shift_horizontal and sb_t_svl_dl_par_perturbation.shift_vertical parameters. | |
#define | SB_SVL_DL_PERTURBATION_STRETCH_CONTRAST_MIN 0.0f |
Minimum value of sb_t_svl_dl_par_perturbation::stretch_contrast parameter. | |
#define | SB_SVL_DL_PERTURBATION_STRETCH_CONTRAST_MAX 0.5f |
Maximum value of sb_t_svl_dl_par_perturbation::stretch_contrast parameter. | |
#define | SB_SVL_DL_PERTURBATION_DELTA_BRIGHTNESS_MIN 0.0f |
Minimum value of sb_t_svl_dl_par_perturbation::delta_brightness parameter. | |
#define | SB_SVL_DL_PERTURBATION_DELTA_BRIGHTNESS_MAX 0.5f |
Maximum value of sb_t_svl_dl_par_perturbation::delta_brightness parameter. | |
#define | SB_SURFACE_OPTIONAL_GRAY_LEVEL 128 |
Gray level for "all models" optional defects. More... | |
Typedefs | |
typedef void * | SB_HANDLE |
HANDLE definition. | |
Enumerations | |
enum | sb_t_dl_library_type { SB_DL_LIBRARY_NONE = 0 , SB_DL_LIBRARY_PYTORCH , SB_DL_LIBRARY_OPENVINO } |
Deep Learning library types. More... | |
enum | sb_t_device_type { SB_DEVICE_NONE = -1 , SB_DEVICE_CPU = 0 , SB_DEVICE_GPU_NVIDIA , SB_DEVICE_IGPU_INTEL , SB_DEVICE_DGPU_INTEL } |
Defines computing device types. More... | |
enum | sb_t_framework_type { SB_FRAMEWORK_TYPE_NONE = 0 , SB_FRAMEWORK_TYPE_SB , SB_FRAMEWORK_TYPE_PYTORCH , SB_FRAMEWORK_TYPE_OPENVINO } |
Defines framework types. More... | |
enum | sb_t_interpolation_mode { SB_INTERPOLATION_MODE_BILINEAR = 0 , SB_INTERPOLATION_MODE_NN } |
Enumerates the interpolation modes. More... | |
enum | sb_t_floating_point_op_type { SB_FLOATING_POINT_OPS_TYPE_SINGLE_PRECISION = 0 , SB_FLOATING_POINT_OPS_TYPE_HALF_PRECISION } |
Enumerates the floating point precision types to perform operations. More... | |
Functions | |
sb_t_err | sb_init (const char *const license_file) |
Initializes the SB library. More... | |
sb_t_err | sb_init_dl (const char *const search_path, sb_t_dl_library_type lib_type) |
Initialize the Deep Learning library. More... | |
sb_t_err | sb_release (void) |
Releases all the resources allocates in the library. More... | |
SB_INLINE sb_t_version | sb_version (int major, int minor, int vminor, int build_major) |
Inline constructor of structure sb_t_version. More... | |
int | sb_version_check (sb_t_version version1, sb_t_version version2) |
Compares two version. More... | |
SB_INLINE sb_t_bgra | sb_bgra (unsigned char b, unsigned char g, unsigned char r, unsigned char a) |
Inline constructor of structure sb_t_bgra. More... | |
SB_INLINE sb_t_rgba | sb_rgba (unsigned char r, unsigned char g, unsigned char b, unsigned char a) |
Inline constructor of structure sb_t_rgba. More... | |
sb_t_err | sb_get_info (sb_t_info **const info, int dl_devices_info) |
The function gets information about the sb library and the available computational devices. More... | |
sb_t_err | sb_destroy_info (sb_t_info **const info) |
Destroys the structure. More... | |
sb_t_err | sb_format_info (const sb_t_info *const info, char *const str, int str_size) |
Formats the sb library information structure. More... | |
sb_t_err | sb_get_uuid (char *const str, size_t size) |
Creates a new uuid. More... | |
sb_t_err | sb_get_file_version (sb_t_version *const ver, const char *const file) |
Get the version of a file. More... | |
int | sb_is_valid_utf8 (const char *string) |
Check if a string conforms to UTF-8 format. More... | |
Generic functions.
#define SB_DELIMITER ";" |
Use this define as delimiter.
#define SB_DL_SCALE_MAX 32.0f |
Maximum value of sb_t_svl_dl_tiling_par::scale parameter and of the sum of sb_t_svl_dl_tiling_par::scale plus the value set with function sb_project_set_scale_offset_par .
#define SB_DL_SCALE_MIN 0.1f |
Minimum value of sb_t_svl_dl_tiling_par::scale parameter and of the sum of sb_t_svl_dl_tiling_par::scale plus the value set with function sb_project_set_scale_offset_par .
#define SB_FRAMEWORKS_MAX_NUMBER 4 |
Maximum number of frameworks associable to a device managed by the sb library.
#define SB_INIT_NO_LICENSE_KEY "NO_KEY" |
#define SB_INIT_ONLY_HW_LICENSE_KEY "ONLY_HW_KEY" |
#define SB_INIT_ONLY_SB_LICENSE_KEY "ONLY_SB_KEY" |
#define SB_SURFACE_OPTIONAL_GRAY_LEVEL 128 |
Gray level for "all models" optional defects.
The optional for all models is used in the event that there are several models and there are parts of the surface that must be optional for all models. Without this it was necessary to exclude the area from the analysis roi.
#define SB_VALUE_NOT_SET 1000000.0f |
Value of the prediction in case it is undefined.
For example the field sb_t_sample::weight can take this value.
enum sb_t_device_type |
enum sb_t_dl_library_type |
Deep Learning library types.
Enumerator | |
---|---|
SB_DL_LIBRARY_NONE | No libraries defined. |
SB_DL_LIBRARY_PYTORCH | Pytorch library. |
SB_DL_LIBRARY_OPENVINO | Openvino library. Can be used only for inference with sb_project_detection function. |
enum sb_t_framework_type |
Defines framework types.
Enumerator | |
---|---|
SB_FRAMEWORK_TYPE_NONE | Framework type None. |
SB_FRAMEWORK_TYPE_SB | Framework type SqueezeBrains. To be used for Retina and Surface projects. |
SB_FRAMEWORK_TYPE_PYTORCH | Framework type Pytorch. To be used for Deep Cortex and Deep Surface projects. |
SB_FRAMEWORK_TYPE_OPENVINO | Frameowrk type Intel OpenVino. To be used for Deep Cortex and Deep Surface projects (detection only). |
Enumerates the interpolation modes.
The values are 32 bits both for 32 and 64 bits library version.
Enumerator | |
---|---|
SB_INTERPOLATION_MODE_BILINEAR | Bilinear interpolation. |
SB_INTERPOLATION_MODE_NN | Nearest Neighbor pixel interpolation. |
SB_INLINE sb_t_bgra sb_bgra | ( | unsigned char | b, |
unsigned char | g, | ||
unsigned char | r, | ||
unsigned char | a | ||
) |
Destroys the structure.
[in,out] | info | Pointer to the parameters structure. |
Formats the sb library information structure.
Interprets the contents of info and converts it to a C-string containing a human-readable version of the corresponding structure.
[in] | info | Pointer to the structure of the sb library information. |
[out] | str | String filled by the function. |
[in] | str_size | Size, in bytes, of str |
sb_t_err sb_get_file_version | ( | sb_t_version *const | ver, |
const char *const | file | ||
) |
Get the version of a file.
The implementation is operative system dependent:
[out] | ver | Pointer to version structure |
[in] | file | File name |
The function gets information about the sb library and the available computational devices.
[out] | info | Pointer of the structure. The pointer must be destroyed with the function sb_destroy_info . |
[in] | dl_devices_info | Set to a non-zero value to also get the information about devices compatible with SB deep learning extensions. The function takes a long time to get gpu information, about 15/20 ms. |
sb_t_err sb_get_uuid | ( | char *const | str, |
size_t | size | ||
) |
Creates a new uuid.
It is the standard UUID without the characters '-', for example f2a2c03ddab7d54b912954a05038e94d. It is a string of 32 characters and each of them has a value in the intervals: 0-9, a-z.
[out] | str | Pointer to the string |
[in] | size | Size of the string, must be greater or equal than 33 (32 characters plus the string terminator) |
sb_t_err sb_init | ( | const char *const | license_file | ) |
Initializes the SB library.
The function initializes all the functionalities of the library including the license. There is no problem if you call the function more than once without calling sb_release .
After this function you should call the sb_init_dl function if you need to enable the sb_project_detection and sb_svl_run functions for the Deep Surface and Deep Cortex projects.
[in] | license_file | License file. You can use one of the following:
|
If license_file is NULL or it is an empty string or the file doesn't exists, the license manager is installed anyway, it asks the license to the license server and it searches for USB dongle key.
sb_t_err sb_init_dl | ( | const char *const | search_path, |
sb_t_dl_library_type | lib_type | ||
) |
Initialize the Deep Learning library.
The function must be called after the sb_init function.
The function enables the sb_project_detection and sb_svl_run functions for the Deep Surface and Deep Cortex projects.
[in] | search_path | The variable allows the user to specify additional folders where to find the SB Deep Learning Framework dependencies in addition to the default ones. Multiple folders paths must be separated by SB_DELIMITER. It can be NULL. |
[in] | lib_type | Deep Learning library to initialize |
int sb_is_valid_utf8 | ( | const char * | string | ) |
Check if a string conforms to UTF-8 format.
Sb library does not manage string which are not in UTF-8 format.
[in] | string | String to check |
sb_t_err sb_release | ( | void | ) |
Releases all the resources allocates in the library.
There is no problem if you call the function more than once without calling sb_init.
SB_INLINE sb_t_rgba sb_rgba | ( | unsigned char | r, |
unsigned char | g, | ||
unsigned char | b, | ||
unsigned char | a | ||
) |
SB_INLINE sb_t_version sb_version | ( | int | major, |
int | minor, | ||
int | vminor, | ||
int | build_major | ||
) |
Inline constructor of structure sb_t_version.
[in] | major | |
[in] | minor | |
[in] | vminor | |
[in] | build_major |
int sb_version_check | ( | sb_t_version | version1, |
sb_t_version | version2 | ||
) |
Compares two version.
[in] | version1 | First version to compare. The value of a fields if you don't want to compare the field. The function breaks the comparison with the first field which is -1. i.e. if you don't want to compare the field build_major set major.minor.vminor.-1 |
[in] | version2 | Second version to compare |