train_texture_inspection_modelT_train_texture_inspection_modelTrainTextureInspectionModelTrainTextureInspectionModeltrain_texture_inspection_model (算子)

名称

train_texture_inspection_modelT_train_texture_inspection_modelTrainTextureInspectionModelTrainTextureInspectionModeltrain_texture_inspection_model — 训练纹理检查模型。

签名

train_texture_inspection_model( : : TextureInspectionModel : )

Herror T_train_texture_inspection_model(const Htuple TextureInspectionModel)

void TrainTextureInspectionModel(const HTuple& TextureInspectionModel)

static void HImage::TrainTextureInspectionModel(const HTextureInspectionModel& TextureInspectionModel)

void HTextureInspectionModel::TrainTextureInspectionModel() const

static void HTextureInspectionResult::TrainTextureInspectionModel(const HTextureInspectionModel& TextureInspectionModel)

static void HOperatorSet.TrainTextureInspectionModel(HTuple textureInspectionModel)

static void HImage.TrainTextureInspectionModel(HTextureInspectionModel textureInspectionModel)

void HTextureInspectionModel.TrainTextureInspectionModel()

static void HTextureInspectionResult.TrainTextureInspectionModel(HTextureInspectionModel textureInspectionModel)

def train_texture_inspection_model(texture_inspection_model: HHandle) -> None

描述

train_texture_inspection_modeltrain_texture_inspection_modelTrainTextureInspectionModelTrainTextureInspectionModelTrainTextureInspectionModeltrain_texture_inspection_model trains a texture inspection model with all training images which were added by add_texture_inspection_model_imageadd_texture_inspection_model_imageAddTextureInspectionModelImageAddTextureInspectionModelImageAddTextureInspectionModelImageadd_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'"num_levels""num_levels""num_levels""num_levels""num_levels" (or 'levels'"levels""levels""levels""levels""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:

  1. Feature extraction extracts a feature for each pixel within the training images. The texture features are calculated according to the settings of the 'patch_*'"patch_*""patch_*""patch_*""patch_*""patch_*" parameters, which can be manipulated with set_texture_inspection_model_paramset_texture_inspection_model_paramSetTextureInspectionModelParamSetTextureInspectionModelParamSetTextureInspectionModelParamset_texture_inspection_model_param。Each texture feature is added to the training data of the GMM.

  2. During the training of the GMMs, the optimal 'gmm_*'"gmm_*""gmm_*""gmm_*""gmm_*""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_paramset_texture_inspection_model_paramSetTextureInspectionModelParamSetTextureInspectionModelParamSetTextureInspectionModelParamset_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_gmmcreate_class_gmmCreateClassGmmCreateClassGmmCreateClassGmmcreate_class_gmm

  3. 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'"sensitivity""sensitivity""sensitivity""sensitivity""sensitivity" that can be set with set_texture_inspection_model_paramset_texture_inspection_model_paramSetTextureInspectionModelParamSetTextureInspectionModelParamSetTextureInspectionModelParamset_texture_inspection_model_param

After the training was successful it is possible to classify images with apply_texture_inspection_modelapply_texture_inspection_modelApplyTextureInspectionModelApplyTextureInspectionModelApplyTextureInspectionModelapply_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_paramset_texture_inspection_model_paramSetTextureInspectionModelParamSetTextureInspectionModelParamSetTextureInspectionModelParamset_texture_inspection_model_param

In general, the manipulation of all parameters, with the exception of 'gen_result_handle'"gen_result_handle""gen_result_handle""gen_result_handle""gen_result_handle""gen_result_handle" and 'sensitivity'"sensitivity""sensitivity""sensitivity""sensitivity""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_paramset_texture_inspection_model_paramSetTextureInspectionModelParamSetTextureInspectionModelParamSetTextureInspectionModelParamset_texture_inspection_model_param

有关纹理检查概念的说明,请参阅 检查 / 纹理检查 一章的引言。

执行信息

此算子修改后续输入参数的状态:

在执行此算子时,若该参数值需在多个线程间使用,则必须对其访问进行同步。

参数

TextureInspectionModelTextureInspectionModelTextureInspectionModelTextureInspectionModeltextureInspectionModeltexture_inspection_model (输入控制,状态被修改)  texture_inspection_model HTextureInspectionModel, HTupleHHandleHTupleHtuple (handle) (IntPtr) (HHandle) (handle)

纹理检查模型的句柄。

示例(HDevelop)

* 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_modeltrain_texture_inspection_modelTrainTextureInspectionModelTrainTextureInspectionModelTrainTextureInspectionModeltrain_texture_inspection_model 在给定参数有效且在可接受范围内时返回值 2 ( H_MSG_TRUE )。 否则,将抛出异常。

可能的前趋

add_texture_inspection_model_imageadd_texture_inspection_model_imageAddTextureInspectionModelImageAddTextureInspectionModelImageAddTextureInspectionModelImageadd_texture_inspection_model_image, set_texture_inspection_model_paramset_texture_inspection_model_paramSetTextureInspectionModelParamSetTextureInspectionModelParamSetTextureInspectionModelParamset_texture_inspection_model_param

可能的后继

apply_texture_inspection_modelapply_texture_inspection_modelApplyTextureInspectionModelApplyTextureInspectionModelApplyTextureInspectionModelapply_texture_inspection_model, clear_texture_inspection_modelclear_texture_inspection_modelClearTextureInspectionModelClearTextureInspectionModelClearTextureInspectionModelclear_texture_inspection_model, remove_texture_inspection_model_imageremove_texture_inspection_model_imageRemoveTextureInspectionModelImageRemoveTextureInspectionModelImageRemoveTextureInspectionModelImageremove_texture_inspection_model_image, write_texture_inspection_modelwrite_texture_inspection_modelWriteTextureInspectionModelWriteTextureInspectionModelWriteTextureInspectionModelwrite_texture_inspection_model, serialize_texture_inspection_modelserialize_texture_inspection_modelSerializeTextureInspectionModelSerializeTextureInspectionModelSerializeTextureInspectionModelserialize_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.

模块

匹配