cluster_model_componentsT_cluster_model_componentsClusterModelComponentsClusterModelComponentscluster_model_components聚类模型组件(算子)

名称

cluster_model_componentsT_cluster_model_componentsClusterModelComponentsClusterModelComponentscluster_model_components — 在训练结果中采用用于创建模型组件的新参数。

签名

cluster_model_components(TrainingImages : ModelComponents : ComponentTrainingID, AmbiguityCriterion, MaxContourOverlap, ClusterThreshold : )

Herror T_cluster_model_components(const Hobject TrainingImages, Hobject* ModelComponents, const Htuple ComponentTrainingID, const Htuple AmbiguityCriterion, const Htuple MaxContourOverlap, const Htuple ClusterThreshold)

void ClusterModelComponents(const HObject& TrainingImages, HObject* ModelComponents, const HTuple& ComponentTrainingID, const HTuple& AmbiguityCriterion, const HTuple& MaxContourOverlap, const HTuple& ClusterThreshold)

HRegion HComponentTraining::ClusterModelComponents(const HImage& TrainingImages, const HString& AmbiguityCriterion, double MaxContourOverlap, double ClusterThreshold) const

HRegion HComponentTraining::ClusterModelComponents(const HImage& TrainingImages, const char* AmbiguityCriterion, double MaxContourOverlap, double ClusterThreshold) const

HRegion HComponentTraining::ClusterModelComponents(const HImage& TrainingImages, const wchar_t* AmbiguityCriterion, double MaxContourOverlap, double ClusterThreshold) const   ( Windows only)

HRegion HImage::ClusterModelComponents(const HComponentTraining& ComponentTrainingID, const HString& AmbiguityCriterion, double MaxContourOverlap, double ClusterThreshold) const

HRegion HImage::ClusterModelComponents(const HComponentTraining& ComponentTrainingID, const char* AmbiguityCriterion, double MaxContourOverlap, double ClusterThreshold) const

HRegion HImage::ClusterModelComponents(const HComponentTraining& ComponentTrainingID, const wchar_t* AmbiguityCriterion, double MaxContourOverlap, double ClusterThreshold) const   ( Windows only)

static void HOperatorSet.ClusterModelComponents(HObject trainingImages, out HObject modelComponents, HTuple componentTrainingID, HTuple ambiguityCriterion, HTuple maxContourOverlap, HTuple clusterThreshold)

HRegion HComponentTraining.ClusterModelComponents(HImage trainingImages, string ambiguityCriterion, double maxContourOverlap, double clusterThreshold)

HRegion HImage.ClusterModelComponents(HComponentTraining componentTrainingID, string ambiguityCriterion, double maxContourOverlap, double clusterThreshold)

def cluster_model_components(training_images: HObject, component_training_id: HHandle, ambiguity_criterion: str, max_contour_overlap: float, cluster_threshold: float) -> HObject

描述

使用 cluster_model_componentscluster_model_componentsClusterModelComponentsClusterModelComponentsClusterModelComponentscluster_model_components ,您可以在使用 train_model_componentstrain_model_componentsTrainModelComponentsTrainModelComponentsTrainModelComponentstrain_model_components 完成首次训练修改参数。cluster_model_componentscluster_model_componentsClusterModelComponentsClusterModelComponentsClusterModelComponentscluster_model_components 将用于解决歧义的标准 AmbiguityCriterionAmbiguityCriterionAmbiguityCriterionAmbiguityCriterionambiguityCriterionambiguity_criterion、最大轮廓重叠度 MaxContourOverlapMaxContourOverlapMaxContourOverlapMaxContourOverlapmaxContourOverlapmax_contour_overlap 以及训练结果 ComponentTrainingIDComponentTrainingIDComponentTrainingIDComponentTrainingIDcomponentTrainingIDcomponent_training_id 的聚类阈值设置为指定值。这些参数的详细说明可在 train_model_componentstrain_model_componentsTrainModelComponentsTrainModelComponentsTrainModelComponentstrain_model_components 的文档中找到。通过修改这些参数,初始组件合并为刚性模型组件的方式随之改变。例如,聚类阈值选得越大,合并的初始组件就越少。您可以通过反复调用 inspect_clustered_componentsinspect_clustered_componentsInspectClusteredComponentsInspectClusteredComponentsInspectClusteredComponentsinspect_clustered_components 并设置不同参数值,然后使用 get_training_componentsget_training_componentsGetTrainingComponentsGetTrainingComponentsGetTrainingComponentsget_training_components 将选定的值设置为最终参数,从而交互式地选择合适的参数值。

