SqueezeBrains SDK 1.18
Project

Project management interface. More...

Collaboration diagram for Project:

Data Structures

struct  sb_t_project_info
 Project info structure. More...
 
struct  sb_t_projects_info
 Array of the projects info. More...
 
struct  sb_t_scale_offset_par
 Offsets to change scale ranges. More...
 
struct  sb_t_par_model_lut
 Information about mapping between old and new models and levels in the sb_t_par structure. More...
 
struct  sb_t_par_changes_info
 Information on what sb_project_set_par and sb_image_info_apply_par_changes do when they apply the new parameters. More...
 
struct  sb_t_elaborated_image
 Elaborated image. More...
 
struct  sb_t_elaborated_images
 List of elaborated images. More...
 
struct  sb_t_project_detection_info
 Detection information structure. More...
 

Enumerations

enum  sb_t_project_type {
  SB_PROJECT_TYPE_RETINA = 0 , SB_PROJECT_TYPE_SURFACE , SB_PROJECT_TYPE_DEEP_SURFACE , SB_PROJECT_TYPE_DEEP_CORTEX ,
  SB_PROJECT_TYPE_DEEP_RETINA
}
 Project types enum. More...
 
enum  sb_t_project_mode { SB_PROJECT_MODE_DETECTION_ONLY = 0 , SB_PROJECT_MODE_DETECTION_AND_SVL , SB_PROJECT_MODE_NO_DETECTION }
 Defines the loading or saving mode of a project. More...
 
enum  sb_t_project_training_status { SB_PROJECT_TRAINED_NONE = 0 , SB_PROJECT_TRAINED , SB_PROJECT_TRAINED_OPENVINO }
 Defines project training status. More...
 

Functions

const char * sb_project_type_format (sb_t_project_type type)
 Returns the string of the project type. More...
 
sb_t_err sb_project_get_info (SB_HANDLE handle, sb_t_project_info *project_info)
 Gets the project information from the handle. More...
 
sb_t_err sb_project_destroy (SB_HANDLE *phandle)
 Frees all the resources of the project handle. More...
 
sb_t_err sb_project_create (SB_HANDLE *phandle, const char *const project_name, sb_t_project_type project_type)
 Creates a new project of the specifed type. More...
 
sb_t_err sb_project_load (SB_HANDLE *phandle, const char *const solution_file, const char *const project_uuid, sb_t_project_mode mode)
 Loads an existing project from a solution file. More...
 
sb_t_err sb_project_save (SB_HANDLE handle, const char *const solution_file, sb_t_project_mode mode)
 Saves the project to file. More...
 
sb_t_err sb_project_clone (SB_HANDLE src, SB_HANDLE *pdst, sb_t_project_mode mode, int regenerate_uuid)
 Clones the SqueezeBrains project. More...
 
sb_t_err sb_project_invalidate (SB_HANDLE handle, const char *const model_name, float scale)
 Eliminates the training of the models. More...
 
const char * sb_project_training_status_format (sb_t_project_training_status training_status)
 Returns the string of the training status. More...
 
sb_t_err sb_project_check_trained (SB_HANDLE handle, const char *const model_name, float scale, sb_t_project_training_status *const training_status)
 Checks if the project is trained. More...
 
sb_t_err sb_project_get_default_features (SB_HANDLE handle, char *str, int size)
 Get the project default features depending on the project type (Retina or Surface)
 
sb_t_err sb_project_set_sensitivity (SB_HANDLE handle, const char *const model_name, float scale, float sensitivity)
 Sets the sensitivity of the detection in the project handle. More...
 
sb_t_err sb_project_get_sensitivity (SB_HANDLE handle, const char *const model_name, float scale, float *const sensitivity)
 Gets the classification threshold from the project handle. More...
 
sb_t_err sb_project_get_notes (SB_HANDLE handle, char **const note)
 Gets the note from the project handle. More...
 
sb_t_err sb_project_set_notes (SB_HANDLE handle, const char *const note)
 Sets the note into the project handle. More...
 
sb_t_err sb_project_get_name (SB_HANDLE handle, char **const name)
 Gets the name from the project handle. More...
 
sb_t_err sb_project_set_name (SB_HANDLE handle, const char *const name)
 Sets the name into the project handle. More...
 
sb_t_err sb_project_get_custom_par_root (SB_HANDLE handle, SB_HANDLE *node_root)
 Returns the xml root node of your own custom parameters. More...
 
sb_t_err sb_project_get_svl_version (SB_HANDLE handle, sb_t_version *const version, char *const version_str, int size_version_str)
 Returns the version of the SB library when the last SVL was made. More...
 
sb_t_err sb_project_detection (SB_HANDLE handle, const sb_t_image *const img, const sb_t_roi *const roi, const sb_t_roi *const roi_defects, const sb_t_samples *const samples)
 Detection function. More...
 
