classify_image_class_svmT_classify_image_class_svmClassifyImageClassSvmClassifyImageClassSvmclassify_image_class_svm (Operator)
Name
classify_image_class_svmT_classify_image_class_svmClassifyImageClassSvmClassifyImageClassSvmclassify_image_class_svm
— Classify an image with a support vector machine.
Signature
def classify_image_class_svm(image: HObject, svmhandle: HHandle) -> HObject
Description
classify_image_class_svmclassify_image_class_svmClassifyImageClassSvmClassifyImageClassSvmClassifyImageClassSvmclassify_image_class_svm
performs a pixel classification
with the support vector machine (SVM) SVMHandleSVMHandleSVMHandleSVMHandleSVMHandlesvmhandle
on the
multichannel image ImageImageImageImageimageimage
. Before calling
classify_image_class_svmclassify_image_class_svmClassifyImageClassSvmClassifyImageClassSvmClassifyImageClassSvmclassify_image_class_svm
the SVM must be trained with
train_class_svmtrain_class_svmTrainClassSvmTrainClassSvmTrainClassSvmtrain_class_svm
. ImageImageImageImageimageimage
must have
NumFeaturesNumFeaturesNumFeaturesNumFeaturesnumFeaturesnum_features
channels, as specified with
create_class_svmcreate_class_svmCreateClassSvmCreateClassSvmCreateClassSvmcreate_class_svm
. On output, ClassRegionsClassRegionsClassRegionsClassRegionsclassRegionsclass_regions
contains
NumClassesNumClassesNumClassesNumClassesnumClassesnum_classes
regions as the result of the classification. Note
that the order of the regions that are returned in
ClassRegionsClassRegionsClassRegionsClassRegionsclassRegionsclass_regions
corresponds to the order of the classes as
defined by the training regions in
add_samples_image_class_svmadd_samples_image_class_svmAddSamplesImageClassSvmAddSamplesImageClassSvmAddSamplesImageClassSvmadd_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_svmAddSamplesImageClassSvmAddSamplesImageClassSvmAddSamplesImageClassSvmadd_samples_image_class_svm
and by re-training the SVM with
train_class_svmtrain_class_svmTrainClassSvmTrainClassSvmTrainClassSvmtrain_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""novelty-detection". Please refer to the description in
create_class_svmcreate_class_svmCreateClassSvmCreateClassSvmCreateClassSvmcreate_class_svm
and add_samples_image_class_svmadd_samples_image_class_svmAddSamplesImageClassSvmAddSamplesImageClassSvmAddSamplesImageClassSvmadd_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
ImageImageImageImageimageimage
(input_object) (multichannel-)image →
objectHImageHObjectHImageHobject (byte / cyclic / direction / int1 / int2 / uint2 / int4 / real)
Input image.
ClassRegionsClassRegionsClassRegionsClassRegionsclassRegionsclass_regions
(output_object) region-array →
objectHRegionHObjectHRegionHobject *
Segmented classes.
SVMHandleSVMHandleSVMHandleSVMHandleSVMHandlesvmhandle
(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_svmClassifyImageClassSvmClassifyImageClassSvmClassifyImageClassSvmclassify_image_class_svm
returns the value TRUE. If
necessary, an exception is raised.
Possible Predecessors
train_class_svmtrain_class_svmTrainClassSvmTrainClassSvmTrainClassSvmtrain_class_svm
,
read_class_svmread_class_svmReadClassSvmReadClassSvmReadClassSvmread_class_svm
,
reduce_class_svmreduce_class_svmReduceClassSvmReduceClassSvmReduceClassSvmreduce_class_svm
Alternatives
classify_image_class_gmmclassify_image_class_gmmClassifyImageClassGmmClassifyImageClassGmmClassifyImageClassGmmclassify_image_class_gmm
,
classify_image_class_knnclassify_image_class_knnClassifyImageClassKnnClassifyImageClassKnnClassifyImageClassKnnclassify_image_class_knn
,
classify_image_class_mlpclassify_image_class_mlpClassifyImageClassMlpClassifyImageClassMlpClassifyImageClassMlpclassify_image_class_mlp
,
classify_image_class_lutclassify_image_class_lutClassifyImageClassLutClassifyImageClassLutClassifyImageClassLutclassify_image_class_lut
,
class_ndim_normclass_ndim_normClassNdimNormClassNdimNormClassNdimNormclass_ndim_norm
,
class_2dim_supclass_2dim_supClass2dimSupClass2dimSupClass2dimSupclass_2dim_sup
See also
add_samples_image_class_svmadd_samples_image_class_svmAddSamplesImageClassSvmAddSamplesImageClassSvmAddSamplesImageClassSvmadd_samples_image_class_svm
,
create_class_svmcreate_class_svmCreateClassSvmCreateClassSvmCreateClassSvmcreate_class_svm
Module
Foundation