Operator Reference

classify_image_class_svmT_classify_image_class_svmClassifyImageClassSvmClassifyImageClassSvmclassify_image_class_svm (Operator)

classify_image_class_svmT_classify_image_class_svmClassifyImageClassSvmClassifyImageClassSvmclassify_image_class_svm — Classify an image with a support vector machine.

Signature

classify_image_class_svm(Image : ClassRegions : SVMHandle : )

Herror T_classify_image_class_svm(const Hobject Image, Hobject* ClassRegions, const Htuple SVMHandle)

void ClassifyImageClassSvm(const HObject& Image, HObject* ClassRegions, const HTuple& SVMHandle)

HRegion HImage::ClassifyImageClassSvm(const HClassSvm& SVMHandle) const

HRegion HClassSvm::ClassifyImageClassSvm(const HImage& Image) const

static void HOperatorSet.ClassifyImageClassSvm(HObject image, out HObject classRegions, HTuple SVMHandle)

HRegion HImage.ClassifyImageClassSvm(HClassSvm SVMHandle)

HRegion HClassSvm.ClassifyImageClassSvm(HImage image)

def classify_image_class_svm(image: HObject, svmhandle: HHandle) -> HObject

Description

classify_image_class_svmclassify_image_class_svmClassifyImageClassSvmClassifyImageClassSvmclassify_image_class_svm performs a pixel classification with the support vector machine (SVM) SVMHandleSVMHandleSVMHandleSVMHandlesvmhandle on the multichannel image ImageImageImageimageimage. Before calling classify_image_class_svmclassify_image_class_svmClassifyImageClassSvmClassifyImageClassSvmclassify_image_class_svm the SVM must be trained with train_class_svmtrain_class_svmTrainClassSvmTrainClassSvmtrain_class_svm. ImageImageImageimageimage must have NumFeaturesNumFeaturesNumFeaturesnumFeaturesnum_features channels, as specified with create_class_svmcreate_class_svmCreateClassSvmCreateClassSvmcreate_class_svm. On output, ClassRegionsClassRegionsClassRegionsclassRegionsclass_regions contains NumClassesNumClassesNumClassesnumClassesnum_classes regions as the result of the classification. Note that the order of the regions that are returned in ClassRegionsClassRegionsClassRegionsclassRegionsclass_regions corresponds to the order of the classes as defined by the training regions in add_samples_image_class_svmadd_samples_image_class_svmAddSamplesImageClassSvmAddSamplesImageClassSvmadd_samples_image_class_svm.

To prevent that the SVM assigns pixels that lie outside the convex hull of the training data in the feature space to one of the classes, it is useful in many cases to explicitly train a rejection class by adding samples for the rejection class with add_samples_image_class_svmadd_samples_image_class_svmAddSamplesImageClassSvmAddSamplesImageClassSvmadd_samples_image_class_svm and by re-training the SVM with train_class_svmtrain_class_svmTrainClassSvmTrainClassSvmtrain_class_svm.

An alternative for explicitly defining a rejection class is to use an SVM in the mode 'novelty-detection'"novelty-detection""novelty-detection""novelty-detection""novelty-detection". Please refer to the description in create_class_svmcreate_class_svmCreateClassSvmCreateClassSvmcreate_class_svm and add_samples_image_class_svmadd_samples_image_class_svmAddSamplesImageClassSvmAddSamplesImageClassSvmadd_samples_image_class_svm.

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.

Parameters

ImageImageImageimageimage (input_object)  (multichannel-)image objectHImageHObjectHObjectHobject (byte / cyclic / direction / int1 / int2 / uint2 / int4 / real)

Input image.

ClassRegionsClassRegionsClassRegionsclassRegionsclass_regions (output_object)  region-array objectHRegionHObjectHObjectHobject *

Segmented classes.

SVMHandleSVMHandleSVMHandleSVMHandlesvmhandle (input_control)  class_svm HClassSvm, HTupleHHandleHTupleHtuple (handle) (IntPtr) (HHandle) (handle)

SVM handle.

Example (HDevelop)

read_image (Image, 'ic')
gen_rectangle1 (Board, 20, 270, 160, 420)
gen_rectangle1 (Capacitor, 359, 263, 371, 302)
gen_rectangle1 (Resistor, 200, 252, 290, 256)
gen_rectangle1 (IC, 180, 135, 216, 165)
concat_obj (Board, Capacitor, Classes)
concat_obj (Classes, Resistor, Classes)
concat_obj (Classes, IC, Classes)
create_class_svm (3, 'rbf', 0.01, 0.01, 4, 'one-versus-all', \
                  'normalization', 3, SVMHandle)
add_samples_image_class_svm (Image, Classes, SVMHandle)
train_class_svm (SVMHandle, 0.001, 'default')
reduce_class_svm (SVMHandle, 'bottom_up', 2, 0.01, SVMHandleReduced)
classify_image_class_svm (Image, ClassRegions, SVMHandleReduced)
dev_display (ClassRegions)

Result

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

Possible Predecessors

train_class_svmtrain_class_svmTrainClassSvmTrainClassSvmtrain_class_svm, read_class_svmread_class_svmReadClassSvmReadClassSvmread_class_svm, reduce_class_svmreduce_class_svmReduceClassSvmReduceClassSvmreduce_class_svm

Alternatives

classify_image_class_gmmclassify_image_class_gmmClassifyImageClassGmmClassifyImageClassGmmclassify_image_class_gmm, classify_image_class_knnclassify_image_class_knnClassifyImageClassKnnClassifyImageClassKnnclassify_image_class_knn, classify_image_class_mlpclassify_image_class_mlpClassifyImageClassMlpClassifyImageClassMlpclassify_image_class_mlp, classify_image_class_lutclassify_image_class_lutClassifyImageClassLutClassifyImageClassLutclassify_image_class_lut, class_ndim_normclass_ndim_normClassNdimNormClassNdimNormclass_ndim_norm, class_2dim_supclass_2dim_supClass2dimSupClass2dimSupclass_2dim_sup

See also

add_samples_image_class_svmadd_samples_image_class_svmAddSamplesImageClassSvmAddSamplesImageClassSvmadd_samples_image_class_svm, create_class_svmcreate_class_svmCreateClassSvmCreateClassSvmcreate_class_svm

Module

Foundation