36#include "../common/common.h"
43 long long last_time_ms;
52 if (ud->last_time_ms < res->
time_ms)
54 ud->last_time_ms = res->
time_ms + 1000;
55 printf(
"\r\"%s\", TP=%d, FP=%d, FN=%d, goodness=%1.3f, cls=\"%s\", features=\"%s\", time=%llds, time last improvement=%llds (%llds), memory=%lld/%lldMByte ",
68#if defined(_WIN32) && !defined(QT_CREATOR)
70static DWORD WINAPI retina_svl(LPVOID svl)
73 printf(
">>> START SVL <<<\n");
75 printf(
"\n>>> STOP SVL <<<\n");
78 printf(
"sb_svl_run returns %d - %s", err,
sb_err_format(err));
88int main(
int argc,
char* argv[])
92 char path[256] =
"solution";
94 float free_memory_percentage = 0.1f;
100 char* program_name = NULL;
104 program_name = strrchr(argv[0],
'\\');
106 program_name = strrchr(argv[0],
'/');
108 program_name = program_name ? program_name + 1: argv[0];
114 printf(
"wait for license...\n");
118 printf(
"---------------------------------------------------------------\n");
119 printf(
"The program run the SVL of the specified project\n");
120 printf(
"Compiled on: %s %s\n", __DATE__, __TIME__);
122 printf(
"Usage: %s project_path reset free_memory_percentage\n", program_name ? program_name :
"");
123 printf(
" - project_path:\n");
124 printf(
" path of the project\n");
125 printf(
" - reset:\n");
126 printf(
" 0 svl incremental\n");
127 printf(
" 1 svl reset\n");
128 printf(
" - free_memory_percentage\n");
129 printf(
" When the free physical memory drops below this percentage, the SVL starts to save on disk its data.\n");
130 printf(
" Value between 0 and 1\n");
131 printf(
"---------------------------------------------------------------\n");
135 printf(
"-------------------------------------------------------------------------------------\n");
136 printf(
"Input parameters:\n");
137 strcpy(path, argv[1]);
138 reset = atoi(argv[2]);
139 free_memory_percentage = (float)atof(argv[3]);
143 printf(
"---------------------------------------------------------------\n");
144 printf(
"No parameters found on command line!\n");
145 printf(
"Runs with default parameter.\n");
147 printf(
"project_path : \"%s\"\n", path);
148 printf(
"reset : %d\n", reset);
149 printf(
"free_memory_percentage: %f\n", free_memory_percentage);
150 printf(
"---------------------------------------------------------------\n");
154 if (folder_cls->
n == 0)
185#if defined(_WIN32) && !defined(QT_CREATOR)
186 printf(
"-------------------------------------------------------------------------------------\n");
187 printf(
"CTRL-right + F12 = stop svl\n");
188 printf(
"-------------------------------------------------------------------------------------\n");
191 int stop_request = 0;
192 CreateThread(NULL, 0, retina_svl, svl, 0, NULL);
199 if (!stop_request && (GetAsyncKeyState(VK_RCONTROL) & 0x8000) && (GetAsyncKeyState(VK_F12) & 0x8000))
201 printf(
"\nSend stop request to svl...\n");
205 if (!svl_run) {
break;}
216 printf(
"\nsaving SVL results....\n");
230 printf(
"Release SqueezeBrains library\n");
233 printf(
"Press ENTER to terminate\n");
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.
const char * sb_err_format(sb_t_err code)
Returns the error message.
@ SB_ERR_FILE_NOT_EXIST
The file doesn't exist.
sb_t_err sb_folder_destroy(sb_t_folder **folder)
Frees all the resources of the sb_t_folder structure.
sb_t_err sb_folder_load(sb_t_folder **const f, const char *const path, const char *const ext, int sort, int verbosity)
Creates the list of the name of the files in a specified folder.
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_par_format(const sb_t_par *const par, char *const str, int str_size)
Formats the project parameters 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_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_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_stop_request(SB_HANDLE handle)
Sends a request to the SVL for stop.
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.
#define SB_SVL_STEP_FINISHED
SVL step: svl has finished.
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 main(int argc, char *argv[])
char name[256]
Name of the file included of path.
defines the list of the file in a folder.
sb_t_file * file
Array of files.
int n
Number of elements of the array file.
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.
signed long long malloc_size
Current allocated memory, expressed in bytes, by sb the library.
signed long long malloc_size_max
Maximum allocated memory, expressed in bytes, by sb the 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_projects_info projects
Array of the projects info.
int current_project
Index of the current project in the projects array.
sb_fp_svl_progress fp_progress
The SVL calls this callback to notify the user the results of SVL.
float free_memory_percentage
Percentage of system memory that the svl tries to leave free.
char project_path[512]
Path of the project, where the SVL will find the images.
void * user_data
Pointer to data which is passed to the callbacks.
float goodness
Goodness of the training.
int fn
Number of FALSE NEGATIVE samples.
int tp
Number of TRUE POSITIVE samples.
char features[SB_PAR_FEATURES_NAMES_LEN]
List of the features choosen by SVL.
char classificator[32]
Classificator choosen by SVL.
int fp
Number of FALSE POSITIVE samples.
sb_t_svl_res_level global
Cumulative results of all levels.
sb_t_svl_res_model model[SB_PAR_MODELS_NUM]
Specific results for each model.
Defines the results of SVL.
sb_t_svl_res_models models
Results for each model.
sb_t_svl_res_level global
Cumulative results of all levels of all models.
long long time_ms_last_improvement
Time, in ms, when there was the last improvement.
long long time_ms
Execution time, in ms, of SVL.
char running_step[256]
Description of the current step of the training.