Sample-Based

List of Operators ↓

This chapter contains operators for sample-based identification.

Concept of sample-based identification

With sample-based identification, trained objects can be identified based on characteristic features like texture or color. This allows you to identify objects that do not carry bar codes or data codes. Compared to the classification approaches described in chapter Classification, the preparation and training for sample-based identification is very convenient as no complex parameter tuning is required. Sample-based identification is capable of differentiating a large number of objects. The identification is robust against rotation, scale, and illumination changes as well as against occlusions, clutter, and moderate perspective distortions. Furthermore, the identification is robust against moderate deformations of the object and, within certain limits, it even allows to identify products stored in bulk. On the other hand, this means that objects cannot be distinguished if they appear identical except for one of the characteristics the identification is robust against. Note that sample-based identification works only with textured objects.

Sample-based identification can identify only one object at the same time. This means that each query image, or more precisely the domain of each query image, must not contain multiple objects.

(1) (2)
(3) (4)
Sample-based identification of the objects 'potato', 'blueberry', 'arugula', and 'champignon'. These images are from the example program identify_vegetables.hdev.

In the following, the steps that are required to use sample-based identification are described briefly.

Create and prepare a sample identifier:

First, a sample identifier must be provided by creating and preparing a new sample identifier with

The preparation is essential to adapt the internal data structure of the sample identifier to the kind of objects to be identified. Alternatively, an already prepared sample identifier, which has been written to file with write_sample_identifierwrite_sample_identifierWriteSampleIdentifierWriteSampleIdentifierWriteSampleIdentifierwrite_sample_identifier, can be read from file with read_sample_identifierread_sample_identifierReadSampleIdentifierReadSampleIdentifierReadSampleIdentifierread_sample_identifier.

A prepared sample identifier can be thought of as a warehouse, optimized to handle a specific group of objects.

Train sample identifier:

Then, the prepared sample identifier has to be trained with samples of the individual objects to be identified. For this, the operators

are used. Note that it is possible to retrain the sample identifier at any time. For this, samples can be removed from the sample identifier with the operator remove_sample_identifier_training_dataremove_sample_identifier_training_dataRemoveSampleIdentifierTrainingDataRemoveSampleIdentifierTrainingDataRemoveSampleIdentifierTrainingDataremove_sample_identifier_training_data and new samples can be added to the sample identifier with the operator add_sample_identifier_training_dataadd_sample_identifier_training_dataAddSampleIdentifierTrainingDataAddSampleIdentifierTrainingDataAddSampleIdentifierTrainingDataadd_sample_identifier_training_data. If the kind of the objects to be identified does not change too much, it is not necessary to repeat the preparation of the sample identifier. To use the picture from above, the training corresponds to filling the warehouse.

Apply sample identifier to identify objects:

Finally, the trained sample identifier can be applied to identify objects with

Further operators to administrate and control sample identifiers

In addition to the operators mentioned above, the following operators can be used to administrate the sample identifier. With remove_sample_identifier_preparation_dataremove_sample_identifier_preparation_dataRemoveSampleIdentifierPreparationDataRemoveSampleIdentifierPreparationDataRemoveSampleIdentifierPreparationDataremove_sample_identifier_preparation_data the data that were added to the sample identifier can be removed in order to exclude them from being used for the preparation. The operators set_sample_identifier_object_infoset_sample_identifier_object_infoSetSampleIdentifierObjectInfoSetSampleIdentifierObjectInfoSetSampleIdentifierObjectInfoset_sample_identifier_object_info and get_sample_identifier_object_infoget_sample_identifier_object_infoGetSampleIdentifierObjectInfoGetSampleIdentifierObjectInfoGetSampleIdentifierObjectInfoget_sample_identifier_object_info can be used to assign and query labels, i.e, names, to the individual objects. The latter operator can further be used to determine some additional information about the number of objects available for preparation and training. Finally, the operators set_sample_identifier_paramset_sample_identifier_paramSetSampleIdentifierParamSetSampleIdentifierParamSetSampleIdentifierParamset_sample_identifier_param and get_sample_identifier_paramget_sample_identifier_paramGetSampleIdentifierParamGetSampleIdentifierParamGetSampleIdentifierParamget_sample_identifier_param can be used to set and retrieve control parameters of the sample identifier.

Glossary

In the following, the most important terms that are used in the context of sample-based identification are described:

object

An object to be identified by sample-based identification.

object index

The index of an object. This index can be seen as a label of the object, which is set while adding preparation data or training data to the SampleIdentifierSampleIdentifierSampleIdentifierSampleIdentifiersampleIdentifiersample_identifier. The object index is the most important result of the operator apply_sample_identifierapply_sample_identifierApplySampleIdentifierApplySampleIdentifierApplySampleIdentifierapply_sample_identifier. With the operator set_sample_identifier_object_infoset_sample_identifier_object_infoSetSampleIdentifierObjectInfoSetSampleIdentifierObjectInfoSetSampleIdentifierObjectInfoset_sample_identifier_object_info, a descriptive name can be set for each object, which eases the interpretation of the identification results.

