Title: Implementation of KNN method for object recognition.
1Implementation of KNN method for object
recognition.
- Presented by Natalya Chilina
2Outline
- Introduction.
- Description of the problem.
- Description of the method.
- Image library.
- Process of identification.
- Example.
- Future work.
3Introduction
- Generally speaking, problem of object recognition
is how to teach computer to recognize different
objects on a picture. - This is a nontrivial problem. Some of the main
difficulties in solving this problem are
separation of an object from the background
(especially in the presence of clutter or
occlusions in the background), and ability to
recognize an object with different lighting.
4Introduction.
- In this research I am trying to improve accuracy
of object recognition by implementation of KNN
method with new weighted Hamming-Levenshtein
distance that I developed.
5Description of the problem.
- The problem of object recognition can be divided
into two parts - 1) Location of an object on the picture
- 2) Identification of an object.
- For example, assume that we have the following
picture
6Description of the problem.
7Description of the problem.
- and we have the following library of images that
we will use for object identification
8Description of the problem.
- Our goal is to identify and locate objects from
our library on the picture.
9Description of the problem.
- In this research I have developed a method of
objects identification assuming that we already
know the location of an object, and I am going to
develop the method of location in my future work.
10Description of the method.
- We will use KNN method to identify objects.
- For example, assume we need to identify an object
X on a given picture. Let us consider the space
of pictures generated by the image of X and
images from our library.
11Description of the method.
- In this space we will pick up, say 5, closest to
X images, and identify X by finding the plurality
class of the nearest pictures.
C1
A3
B3
A1
X
A2
B2
B1
C2
Nearest neighbors A1, B1, A2, B2, A3
12Description of the method.
- In order to use KNN method we need to introduce a
measure of similarity between two pictures. - First of all, in order to say something about
similarity between pictures, we need to get some
ideas about the shape of objects on these
pictures. To do this we use edge-detection method
(Sobel method, for example).
13(No Transcript)
14(No Transcript)
15Description of the method.
- Next, we turn the edge-detected picture into a
bit array by thresholding intensities to 0 or 1.
In fact, we are going to keep images in the
library in this form.
16(No Transcript)
17Description of the method.
- Now, in order to compare two pictures , we need
to compare two 2-dimensional bit arrays. - It may seem natural to use the traditional
Hamming distance for bitstrings which is defined
as follows given two bitstrings of the same
dimension, the Hamming distance is the minimum
number of symbol changes needed to change one
bitmap into the other.
18Description of the method.
- For example, the Hamming distance between
- (A) 10001001 and
- (B) 11100000 is 4.
- Notice that the Hamming distance between
- (A) 10001001 and
- (C) 10010010 is also 4, but intuitively one can
regard (C) as a better match for (A) than (B).
19Description of the method.
- We can modify Hamming distance using the idea of
Levenshtein distance which is usually used for
comparing of text strings and is obtained by
finding the cheapest way to transform one string
into another. Transformations are the one-step
operations of insertion, deletion and
substitution, and each transformation has a
certain cost.
20Description of the method.
- Also, since different parts of images have
different level of importance in the process of
recognition, we can assign a weight value for
each pixel of an image, and use it in the
definition of a distance. For example, we can
eliminate the background of a picture by
assigning to the corresponding pixels zero
weight.
21(No Transcript)
22(No Transcript)
23Description of the method.
- To get weighted Hamming-Levenshtein distance
between two pictures we - divide each bitstring into several substrings of
the same length. - Then we compare corresponding substrings using
Levenshtein distance, - And summarize all these distances multiplied by
the average weight of each substring.
24Image library.
- Each object in the library is represented by
several images taken with different lighting and
from different sides. Each image in the library
is represented by two 2-dimensional arrays. First
array contains the edge-detected picture turned
into a bit array, and the second one contains
weight values assigned to each pixel.
25Process of identification.
- To identify an object,
- we turn its edge-detected image into a bit array
by thresholding intensities to 0 or 1. - Then we measure distance between this image and
each image from our library using corresponding
weight arrays and weighted Hamming-Levenshtein
distance. - Using KNN method we identify the object.
26Example.
- Below I present some results in object
identification that I obtained using the method
that I described.
27Example.
- Assume that we have the image library with the
following edge-detected images of objects and
weighted images.
28Example.
29(No Transcript)
30Example.
- I want to identify objects from this picture.
31Example.
- Let us try to identify the following picture.
Picture 1
32Example.
- We compare this picture with each image in our
library, and we get the following table of
distances.
33Example.
- If we select three closest neighbors of our
picture 1, then we can identify it as Bear.
34Example.
- Let us do similar calculations for these two
pictures
Picture 3.
Picture 2.
35(No Transcript)
36Future work.
- Develop a method of location of an object on the
picture. - Develop an idea of reasonable weight distribution
on the images from the library. - Improve the algorithm of identification to allow
to compare pictures of different sizes. - Continue to work on improving the definition of
weighted Hamming-Levenshtein distance.
37References.
- A. Bookstein, V. Kulyukin, T. Raita (2002)
Generalized Hamming Distance. - Michael Gilleland, Merriam Park Software
Levenshtein Distance, in Three Flavors. - Bill Green (2002) Edge Detection Tutorial
- V. Kulyukin (2004) Human-Robot Interaction
Through Gesture-Free Spoken Dialogue.
38