sb_t_err sb_project_copy_labeling (const char *const path_solution_dst, const char *const path_solution_src, int copy_roi, int copy_labeling, int verbosity)
 Copies the analysis roi and the labeling between two current projects of two different solutions. More...
 
sb_t_err sb_project_set_scale_offset_par (SB_HANDLE handle, sb_t_scale_offset_par scale_offset)
 Sets in the project handle the scale offset used at detection time. More...
 
sb_t_err sb_project_get_scale_offset_par (SB_HANDLE handle, sb_t_scale_offset_par *const scale_offset)
 Gets the scale offset from the project handle. More...
 
sb_t_err sb_project_openvino_conversion (SB_HANDLE handle, const char *const converter_path)
 Starting from the pytorch weights, it generates the openvino weights. More...
 
sb_t_err sb_project_get_par_changes_info (SB_HANDLE handle, const sb_t_par *const par, sb_t_par_changes_info **const par_changes_info)
 Returns the information on what sb_project_set_par and sb_image_info_apply_par_changes do when they apply the new parameters. More...
 
sb_t_err sb_project_destroy_par_changes_info (sb_t_par_changes_info **const par_changes_info)
 Destroys the structure. More...
 
sb_t_err sb_project_change_type (const char *const solution_file, const char *const project_uuid, sb_t_project_type project_type)
 Change the project type. More...
 
sb_t_err sb_project_get_par (SB_HANDLE handle, sb_t_par **const par)
 Retrieves the project parameters structure. More...
 
sb_t_err sb_project_set_par (SB_HANDLE handle, const sb_t_par *const par)
 Sets the parameters structure into the project handle. More...
 
sb_t_err sb_project_get_res (SB_HANDLE handle, sb_t_res **const res, int details)
 Retrieves the results of the last elaborated image. More...
 
sb_t_err sb_project_reset_stat (SB_HANDLE handle)
 Resets the internal statistics of the elaborations. More...
 
sb_t_err sb_project_get_stat (SB_HANDLE handle, sb_t_stat **const stat)
 Gets the statistics from the handle. More...
 
sb_t_err sb_project_detection_destroy_info (sb_t_project_detection_info **const di)
 Destroy the detection info structure. More...
 
sb_t_err sb_project_detection_get_info (SB_HANDLE handle, const sb_t_image *const src, const sb_t_roi *const roi, sb_t_project_detection_info **const di)
 Returns detection information. More...
 

Detailed Description

Project management interface.

See Solution and projects management for more information.

Enumeration Type Documentation

◆ sb_t_project_mode

Defines the loading or saving mode of a project.

The values are 32 bits both for 32 and 64 bits library version.

Enumerator
SB_PROJECT_MODE_DETECTION_ONLY 

Load/save the minimum module information to allow detection.

SB_PROJECT_MODE_DETECTION_AND_SVL 

Load/save all the module information.

SB_PROJECT_MODE_NO_DETECTION 

Load/save the minimum module information and is not possible to do detection.
In case of Deep Surface and Deep Cortex project types the network is not loaded.

Definition at line 9820 of file sb.h.

◆ sb_t_project_training_status

Defines project training status.

Enumerator
SB_PROJECT_TRAINED_NONE 

Project is not trained.

SB_PROJECT_TRAINED 

Project is trained.

SB_PROJECT_TRAINED_OPENVINO 

Project is trained and Intel OpenVino support is available.

Only for Deep Cortex and Deep Surface projects.

Definition at line 9920 of file sb.h.

◆ sb_t_project_type

Project types enum.

The values are 32 bits both for 32 and 64 bits library version.

Enumerator
SB_PROJECT_TYPE_RETINA 

Project Retina.

SB_PROJECT_TYPE_SURFACE 

Project Surface.

SB_PROJECT_TYPE_DEEP_SURFACE 

Project Deep Surface.

SB_PROJECT_TYPE_DEEP_CORTEX 

Project Deep Cortex.

SB_PROJECT_TYPE_DEEP_RETINA 

Project Deep Retina.

Definition at line 9668 of file sb.h.

Function Documentation

◆ sb_project_change_type()

sb_t_err sb_project_change_type ( const char *const  solution_file,
const char *const  project_uuid,
sb_t_project_type  project_type 
)

Change the project type.

The function changes the project type in the solution file.
It also updates the project type in all rtn files associated with images in sb_t_svl_par::project_path.
The function returns SB_ERR_DIR_NOT_EXIST if sb_t_svl_par::project_path is not an existing folder, and SB_ERR_STRING_EMPTY if it is an empty string.
When the project type is changed the training and all the analysis results will be lost, moreover some data is initialized, others are kept.
Regarding the parameters of the project the models number, their name and sb_t_par. collaborations "collaboration matrix" are always kept.
While, for image data, ROI analysis and labeling can be retained or lost.
The following table shows what happens when you change the project type.

