Skip to content

create_class_lut_mlpCreateClassLutMlpCreateClassLutMlpcreate_class_lut_mlpT_create_class_lut_mlp🔗

Short description🔗

create_class_lut_mlpCreateClassLutMlpCreateClassLutMlpcreate_class_lut_mlpT_create_class_lut_mlp — Create a look-up table using a multi-layer perceptron to classify byte images.

Signature🔗

create_class_lut_mlp( class_mlp MLPHandle, attribute.name GenParamName, attribute.value GenParamValue, out class_lut ClassLUTHandle )void CreateClassLutMlp( const HTuple& MLPHandle, const HTuple& GenParamName, const HTuple& GenParamValue, HTuple* ClassLUTHandle )static void HOperatorSet.CreateClassLutMlp( HTuple MLPHandle, HTuple genParamName, HTuple genParamValue, out HTuple classLUTHandle )def create_class_lut_mlp( mlphandle: HHandle, gen_param_name: Sequence[str], gen_param_value: Sequence[Union[str, int, float]] ) -> HHandle

Herror T_create_class_lut_mlp( const Htuple MLPHandle, const Htuple GenParamName, const Htuple GenParamValue, Htuple* ClassLUTHandle )

void HClassLUT::HClassLUT( const HClassMlp& MLPHandle, const HTuple& GenParamName, const HTuple& GenParamValue )

public HClassLUT( HClassMlp MLPHandle, HTuple genParamName, HTuple genParamValue )

HClassLUT HClassMlp::CreateClassLutMlp( const HTuple& GenParamName, const HTuple& GenParamValue ) const

void HClassLUT::CreateClassLutMlp( const HClassMlp& MLPHandle, const HTuple& GenParamName, const HTuple& GenParamValue )

HClassLUT HClassMlp.CreateClassLutMlp( HTuple genParamName, HTuple genParamValue )

void HClassLUT.CreateClassLutMlp( HClassMlp MLPHandle, HTuple genParamName, HTuple genParamValue )

Description🔗

create_class_lut_mlpCreateClassLutMlp generates a look-up table (LUT) ClassLUTHandleclassLUTHandleclass_luthandle using the data of a trained multi-layer perceptron (MLP) MLPHandleMLPHandlemlphandle to classify multi-channel byte images. By using this MLP-based LUT classifier the operator classify_image_class_mlpClassifyImageClassMlp of the subsequent classification can be replaced by the operator classify_image_class_lutClassifyImageClassLut. The classification gets a major speed-up, because the estimation of the class in every image point is no longer necessary since every possible response of the MLP is stored in the LUT. For the generation of the LUT, the parameters NumInputnumInputnum_input, Preprocessingpreprocessingpreprocessing, and NumComponentsnumComponentsnum_components defined in the earlier called operator create_class_mlpCreateClassMlp are important. In NumInputnumInputnum_input, the number of image channels the images must have to be classified is defined. By using the Preprocessingpreprocessingpreprocessing (see create_class_mlpCreateClassMlp) the number of image channels can be transformed to NumComponentsnumComponentsnum_components. NumComponentsnumComponentsnum_components defines the length of the feature vector, which the classifier classify_class_mlpClassifyClassMlp handles internally. Because of performance and disk space, the LUT is restricted to be maximal 33-dimensional. Since it replaces the operator classify_class_mlpClassifyClassMlp, NumComponentsnumComponentsnum_components \(<=\) 33 must hold. If there is no preprocessing that reduces the number of image channels (NumInputnumInputnum_input \(=\) NumComponentsnumComponentsnum_components), all possible pixel values, which can occur in a byte image, are classified with classify_class_mlpClassifyClassMlp. The returned classes are stored in the LUT. If there is a preprocessing that reduces the number of image channels (NumInputnumInputnum_input \(>\) NumComponentsnumComponentsnum_components), the preprocessing parameters of the MLP are stored in a separate structure of the LUT. To create the LUT, all transformed pixel values are classified with classify_class_mlpClassifyClassMlp. The returned classes are stored in the LUT. Because of the discretization of the LUT, the accuracy of the LUT classifier could become lower than the accuracy of classify_image_class_mlpClassifyImageClassMlp. With 'bit_depth'"bit_depth" and 'class_selection'"class_selection" the accuracy of the classification, the required storage, and the runtime needed to create the LUT can be controlled.

