東京大学 情報理工学系研究科 創造情報学専攻 2013年8月実施 筆記試験 第3問
Author
Description
Official examination, archived Japanese PDF. We consider the problem of distinguishing between two hand-written alphabets "C" and "I" using image processing and pattern recognition techniques. Figure 1 shows an input image X. Let and denote integers corresponding to the and coordinates of a pixel. The value of a pixel is represented by . Here, we take the top-left pixel as the origin of the coordinates.
Following the procedure below, we extract some features to quantify the properties of the input image. First, we apply a size linear filter. Let denote the output value of the filter for a pixel , which is defined as where is the array that contains the coefficients of the filter ( and are integer values). Answer the following questions.
(1) We apply the linear filter L illustrated in Figure 2 to the image X. Compute the output value for the pixel P in Figure 1.
Next, we reduce the resolution of the filtered image to pixels and binarize its values. Specifically, the converted image is represented as . Figure 3 shows two examples of binary images Y1 and Y2. We extract features called "image moments" from them. The image moment of order is defined as . For example, we can see that corresponds to the [ (A) ] of the figure in the binary image, and corresponds to its [ (B) ].
(2) Fill in the blanks (A) and (B) with appropriate words. Also, compute the image moments and of Y1 and Y2 respectively.
Taking a pair of two features extracted by the above procedure as an input pattern, we classify this into one of two classes ("C" or "I"). Table 1 lists the values of features of four "C" and four "I" training examples. Also, Figure 4 shows their plots on a two-dimensional graph.
(3) We classify an input pattern using the nearest neighbor (-NN) method. Namely, a pattern is classified into the class that has the largest number of samples among its nearest training examples. Suppose we have a new pattern of an input image with the features . Classify this pattern into "C" or "I" using the -NN method and describe the reason when and , respectively. Distance between any two patterns is defined in terms of the Euclidean distance.
(4) As an alternative classification algorithm, we classify an input pattern into the class where the mean of its training examples is nearest to the pattern in terms of the Euclidean distance. Show the equation that defines the boundary of discrimination, and the methodology of discrimination using it. Also, classify the pattern using the methodology.
(5) Compare the two algorithms described at (3) and (4) and discuss their advantages respectively.
题目描述
用图像处理和模式识别区分手写字母 “C” 与 “I”。图 1 为输入图像 。像素横、纵坐标分别为整数 ,像素值为 ,左上角像素为原点 。
首先使用 线性滤波器提取特征。像素 的输出为
其中 为滤波器系数阵列。
-
将图 2 的线性滤波器 作用于图像 ,计算图 1 中像素 的输出值。
-
把滤波后图像降采样为 并二值化,使 ()。图 3 给出二值图像 Y1、Y2。定义 阶图像矩
填写: 对应图形的【A】,而
对应图形的【B】;并分别计算 Y1、Y2 的 与 。
-
取特征对 作为输入模式,分类为 C 或 I。原文表 1、图 4 给出四个 C 与四个 I 训练样本的特征。对新样本 ,分别用 和 的 近邻法分类并说明理由;距离采用欧氏距离,类别由 个最近训练样本中的多数决定。
-
另一方法把样本分到“训练样本均值离它最近”的类别。写出判别边界方程及用它分类的方法,并判定 的类别。
-
比较第 3、4 问两种分类算法,分别讨论其优点。
题中像素值、滤波器系数、二值图和训练数据沿用原文图表。
Kai
(1) Filter output
The filter is the four-neighbor discrete Laplacian: center coefficient , horizontal/vertical neighbors , and diagonal neighbors . At the center is 150 and the upper, left, right and lower neighbors are 80, 250, 80 and 250. Hence
No image-boundary convention is needed because all required pixels are supplied.
(2) Image moments
(A) is area (the number of foreground pixels), and (B) is the centroid or center of mass of uniform foreground pixels. The centroid requires .
For checking the sums, the two binary arrays from Figure 3 are, with row index increasing downward and column index increasing to the right:
For , the row foreground counts are and the row sums of horizontal coordinates are . For , these are and . Therefore
weights the horizontal coordinate , not the vertical coordinate .
(3) Nearest neighbors
The numerical data in Table 1 and squared distances from are:
| Sample | Squared distance | ||
|---|---|---|---|
| C1 | 10 | 24 | 18 |
| C2 | 12 | 24 | 10 |
| C3 | 12 | 26 | 2 |
| C4 | 14 | 26 | 2 |
| I1 | 8 | 27 | 25 |
| I2 | 10 | 26 | 10 |
| I3 | 10 | 28 | 10 |
| I4 | 12 | 27 | 1 |
For , the unique nearest example is I4, so the class is . For , the neighbors are I4, C3 and C4. Two of these three are C, so the class is . The tie between C3 and C4 does not create a tie at the third-neighbor boundary because both are included.
(4) Nearest class mean
The class means are
Write the input as . The boundary is the perpendicular bisector of the two means:
or
The difference “squared distance to C minus squared distance to I” is . Thus classify as C when , and as I when , with an explicit arbitrary tie rule on the line. At the squared distances are 5 and 9, respectively, so the decision is .
(5) Comparison
The -NN method retains individual examples and can represent nonlinear or multimodal class shapes without restricting each class to one center. Choosing reduces sensitivity to an isolated mislabeled point, but the result depends on , sampling density, feature scaling and distance. A naive query costs for distances to examples in dimensions, plus neighbor selection, and needs the training examples in memory.
Nearest-mean classification stores only one -dimensional mean per class and compares a query to those means, so prediction is cheaper and the model is compact. Averaging also smooths sample noise when one center summarizes each class well. However, a single mean can lie between separated clusters and ignores their shapes and spreads; with Euclidean distance its pairwise boundaries are linear. Both methods here use the raw features and the specified Euclidean metric; rescaling the moments would define a different classifier.