set_texture_inspection_model_param — 设置纹理检查模型的参数。
set_texture_inspection_model_param( : : TextureInspectionModel, GenParamName, GenParamValue : )
算子 set_texture_inspection_model_param is used to
manipulate the parameters of a texture inspection model
TextureInspectionModel. The current parameter settings
can be queried with the operator get_texture_inspection_model_param。
有关纹理检查概念的说明,请参阅 检查 / 纹理检查 一章的引言。
General parameters:
Determines the number of pyramid levels
used within the texture inspection process. The number
of pyramid levels affects the inspection results as well as the runtime of
train_texture_inspection_model and
apply_texture_inspection_model。Per default the number of
levels is estimated by the size of the training images. It should be noted,
that no more than 5 pyramid levels are used by the estimation process.
Changing this parameter can require a complete new training of the texture inspection model. No retraining is required if the number of levels of a trained texture inspection model are merely reduced.
If the texture in your images is very coarse, the lower pyramid levels may not be needed for a successful inspection. Then you can save a lot of runtime by setting the levels of interest explicitly with 'levels'.
Values: integer values larger or equal to 1 or 'auto'
Default: 'auto'
Determines the pyramid levels
used within the texture inspection process. The number
of pyramid levels affects the inspection results as well as the runtime of
train_texture_inspection_model and
apply_texture_inspection_model。Per default the pyramid levels
are determined by the value of 'num_levels'. If for example
'num_levels' is set to four, then the texture inspection is
performed for levels 1 to 4.
If all available levels should be trained, the value has to be set to
'auto'.
Changing this parameter can require a complete new training of the texture inspection model. No retraining is required if the number of levels of a trained texture inspection model are merely reduced.
If the texture in your images is very coarse, the lower pyramid levels may not be needed for a successful inspection. Then you can save a lot of runtime by excluding unwanted levels by setting the pyramid levels with 'levels' explicitly.
In order to avoid confusions regarding the returned tuple length,
'levels' can only be set alone i.e. without passing any other
parameter to set_texture_inspection_model_param.
Values: a monotonically increasing tuple of integer values larger or equal to 1, or 'auto'
Default: 'auto'
This parameter determines whether or
not a result handle is returned by apply_texture_inspection_model。If set to 'true', the individual pyramid level results can be
queried from the texture result handle with
get_texture_inspection_result_object。This is useful for debugging and fine tuning.
If set to 'false',
apply_texture_inspection_model only returns a novelty region.
Values: 'true', 'false'
Default: 'false'
Parameters which influence the automatic novelty threshold calculation:
This parameter sets the values of the novelty thresholds, which distinguish between defective and non-defective texture. The novelty thresholds are passed as a tuple and are set for all pyramid levels at once. Therefore, the number of elements must be equal to the number of pyramid levels 'num_levels'.
Setting the novelty thresholds prior to training
has no effect since the training automatically determines novelty
thresholds. Hence the novelty thresholds should be adapted after the
training. A typical use case is the fine tuning to optimize the results of
apply_texture_inspection_model。Please note, if the novelty
thresholds have been set explicitly, a new call of
train_texture_inspection_model will re-estimate the
novelty thresholds automatically and overwrite any explicitly set novelty
thresholds.
It is possible to add an index to set the novelty threshold of a specific pyramid level. For example, 'novelty_threshold_3' sets the novelty threshold for the third pyramid level.
Values: integer or float values larger or equal to 0 and smaller or equal to 710
Default: Is determined by train_texture_inspection_model
This parameter influences the sensitivity
of the novelty thresholds which are determined during the training with
train_texture_inspection_model。Per default
'sensitivity' is set to 0.0, which means the novelty thresholds
from the training are used directly when calling
apply_texture_inspection_model。If a negative value for the
parameter 'sensitivity' is used, the value is added to the novelty
boundaries.
Hence, a sensitivity value below 0.0 increments the novelty thresholds and
therefore leads to potentially fewer detected errors. If instead a positive
value is set, the novelty thresholds are decremented which leads to
potentially more detected errors.
The automatically determined novelty thresholds can be changed after the training with the parameter 'novelty_threshold'.
Values: float or integer value
Default: 0.0
Parameters that influence the texture features:
Determines the method used to normalize the texture features. A normalization is required if the lighting between different images is not consistent. If set to 'weber', the patches are normalized in accordance with the Weber-Fechner law. If the parameter is set to 'none', no feature normalization is performed.
Changing this parameter requires a complete new training of the texture inspection model.
Values: 'none', 'weber'
Default: 'none'
If set to 'true', the texture features are sorted in a way to obtain a certain amount of rotational invariance. Sorting the features leads to a loss of feature information and generally makes the texture inspection less sensitive. Also, the runtime is slightly increased. If the parameter is set to 'false', the texture features are not sorted.
Alternatively, it is possible to capture all possible rotations within the training images. Increasing the training images leads to an increase of the training time.
Changing this parameter requires a complete new training of the texture inspection model.
Values: 'true', 'false'
Default: 'false'
This parameter determines the diameter of the extracted texture feature patches in pixels. Higher patch sizes increase the runtime significantly. Therefore this parameter should only be changed with great care. First try to change the image resolution or the number of pyramids used.
Changing this parameter requires a complete new training of the texture inspection model.
Values: odd integer values between 1 and 11
Default: 5
Advanced parameters that influence the GMM classifiers:
Internally, the texture inspection model uses a Gaussian Mixture Model (GMM) classifier. In general, it is recommended not to change the GMM parameters, but for experienced users this is still possible.
Changing these parameters requires a new training of the texture inspection model.
In the following, the parameters which influence the GMM classifiers are
described. For more information on classification with GMM classifiers, see
create_class_gmm and train_class_gmm。
This parameter determines the standard
deviation of the Gaussian noise which is added to the training samples
(see add_sample_class_gmm).
Values: integer or float values larger or equal to 0.0
Default: 0.0
This parameter determines the minimum number of Gaussian distributions per class. 'gmm_pmincenters' cannot be set to a value larger than the current value of 'gmm_pmaxcenters'.
Values: integer value larger or equal to 1 and less or equal to 'gmm_pmaxcenters'
Default: 12
This parameter determines the maximum number of Gaussian distributions per class. 'gmm_pmaxcenters' cannot be set to a value smaller than the current value of 'gmm_pmincenters'.
Values: integer value larger or equal to 'gmm_pmincenters'
Default: 12
This parameter determines the type of preprocessing used to transform the feature vectors.
Values: 'principal_components', 'normalization', 'none'
Default: 'normalization'
This parameter manipulates the preprocessing in case 'principal_components' is chosen as the preprocessing method. More specifically, it determines the dimension of the transformed feature vectors. It needs to be chosen such that it is smaller than the feature dimension, which is 'patch_size' 'patch_size'. If the 'patch_size' is changed such that 'patch_size' 'patch_size' 'gmm_ncomp', the parameter is manipulated accordingly.
Values: integer value larger or equal to 1
Default: 15
This parameter determines the initialization value for the random number generator, which is required to initialize the GMM with random values.
Values: integer value
Default: 42
This parameter determines the maximum number of iterations of the expectation maximization algorithm.
Values: integer values larger or equal to 0
Default: 100
This parameter determines the threshold for the relative change of the error for the expectation maximization algorithm to terminate.
Values: integer or float value larger or equal to 0 and smaller than 1.0
Default: 0.001
This parameter determines the regularization value for preventing covariance matrix singularity within the training process.
Values: integer or float values larger or equal to 0 and smaller than 1.0
Default: 0.0001
This parameter determines the type of covariance matrix that is used internally.
Values: 'spherical', 'diag', 'full'
Default: 'diag'
If parameters of a texture inspection model are manipulated after a
successful call of train_texture_inspection_model, the texture
inspection model usually needs to be retrained. Depending on which parameters
are changed, different parts of the training need to be recalculated.
A manipulation of the parameters 'gmm_*' requires a new training of the classifiers. Since a new classifier yields different novelty scores, the novelty thresholds also need to be recalculated. The parameter 'patch_*' requires a complete new training of the texture inspection model. The parameters 'num_levels' and 'levels' require a retraining if the number of levels is increased or levels are set which were not trained beforehand. For example, setting 'levels' from [1,2,3] to [1,3] does not require a retraining. The operator 'gen_result_handle' has no effect on a trained texture inspection model and can be manipulated without requiring any retraining.
此算子修改后续输入参数的状态:
在执行此算子时,若该参数值需在多个线程间使用,则必须对其访问进行同步。
TextureInspectionModel (输入控制,状态被修改) texture_inspection_model → (handle)
纹理检查模型的句柄。
GenParamName (输入控制) attribute.name(-array) → (string)
Name of the model parameter to be adjusted.
默认值: 'gen_result_handle'
值列表: 'gen_result_handle', 'gmm_covartype', 'gmm_em_max_iter', 'gmm_em_regularize', 'gmm_em_threshold', 'gmm_ncomp', 'gmm_pmaxcenters', 'gmm_pmincenters', 'gmm_preprocessing', 'gmm_randseed', 'gmm_sigma', 'levels', 'novelty_threshold', 'num_levels', 'patch_normalization', 'patch_rotational_robustness', 'patch_size', 'sensitivity'
GenParamValue (输入控制) attribute.value(-array) → (integer / real / string)
New value of the model parameter.
默认值: 'true'
值列表: 5, 'auto', 'false', 'none', 'normalization', 'principal_components', 'true', 'weber'
* Create texture inspection model
create_texture_inspection_model ('basic', TextureInspectionModel)
* Set parameters
set_texture_inspection_model_param (TextureInspectionModel, \
'gen_result_handle', 'true')
* Make this short example fast:
set_texture_inspection_model_param (TextureInspectionModel, \
'gmm_em_max_iter', 1)
* Read and add training images
read_image (TrainImage, 'carpet/carpet_01')
add_texture_inspection_model_image (TrainImage, TextureInspectionModel, \
Indices)
* Train the model
train_texture_inspection_model (TextureInspectionModel)
* Read and apply a test image
read_image (TestImage, 'carpet/carpet_02')
apply_texture_inspection_model (TestImage, DefectCandidates, \
TextureInspectionModel, \
TextureInspectionResultID)
算子 set_texture_inspection_model_param 在给定参数有效且在可接受范围内时返回值 2 ( H_MSG_TRUE )。
否则,将抛出异常。
create_texture_inspection_model
add_texture_inspection_model_image,
train_texture_inspection_model
get_texture_inspection_model_param
匹配