train_texture_inspection_model — 训练纹理检查模型。
train_texture_inspection_model( : : TextureInspectionModel : )
train_texture_inspection_model trains a texture inspection model
with all training images which were added by
add_texture_inspection_model_image。
The complete texture inspection process works with image pyramids. The depth of the pyramid is determined by the parameter 'num_levels' (or 'levels' if the levels have been set explicitly). In the first step of the training, texture features are extracted and added to the set of training samples for each pyramid level. For each pyramid level a Gaussian Mixture Model (GMM) classifier is determined with all training samples of the corresponding pyramid level. In a third step, the training samples are used to determine a novelty threshold for each pyramid level. In the following, the three training steps are explained in detail:
Feature extraction extracts a feature for each pixel within
the training images. The texture features are calculated according to the
settings of the 'patch_*' parameters, which can be manipulated
with set_texture_inspection_model_param。Each texture feature
is added to the training data of the GMM.
During the training of the GMMs, the optimal 'gmm_*'
parameters are calculated from the training data. The dimension of the
single GMMs is determined by the size of the feature patches. Please refer to
set_texture_inspection_model_param for details. For large patch
sizes, it can be extremely difficult to obtain a good approximation of the
optimal GMM parameters. Also, the run time and memory usage rises
significantly. Therefore we recommend to alter the default patch size with
care.
More information on GMM classifiers can be found in the description of the
operator create_class_gmm。
The calculation of the novelty thresholds is required
to be able to distinguish between defective and non-defective
texture. First, the novelty score of each training sample is
determined with the GMMs determined in step 2. Then, based on
the resulting novelty scores, novelty thresholds are determined for each
pyramid level. The automatic determination of the novelty thresholds
can be influenced with the parameter 'sensitivity' that can
be set with set_texture_inspection_model_param。
After the training was successful it is possible to classify images
with apply_texture_inspection_model。Each pixel is
assigned a novelty score that is compared to the novelty
threshold, which was determined within the third step of the training. For
optimal results it is possible to adapt the novelty threshold of the single
pyramid levels with set_texture_inspection_model_param。
In general, the manipulation of all parameters, with the exception of
'gen_result_handle' and 'sensitivity', requires a retraining
of the texture inspection model. Depending on which part of the training is
affected by the corresponding parameter, either the whole training or only
single steps have to be recalculated. This can lead to strong variations in
the time required for retraining a texture inspection model. A precise
description which parameters influence which parts of the algorithm are
illustrated in set_texture_inspection_model_param。
有关纹理检查概念的说明,请参阅 检查 / 纹理检查 一章的引言。
此算子修改后续输入参数的状态:
在执行此算子时,若该参数值需在多个线程间使用,则必须对其访问进行同步。
TextureInspectionModel (输入控制,状态被修改) texture_inspection_model → (handle)
纹理检查模型的句柄。
* Create texture inspection model
create_texture_inspection_model ('basic', TextureInspectionModel)
* 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)
算子 train_texture_inspection_model 在给定参数有效且在可接受范围内时返回值 2 ( H_MSG_TRUE )。
否则,将抛出异常。
add_texture_inspection_model_image,
set_texture_inspection_model_param
apply_texture_inspection_model,
clear_texture_inspection_model,
remove_texture_inspection_model_image,
write_texture_inspection_model,
serialize_texture_inspection_model
X. Xianghua, M. Mirmehdi: “TEXEMS: Texture Exemplars for Defect Detection
on Random Textured Surfaces”; IEEE Transactions on Pattern Analysis and
Machine Intelligence, Vol. 29, No. 8; August 2007.
T. Boettger, M. Ulrich: “Real-time Texture Detection on Textured
Surfaces with Compressed Sensing”; Pattern Recognition and Image
Analysis, Vol. 26, No. 1, pp. 88-94; January 2016.
匹配