SqueezeBrains SDK 1.18
cs_par.h
1#pragma once
2namespace sb_cs
3{
15 public enum class SbProjectType :int
16 {
22 };
23
27 public enum class SbImageCircularityType :int
28 {
32 };
33
37 public enum class SbFloatingPointPrecisionType :int
38 {
41 };
42
46 public enum class SbSvlParOptimizationMode :int
47 {
69 };
70
74 public ref class SbParSl
75 {
76 public:
87
88 internal:
89 SbParSl(const sb_t_par_sl* const src);
90 SbError CopyFromNative(const sb_t_par_sl* const src);
91 SbError CopyToNative(sb_t_par_sl* dst);
92 };
93
97 public ref class SbParLevel
98 {
99 public:
111 float scale;
112
113 internal:
114 SbParLevel(const sb_t_par_level* const src);
115 SbError CopyFromNative(const sb_t_par_level* const src);
116 SbError CopyToNative(sb_t_par_level* dst);
117 };
118
122 public ref class SbPerturbation
123 {
124 public:
129 int angle;
130
136
142
148
154 internal:
155 SbPerturbation(const sb_t_par_perturbation* const src);
156 SbError CopyFromNative(const sb_t_par_perturbation* const src);
157 SbError CopyToNative(sb_t_par_perturbation* const dst);
158 };
159
164 public ref class SbParModel
165 {
166 public:
171 String^ name;
176 String^ description;
191 array<SbParLevel^>^ levels;
196 array<SbPerturbation^>^ perturbations;
237 SbParModel();
238 internal:
239 SbParModel(const sb_t_par_model* const src);
240 SbError CopyFromNative(const sb_t_par_model* const src);
241 SbError CopyToNative(sb_t_par_model* const dst);
242 };
243
247 public ref class SbDevicesPar
248 {
249 public:
255
261
266 array<int>^ id;
267 internal:
268 SbDevicesPar();
269 SbDevicesPar(const sb_t_devices_par* const src);
270 SbError CopyFromNative(const sb_t_devices_par* const src);
271 SbError CopyToNative(sb_t_devices_par* dst);
272 };
273
277 public enum class SbNetworkType :int
278 {
308#ifdef NEW_VERSION_SDINET1
312 SB_NETWORK_TYPE_SDINET1 = SB_NETWORK_TYPE_SDINET1
313#endif
314
315 };
316
320 public enum class SbNetworkFreezeMode :int
321 {
338
339 SB_NETWORK_FREEZE_MODE_END = SB_NETWORK_FREEZE_MODE_END
340 };
341
345 public ref class SbSvlDlParNetwork
346 {
347 public:
378 internal:
380 SbError CopyFromNative(const sb_t_svl_dl_par_network* const src);
381 SbError CopyToNative(sb_t_svl_dl_par_network* dst);
382 };
383
387 public enum class SbTilingMode :int
388 {
391 };
392
396 public enum class SbLossFnType :int
397 {
401 //SB_LOSS_FN_TYPE_DICE = SB_LOSS_FN_TYPE_DICE,//!< Dice loss.
402 //SB_LOSS_FN_TYPE_RMI = SB_LOSS_FN_TYPE_RMI //!< RMI loss.
403 };
404
408 public enum class SbImageBordersExtensionMode :int
409 {
421 };
422
427 public enum class SbPerturbationMode :int
428 {
432 };
433
438 public enum class SbPerturbationType :int
439 {
443 };
444
448 public ref class SbSvlDlParPerturbation
449 {
450 public:
456
462
468
474
480
486
492
498
504
510
516
517 internal:
519 SbError CopyFromNative(const sb_t_svl_dl_par_perturbation* const src);
520 SbError CopyToNative(sb_t_svl_dl_par_perturbation* dst);
521 };
522
526 public ref class SbSvlDlTilingPar
527 {
528 public:
534
540
546
547 internal:
549 SbError CopyFromNative(const sb_t_svl_dl_tiling_par* const src);
550 SbError CopyToNative(sb_t_svl_dl_tiling_par* dst);
551 };
552
556 public ref class SbSvlDlPar
557 {
558 public:
564
570
576
582
588
594
600
606
612
618
629 internal:
630 SbSvlDlPar(const sb_t_svl_dl_par* const src);
631 SbError CopyFromNative(const sb_t_svl_dl_par* const src);
632 SbError CopyToNative(sb_t_svl_dl_par* dst);
633 };
634
638 public ref class SbSvlSlPar
639 {
640 public:
650 String^ features;
661
662 internal:
663 SbSvlSlPar(const sb_t_svl_sl_par* const src);
664 SbError CopyFromNative(const sb_t_svl_sl_par* const src);
665 SbError CopyToNative(sb_t_svl_sl_par* dst);
666 };
667
671 public ref class SbSvlPar
672 {
673 // TODO callback
674 public:
684 String^ image_ext;
720 internal:
725 sb_fp_svl_pre_elaboration fp_pre_elaboration;
741 SbSvlPar(const sb_t_svl_par* const src);
742 SbError CopyFromNative(const sb_t_svl_par* const src);
743 SbError CopyToNative(sb_t_svl_par* dst);
744 };
745
750 public ref class SbPar: SbCommon
751 {
752 public:
758
763 array<SbParModel^>^ models;
764
769 array<unsigned char, 2>^collaborations;
770
776
782
788
794
800
806
812
818
824
831 SbError AddModel(String^ model_name);
832
839 SbError RemoveModel(String^ model_name);
840
848 SbError AddLevel(String^ model_name, float scale);
849
857 SbError RemoveLevel(String^ model_name, float scale);
858
867 SbError SetCollaboration(String^ model_name1, String^ model_name2, bool value);
868
876 int GetCollaboration(String^ model_name1, String^ model_name2);
877
885 String^ Format();
886
895 static String^ FormatProjectType(SbProjectType value);
896
906
916
925 static String^ FormatNetworkType(SbNetworkType value);
926
935 static String^ FormatTilingMode(SbTilingMode value);
936
945 static String^ FormatLossFnType(SbLossFnType value);
946
956
966
976
986
987 internal:
988 //E' obbligatorio che sia un puntatore in un progetto CLR
989 sb_t_par* sb_par;
990 SbPar();
991 ~SbPar();
992 SbError CopyToNative();
993 //src viene utilizzato solo nel caso in cui this->sb_par e' NULL.
994 //In questo caso la funzione alloca this->sb_par e poi copia src
995 SbError CopyFromNative();
996 SbError CopyFromNative(const sb_t_par* const src);
997 }; // group_cs_parameters // group_cs
1000}
Blob analysis parameters Class that wraps the structure sb_t_blob_par
Definition: cs_blob.h:44
Common class
Definition: cs_common.h:242
Defines computing device types that wraps the sb_t_devices_par structure
Definition: cs_par.h:248
array< int > id
Identifier of the devices to be used
Definition: cs_par.h:266
SbDeviceType type
Device computational type
Definition: cs_par.h:254
SbFrameworkType framework
Identifier of the framework to be used
Definition: cs_par.h:260
Parameters Class that wraps the sb_t_par structure. You must call the Dispose() method to free all th...
Definition: cs_par.h:751
array< unsigned char, 2 > collaborations
Matrix of the models collaborations
Definition: cs_par.h:769
static String FormatImageCircularityType(SbImageCircularityType value)
Formats the image circularity type
SbProjectType project_type
Project type
Definition: cs_par.h:757
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:781
static String FormatImageBordersExtensionMode(SbImageBordersExtensionMode value)
Formats the Deep Learning image borders extension mode
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:799
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:763
SbInterpolationMode resize_mode
Interpolation mode used to resize the images.
Definition: cs_par.h:793
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 FormatTilingMode(SbTilingMode value)
Formats the Deep Learning tiling mode
static String FormatPerturbationType(SbPerturbationType value)
Formats the Deep Learning SVL image perturbation type
SbParSl sl
Shallow Learning modules parameters
Definition: cs_par.h:817
static String FormatSvlParOptimizationMode(SbSvlParOptimizationMode value)
Formats the Shallow Learning SVL optimization mode
SbSvlPar svl
SVL parameters
Definition: cs_par.h:823
SbDevicesPar devices
Devices used for inference.
Definition: cs_par.h:787
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:811
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:805
int num_threads
Num threads to be used for the detection
Definition: cs_par.h:775
Level parameters Class that wraps the sb_t_level_par structure
Definition: cs_par.h:98
float scale
Scale factor.
Definition: cs_par.h:111
bool enabled
Enabling flag of the level.
Definition: cs_par.h:106
Model parameters class that wraps the sb_t_par_model structure
Definition: cs_par.h:165
int num_occurrences
Num occurrences.
Definition: cs_par.h:226
SbSize obj_min_distance
Objects min distance
Definition: cs_par.h:211
SbRgba color_opt
Paint color of the model optional defect. Used only for Surface projects
Definition: cs_par.h:206
SbSize obj_stride_fine
Fine search step.
Definition: cs_par.h:221
array< SbPerturbation^> perturbations
Array of the perturbations of the model
Definition: cs_par.h:196
float defect_area_percentage
Definition: cs_par.h:231
String name
Model name
Definition: cs_par.h:171
String description
Model description
Definition: cs_par.h:176
SbSize obj_stride_coarse
Coarse search step.
Definition: cs_par.h:216
float defect_area_threshold
Definition: cs_par.h:236
SbSize obj_size
Object size
Definition: cs_par.h:181
bool enabled
Model is enabled
Definition: cs_par.h:186
SbRgba color
Paint color of the model defect. Used only for Surface projects
Definition: cs_par.h:201
array< SbParLevel^> levels
Array of the detection levels associated to the model
Definition: cs_par.h:191
Shallow Learning modules parameters class that wraps the sb_t_par_sl structure
Definition: cs_par.h:75
float speed_boost
Detection speed boost.
Definition: cs_par.h:81
int detection_out_of_roi
Detection near or partially outside the analysis roi.
Definition: cs_par.h:86
Perturbations Class that wraps the sb_t_perturbation structure
Definition: cs_par.h:123
SbRange angle_range
Angular range, in degrees, for random rotation.
Definition: cs_par.h:147
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:153
int flip_horizontal
Flip around y-axis. 2th operation.
Definition: cs_par.h:135
int flip_vertical
Flip around x-axis. 3th operation.
Definition: cs_par.h:141
int angle
Rotation angle, in degree, of the sample. 1th operation.
Definition: cs_par.h:129
Range value class that wraps the sb_t_range_flt structure
Definition: cs_sb.h:148
Range value class that wraps the sb_t_range structure
Definition: cs_sb.h:126
rgba class that wraps the sb_t_rgba structure
Definition: cs_sb.h:48
Size class that wraps the sb_t_size structure
Definition: cs_sb.h:82
SVL parameters that configure the Shallow Learning training, it wraps the sb_t_svl_sl_par structure
Definition: cs_par.h:557
SbSvlDlTilingPar tiling_par_height
Height tiling configuration.
Definition: cs_par.h:628
float learning_rate
Learning rate.
Definition: cs_par.h:581
String pre_training_file
Network weights file path with extension SB_PRE_TRAINING_EXT.
Definition: cs_par.h:563
float validation_percentage
Validation percentage.
Definition: cs_par.h:599
SbSvlDlParNetwork network
Network parameters.
Definition: cs_par.h:569
SbSvlDlParPerturbation perturbations
Perturbations for deep learning training.
Definition: cs_par.h:575
int save_best
At the end of the training, the best internal parameters configuration is recovered.
Definition: cs_par.h:605
SbImageBordersExtensionMode borders_extension_mode
Loss Image borders extension mode.
Definition: cs_par.h:617
int batch_size
Size of the batch used during SVL.
Definition: cs_par.h:593
SbSvlDlTilingPar tiling_par_width
Width tiling configuration.
Definition: cs_par.h:623
SbLossFnType loss_fn
Loss function.
Definition: cs_par.h:611
int num_epochs
Number of epochs.
Definition: cs_par.h:587
Deep Learning network parameters class that wraps the sb_t_svl_dl_par_network structure
Definition: cs_par.h:346
SbNetworkType type
Network type.
Definition: cs_par.h:352
SbSize input_size
Network input size.
Definition: cs_par.h:357
int n_channels
Network input channels.
Definition: cs_par.h:362
float features_multiplier
Features multiplier factor of the network.
Definition: cs_par.h:372
SbImageFormat image_format
Network input image format.
Definition: cs_par.h:367
SbNetworkFreezeMode freeze_mode
Freeze mode to apply on network parameters during SVL.
Definition: cs_par.h:377
Describes the perturbation of the image / defect, it wraps the sb_t_svl_dl_par_perturbation structure
Definition: cs_par.h:449
SbPerturbationMode mode
Select the perturbation mode.
Definition: cs_par.h:461
SbPerturbationType type
Select the perturbation type.
Definition: cs_par.h:467
int flip_horizontal
Flip around y-axis.
Definition: cs_par.h:473
float delta_brightness
Maximum delta of brightness to apply to the image.
Definition: cs_par.h:503
int flip_vertical
Flip around x-axis.
Definition: cs_par.h:479
SbRange angle_range
Angular range, in degrees, for random rotation.
Definition: cs_par.h:497
String inpainter_path
Inpainter file path.
Definition: cs_par.h:455
float delta_scale
Maximum variation for defects scaling.
Definition: cs_par.h:515
float stretch_contrast
Maximum variation for histogram stretching.
Definition: cs_par.h:509
float shift_horizontal
Shift along x-axis.
Definition: cs_par.h:485
float shift_vertical
Shift along y-axis.
Definition: cs_par.h:491
SVL parameters that configure the Shallow Learning training, it wraps the sb_t_svl_dl_tiling_par stru...
Definition: cs_par.h:527
SbRangeFlt scale
Scale to applied to the image before the processing.
Definition: cs_par.h:545
int num_tiles
Number of horizontal and vertical tiles used to process the image.
Definition: cs_par.h:533
SbTilingMode mode
Automatic tiling mode for image processing.
Definition: cs_par.h:539
Svl parameters (not used at the moment) that wraps the sb_t_svl_par structure
Definition: cs_par.h:672
SbImageCircularityType image_circularity_type
Image circularity type.
Definition: cs_par.h:704
int reproducibility
Enable the reproducibility of the training.
Definition: cs_par.h:699
String image_ext
Extensions of the images.
Definition: cs_par.h:684
sb_fp_svl_progress fp_progress
The SVL calls this callback to notify the user the results of SVL.
Definition: cs_par.h:730
void * user_data
Pointer to data which is passed to the callbacks.
Definition: cs_par.h:740
SbSvlDlPar dl
Deep Learning modules parameters.
Definition: cs_par.h:719
SbDevicesPar devices
Devices used for training.
Definition: cs_par.h:709
int num_threads
Maximum number of OpenMP threads that SVL can use.
Definition: cs_par.h:694
SbSvlSlPar sl
Shallow Learning modules parameters.
Definition: cs_par.h:714
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:735
String project_path
Path of the project, where the SVL will find the images.
Definition: cs_par.h:679
float free_memory_percentage
Percentage of system memory that the svl tries to leave free.
Definition: cs_par.h:689
SVL parameters that configure the Shallow Learning training, it wraps the sb_t_svl_sl_par structure
Definition: cs_par.h:639
String features
List of the features among which SVL will choose the best features.
Definition: cs_par.h:650
float goodness_target
Goodness target of the training.
Definition: cs_par.h:645
SbSvlParOptimizationMode optimization_mode
Optimization mode.
Definition: cs_par.h:655
int auto_levels
Enable the automatic surface levels training.
Definition: cs_par.h:660
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:439
SbImageBordersExtensionMode
Enumerates the image borders extension mode, it wraps the sb_t_image_borders_extension_mode enum.
Definition: cs_par.h:409
SbNetworkFreezeMode
Deep learning network freeze mode that wraps the sb_t_network_freeze_mode enum
Definition: cs_par.h:321
SbLossFnType
Enumerates the type of loss function, it wraps the sb_t_loss_fn_type enum.
Definition: cs_par.h:397
SbSvlParOptimizationMode
Svl par optimization mode that wraps the sb_t_svl_par_optimization_mode enum
Definition: cs_par.h:47
SbNetworkType
Deep Learning Network type that wraps the sb_t_network_type enum
Definition: cs_par.h:278
SbFloatingPointPrecisionType
Floating point precision type that wraps the sb_t_floating_point_op_type enum
Definition: cs_par.h:38
SbPerturbationMode
Enumerates the mode of the perturbations, it wraps the sb_t_perturbation_mode enum.
Definition: cs_par.h:428
SbImageCircularityType
Image circularity that wraps the sb_t_image_circularity_type enum
Definition: cs_par.h:28
SbTilingMode
Enumerates the tiling mode, it wraps the sb_t_tiling_mode enum.
Definition: cs_par.h:388
@ SB_PROJECT_TYPE_RETINA
Project Retina.
@ SB_PROJECT_TYPE_DEEP_CORTEX
Project Deep Cortex.
@ SB_PROJECT_TYPE_DEEP_RETINA
Project Deep Retina.
@ 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_IMAGE_BORDERS_EXTENSION_MODE_KERNEL_AVG
Local average extension mode.
@ SB_IMAGE_BORDERS_EXTENSION_MODE_BORDER_AVG
Last line average extension mode.
@ SB_IMAGE_BORDERS_EXTENSION_MODE_V_127
Grey 127 extension mode.
@ SB_IMAGE_BORDERS_EXTENSION_MODE_BORDER_AVG_LOCAL
Last line local average extension mode.
@ SB_IMAGE_BORDERS_EXTENSION_MODE_V_0
Zero extension mode.
@ SB_IMAGE_BORDERS_EXTENSION_MODE_V_255
Grey 255 extension mode.
@ SB_IMAGE_BORDERS_EXTENSION_MODE_KERNEL_AVG_17x1
Horizontal local average extension mode.
@ SB_IMAGE_BORDERS_EXTENSION_MODE_LAST
Last pixel extension mode.
@ SB_IMAGE_BORDERS_EXTENSION_MODE_MIRRORING
Mirroring extension mode.
@ SB_IMAGE_BORDERS_EXTENSION_MODE_NONE
Undefined extension mode.
@ SB_IMAGE_BORDERS_EXTENSION_MODE_IMAGE_AVG
Image average extension mode.
@ SB_NETWORK_FREEZE_MODE_ENCODER
Freeze the network encoder.
@ SB_NETWORK_FREEZE_MODE_NONE
Freeze mode disabled.
@ SB_NETWORK_FREEZE_MODE_FIRST_BLOCK
Freeze the first block of the newtork.
@ SB_NETWORK_FREEZE_MODE_ENCODER_DECODER
Freeze both encoder and decoder.
@ SB_LOSS_FN_TYPE_CCE
CCE loss.
@ SB_LOSS_FN_TYPE_FOCAL
Foacal loss.
@ SB_LOSS_FN_TYPE_BCE
BCE loss.
@ SB_NETWORK_TYPE_ODNET0
Deep Learning Object Detection Network 0 with input size 416x416.
@ SB_NETWORK_TYPE_EFFICIENTNET_B1
Deep Learning EfficientNet b1.
@ SB_NETWORK_TYPE_SDINET0
Deep Learning Surface Defects Inspection Network 0 with variable input size.
@ 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_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.
@ SB_TILING_MODE_AUTO
Auto-tiling.
@ SB_TILING_MODE_MANUAL
Manual tiling.
SbFrameworkType
Framework type that wraps the sb_t_framework_type enum
Definition: cs_common.h:231
SbDeviceType
Device type that wraps the sb_t_device_type enum
Definition: cs_common.h:219
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:10373
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:10385
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:10398
SB Namespace
Definition: cs_common.h:3
Property of computational devices.
Definition: sb.h:11233
Level parameters.
Definition: sb.h:11456
Parameters of a model.
Definition: sb.h:11495
Describes the perturbation of a sample.
Definition: sb.h:11392
Shallow Learning modules parameters.
Definition: sb.h:11751
Project parameters.
Definition: sb.h:11797
Deep Learning network parameters.
Definition: sb.h:10519
Describes the perturbation of the image / defect.
Definition: sb.h:10863
SVL parameters to configure the Deep Learning training.
Definition: sb.h:11028
Image tiling parameters.
Definition: sb.h:10965
SVL parameters.
Definition: sb.h:11261
SVL parameters that configure the Shallow Learning training.
Definition: sb.h:11167