38#include "../common/common.h"
67 printf(
"Initialize the SqueezeBrains library\n");
75 printf(
"wait for license...\n");
93 printf(
"Release SqueezeBrains library\n");
96 printf(
"Press ENTER to terminate\n");
134 remove(
"dataset/surface_001.rtn");
186 printf(
"Training is running, please wait . . .\n");
191 printf(
"time=%1.3fs\n", svl_res->
time_ms / 1000.0f);
EXTERN_C sb_t_err wait_license(void)
The functions wait until the license status is active.
#define CHECK_FN_GOTO(function)
sb_t_err
Errors code enum.
sb_t_err sb_destroy_info(sb_t_info **const info)
Destroys the structure.
sb_t_err sb_release(void)
Releases all the resources allocates in the library.
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.
sb_t_err sb_init(const char *const license_file)
Initializes the SB library.
void * SB_HANDLE
HANDLE definition.
sb_t_err sb_image_info_set_roi(SB_HANDLE image_info, const sb_t_roi *const roi)
Sets the ROI in a SqueezeBrains image info handle.
sb_t_err sb_image_info_set_type(SB_HANDLE image_info, sb_t_image_info_type type)
Sets the type of the SqueezeBrains image info.
sb_t_err sb_image_info_get_roi(SB_HANDLE image_info, sb_t_roi **const roi, int width, int height, int compressed)
Gets the ROI from a SqueezeBrains image info handle.
sb_t_err sb_image_info_get_roi_defects(SB_HANDLE image_info, sb_t_roi **const defects, int width, int height, int compressed)
Gets the surface defects ROI from a SqueezeBrains image info handle.
sb_t_err sb_image_info_load(SB_HANDLE *image_info, const char *const image_file, SB_HANDLE module_handle)
Creates a SqueezeBrains image info handle.
sb_t_err sb_image_info_set_roi_defects(SB_HANDLE image_info, const sb_t_roi *const defects)
Sets the surface defects ROI on a SqueezeBrains image info handle.
sb_t_err sb_image_info_reset(SB_HANDLE image_info)
Erases all the data from the SqueezeBrains image info handle.
sb_t_err sb_image_info_destroy(SB_HANDLE *image_info)
Destroys the SqueezeBrains image info handle.
sb_t_err sb_image_info_save(SB_HANDLE image_info)
Saves the SqueezeBrains image info handle into the image file.
@ SB_IMAGE_INFO_TYPE_SVL
Image is used for SVL and not used for training.
#define SB_IMAGE_FILE_EXTENSIONS
List of the possible extensions of the image.
sb_t_err sb_image_destroy(sb_t_image **const pimg)
Destroys the image.
sb_t_err sb_image_load(sb_t_image **const img, const char *const file)
Loads an image from a file.
sb_t_err sb_par_add_level(sb_t_par *const par, const char *const model_name, float scale)
Adds the level to the parameter structure.
sb_t_err sb_par_add_model(sb_t_par *const par, const char *const model_name)
Adds the model to the parameter structure.
sb_t_err sb_par_destroy(sb_t_par **const par)
Destroys the project parameters structure.
sb_t_err sb_project_set_par(SB_HANDLE handle, const sb_t_par *const par)
Sets the parameters structure into the project handle.
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.
sb_t_err sb_project_save(SB_HANDLE handle, const char *const solution_file, sb_t_project_mode mode)
Saves the project to file.
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.
sb_t_err sb_project_destroy(SB_HANDLE *phandle)
Frees all the resources of the project handle.
sb_t_err sb_project_get_par(SB_HANDLE handle, sb_t_par **const par)
Retrieves the project parameters structure.
@ SB_PROJECT_MODE_DETECTION_AND_SVL
Load/save all the module information.
@ SB_PROJECT_TYPE_SURFACE
Project Surface.
sb_t_err sb_roi_set_circle(sb_t_roi *const roi, unsigned char gl, int center_x, int center_y, int radius, int reset_roi)
Sets a circular ROI.
sb_t_err sb_roi_set_ellipse(sb_t_roi *const roi, unsigned char gl, int center_x, int center_y, int radius_x, int radius_y, int reset_roi)
Sets an elliptical ROI.
sb_t_err sb_roi_destroy(sb_t_roi **const roi)
Destroys the ROI.
sb_t_err sb_solution_get_info(const char *const solution_file, sb_t_solution_info **const solution)
Returns the information contained in the solution_file.
#define SB_SOLUTION_EXT
Extension of the SqueezeBrains solution file.
sb_t_err sb_solution_destroy_info(sb_t_solution_info **const solution)
Destroys the structure of the solution information.
sb_t_err sb_svl_destroy_res(sb_t_svl_res **const res)
Destroys the structure of the results of SVL.
sb_t_err sb_svl_reset(SB_HANDLE handle)
Resets the history of previous executions of the SVL.
sb_t_err sb_svl_run(SB_HANDLE handle)
Runs the SVL.
sb_t_err sb_svl_get_res(SB_HANDLE handle, sb_t_svl_res **const res)
Retrieves the results of SVL.
int width
Width, in pixel, of the image.
int height
Height, in pixel, of the image.
General information about sb library and computing devices like CPU and GPUs.
char compile_time[32]
String with the compilation time of the sb library.
char compile_date[32]
String with the compilation date of the sb library.
char version_str[16]
String with the version of the sb library.
sb_t_svl_par svl
SVL parameters.
char uuid[SB_PROJECT_UUID_LEN]
Project UUID.
sb_t_project_info * info
Array of solution project information.
sb_t_image * img
8bit BW image.
sb_t_projects_info projects
Array of the projects info.
int current_project
Index of the current project in the projects array.
sb_t_svl_sl_par sl
Shallow Learning SVL parameters.
char project_path[512]
Path of the project, where the SVL will find the images.
char image_ext[64]
Extensions of the images.
float goodness
Goodness of the training.
Defines the results of SVL.
sb_t_svl_res_level global
Cumulative results of all levels of all models.
long long time_ms
Execution time, in ms, of SVL.
float goodness_target
Goodness target of the training.
sb_t_err execute_training(void)
Execute training.
sb_t_err set_labeling(SB_HANDLE surface)
Set labeling.
sb_t_err create_surface_project_file(SB_HANDLE *surface)
Create a surface project file.