刚性模型组件将通过 ModelComponentsModelComponentsModelComponentsModelComponentsmodelComponentsmodel_components 返回。为获得合理结果,必须将用于 train_model_componentstrain_model_componentsTrainModelComponentsTrainModelComponentsTrainModelComponentstrain_model_components 训练的相同训练图像传递至 TrainingImagesTrainingImagesTrainingImagesTrainingImagestrainingImagestraining_images 参数。训练图像中新建聚类组件的姿态通过形状匹配确定。与 train_model_componentstrain_model_componentsTrainModelComponentsTrainModelComponentsTrainModelComponentstrain_model_components 相同,可通过 set_system('pregenerate_shape_models',...)set_system("pregenerate_shape_models",...)SetSystem("pregenerate_shape_models",...)SetSystem("pregenerate_shape_models",...)SetSystem("pregenerate_shape_models",...)set_system("pregenerate_shape_models",...) 决定是否预生成形状模型。请注意,如果在某个金字塔层级上模型触及图像边界,即使该模型完全位于原始图像内部,也可能无法被检测到。set_system('border_shape_models',...)set_system("border_shape_models",...)SetSystem("border_shape_models",...)SetSystem("border_shape_models",...)SetSystem("border_shape_models",...)set_system("border_shape_models",...) 可用于确定模型是否必须完全位于训练图像内,或是否可部分延伸至图像边界之外。

执行信息

参数

TrainingImagesTrainingImagesTrainingImagesTrainingImagestrainingImagestraining_images (输入对象)  (multichannel-)image(-array) objectHImageHObjectHImageHobject (byte / uint2)

用于训练模型组件的训练图像。

ModelComponentsModelComponentsModelComponentsModelComponentsmodelComponentsmodel_components (输出对象)  region(-array) objectHRegionHObjectHRegionHobject *

刚性模型组件的轮廓区域。

ComponentTrainingIDComponentTrainingIDComponentTrainingIDComponentTrainingIDcomponentTrainingIDcomponent_training_id (输入控制)  component_training HComponentTraining, HTupleHHandleHTupleHtuple (handle) (IntPtr) (HHandle) (handle)

训练结果的句柄。

AmbiguityCriterionAmbiguityCriterionAmbiguityCriterionAmbiguityCriterionambiguityCriterionambiguity_criterion (输入控制)  string HTuplestrHTupleHtuple (string) (string) (HString) (char*)

解决歧义的标准。

默认值: 'rigidity' "rigidity" "rigidity" "rigidity" "rigidity" "rigidity"

值列表: 'distance'"distance""distance""distance""distance""distance", 'distance_orientation'"distance_orientation""distance_orientation""distance_orientation""distance_orientation""distance_orientation", 'orientation'"orientation""orientation""orientation""orientation""orientation", 'rigidity'"rigidity""rigidity""rigidity""rigidity""rigidity"

MaxContourOverlapMaxContourOverlapMaxContourOverlapMaxContourOverlapmaxContourOverlapmax_contour_overlap (输入控制)  real HTuplefloatHTupleHtuple (real) (double) (double) (double)

已找到初始组件的最大轮廓重叠度。

默认值: 0.2

建议值: 0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0

最小增量: 0.01

建议增量: 0.05

限制: 0 <= MaxContourOverlap && MaxContourOverlap <= 1