Source project type Destination project type ROI analysis Samples ROI defects Model size Network
Retina Surface full image / empty / /
Deep Surface full image / empty / initialized if necessary
Deep Cortex / / / / initialized if necessary
Surface Retina full image none / initialized /
Deep Surface kept / kept / initialized if necessary
Deep Cortex / / / / initialized if necessary
Deep Surface Retina full image none / initialized if necessary /
Surface kept / kept / /
Deep Cortex / / / / initialized
Deep Cortex Retina full image none / initialized if necessary /
Surface full image / empty / /
Deep Surface full image / empty / initialized
Parameters
[in]solution_fileSolution file name.
[in]project_uuidUUID of the project.
[in]project_typeNew project type.
Returns
If successful, returns SB_ERR_NONE. Otherwise, it returns an error code sb_t_err.

◆ sb_project_check_trained()

sb_t_err sb_project_check_trained ( SB_HANDLE  handle,
const char *const  model_name,
float  scale,
sb_t_project_training_status *const  training_status 
)

Checks if the project is trained.

Usually, to check if a project is trained and the sb_project_detection function can be called, the function is called with model_name equal to NULL and scale equal to 0.
The function works in a slightly different way depending on the project type.
In case of a Surface project the model_name and scale parameters can be configured in 4 different ways explained below.

model_name scale Condition is_trained
NULL 0
All models are disabled SB_PROJECT_TRAINED
All the enabled models and all their enabled scale levels are trained SB_PROJECT_TRAINED
There is an enabled model with all scale levels disabled SB_PROJECT_TRAINED
There is an enabled model with no scale levels SB_PROJECT_TRAINED_NONE
There is an enabled model with an enabled scale level that is no trained SB_PROJECT_TRAINED_NONE
The project has no models SB_PROJECT_TRAINED_NONE
!=NULL >=1.0
The model is disabled SB_PROJECT_TRAINED
The model is enabled and the scale is disabled SB_PROJECT_TRAINED
the specified combination model_name - scale has been trained SB_PROJECT_TRAINED
the specified combination model_name - scale has not been trained SB_PROJECT_TRAINED_NONE
NULL >=1.0
All the enabled models that have the specified scale level are trained SB_PROJECT_TRAINED
There is an enabled model with the specified scale level that is not trained SB_PROJECT_TRAINED_NONE
!=NULL 0
The model is disabled SB_PROJECT_TRAINED
The model is enabled and all the enabled scale levels are trained SB_PROJECT_TRAINED
The model is enabled and all the scale levels are disabled SB_PROJECT_TRAINED
The model is enabled and it has no scale levels SB_PROJECT_TRAINED_NONE
The model is enabled and there is an enabled scale level that is no trained SB_PROJECT_TRAINED_NONE

In case of Retina, Deep Cortex or Deep Surface project type the parameter scale is not used, so the table can be simplified as the one below:

model_name Condition is_trained
NULL
All models are disabled SB_PROJECT_TRAINED or SB_PROJECT_TRAINED_OPENVINO
All the enabled models are trained SB_PROJECT_TRAINED or SB_PROJECT_TRAINED_OPENVINO
The project has no models SB_PROJECT_TRAINED_NONE
!=NULL
The model is disabled SB_PROJECT_TRAINED or SB_PROJECT_TRAINED_OPENVINO
The model is enabled and it is trained SB_PROJECT_TRAINED or SB_PROJECT_TRAINED_OPENVINO
The model is enabled but it isn't trained SB_PROJECT_TRAINED_NONE
Parameters
[in]handleProject Handle.
[in]model_nameName of the model to be checked.
If the model_name is not found the function returns the error SB_ERR_MODEL_NOT_FOUND.
[in]scaleLevel scale to check.
Used only by Surface projects.
The permitted values are 0 and between SB_PAR_LEVEL_SCALE_MIN and SB_PAR_LEVEL_SCALE_MAX with steps of SB_PAR_LEVEL_SCALE_GRANULARITY, i.e. 1, 1.5, 2, 2.5 etc.
If scale has no allowed value, the function returns the error SB_ERR_WRONG_PARAMETER.
If the scale has an allowed value but it is not found the function returns the error SB_ERR_SCALE_NOT_FOUND.
[out]training_statusVariable set according to the tables above.
Returns
If successful, returns SB_ERR_NONE. Otherwise, it returns an error code sb_t_err.
See also
sb_project_invalidate

◆ sb_project_clone()

sb_t_err sb_project_clone ( SB_HANDLE  src,
SB_HANDLE pdst,
sb_t_project_mode  mode,
int  regenerate_uuid 
)

Clones the SqueezeBrains project.

The function returns the SB_ERR_PROJECT_LOAD_MODE error if the load mode of the source project is lower than the new load mode.

Parameters
[in]srcThe source project handle.
[out]pdstThe pointer to the new project handle.
[in]modeLoading method of the module of a project.
[in]regenerate_uuidIf true it generates a new project uuid for the new project
Returns
If successful, returns SB_ERR_NONE. Otherwise, it returns an error code sb_t_err.
See also
sb_project_create
sb_project_load
sb_project_destroy

◆ sb_project_copy_labeling()

sb_t_err sb_project_copy_labeling ( const char *const  path_solution_dst,
const char *const  path_solution_src,
int  copy_roi,
int  copy_labeling,
int  verbosity 
)

Copies the analysis roi and the labeling between two current projects of two different solutions.

For each image of the destination project it searches the source project for the image with the same name and if the .rtn file exists, it copies the required data.
The source and destination image must have the same resolution.

Parameters
path_solution_dstFolder of the destination solution, the current project is used
path_solution_srcFolder of the source solution, the current project is used
copy_roiSet to 1 if you need to copy ROI analysis.
copy_labelingSet to 1 if you need to copy labeling (i.e. samples or ROI defects).
verbosityMessage verbosity, 0 disable all trace
Returns
If successful, returns SB_ERR_NONE. Otherwise, it returns an error code sb_t_err.
See also
sb_solution_set_current_project

◆ sb_project_create()

sb_t_err sb_project_create ( SB_HANDLE phandle,
const char *const  project_name,
sb_t_project_type  project_type 
)

Creates a new project of the specifed type.

Parameters
[out]phandlePointer to the project handle
[in]project_nameName of the project.
[in]project_typeProject type.
Returns
If successful, returns SB_ERR_NONE. Otherwise, it returns an error code sb_t_err.
See also
Solution and projects management
sb_project_save
sb_project_destroy
sb_project_clone

◆ sb_project_destroy()

sb_t_err sb_project_destroy ( SB_HANDLE phandle)

Frees all the resources of the project handle.

Parameters
[in,out]phandlePointer to the project handle
Returns
If successful, returns SB_ERR_NONE. Otherwise, it returns an error code sb_t_err.
See also
Solution and projects management
sb_project_create
sb_project_load
sb_project_clone

◆ sb_project_destroy_par_changes_info()

sb_t_err sb_project_destroy_par_changes_info ( sb_t_par_changes_info **const  par_changes_info)

Destroys the structure.

Parameters
[in,out]par_changes_infoPointer to the structure. The function sets it to NULL.
Returns
If successful, returns SB_ERR_NONE. Otherwise, it returns an error code sb_t_err.
See also
Solution and projects management
sb_project_get_par_changes_info

◆ sb_project_detection()

sb_t_err sb_project_detection ( SB_HANDLE  handle,
const sb_t_image *const  img,
const sb_t_roi *const  roi,
const sb_t_roi *const  roi_defects,
const sb_t_samples *const  samples 
)

Detection function.

The function elaborates the image inside the ROI.
You should use the function sb_project_get_res to get the results.
Remember to call sb_roi_evaluate_bounding_box if the ROI is changed.
In case of Surface and Deep Surface projects the function also executes a blob analysis on the voting plane in order to cluster the defects areas. The function does the blob analysis if the parameter roi_defects is valorized or if the sb_t_par.surface_blob_analysis is set.
If you want to reset the statistic you should call the function sb_project_reset_stat before to call sb_project_detection .

Note
The function needs that the license be active and valid.
Parameters
[in]handleProject handle.
[in]imgPointer to the image. It is analyzed inside the ROI.
[in]roiPointer of the ROI.
[in]roi_defectsPointer to the defects ROI. Is it used only with Surface and Deep Surface projects. The parameter can be NULL.
In the case roi_defects is valorized, the function executes the blob analysis on the voting plane and does the following operation:
[in]samplesPointer to the samples of the image that is the ground truth or labeling. It is used only with Retina and Deep Cortex projects. The parameter can be NULL.
If samples if valorized, the function works in test mode and can perform the following operation:
  • compare the results with the labeling in order to set the field truth (see sb_t_sample) of the samples in the results (see sb_t_res).
  • evaluates the detection statistics. You should use the function sb_project_get_stat to get them. In case the parameter roi_defects is valorized than the function vote plane extracted in order to cluster the defects areas and compare them with the corresponding areas of the ground truth, thus providing a global statistic.
Returns
If successful, returns SB_ERR_NONE. Otherwise, it returns an error code sb_t_err.
See also
Solution and projects management
How SB works
License configurations
ROI management
How to do labeling
sb_project_load
sb_roi_evaluate_bounding_box
sb_project_get_res
sb_project_get_stat
sb_project_reset_stat

◆ sb_project_detection_destroy_info()

sb_t_err sb_project_detection_destroy_info ( sb_t_project_detection_info **const  di)

Destroy the detection info structure.

Parameters
[in,out]diPointer to the detection info
Returns
If successful, returns SB_ERR_NONE. Otherwise, it returns an error code sb_t_err.
See also
sb_project_detection_get_info

◆ sb_project_detection_get_info()

