机器视觉halcon classification——分类概述

时间:2024-03-31 13:02:16

      Classification: Theoretical  Background 

     *灰度图中含有圆形水果,已经将有水果的区域提取出来且每个区域一个水果。使用分类器可将橘子和柠檬区分开,分类任务即决定每个区域中的水果是属于橘子那个类还是柠檬。

      Generally, a classifier is used to assign an object to one of several available classes. For example, you have gray
value images containing citrus fruits. You have extracted regions from the images and each region represents  a fruit.           Now, you want to separate the oranges from the lemons. To distinguish the fruits, you can apply a   classification.               Then, the extracted regions of the fruits are your objects and the task of the classification is to decide
for each region if it belongs to the class ’oranges’ or to the class ’lemons’.

     *分类需要事先知道类之间的区别和相似之处,deep learning可通过学习自动获取这些信息,其他分类器需要自己对图像进行处理并提供这些信息。
      In order to decide to which class an image or a region belongs, the classifier needs to know how to distinguish the
classes.
Thus, differences between the classes and the similarities within each individual class have to be known.
With deep-learning-based classification, the network learns this information automatically from the images. For
further information, see section 3.7 on page 23. However, for all other approaches, you as user need to provide the
knowledge
, which you can obtain by analyzing typical features of the objects to classify. Let us illustrate the latter
case with the example of citrus fruits (an actual program is described in more detail in section 8.3.1 on page 102).
Suitable features can be, e.g., the ’area’ (an orange is usually bigger than a lemon) and the shape, in particular the
’circularity’ of the regions (the outline of an orange is closer to a circle than that of a lemon). Figure 3.1 shows
some oranges and lemons for which the regions are extracted and the region features ’area’ and ’circularity’
are calculated.

     *特征被保存在一个被称为特征向量的数组中,这些特征也被称为特征空间。每个特征在一维空间中表示。这里用一个2维的特征向量为例,实际上高维度的特征空间十分普遍。在例子中,一维表示(area)面积,一维表示圆度(circularity)。尽管区域在大小和圆度有所差别,但它们有足够的相似特征以建立蔟(clusters)。在特征线左下方的标识为柠檬,右上方为橘子。
     The features are arranged in an array that is called feature vector. The features of the feature vector span a so-
called feature space, i.e., a vector space in which each feature is represented by an axis. Generally, a feature space
can have any dimension, depending on the number of features contained in the feature vector. For visualization
purpose, here a 2D feature space is shown. In practice, feature spaces of higher dimension are very common.
In figure 3.2 the feature vectors of the fruits shown in figure 3.1 are visualized in a 2D graph, for which one axis
represents the ’area’ values and the other axis represents the ’circularity’ values. Although the regions vary
in size and circularity, we can see that they are similar enough to build clusters. The goal of a classifier is to
separate the clusters and to assign each feature vector to one of the clusters. Here, the oranges and lemons can
be separated, e.g., by a straight line. All objects on the lower left side of the line are classified as lemons and all
objects on the upper right side of the line are classified as oranges.

      *非常小的橘子和很圆的柠檬与特征线离得非常近,若小橘子没那么圆,特征向量在分类时可能出错。

       As we can see, the feature vector of a very small orange and that of a rather circular lemon are close to the
separating line. With a little bit different data, e.g., if the small orange additionally would be less circular, the feature          vectors may be classified incorrectly.

机器视觉halcon classification——分类概述

     Figure 3.1: Region features of oranges and lemons are extracted and can be added as samples to the classifier.
    *为了减少出错,需要使用更多的特征去分类,比如灰度值。此时不再使用特征线而是N-维平面(hyperplane超平面去分类对象。

    To minimize errors, a lot of different samples and in many cases also  additional features are needed. An additional feature for the citrus fruits may be, e.g., the gray value. Then, not a  line but a plane is needed to separate the clusters. If color images are available, you can combine the area and the  circularity with the gray values of three channels. For feature vectors of more than three features, an n-dimensional  plane, also called hyperplane, is needed.
   *使用线或者超平面的被称为线性分类器。非线性分类器可使用任意曲面去分类对象,在某些情况下也更加方便。

    Classifiers that use separating lines or hyperplanes are called linear classifiers. Other classifiers, i.e., non-linear
classifiers, can separate clusters using arbitrary surfaces and may be able to separate clusters more conveniently in
some cases.
   Summarized, we need a suitable set of features and we have to select the classifier that is suited best for a spe-
cific classification application. To select the most appropriate approach, we have to know some basics about the
available classifiers and the algorithms they use.

机器视觉halcon classification——分类概述

文档下载

在Halcon18.05中可使用的分类器,在后续的文章中介绍。

  1. Euclidean and Hyperbox Classifiers/欧几里得和Hyperbox分类器

  2. Multi-Layer Perceptrons (MLP)/多层感知器(MLP)

  3. Support-Vector Machines (SVM)/支持向量机(SVM)

  4. Gaussian Mixture Models (GMM)/高斯混合模型

  5. K-Nearest Neighbors (k-NN)/K近邻算法

  6. Deep Learning (DL) and Convolutional Neural Networks(CNNs)/深度学习、卷积神经网络