ClusterThresholdClusterThresholdClusterThresholdClusterThresholdclusterThresholdcluster_threshold (输入控制)  real HTuplefloatHTupleHtuple (real) (double) (double) (double)

初始组件的聚类阈值。

默认值: 0.5

建议值: 0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0

限制: 0 <= ClusterThreshold && ClusterThreshold <= 1

示例(HDevelop)

* Get the model image.
read_image (ModelImage, 'model_image.tif')
* Define the regions for the initial components.
gen_rectangle2 (InitialComponentRegions, 212, 233, 0.62, 167, 29)
gen_rectangle2 (Rectangle2, 298, 363, 1.17, 162, 34)
gen_rectangle2 (Rectangle3, 63, 444, -0.26, 50, 27)
gen_rectangle2 (Rectangle4, 120, 473, 0, 33, 20)
concat_obj (InitialComponentRegions, Rectangle2, InitialComponentRegions)
concat_obj (InitialComponentRegions, Rectangle3, InitialComponentRegions)
concat_obj (InitialComponentRegions, Rectangle4, InitialComponentRegions)
* Get the training images
gen_empty_obj (TrainingImages)
for i := 1 to 4 by 1
    read_image (TrainingImage, 'training_image-'+i$'02'+'.tif')
    concat_obj (TrainingImages, TrainingImage, TrainingImages)
endfor
* Extract the model components and train the relations.
train_model_components (ModelImage, InitialComponentRegions, \
                        TrainingImages, ModelComponents, 22, 60, 30, 0.65, \
                        0, 0, rad(60), 'speed', 'rigidity', 0.2, 0.5, \
                        ComponentTrainingID)
* Find the best value for the parameter ClusterThreshold.
inspect_clustered_components (ModelComponents, ComponentTrainingID, \
                              'rigidity', 0.2, 0.4)
* Adopt the ClusterThreshold into the training result.
cluster_model_components (TrainingImages, ModelComponents, \
                          ComponentTrainingID, 'rigidity', 0.2, 0.4)
* Create the component model based on the training result.
create_trained_component_model (ComponentTrainingID, -rad(30), rad(60), \
                                10, 0.5, 'auto', 'auto', 'none', \
                                'use_polarity', 'false', ComponentModelID, \
                                RootRanking)

结果

如果参数值正确,算子 cluster_model_componentscluster_model_componentsClusterModelComponentsClusterModelComponentsClusterModelComponentscluster_model_components 返回值 2 (H_MSG_TRUE)。当输入为空(没有可用输入图像)时,可设置行为通过算子 set_system('no_object_result',<Result>)set_system("no_object_result",<Result>)SetSystem("no_object_result",<Result>)SetSystem("no_object_result",<Result>)SetSystem("no_object_result",<Result>)set_system("no_object_result",<Result>)。如有必要,则抛出异常。

可能的前趋

train_model_componentstrain_model_componentsTrainModelComponentsTrainModelComponentsTrainModelComponentstrain_model_components, inspect_clustered_componentsinspect_clustered_componentsInspectClusteredComponentsInspectClusteredComponentsInspectClusteredComponentsinspect_clustered_components

可能的后继

get_training_componentsget_training_componentsGetTrainingComponentsGetTrainingComponentsGetTrainingComponentsget_training_components, create_trained_component_modelcreate_trained_component_modelCreateTrainedComponentModelCreateTrainedComponentModelCreateTrainedComponentModelcreate_trained_component_model, modify_component_relationsmodify_component_relationsModifyComponentRelationsModifyComponentRelationsModifyComponentRelationsmodify_component_relations, write_training_componentswrite_training_componentsWriteTrainingComponentsWriteTrainingComponentsWriteTrainingComponentswrite_training_components, get_component_relationsget_component_relationsGetComponentRelationsGetComponentRelationsGetComponentRelationsget_component_relations, clear_training_componentsclear_training_componentsClearTrainingComponentsClearTrainingComponentsClearTrainingComponentsclear_training_components

模块

匹配