SqueezeBrains SDK 1.13
deep_surface_svl_simple.c File Reference

Tutorial 13 - Deep Surface - How to create a project, import defects labeling from images, and execute the training (SVL). More...

#include "../common/common.h"
Include dependency graph for deep_surface_svl_simple.c:

Go to the source code of this file.

Data Structures

struct  sb_svl_user_data
 

Functions

sb_t_err create_deep_surface_project_file (SB_HANDLE *deep_surface)
 Create a solution file with a Deep Surface project. More...
 
sb_t_err set_labeling (SB_HANDLE deep_surface)
 Set labeling. More...
 
sb_t_err execute_training (void)
 Execute training. More...
 
sb_t_err check_labeling_file_exists (char *img_file, sb_t_folder *folder_defects, int *file_index)
 Check if a labeling mask file exists for the specified image. More...
 
int main (void)
 

Detailed Description

Tutorial 13 - Deep Surface - How to create a project, import defects labeling from images, and execute the training (SVL).

Attention
To execute this tutorial you need:

This tutorial shows what you should do to train a model from scratch, i.e. without using the SB GUI, starting from a set of images with associated labeling masks. A labeling mask is a grayscale image containing roi defects. On the command line you can specify the memory percentage to leave free.
During the execution the programs shows the status of the svl with the progressive results.
If you use Microsoft Visual Studio, you can stop the SVL using a key combination.
At the end the new SVL is saved in a solution file.

Attention
In current directory you should copy the license file sb.lic.
Alternatively, if you have bought a the dongle license, you can connect it to an usb port of the PC.
See also
sb_init
sb_init_dl
sb_release
sb_get_info
sb_license_get_info
sb_folder_load
sb_folder_destroy
sb_solution_get_info
sb_solution_destroy_info
sb_project_load
sb_project_destroy
sb_project_save
sb_project_get_par
sb_project_set_par
sb_par_format
sb_svl_reset
sb_svl_stop_request
sb_svl_run
sb_svl_get_res
sb_svl_destroy_res

Definition in file deep_surface_svl_simple.c.

Function Documentation

◆ check_labeling_file_exists()

sb_t_err check_labeling_file_exists ( char *  img_file,
sb_t_folder folder_defects,
int *  file_index 
)

Check if a labeling mask file exists for the specified image.

  1. Get the name without extension of the input image file.
  2. Scan the folder with the defects labeling and check if a mask with name equal to the current image exists.
  3. If the defects mask is founded, the index of the file in the folder is assigned.

Definition at line 207 of file deep_surface_svl_simple.c.

Here is the call graph for this function:

◆ create_deep_surface_project_file()

sb_t_err create_deep_surface_project_file ( SB_HANDLE deep_surface)

Create a solution file with a Deep Surface project.

  1. Create the project file
  2. Set parameters of the model of the object.
    • Set the model name
  3. Save the solution file.

Definition at line 186 of file deep_surface_svl_simple.c.

Here is the call graph for this function:

◆ execute_training()

sb_t_err execute_training ( void  )

Execute training.

  1. Get the solution information.
  2. Load the project.
  3. Reset a previous training.
  4. Set training parameters.
    • set GPU device for SVL
    • set deep learning network parameters (SDINet)
    • set deep learning perturbation parameters (flip, rotation and shift)
  5. Start the SVL (only on Linux)
  6. Save SVL results if it is possible
  7. Release the handles and the library

Definition at line 306 of file deep_surface_svl_simple.c.

Here is the call graph for this function:

◆ main()

int main ( void  )

In the following the list of the program steps:

  1. Initialization of the SqueezeBrains library.
  2. Initialization of the Squeezebrains deep learning modules.
  3. Wait until the license is active.
  4. Create SB project file.
  5. Add defects to images from labeling masks.
  6. Execute training.
  7. Destroy the project handle.
  8. Release the library.

Definition at line 137 of file deep_surface_svl_simple.c.

Here is the call graph for this function:

◆ set_labeling()

sb_t_err set_labeling ( SB_HANDLE  deep_surface)

Set labeling.

  1. Erase the old rtn files to begin from zero
  2. Load folder containing the labeling masks
  3. Add the labeling to the images. For each image:
    • Set the flag classified of the image in order for the image to be considered for the learning
    • Set the roi
    • Set the roi defects loading data from the corresponding labeling mask
  4. Destroy the handles

Definition at line 232 of file deep_surface_svl_simple.c.

Here is the call graph for this function: