SqueezeBrains SDK 1.13
cs_par.h
1#pragma once
2namespace sb_cs
3{
15 public enum class SbProjectType :int
16 {
21 };
22
26 public enum class SbImageCircularityType :int
27 {
31 };
32
36 public enum class SbFloatingPointPrecisionType :int
37 {
40 };
41
45 public enum class SbSvlParOptimizationMode :int
46 {
68 };
69
73 public ref class SbParSl
74 {
75 public:
86
87 internal:
88 SbParSl(const sb_t_par_sl* const src);
89 SbError CopyFromNative(const sb_t_par_sl* const src);
90 SbError CopyToNative(sb_t_par_sl* dst);
91 };
92
96 public ref class SbParLevel
97 {
98 public:
110 float scale;
111
112 internal:
113 SbParLevel(const sb_t_par_level* const src);
114 SbError CopyFromNative(const sb_t_par_level* const src);
115 SbError CopyToNative(sb_t_par_level* dst);
116 };
117
121 public ref class SbPerturbation
122 {
123 public:
128 int angle;
129
135
141
147
153 internal:
154 SbPerturbation(const sb_t_par_perturbation* const src);
155 SbError CopyFromNative(const sb_t_par_perturbation* const src);
156 SbError CopyToNative(sb_t_par_perturbation* const dst);
157 };
158
163 public ref class SbParModel
164 {
165 public:
170 String^ name;
185 array<SbParLevel^>^ levels;
190 array<SbPerturbation^>^ perturbations;
231 SbParModel();
232 internal:
233 SbParModel(const sb_t_par_model* const src);
234 SbError CopyFromNative(const sb_t_par_model* const src);
235 SbError CopyToNative(sb_t_par_model* const dst);
236 };
237
241 public ref class SbDevicesPar
242 {
243 public:
249
254 array<int>^ id;
255 internal:
256 SbDevicesPar();
257 SbDevicesPar(const sb_t_devices_par* const src);
258 SbError CopyFromNative(const sb_t_devices_par* const src);
259 SbError CopyToNative(sb_t_devices_par* dst);
260 };
261
265 public enum class SbNetworkType :int
266 {
299 };
300
304 public ref class SbSvlDlParNetwork
305 {
306 public:
332 internal:
334 SbError CopyFromNative(const sb_t_svl_dl_par_network* const src);
335 SbError CopyToNative(sb_t_svl_dl_par_network* dst);
336 };
337
342 public enum class SbLossFnType :int
343 {
347 //SB_LOSS_FN_TYPE_DICE = SB_LOSS_FN_TYPE_DICE,//!< Dice loss.
348 //SB_LOSS_FN_TYPE_RMI = SB_LOSS_FN_TYPE_RMI //!< RMI loss.
349 };
350
355 public enum class SbPerturbationMode :int
356 {
360 };
361
366 public enum class SbPerturbationType :int
367 {
371 };
372
376 public ref class SbSvlDlParPerturbation
377 {
378 public:
384
390
396
402
408
414
420
426
432
438
444
445 internal:
447 SbError CopyFromNative(const sb_t_svl_dl_par_perturbation* const src);
448 SbError CopyToNative(sb_t_svl_dl_par_perturbation* dst);
449 };
450
454 public ref class SbSvlDlPar
455 {
456 public:
462
468
474
480
486
492
498
504
510
516
522
528
534
535 internal:
536 SbSvlDlPar(const sb_t_svl_dl_par* const src);
537 SbError CopyFromNative(const sb_t_svl_dl_par* const src);
538 SbError CopyToNative(sb_t_svl_dl_par* dst);
539 };
540
544 public ref class SbSvlSlPar
545 {
546 public:
556 String^ features;
567
568 internal:
569 SbSvlSlPar(const sb_t_svl_sl_par* const src);
570 SbError CopyFromNative(const sb_t_svl_sl_par* const src);
571 SbError CopyToNative(sb_t_svl_sl_par* dst);
572 };
573
577 public ref class SbSvlPar
578 {
579 // TODO callback
580 public:
590 String^ image_ext;
626 internal:
631 sb_fp_svl_pre_elaboration fp_pre_elaboration;
647 SbSvlPar(const sb_t_svl_par* const src);
648 SbError CopyFromNative(const sb_t_svl_par* const src);
649 SbError CopyToNative(sb_t_svl_par* dst);
650 };
651
656 public ref class SbPar: SbCommon
657 {
658 public:
664
669 array<SbParModel^>^ models;
670
675 array<unsigned char, 2>^collaborations;
676
682
688
694
700
706
712
718
724
730
737 SbError AddModel(String^ model_name);
738
745 SbError RemoveModel(String^ model_name);
746
754 SbError AddLevel(String^ model_name, float scale);
755
763 SbError RemoveLevel(String^ model_name, float scale);
764
773 SbError SetCollaboration(String^ model_name1, String^ model_name2, bool value);
774
782 int GetCollaboration(String^ model_name1, String^ model_name2);
783
791 String^ Format();
792
801 static String^ FormatProjectType(SbProjectType value);
802
812
822
831 static String^ FormatNetworkType(SbNetworkType value);
832
841 static String^ FormatLossFnType(SbLossFnType value);
842
852
862
872
873 internal:
874 //E' obbligatorio che sia un puntatore in un progetto CLR
875 sb_t_par* sb_par;
876 SbPar();
877 ~SbPar();
878 SbError CopyToNative();
879 //src viene utilizzato solo nel caso in cui this->sb_par e' NULL.
880 //In questo caso la funzione alloca this->sb_par e poi copia src
881 SbError CopyFromNative();
882 SbError CopyFromNative(const sb_t_par* const src);
883 }; // group_cs_parameters // group_cs
886}
Blob analysis parameters Class that wraps the structure sb_t_blob_par
Definition: cs_blob.h:44
Common class
Definition: cs_common.h:191
Defines computing device types that wraps the sb_t_devices_par structure
Definition: cs_par.h:242
array< int > id
Identifier of the devices to be used
Definition: cs_par.h:254
SbDeviceType type
Device computational type
Definition: cs_par.h:248
Parameters Class that wraps the sb_t_par structure. You must call the Dispose() method to free all th...
Definition: cs_par.h:657
array< unsigned char, 2 > collaborations
Matrix of the models collaborations
Definition: cs_par.h:675
static String FormatImageCircularityType(SbImageCircularityType value)
Formats the image circularity type
SbProjectType project_type
Project type
Definition: cs_par.h:663
SbError RemoveLevel(String^ model_name, float scale)
Removes the l-th level from the structure of the project parameters.
SbBlobPar blob_par
Blob analysis parameters. Used only for Surface projects
Definition: cs_par.h:687
static String FormatProjectType(SbProjectType value)
Formats the project type
static String FormatFloatingPointPrecisionType(SbFloatingPointPrecisionType value)
Formats the floating point precision
SbFloatingPointPrecisionType floating_point_precision
Floating point precision used to run operations during detection.
Definition: cs_par.h:705
int GetCollaboration(String^ model_name1, String^ model_name2)
Gets collaboration between two models.
SbError RemoveModel(String^ model_name)
Removes the model from the parameter structure.
String Format()
Formats the parameters string.
static String FormatNetworkType(SbNetworkType value)
Formats the Deep Learning Network type
SbError SetCollaboration(String^ model_name1, String^ model_name2, bool value)
Sets collaboration between two models.
array< SbParModel^> models
Array of the models parameters
Definition: cs_par.h:669
SbInterpolationMode resize_mode
Interpolation mode used to resize the images.
Definition: cs_par.h:699
SbError AddModel(String^ model_name)
Adds the model to the parameter structure.
static String FormatLossFnType(SbLossFnType value)
Formats the Deep Learning Loss function type
static String FormatPerturbationType(SbPerturbationType value)
Formats the Deep Learning SVL image perturbation type
SbParSl sl
Shallow Learning modules parameters
Definition: cs_par.h:723
static String FormatSvlParOptimizationMode(SbSvlParOptimizationMode value)
Formats the Shallow Learning SVL optimization mode
SbSvlPar svl
SVL parameters
Definition: cs_par.h:729
SbDevicesPar devices
Devices used for inference.
Definition: cs_par.h:693
static String FormatPerturbationMode(SbPerturbationMode value)
Formats the Deep Learning SVL image perturbation mode
int surface_blob_analysis
Enable the surface blob analysis
Definition: cs_par.h:717
SbError AddLevel(String^ model_name, float scale)
Adds the level to the parameter structure.
SbRgba color_opt
Optional all models color. Used for painting
Definition: cs_par.h:711
int num_threads
Num threads to be used for the detection
Definition: cs_par.h:681
Level parameters Class that wraps the sb_t_level_par structure
Definition: cs_par.h:97
float scale
Scale factor.
Definition: cs_par.h:110
bool enabled
Enabling flag of the level.
Definition: cs_par.h:105
Model parameters class that wraps the sb_t_par_model structure
Definition: cs_par.h:164
int num_occurrences
Num occurrencies.
Definition: cs_par.h:220
SbSize obj_min_distance
Objects min distance
Definition: cs_par.h:205
SbRgba color_opt
Paint color of the model optional defect. Used only for Surface projects
Definition: cs_par.h:200
SbSize obj_stride_fine
Fine search step.
Definition: cs_par.h:215
array< SbPerturbation^> perturbations
Array of the perturbations of the model
Definition: cs_par.h:190
float defect_area_percentage
Definition: cs_par.h:225
String name
Model name
Definition: cs_par.h:170
SbSize obj_stride_coarse
Coarse search step.
Definition: cs_par.h:210
float defect_area_threshold
Definition: cs_par.h:230
SbSize obj_size
Object size
Definition: cs_par.h:175
bool enabled
Model is enabled
Definition: cs_par.h:180
SbRgba color
Paint color of the model defect. Used only for Surface projects
Definition: cs_par.h:195
array< SbParLevel^> levels
Array of the detection levels associated to the model
Definition: cs_par.h:185
Shallow Learning modules parameters class that wraps the sb_t_par_sl structure
Definition: cs_par.h:74
float speed_boost
Detection speed boost.
Definition: cs_par.h:80
int detection_out_of_roi
Detection near or partially outside the analysis roi.
Definition: cs_par.h:85
Perturbations Class that wraps the sb_t_perturbation structure
Definition: cs_par.h:122
SbRange angle_range
Angular range, in degrees, for random rotation.
Definition: cs_par.h:146
int num_synthetic_samples
Number of synthetic sample to generated with a random angle in the range sb_t_par_perturbation::angle...
Definition: cs_par.h:152
int flip_horizontal
Flip around y-axis. 2th operation.
Definition: cs_par.h:134
int flip_vertical
Flip around x-axis. 3th operation.
Definition: cs_par.h:140
int angle
Rotation angle, in degree, of the sample. 1th operation.
Definition: cs_par.h:128
Range value class that wraps the sb_t_range structure
Definition: cs_sb.h:136
rgba class that wraps the sb_t_rgba structure
Definition: cs_sb.h:58
Size class that wraps the sb_t_size_flt structure
Definition: cs_sb.h:114
Size class that wraps the sb_t_size structure
Definition: cs_sb.h:92
SVL parameters that configure the Shallow Learning training, it wraps the sb_t_svl_sl_par structure
Definition: cs_par.h:455
int pre_trained
The network is loaded as pre-trained, i.e. network parameters are not randomly initialized before tra...
Definition: cs_par.h:473
float learning_rate
Learning rate.
Definition: cs_par.h:485
SbSizeFlt scale
Scale to applied to the image before the processing.
Definition: cs_par.h:527
float validation_percentage
Validation percentage.
Definition: cs_par.h:503
SbSvlDlParNetwork network
Network parameters.
Definition: cs_par.h:467
SbSize tile_factor
Number of horizontal and vertical tiles used to process the image.
Definition: cs_par.h:515
SbSvlDlParPerturbation perturbations
Perturbations for deep learning training.
Definition: cs_par.h:479
int auto_tiling
Enable the automatic tiling for image processing.
Definition: cs_par.h:521
String network_path
Network weights file path with extension SB_DL_WEIGHTS_EXT.
Definition: cs_par.h:461
int save_best
At the end of the training, the best internal parameters configuration is recovered.
Definition: cs_par.h:509
int batch_size
Size of the batch used during SVL.
Definition: cs_par.h:497
SbLossFnType loss_fn
Loss function.
Definition: cs_par.h:533
int num_epochs
Number of epochs.
Definition: cs_par.h:491
Deep Learning network parameters class that wraps the sb_t_svl_dl_par_network structure
Definition: cs_par.h:305
SbNetworkType type
Network type.
Definition: cs_par.h:311
SbSize input_size
Network input size.
Definition: cs_par.h:316
int n_channels
Network input channels.
Definition: cs_par.h:321
float features_multiplier
Features multiplier factor of the network.
Definition: cs_par.h:331
SbImageFormat image_format
Network input image format.
Definition: cs_par.h:326
Describes the perturbation of the image / defect, it wraps the sb_t_svl_dl_par_perturbation structure
Definition: cs_par.h:377
SbPerturbationMode mode
Select the perturbation mode.
Definition: cs_par.h:389
SbPerturbationType type
Select the perturbation type.
Definition: cs_par.h:395
int flip_horizontal
Flip around y-axis.
Definition: cs_par.h:401
float delta_brightness
Maximum delta of brightness to apply to the image.
Definition: cs_par.h:431
int flip_vertical
Flip around x-axis.
Definition: cs_par.h:407
SbRange angle_range
Angular range, in degrees, for random rotation.
Definition: cs_par.h:425
String inpainter_path
Inpainter file path.
Definition: cs_par.h:383
float delta_scale
Maximum variation for defects scaling.
Definition: cs_par.h:443
float stretch_contrast
Maximum variation for histogram stretching.
Definition: cs_par.h:437
float shift_horizontal
Shift along x-axis.
Definition: cs_par.h:413
float shift_vertical
Shift along y-axis.
Definition: cs_par.h:419
Svl parameters (not used at the moment) that wraps the sb_t_svl_par structure
Definition: cs_par.h:578
SbImageCircularityType image_circularity_type
Image circularity type.
Definition: cs_par.h:610
int reproducibility
Enable the reproducibility of the training.
Definition: cs_par.h:605
String image_ext
Extensions of the images.
Definition: cs_par.h:590
sb_fp_svl_progress fp_progress
The SVL calls this callback to notify the user the results of SVL.
Definition: cs_par.h:636
void * user_data
Pointer to data which is passed to the callbacks.
Definition: cs_par.h:646
SbSvlDlPar dl
Deep Learning modules parameters.
Definition: cs_par.h:625
SbDevicesPar devices
Devices used for training.
Definition: cs_par.h:615
int num_threads
Maximum number of OpenMP threads that SVL can use.
Definition: cs_par.h:600
SbSvlSlPar sl
Shallow Learning modules parameters.
Definition: cs_par.h:620
sb_fp_svl_command fp_command
Callback called by SVL to allow the user to decide how to continue when particular situations happen,...
Definition: cs_par.h:641
String project_path
Path of the project, where the SVL will find the images.
Definition: cs_par.h:585
float free_memory_percentage
Percentage of system memory that the svl tries to leave free.
Definition: cs_par.h:595
SVL parameters that configure the Shallow Learning training, it wraps the sb_t_svl_sl_par structure
Definition: cs_par.h:545
String features
List of the features among which SVL will choose the best features.
Definition: cs_par.h:556
float goodness_target
Goodness target of the training.
Definition: cs_par.h:551
SbSvlParOptimizationMode optimization_mode
Optimization mode.
Definition: cs_par.h:561
int auto_levels
Enable the automatic surface levels training.
Definition: cs_par.h:566
SbError
Enum error codes
Definition: cs_common.h:13
SbInterpolationMode
Interpolation mode enumeration that wraps the sb_t_interpolation_mode enum
Definition: cs_image.h:45
SbImageFormat
Image format enumeration that wraps the sb_t_image_format enum
Definition: cs_image.h:16
SbProjectType
Project type that wraps the sb_t_project_type enum
Definition: cs_par.h:16
SbPerturbationType
Enumerates the range of application of the perturbations, it wraps the sb_t_perturbation_type enums.
Definition: cs_par.h:367
SbLossFnType
Enumerates the type of loss function, it wraps the sb_t_loss_fn_type enum.
Definition: cs_par.h:343
SbSvlParOptimizationMode
Svl par optimization mode that wraps the sb_t_svl_par_optimization_mode enum
Definition: cs_par.h:46
SbNetworkType
Deep Learning Network type that wraps the sb_t_network_type enum
Definition: cs_par.h:266
SbFloatingPointPrecisionType
Floating point precision type that wraps the sb_t_floating_point_op_type enum
Definition: cs_par.h:37
SbPerturbationMode
Enumerates the mode of the perturbations, it wraps the sb_t_perturbation_mode enum.
Definition: cs_par.h:356
SbImageCircularityType
Image circularity that wraps the sb_t_image_circularity_type enum
Definition: cs_par.h:27
@ SB_PROJECT_TYPE_RETINA
Project Retina.
@ SB_PROJECT_TYPE_DEEP_CORTEX
Project Deep Cortex.
@ SB_PROJECT_TYPE_SURFACE
Project Surface.
@ SB_PROJECT_TYPE_DEEP_SURFACE
Project Deep Surface.
@ SB_PERTURBATION_TYPE_IMAGE
The whole image is perturbated.
@ SB_PERTURBATION_TYPE_BOTH
Both image and defects perturbation types.
@ SB_PERTURBATION_TYPE_DEFECTS
Only the defect area is perturbated.
@ SB_LOSS_FN_TYPE_CCE
CCE loss.
@ SB_LOSS_FN_TYPE_FOCAL
Foacal loss.
@ SB_LOSS_FN_TYPE_BCE
BCE loss.
@ SB_NETWORK_TYPE_EFFICIENTNET_B1
Deep Learning EfficientNet b1.
@ SB_NETWORK_TYPE_SDINET0_331x128
Deep Learning Surface Defects Inspection Network 0 with input size to 331x128.
@ SB_NETWORK_TYPE_SDINET0_331
Deep Learning Surface Defects Inspection Network 0 with input size to 331x331.
@ SB_NETWORK_TYPE_ICNET0_128
Deep Learning Image Classification Network 0 with input size 128x128.
@ SB_NETWORK_TYPE_ICNET0_64
Deep Learning Image Classification Network 0 with input size 64x64.
@ SB_NETWORK_TYPE_EFFICIENTNET_B0
Deep Learning EfficientNet b0.
@ SB_NETWORK_TYPE_EFFICIENTNET_B2
Deep Learning EfficientNet b2.
@ SB_NETWORK_TYPE_SDINET0_400x160
Deep Learning Surface Defects Inspection Network 0 with input size to 400x160.
@ SB_FLOATING_POINT_OPS_TYPE_HALF_PRECISION
Single Precision (Float16)
@ SB_FLOATING_POINT_OPS_TYPE_SINGLE_PRECISION
Single Precision (Float32)
@ SB_PERTURBATION_MODE_OFFLINE
Offline perturbation.
@ SB_PERTURBATION_MODE_ONLINE
Online perturbation.
@ SB_PERTURBATION_MODE_BOTH
Both online and offline perturbations.
@ SB_IMAGE_CIRCULARITY_TYPE_NONE
No image circularity.
@ SB_IMAGE_CIRCULARITY_TYPE_HORIZONTAL
Horizontal image circularity.
@ SB_IMAGE_CIRCULARITY_TYPE_VERTICAL
Vertical image circularity.
SbDeviceType
Device type that wraps the sb_t_device_type enum
Definition: cs_common.h:181
sb_t_err(* sb_fp_svl_pre_elaboration)(const SB_HANDLE image_info, void *const user_data, const char *const image_file, int image_index, sb_t_svl_pre_elaboration *const pre_elaboration)
Definition of the callback for image pre elaboration.
Definition: sb.h:9489
sb_t_err(* sb_fp_svl_progress)(void *const user_data, sb_t_svl_res *res, int force)
Definition of the callback for the working progress.
Definition: sb.h:9501
sb_t_err(* sb_fp_svl_command)(void *const user_data, sb_t_svl_res *res, sb_t_svl_command *const command, const char *const msg)
Definition of the callback that the SVL calls when it needs to know how to continue.
Definition: sb.h:9514
SB Namespace
Definition: cs_common.h:3
Property of computational devices.
Definition: sb.h:10095
Level parameters.
Definition: sb.h:10312
Parameters of a model.
Definition: sb.h:10351
Describes the perturbation of a sample.
Definition: sb.h:10248
Shallow Learning modules parameters.
Definition: sb.h:10601
Project parameters.
Definition: sb.h:10647
Deep Learning modules parameters.
Definition: sb.h:9588
Describes the perturbation of the image / defect.
Definition: sb.h:9767
SVL parameters to configure the Deep Learning training.
Definition: sb.h:9866
SVL parameters.
Definition: sb.h:10117
SVL parameters that configure the Shallow Learning training.
Definition: sb.h:10029