sb_t_err sb_project_detection_get_info ( SB_HANDLE  handle,
const sb_t_image *const  src,
const sb_t_roi *const  roi,
sb_t_project_detection_info **const  di 
)

Returns detection information.

The function analyzes the image and returns some information that can be useful to understand which images have actually been processed.
The function has been implemented only for Deep Surface projects.

Parameters
handleProject handle
[in]srcPointer to the image.
[in]roiPointer of the ROI.
[out]diPointer to the detection information. The structure must be destroied with the function sb_project_detection_destroy_info . Nella struttura c'è la lista dei singoli tile elaborati
Returns
If successful, returns SB_ERR_NONE. Otherwise, it returns an error code sb_t_err.
See also
sb_project_detection_destroy_info

◆ sb_project_get_custom_par_root()

sb_t_err sb_project_get_custom_par_root ( SB_HANDLE  handle,
SB_HANDLE node_root 
)

Returns the xml root node of your own custom parameters.

Attention
The handle returned by the function must not the destroyed.
Parameters
[in]handleProject handle.
[out]node_rootThe variable is filled with the xml root node of your own custom parameters.
The handle returned by the function must not be destroyed.
Returns
If successful, returns SB_ERR_NONE. Otherwise, it returns an error code sb_t_err.
See also
Manage custom parameters
sb_xml_node_get
sb_xml_node_get_child
sb_xml_node_next
sb_xml_node_add
sb_xml_node_set
sb_xml_node_get_name
sb_xml_node_set_attribute
sb_xml_node_get_attribute
sb_xml_node_set_itself
sb_xml_node_count
sb_xml_node_get_string
sb_xml_node_get_string_malloc
sb_xml_node_remove
sb_xml_node_remove_itself

◆ sb_project_get_info()

sb_t_err sb_project_get_info ( SB_HANDLE  handle,
sb_t_project_info project_info 
)

Gets the project information from the handle.

Parameters
[in]handleThe project handle
[out]project_infoPointer to the project information structure
Returns
If successful, returns SB_ERR_NONE. Otherwise, it returns an error code sb_t_err.
See also
sb_solution_get_info

◆ sb_project_get_name()

sb_t_err sb_project_get_name ( SB_HANDLE  handle,
char **const  name 
)

Gets the name from the project handle.

Parameters
[in]handleProject handle.
[out]namePointer to the name.
On successful return, this parameter will be filled with the pointer to the name.
The pointer should be freed with sb_free.
Returns
If successful, returns SB_ERR_NONE. Otherwise, it returns an error code sb_t_err.
See also
sb_project_set_name

◆ sb_project_get_notes()

sb_t_err sb_project_get_notes ( SB_HANDLE  handle,
char **const  note 
)

Gets the note from the project handle.

Parameters
[in]handleProject handle.
[out]notePointer to the note.
On successful return, this parameter will be filled with the pointer to the note.
The pointer should be freed with sb_free.
Returns
If successful, returns SB_ERR_NONE. Otherwise, it returns an error code sb_t_err.
See also
sb_project_set_notes

◆ sb_project_get_par()

sb_t_err sb_project_get_par ( SB_HANDLE  handle,
sb_t_par **const  par 
)

Retrieves the project parameters structure.

Parameters
[in]handleProject handle.
[out]parPointer to the parameters structure.
On successful return, this parameter will be filled with the pointer to sb_t_par structure.
The structure should be freed using the function sb_par_destroy.
Returns
If successful, returns SB_ERR_NONE. Otherwise, it returns an error code sb_t_err.
See also
Solution and projects management
sb_project_set_par
sb_project_create
sb_project_load
sb_par_destroy
sb_par_clone
sb_par_copy
sb_par_format
sb_par_add_model
sb_par_remove_model
sb_par_add_level
sb_par_remove_level
sb_par_set_collaboration
sb_par_get_collaboration

◆ sb_project_get_par_changes_info()

sb_t_err sb_project_get_par_changes_info ( SB_HANDLE  handle,
const sb_t_par *const  par,
sb_t_par_changes_info **const  par_changes_info 
)

Returns the information on what sb_project_set_par and sb_image_info_apply_par_changes do when they apply the new parameters.

Parameters
[in]handleProject handle.
[in]parPointer to the new project parameters structure.
[out]par_changes_infoPointer to the structure of information on parameter changes. The structure must be deallocated with sb_project_destroy_par_changes_info .
Returns
If successful, returns SB_ERR_NONE. Otherwise, it returns an error code sb_t_err.
See also
Solution and projects management
sb_project_destroy_par_changes_info
sb_project_set_par

◆ sb_project_get_res()

sb_t_err sb_project_get_res ( SB_HANDLE  handle,
sb_t_res **const  res,
int  details 
)

Retrieves the results of the last elaborated image.

For more information see sb_t_res .
The field par in the structure sb_t_res is valued with the parameters saved when the sb_project_detection function was last called.

Parameters
[in]handleModule handle.
[out]resPointer to the results structure.
On successful return, this parameter will be filled with the pointer to sb_t_res structure.
The structure should be freed using the function sb_res_destroy.
[in]detailsIf 1 the function also exports some additional details.
For Retina project the details are the weight images of each sample, that is the sb_t_sample::weights_image image.
For Surface or Deep Surface project the details are the fields sb_t_res_model::surface in the models array sb_t_res::models.
For Deep Cortex project the details are currently not available.
Returns
If successful, returns SB_ERR_NONE. Otherwise, it returns an error code sb_t_err.
See also
Solution and projects management
sb_project_detection
sb_res_destroy
sb_t_res
sb_t_par

◆ sb_project_get_scale_offset_par()

sb_t_err sb_project_get_scale_offset_par ( SB_HANDLE  handle,
sb_t_scale_offset_par *const  scale_offset 
)

Gets the scale offset from the project handle.

It works only for Deep Surface projects.

Parameters
[in]handleThe project handle
[out]scale_offsetThe variable is filled with the scale offset.
Returns
If successful, returns SB_ERR_NONE. Otherwise, it returns an error code sb_t_err.
See also
sb_project_set_scale_offset_par

◆ sb_project_get_sensitivity()

sb_t_err sb_project_get_sensitivity ( SB_HANDLE  handle,
const char *const  model_name,
float  scale,
float *const  sensitivity 
)

Gets the classification threshold from the project handle.

Parameters
[in]handleThe project handle
[in]model_nameModel name.
[in]scaleScale value. Used only by Surface projects.
[out]sensitivityThe variable is filled with the classification sensitivity.
Returns
If successful, returns SB_ERR_NONE. Otherwise, it returns an error code sb_t_err.
See also
sb_project_set_sensitivity

◆ sb_project_get_stat()

sb_t_err sb_project_get_stat ( SB_HANDLE  handle,
sb_t_stat **const  stat 
)

Gets the statistics from the handle.

Parameters
[in]handleModule handle.
[out]statPointer to the statistics structure.
On successful return, this parameter will be filled with the pointer to a sb_t_stat structure.
The structure should be freed using the function sb_stat_destroy.
The field par in the structure sb_t_stat is valorized with the parameters saved when the sb_project_detection function was last called.
Returns
If successful, returns SB_ERR_NONE. Otherwise, it returns an error code sb_t_err.
See also
sb_project_detection
sb_stat_destroy

◆ sb_project_get_svl_version()

sb_t_err sb_project_get_svl_version ( SB_HANDLE  handle,
sb_t_version *const  version,
char *const  version_str,
int  size_version_str 
)

Returns the version of the SB library when the last SVL was made.

Parameters
[in]handleProject handle.
[out]versionPointer of the version structure.
[out]version_strPointer to the string, is filled with the SVL version for example "1.8.0.0". This parameter can be left to NULL if not necessary.
[in]size_version_strSize of the version_str string.
Returns
If successful, returns SB_ERR_NONE. Otherwise, it returns an error code sb_t_err.
See also
sb_solution_get_version

◆ sb_project_invalidate()

sb_t_err sb_project_invalidate ( SB_HANDLE  handle,
const char *const  model_name,
float  scale 
)

Eliminates the training of the models.

After calling this function it is necessary to do an SVL before to call again the functions sb_project_detection.

Parameters
[in]handleProject Handle.
[in]model_nameName of the model to be invalidated. If NULL all models will be invalidated.
[in]scaleLevel / Scale to be invalidated. If 0 all levels will be invalidated. Used only by Surface projects.
Returns
If successful, returns SB_ERR_NONE. Otherwise, it returns an error code sb_t_err.
See also
sb_project_check_trained

◆ sb_project_load()

sb_t_err sb_project_load ( SB_HANDLE phandle,
const char *const  solution_file,
const char *const  project_uuid,
sb_t_project_mode  mode 
)

Loads an existing project from a solution file.

The project resides in a solution together with other projects for which it is necessary to specify the UUID of the project that uniquely identifies it.

Parameters
[out]phandlePointer to the project handle
[in]solution_fileFull name of the solution file in which the project exists
[in]project_uuiduuid of the project. To get the project uuid use the function sb_solution_get_info .
[in]modeLoading mode of a project from a solution.
Returns
If successful, returns SB_ERR_NONE. Otherwise, it returns an error code sb_t_err.
See also
Solution and projects management
sb_project_save
sb_project_create
sb_project_destroy
sb_solution_get_info
sb_project_clone

◆ sb_project_openvino_conversion()

sb_t_err sb_project_openvino_conversion ( SB_HANDLE  handle,
const char *const  converter_path 
)

Starting from the pytorch weights, it generates the openvino weights.