object sample

One sample or view of an object. Sometimes, also the term “sample image” is used to refer to object samples.

sample image

This term is used as a synonym for “object sample”, if the emphasis lies on the image.

object sample index

The index of an object sample. Note that for each object, this index is set individually starting with 0. Therefore, the object sample index is unambiguous only together with the respective object index.

preparation

The adaptation of the internal data structure of the sample identifier to the features of a typical set of object samples that may appear during the identification process.

preparation object

An object that has been added to the sample identifier with add_sample_identifier_preparation_dataadd_sample_identifier_preparation_dataAddSampleIdentifierPreparationDataAddSampleIdentifierPreparationDataAddSampleIdentifierPreparationDataadd_sample_identifier_preparation_data.

preparation sample

An object sample of a preparation object. The preparation is typically done based on multiple preparation samples per object.

preparation data

The collection of all preparation samples.

training

The training of the sample identifier. In this step, the sample identifier learns to differentiate all given objects.

training object

An object that has been added to the sample identifier with add_sample_identifier_training_dataadd_sample_identifier_training_dataAddSampleIdentifierTrainingDataAddSampleIdentifierTrainingDataAddSampleIdentifierTrainingDataadd_sample_identifier_training_data or which is the result of reusing preparation data as training data. In contrast to preparation objects, all training objects are labeled with a unique object index.

training sample

An object sample of a training object. The training is typically done based on multiple training samples per object.

training data

The collection of all training samples.

query image

An image, in which an object is visible that should be identified with sample-based identification.


List of Operators

add_sample_identifier_preparation_dataAddSampleIdentifierPreparationDataadd_sample_identifier_preparation_dataAddSampleIdentifierPreparationDataadd_sample_identifier_preparation_data
Add preparation data to an existing sample identifier.
add_sample_identifier_training_dataAddSampleIdentifierTrainingDataadd_sample_identifier_training_dataAddSampleIdentifierTrainingDataadd_sample_identifier_training_data
Add training data to an existing sample identifier.
apply_sample_identifierApplySampleIdentifierapply_sample_identifierApplySampleIdentifierapply_sample_identifier
Identify objects with a sample identifier.
clear_sample_identifierClearSampleIdentifierclear_sample_identifierClearSampleIdentifierclear_sample_identifier
Free the memory of a sample identifier.
create_sample_identifierCreateSampleIdentifiercreate_sample_identifierCreateSampleIdentifiercreate_sample_identifier
Create a new sample identifier.
deserialize_sample_identifierDeserializeSampleIdentifierdeserialize_sample_identifierDeserializeSampleIdentifierdeserialize_sample_identifier
Deserialize a serialized sample identifier.
get_sample_identifier_object_infoGetSampleIdentifierObjectInfoget_sample_identifier_object_infoGetSampleIdentifierObjectInfoget_sample_identifier_object_info
Retrieve information about an object of a sample identifier.
get_sample_identifier_paramGetSampleIdentifierParamget_sample_identifier_paramGetSampleIdentifierParamget_sample_identifier_param
Get selected parameters of a sample identifier.
prepare_sample_identifierPrepareSampleIdentifierprepare_sample_identifierPrepareSampleIdentifierprepare_sample_identifier
Adapt the internal data structure of a sample identifier to the objects to be identified.
read_sample_identifierReadSampleIdentifierread_sample_identifierReadSampleIdentifierread_sample_identifier
Read a sample identifier from a file.
remove_sample_identifier_preparation_dataRemoveSampleIdentifierPreparationDataremove_sample_identifier_preparation_dataRemoveSampleIdentifierPreparationDataremove_sample_identifier_preparation_data
Remove preparation data from a sample identifier.
remove_sample_identifier_training_dataRemoveSampleIdentifierTrainingDataremove_sample_identifier_training_dataRemoveSampleIdentifierTrainingDataremove_sample_identifier_training_data
Remove training data from a sample identifier.
serialize_sample_identifierSerializeSampleIdentifierserialize_sample_identifierSerializeSampleIdentifierserialize_sample_identifier
Serialize a sample identifier.
set_sample_identifier_object_infoSetSampleIdentifierObjectInfoset_sample_identifier_object_infoSetSampleIdentifierObjectInfoset_sample_identifier_object_info
Define a name or a description for an object of a sample identifier.
set_sample_identifier_paramSetSampleIdentifierParamset_sample_identifier_paramSetSampleIdentifierParamset_sample_identifier_param
Set selected parameters of a sample identifier.
train_sample_identifierTrainSampleIdentifiertrain_sample_identifierTrainSampleIdentifiertrain_sample_identifier
Train a sample identifier.
write_sample_identifierWriteSampleIdentifierwrite_sample_identifierWriteSampleIdentifierwrite_sample_identifier
Write a sample identifier to a file.