The following parameters of the MLP-based LUT classifier can be set with GenParamNamegenParamNamegen_param_name and GenParamValuegenParamValuegen_param_value:

  • 'bit_depth'"bit_depth": Number of bits used from the pixels. It controls the storage requirement of the LUT classifier and is bounded by the bit depth of the image ('bit_depth'"bit_depth" \(<=\) 88). If the bit depth of the LUT is smaller ('bit_depth'"bit_depth" \(<\) 88), the classes of multiple pixel combinations will be mapped to the same LUT entry, which can result in a lower accuracy for the classification. One of these clusters contains \(2^{NumComponents \cdot (8-bit\_depth)}\) pixel combinations, where NumComponentsnumComponentsnum_components denotes the dimension of the LUT, which is specified in create_class_mlpCreateClassMlp. For example, for 'bit_depth'"bit_depth" \(=\) 77, NumComponentsnumComponentsnum_components \(=\) 33, the classes of 88 pixel combinations are mapped in the same LUT entry. The LUT requires at most \(2^{NumComponents \cdot bit\_depth+2}\) bytes of storage. For example, for NumComponentsnumComponentsnum_components \(=\) 33, 'bit_depth'"bit_depth" \(=\) 88 and NumOutputnumOutputnum_output \(<\) 1616 (specified in create_class_mlpCreateClassMlp), the LUT requires 8 MB of storage with internal storage optimization. If NumOutputnumOutputnum_output \(=\) 11, the LUT requires only 2 MB of storage by using the full bit depth of the LUT. The runtime for the classification in classify_image_class_lutClassifyImageClassLut becomes minimal if the LUT fits into the cache.

    Suggested values: 66,77,88 Default: 88

    Restriction: 'bit_depth'"bit_depth" \(>=\) 11, 'bit_depth'"bit_depth" \(<=\) 88.

  • 'class_selection'"class_selection": Method for the class selection for the LUT. Can be modified to control the accuracy and the runtime needed to create the LUT classifier. The value in 'class_selection'"class_selection" is ignored if the bit depth of the LUT is maximal, thus 'bit_depth'"bit_depth" \(=\) 88 holds. If the bit depth of the LUT is smaller ('bit_depth'"bit_depth" \(<\) 88), the classes of multiple pixel combinations will be mapped to the same LUT entry. One of these clusters contains \(2^{NumComponents \cdot (8-bit\_depth)}\) pixel combinations, where NumComponentsnumComponentsnum_components denotes the dimension of the LUT, which is specified in create_class_mlpCreateClassMlp. By choosing 'class_selection'"class_selection" \(=\) 'best'"best", the class that appears most often in the cluster is stored in the LUT. For 'class_selection'"class_selection" \(=\) 'fast'"fast", only one pixel of the cluster, i.e., the pixel with the smallest value (component-wise), is classified. The returned class is stored in the LUT. In this case, the accuracy of the subsequent classification could become lower. On the other hand, the runtime needed to create the LUT can be reduced, which is proportional to the maximal needed storage of the LUT, which is defined with \(2^{NumComponents \cdot bit\_depth+2}\).

    List of values: 'fast'"fast", 'best'"best"

    Default: 'fast'"fast",

  • 'rejection_threshold'"rejection_threshold": Threshold for the rejection of uncertain classified points of the MLP. The parameter represents a threshold on the probability measure returned by the classification (see classify_class_mlpClassifyClassMlp and evaluate_class_mlpEvaluateClassMlp). All pixels having a probability below 'rejection_threshold'"rejection_threshold" are not assigned to any class.

    Default: 0.50.5

    Restriction: 'rejection_threshold'"rejection_threshold" \(>=\) 00, 'rejection_threshold'"rejection_threshold" \(<=\) 11.

Execution information🔗

Execution information
  • Multithreading type: reentrant (runs in parallel with non-exclusive operators).

  • Multithreading scope: global (may be called from any thread).

  • Automatically parallelized on internal data level.

This operator returns a handle. Note that the state of an instance of this handle type may be changed by specific operators even though the handle is used as an input parameter by those operators.

Parameters🔗

MLPHandleMLPHandlemlphandle (input_control) class_mlp → (handle)HTuple (HHandle)HClassMlp, HTuple (IntPtr)HHandleHtuple (handle)

MLP handle.

GenParamNamegenParamNamegen_param_name (input_control) attribute.name-array → (string)HTuple (HString)HTuple (string)Sequence[str]Htuple (char*)

Names of the generic parameters that can be adjusted for the LUT classifier creation.

Default: [][]
Suggested values: 'bit_depth', 'class_selection', 'rejection_threshold'"bit_depth", "class_selection", "rejection_threshold"

GenParamValuegenParamValuegen_param_value (input_control) attribute.value-array → (string / integer / real)HTuple (HString / Hlong / double)HTuple (string / int / long / double)Sequence[Union[str, int, float]]Htuple (char* / Hlong / double)

Values of the generic parameters that can be adjusted for the LUT classifier creation.

Default: [][]
Suggested values: 8, 7, 6, 'fast', 'best'8, 7, 6, "fast", "best"

ClassLUTHandleclassLUTHandleclass_luthandle (output_control) class_lut → (handle)HTuple (HHandle)HClassLUT, HTuple (IntPtr)HHandleHtuple (handle)

Handle of the LUT classifier.

Result🔗

If the parameters are valid, the operator create_class_lut_mlpCreateClassLutMlp returns the value 2 (H_MSG_TRUE). If necessary an exception is raised.

Combinations with other operators🔗

Combinations

Possible predecessors

train_class_mlpTrainClassMlp, read_class_mlpReadClassMlp

Possible successors

classify_image_class_lutClassifyImageClassLut

Alternatives

create_class_lut_gmmCreateClassLutGmm, create_class_lut_knnCreateClassLutKnn, create_class_lut_svmCreateClassLutSvm

See also

classify_image_class_lutClassifyImageClassLut, clear_class_lutClearClassLut

Module🔗

Foundation