The name of the weights conversion programm is pytorch_to_onnx_converter.exe on Windows and pytorch_to_onnx_converter on Linux.
You can found it in the folder "C:Program Files\SqueezeBrains\1.16\win_x64\dl_framework" for Windows or "/opt/SqueezeBrains/1.16/linux_x64/dl_framework" for Linux.
If you need to run the detection using Intel OpenVino technology on SB_DEVICE_CPU , SB_DEVICE_IGPU_INTEL or SB_DEVICE_DGPU_INTEL device, you have to call this function after sb_svl_run in order to generate the openvino weights.

Parameters
[in]handleThe project handle.
[in]converter_pathName of the weights conversion programm with path.
It can be null, in this case the executable must be in the current directory or in the PATH environment variable the path in which the conversion program resides must have been added.
Returns
If successful, returns SB_ERR_NONE. Otherwise, it returns an error code sb_t_err.
See also
sb_svl_run

◆ sb_project_reset_stat()

sb_t_err sb_project_reset_stat ( SB_HANDLE  handle)

Resets the internal statistics of the elaborations.

Parameters
[in]handleModule handle.
Returns
If successful, returns SB_ERR_NONE. Otherwise, it returns an error code sb_t_err.
See also
sb_project_detection

◆ sb_project_save()

sb_t_err sb_project_save ( SB_HANDLE  handle,
const char *const  solution_file,
sb_t_project_mode  mode 
)

Saves the project to file.

The project is saved in a solution along with other projects.

Parameters
[in]handleThe project handle
[in]solution_fileFilename of the solution where to save the project. If NULL the function uses the parameter solution_file of the function sb_project_load used to create the project.
[in]modeSaving mode of a project into a solution.
Returns
If successful, returns SB_ERR_NONE. Otherwise, it returns an error code sb_t_err.
See also
Solution and projects management
sb_project_create
sb_project_load
sb_project_destroy

◆ sb_project_set_name()

sb_t_err sb_project_set_name ( SB_HANDLE  handle,
const char *const  name 
)

Sets the name into the project handle.

Parameters
[in,out]handleProject handle.
[in]nameName to be written. The string must be compliant to UTF-8 format.
Returns
If successful, returns SB_ERR_NONE. Otherwise, it returns an error code sb_t_err.
See also
sb_project_get_name

◆ sb_project_set_notes()

sb_t_err sb_project_set_notes ( SB_HANDLE  handle,
const char *const  note 
)

Sets the note into the project handle.

Parameters
[in,out]handleProject handle.
[in]noteNote to be written. The string must be compliant to UTF-8 format.
Returns
If successful, returns SB_ERR_NONE. Otherwise, it returns an error code sb_t_err.
See also
sb_project_get_notes

◆ sb_project_set_par()

sb_t_err sb_project_set_par ( SB_HANDLE  handle,
const sb_t_par *const  par 
)

Sets the parameters structure into the project handle.

The function can invalidate the training if some critical parameter is changed.
In the following the list for each project type:

You can call the function sb_project_get_par_changes_info to know which models will be invalidated in a subsequent call of the function sb_project_set_par.
The following table describe all the possible situations in which a model (Retina and Surface) or a level (Surface) or the SVL (Deep Cortex and Deep Surface) will be invalidated or not.

Project type Changes in parameters sb_t_par Model is invalidated Level is invalidated SVL invalidated
Retina The size of the model is changed yes
One of the models it collaborates with is invalidated due to changes in size yes
One of the models it collaborates with is deleted yes
The model's collaborations have been changed yes
The model is deleted yes
The order in the model array has been changed no
One of the models it collaborates with is disabled no
The model is disabled no
The parameter sb_t_svl_par::image_circularity_type is changed yes
Surface One of the models it collaborates with is deleted yes
The model's collaborations have been changed yes
The model is deleted yes
The order in the model array has been changed no
One of the models it collaborates with is disabled no
The model is disabled no
The automatic choice of levels is enabled yes
The level is deleted yes
The level is disabled no
The parameter sb_t_par_sl::detection_out_of_roi is changed yes
The parameter sb_t_svl_par::image_circularity_type is changed yes
Deep Cortex The network is changed yes
The order in the model array has been changed yes
A model is added yes
A model is deleted yes
The pre-training file is set or removed yes
The model's collaborations have been changed yes
sb_t_svl_dl_par_network::features_multiplier is changed yes
A model is disabled no
Deep SurfaceThe network is changed yes
The pre-training file is set or removed yes
The scale is changed yes (if tiling mode is equal to SB_TILING_MODE_AUTO )
The tiling mode is changed yes
The number of tiles is changed yes (if tiling mode is equal to SB_TILING_MODE_MANUAL )
The order in the model array has been changed yes
A model is added yes
A model is deleted yes
The model's collaborations have been changed yes
The parameter sb_t_svl_par::image_circularity_type is changed yes
sb_t_svl_dl_par_network::features_multiplier is changed yes
A model is disabled no
Parameters
[in,out]handleProject handle.
[in]parPointer to the parameters structure.
Returns
If successful, returns SB_ERR_NONE. Otherwise, it returns an error code sb_t_err.
See also
Solution and projects management
sb_project_get_par
sb_project_create
sb_project_load
sb_project_get_par_changes_info

◆ sb_project_set_scale_offset_par()

sb_t_err sb_project_set_scale_offset_par ( SB_HANDLE  handle,
sb_t_scale_offset_par  scale_offset 
)

Sets in the project handle the scale offset used at detection time.

The scale offset give the possibility to the user to vary the scale range used by sb_project_detection when tiling mode is equal to to SB_TILING_MODE_AUTO. It consists in four values that are added to the sb_t_svl_dl_tiling_par::scale parameter in order to change both horizontal and vertical scale ranges used at detection time. The scale offset allows the user to change both the minimum and maximum value of the scale range. Call this function may be useful when detection is performed over images at different resolution but at the same time is necessary to maintain fixed the number of tiles effectively used by the algorithm and the elaboration times. However, the usage by detection of a scale different from that used by SVL, may affect the results. Therefore it is not recommended to set sb_t_scale_offset_par::width_max and sb_t_scale_offset_par::height_max scale values higher than 1.0 or lower than -1.0.
The sum of sb_t_svl_dl_tiling_par::scale plus the value set with the function must be greater or equal than SB_DL_SCALE_MIN and less or equal than SB_DL_SCALE_MAX. Furthermore, the value must have the granularity SB_DL_SCALE_GRANULARITY.
The function limits the value between the minimum and maximum and approximates it to the nearest granular value.
If the maximum value of the scale range plus sb_t_scale_offset_par::width_max is less than the minimum value of the scale range plus sb_t_scale_offset_par::width_min, than the function corrects the scale offset according to the following rules:

  1. The first operation that is done is to limit the scale offsets so that: SB_DL_SCALE_MIN <= scale.min + offset_min <= SB_DL_SCALE_MAX SB_DL_SCALE_MIN <= scale.max + offset_max <= SB_DL_SCALE_MAX
  2. If scale.min + offset_min > scale.max + offset_max then:
    1. if offset_min > 0 and offset_max > 0:
      offset_min = scale.max + offset_max - scale.min offset_max unchanged
    2. if offset_min < 0 and offset_max < 0:
      offset_min unchanged offset_max = scale.min + offset_min - scale.max
    3. if offset_min > 0 and offset_max < 0 then both offsets are reduced proportionally in absolute value so that:
      offset_min = offset_min - offset_min / offset_max * (scale.max + offset_max - scale.min - offset_min) / ( 1 - offset_min / offset_max) offset_max = (scale.max + offset_max - scale.min - offset_min) / ( 1 - offset_min / offset_max)
    4. if offset_min < 0 and offset_max > 0:
      case not possible because in this case the initial hypothesis is not verified

It works only for Deep Surface projects.

Note
If high scale offset value is needed, try to re-evaluate the sb_t_svl_dl_tiling_par::scale parameter used for SVL.
Default
Default value is (0.0, 0.0).
Parameters
[in]handleThe project handle
[in]scale_offsetNew value of scale offset to be set
Returns
If successful, returns SB_ERR_NONE. Otherwise, it returns an error code sb_t_err.
See also
sb_project_get_scale_offset_par

◆ sb_project_set_sensitivity()

sb_t_err sb_project_set_sensitivity ( SB_HANDLE  handle,
const char *const  model_name,
float  scale,
float  sensitivity 
)

Sets the sensitivity of the detection in the project handle.

The sensitivity affects only the results of the detection and does not affect training in any way.

Parameters
[in]handleThe project handle.
[in]model_nameName of the model to be set. If NULL all models will be set.
[in]scaleLevel / Scale value. If 0 all levels will be set. Used only by Surface projects.
[in]sensitivityNew value of sensitivity to be set.
The range of acceptable values is between -1 and 1 excluded.
If the value is greater than 1 or less than -1, it is rounded to 1 and -1 respectively.
Returns
If successful, returns SB_ERR_NONE. Otherwise, it returns an error code sb_t_err.
See also
sb_project_get_sensitivity

◆ sb_project_training_status_format()

const char * sb_project_training_status_format ( sb_t_project_training_status  training_status)

Returns the string of the training status.

Interprets the contents of the training_status and converts it to a C-string containing a human-readable version of the corresponding training status.
The string must not be freed.

Parameters
[in]training_statusTraining status.
Returns
A C-string containing the training status in a human-readable format.

◆ sb_project_type_format()

const char * sb_project_type_format ( sb_t_project_type  type)

Returns the string of the project type.

Interprets the contents of the code and converts it to a C-string containing a human-readable version of the corresponding value.

Warning
The string must not be freed.
Parameters
[in]typeProject type.
Returns
A C-string containing the project type in a human-readable format.