Pattern Recognition and Application PDF

Summary

Lecture notes on pattern recognition and application from Sohag University, Fall 2024/2025, discussing the concepts of intelligence and how we recognize patterns.

Full Transcript

Sohag University Fall 2024/2025 Pattern Recognition and Application Rania R. Mohamed [email protected] Lecture one Introduction Introduction Suppose we draw a simple diagram of something like this....

Sohag University Fall 2024/2025 Pattern Recognition and Application Rania R. Mohamed [email protected] Lecture one Introduction Introduction Suppose we draw a simple diagram of something like this. This is nothing but a pattern. If we draw diagrams like this, it is also a pattern. If we knew the pattern, what would the pattern recognition be? pattern recognition involves analyzing whether a signal is one-dimensional or two-dimensional. We want the machine to recognize that signal, so that is the problem of pattern recognition. The pattern recognition problem started within the early years with the effort to understand intelligence. What does intelligence mean? We can define intelligence as the ability to comprehend, understand, and benefit from experience. What do we mean by that ability to understand and benefit from the experience? Let us take a simple example. Suppose we have a sharp object. If we take the tip of a pin, which is very sharp, we know that if we touch or hit the tip of the pin, in that case, it will hurt our finger. So, that is our experience, and how do We benefit from this experience. The benefit is that whenever we come across such a sharp end, we will not try to touch it hard, because we know it will hurt us. Similarly, if we take the example of fire, we know if we put our finger in the fire, the fire will burn our finger. So, that is the experience, and how we benefit from this experience is that, whenever there is fire, we will not put our finger into the fire. So, that is our experience. The basic explanation of intelligence is comprehending and gaining from experiences. That is intelligence, or we can say, it is the capability to gain and apply knowledge. So, we should be able to gain knowledge and apply that knowledge we have gained. Now, let us show you two different pictures. If you've seen these two pictures before, can you recognize them if we ask you? We would classify the left-hand side as a painting. Specifically, we can identify it as a wall painting in the AL-Karnak Temple. Similarly, the picture on the right illustrates a building. But some of us would have seen this building before. This photo represents the Tahrir Complex, located in Cairo. The question is, if we can recognize these pictures, we try to find out the answer to this question when we can recognize these pictures, then how do we recognize these pictures? The answer is not very new. We must go back to almost 2000 years ago when Plato tried to answer this. How do we recognize objects, pictures, or patterns? It's Plato, who claimed that our understanding of abstract ideas comes from a mystical connection to the world, known to us as a priori. The concept of abstract ideas is what we'll be talking about. Consider these two terms: abstract ideas, a priori, and, on top of that, a mystical connection to the world. So, again, if you look at these two pictures, we said that if we know, we can say that this left hand is a wall painting in the AL-Karnak Temple. and the right picture is the picture of the Tahrir Complex in Cairo. So, how do you know? In many cases, we have seen pictures of wall paintings in temples in our history books. It's possible that some of us have seen the Tahrir Complex in Cairo, or we've seen pictures or videos of it. So, that means this information or what we say is an abstract idea because we cannot specifically say why we recognize this to be a painting in the AL-Karnak Temple and why we recognize it or how we recognize this to be the image of the Tahrir Complex. We can categorize this concept as both tangible and intangible, like a painting in the AL-Karnak Temple or an image of the Tahrir Complex., because this information or this knowledge is already available to us a priori. So, what we are doing is we are making use of this prior knowledge to recognize these two pictures. So, that is why these two terms abstract ideas and a priori, are very important. That means our brain stores this information or the image of the picture in a way. Why hasn't that way been completely comprehended yet? So, that is why it is said that through a mysterious connection with the world, So, our brain stores these abstract ideas of prior knowledge mysteriously. The process of recognizing or storing that information, or retrieving it to recognize certain things, is a mystery. Plato has also concluded that the ability to think is based on knowledge of concepts a priori. So, this is a prior term that Plato told in many ways. Now, let us look at another picture... If we ask you that, what is this picture? You know that most of us have seen images of the pyramids and sphinx like this, So, if we look at this picture the immediate reaction will be, this is the picture of the pyramids. If we show you the next two pictures, you'll notice that the one on the right is the same as the one we saw earlier, while the one on the left is something new. So, when we show you these two, you will immediately say that the picture on the left is the picture of the Al-Giza pyramids and sphinx, while the picture on the right is not the picture of the Al-Giza pyramids and sphinx, but it is a monument, which is very similar to Al-Giza pyramids and sphinx. This monument is what is known as the Egyptian Pavilion at Boulevard World in Riyadh But they are very much alike. So, you find this a priori knowledge, which has been proved by Plato is not sufficient. We should be able to adapt our knowledge. That means the learning we do have or the knowledge, acquiring knowledge which we employ that much be incremental. Aristotle, who was Plato's student did not fully agree on the concept of a priori knowledge, which was given by Plato. So, what Aristotle said is that it is not only the a priori knowledge, that is very important, but also the ability to learn or to adapt to the changing world, that is also equally important. That means we should be able to adapt to the changing environment and our learning process must be adaptive. That is, we should be able to learn new and new things and we should be able to modify the knowledge that we have already acquired. So, what is the problem with pattern recognition in that case? So, as we have seen earlier, these two figures may represent some signals. Certain structures can be represented by them. So, the problem of pattern recognition is to identify the underlying structure within data. So, if we have a given set of data, we want to identify the structures within that data and what are the structures that we want to identify? It is the structures, which are known to me a priori, so that is what the pattern recognition problem is. So, we can define pure pattern recognition to be the start of structure in the data. Now, why do we want this pattern recognition, what is the importance of pattern recognition? The purpose of implementing pattern recognition is to grant machines the ability to function like humans. So, we want machines should be equally intelligent as a human being and whatever work that we do, a machine or a computer should be able to do the same things. So, what are the different approaches to pattern recognition? So, in this introductory lecture, we will briefly introduce the pattern recognition problem. Then we will talk about what are the approaches to pattern recognition problems or to solve pattern recognition problems during this course on pattern recognition and applications. Now, coming to the application side, pattern recognition techniques have applications in various domains. For example, take the medical signal analysis. So, each of us has seen that whenever a doctor or medical practitioner has any doubt about the functioning of the heart, whether our heart is functioning properly, they prescribe us to go for an ECG checkup. All of you know that when you get an ECG pattern, the ECG pattern appears something like this and it is a repeated pattern, so this is nothing but a structure. So, what the doctors do is, they look at these patterns and by looking at these patterns, they try to judge whether our heart function is proper or if there is some abnormality in our heart function. So, this is just one example, where pattern recognition is very useful. Likewise, pattern recognition can be applied to speech recognition or speaker recognition. we can easily recognize the voice of Al-Shikh Al-menshawy and easily recognize the voice of Al-Shikh Abdelbaset; we can easily recognize the voice of all other different people. But all of them are readers, and their voice is nothing but an acoustic signal because it is a sound wave, but how do you from those acoustic signals recognize the voices of different people? So, that is what is a speaker recognition problem. Similarly, we can have speech recognition problems. So, you might have heard about tools like speech-to-word conversion The speech-to-word conversion tool is nothing but whatever we are speaking, there is a machine that captures the voice, and which is converted into electrical signal processes. That electrical signal extracts certain properties or called features which we will come to a bit later. And based on those features the machine tries to extract which word we have uttered. We use the same concept for speaker recognition, even when we're not famous readers, like when we read the Quran. There is a clear distinction between my voice and the voice of Al-Shikh Al-menshawy, so we can have signal processing techniques to extract those properties or those features from the speech signal. By utilizing those features, we can attempt to identify if the voice belongs to Al-Shikh Al-menshawy or someone else. So, similarly, in the case of a machine mission, if we have an automated assembly shop, we want every operation to be done by a robot automatically. So, the robot must be capable of seeing what is there on the shop floor which means that the robot must be attached to a vision system, maybe a digital camera. So, a digital camera takes images of the shop floor, and from those images, it locates different objects. Locating different objects is not sufficient, it should also be able to recognize which object is what, and based on that it can pick up certain objects and pick that object in some specific position. So, there is also your pattern recognition or object recognition, because objects are also nothing but patterns. So, pattern recognition or object recognition is very useful. So, this problem of the domain recognition problems is quite wide, the pattern recognition is applied in various applications, whether we try to recognize the patterns in one-dimensional signals or two-dimensional signals, like images. Now, when we go for such pattern recognition pattern recognition can be done in one of two ways. One of the ways is called supervised learning and the other approach is unsupervised, though the problem domains are slightly different. So now, let me just illustrate what is meant by supervised learning. Let us take a few objects. So, this is a set of objects all of you know, what these are, and we have another set of objects something like this. So, if we take the images of these 2 sets of objects, they are nothing but patterns. These patterns are to be known a priori coming to what Plato said that we had to have a priori knowledge or a priori information of the object that we have. And how do we have that priori information? All of you know that this is nothing, but a USB drive which is used to store data or taking backup from a computer. Similarly, here we have another set of objects or another set of patterns, and we know that these are pens with which we can write. So, these are 2 sets of patterns and the knowledge of patterns. we have a priori and how do we acquire this knowledge? Acquiring this knowledge is not a one-day process, this knowledge has been acquired over time starting from my childhood when we started writing a, b, c, d, my mother used to take a pen and she used to tell me this you can write, and this is how you can write. So, you find that starting from our childhood, we started learning patterns that is what is a priori knowledge and then we grew up a little bit then we started using these. These USB drives and then there also my teacher or my friends, who have used them before, must have told me that these are USB drives with which you can take your data backup or with which you can take a program backup. Then we started using these USB drives. According to Plato, abstract concepts are known as a priori, whereas Aristotle believed that learning must be incremental. When we were kids, we were taught about pens, but as we got older, we discovered USB drives. As children, we didn't have USB drives, so we are gradually learning about them. It's clear that the pattern recognition problems we're discussing today aren't a recent issue. The problems were considered by philosophers over 2000 years ago. It's important that we deal with our problem when we have these two sets of objects. If we compare a pen to sets of objects, it is more like pen sets than to USB sets. Consequently, we will classify an unfamiliar object as a pen rather than a USB drive. This is how we define supervised learning. In supervised learning, prior knowledge is necessary and can be obtained through experience, observation, and instruction. In the process of classification, when faced with an unknown object, we must categorize it into predefined classes based on similarity measures. So, when we try to classify this object to a pen effectively, what we are trying to do is, we are trying to find out the similarity between these objects and these two sets of objects, and we compute that the similarity of this object with these set of objects is more than the similarity of this object, with these set of objects. This is an example of supervised learning, as we correctly classify this object as a pen rather than a USB drive. In supervised learning, prior knowledge is necessary and can be gained from experience, observation, or instruction. We utilize our prior knowledge to identify or categorize unfamiliar objects or patterns, which is the basis of our supervised learning approach. Now, the other category that we mentioned is unsupervised learning, in the case of unsupervised learning nothing is told a priori. The issue is that we have a mix of various objects (pens and USBs). The objects in this mixture need to be divided into two or more groups. We aim to categorize similar objects together and place dissimilar ones in separate groups. These objects will be categorized into one group due to their apparent similarity, while those objects will be placed in another group for the same reason. Initially, we had a set of unfamiliar objects. By identifying every pair, we can group similar objects together. Different groups are created for objects that are not alike. If you select two items from a set, they must be alike. This suggests that objects within the same group are very similar, but selecting objects from different groups may yield poor similarity or dissimilarity. Unsupervised learning is the term used when we don't utilize any prior knowledge, as we mentioned. When discussing pattern recognition problems, they are divided into two types: supervised learning and unsupervised learning. When it comes to supervised learning, we have prior knowledge of either patterns or objects. And using that a priori knowledge we want to recognize or try to recognize or classify an unknown pattern or an unknown object. In unsupervised learning, we lack prior knowledge and work with a mixture of objects. Our goal is to partition them into groups based on similarity, where objects within the same group are similar and objects in different groups are dissimilar. Hence, we require a means of measuring our likeness, which brings us back to Plato's assertion that a priori knowledge is mystically ingrained in our minds. The way information is stored and retrieved in our brains is still a mystery. The aim is to provide computers with an equivalent level of expertise and intelligence. The computer needs to mimic our work process or identify different objects. Although it may seem clear to us as a human, let's make it clear that these two items are different - one is a pen, and the other is a USB drive. We're faced with the question of how the computer will tackle the same problem. For those familiar with computer programming and algorithm writing, it is understood that for the computer to perform the same operation, there must be a description of the objects or patterns involved. Both the pen object and the USB require a description. The description or the instance of the pen object, and the instance of the description of the USB object should be different, and this description of what we are calling a feature. What are the different types of features we can have? At the start of this course, we will focus on feature extraction. The first topic we'll cover in this pattern recognition lecture series is feature extraction. So, what is this feature extraction? Say, for example, if we take this USB drive, and if we take this pen, you find that if we draw the boundary of these two defined objects. The boundary of the USB object will be something like this. Similarly, the boundary of the pen object will be something like this, So, you find that there is a clear difference in the boundary, so we can have the features, which are derived, from the boundary. Not only do these objects have a boundary, they also contain a region that is bounded by it. So, this is the bounding region of the USB drive, and this is the bounding region of the pen, So we can also obtain features from these bounding regions. So accordingly, when we talk about features, the features are usually of two types, one type of feature is known as boundary features, and the other one is known as region features. So, boundary feature is the feature or the set of features, which can be derived, the boundary of the object. It must be argued that whenever it comes to the shape of an object most of the information is available on to the boundary. If we can't distinguish between objects or patterns using only boundary information, we rely on region features extracted from the enclosed region by the object’s boundary. What are the available boundary-based features for extraction? The digital domain only consists of a set of points that make up this boundary. So, what we have is, that if we draw it in two dimensions we can illustrate that with the help of two- dimensional figures. So, this boundary is nothing but a set of points in a two-dimensional space, something like this. So, when we have a set of features like this, we can assume the 𝑢𝑢 horizontal axis to be my real axis and the 𝑗𝑗𝑗𝑗 as vertical axis to be an imaginary axis. So, given this, every kth point in this boundary can be represented by a complex number say, 𝑠𝑠(𝑘𝑘) = 𝑢𝑢(𝑘𝑘) + 𝑗𝑗𝑗𝑗(𝑘𝑘) we have all these different points for different values of k, so what do we have if we start scanning this boundary from any of the initial points? The collection we have is made up of numbers s(k), with k varying from 0 to N - 1. If we have N boundary points, you'll discover that it's simply a sequence of numbers. One way to extract the feature is by using a sequence of numbers is take the Fast Fourier transform, or Discrete Fourier transform of this sequence of numbers. As we have N number of Discrete Fourier transform coefficients. The magnitudes of those N numbers of Discrete Fourier coefficients itself can describe this boundary. So, that becomes a set of features, there are various other ways in which the feature can be extracted. One of the ways can be that when we have such a boundary, we may like to find out the moment of this shape around say principal axis. we will find out the moment of this shape around 𝑢𝑢 axis, and we find out the moment of this shape around 𝑗𝑗𝑗𝑗 axis, which is orthogonal to the principal axis. So, we get two components, so one is a moment around the principal axis, and the other one is a moment around an axis, which is orthogonal to the principal axis and passes towards the center of gravity of the shape, so you get another set of features. This is what is shape feature, so we can have a boundary feature, we can have a shape feature. coming to the regional features, the bounded region will have a certain color, and it can also have a certain texture. So, we can extract the color property which we can call the color feature. and we can extract the texture property which we can call the texture feature. This object has various types of properties, such as those computed from the boundary, shaping formation, color, texture, and more. The different features provided us with various numerical values, and when arranged in a specific order, each value conveys information about the object. So, when we arrange all these numerical values in a specific order, we end up with a vector. Each component is considered a feature, and when combined in a specific order, they form a feature vector. Next, we use vectors to represent the objects or patterns. The classification process becomes extremely simple when I have a vector representation of an object or pattern. How does it transform into a simpler form? Since each pattern is represented by an M dimensional vector, we effectively transform the pattern or object from its original domain to a feature space. To keep things simple, we have defined an M-dimensional feature space since we will be illustrating it on paper. Assuming M is equal to 3, we have a three-dimensional feature vector. Each pattern corresponds to a single three-dimensional feature vector. What advantage do I have, then? The advantage is that when we have feature vectors of dimension three, we are essentially representing my pattern in a three- dimensional feature space. If we represent pattern P1 as a vector, it will look like this: P1 >. The three-dimensional feature vector represents a point in my three-dimensional space, specifically related to pattern P1. Likewise, we could also consider a point P2, denoted by a feature vector such as P2 = (f1, f2, f3), where f1, f2, and f3 are assigned specific numerical values. Once represented by a feature vector, pattern P2 becomes a point in the three-dimensional feature space. By representing these patterns in a three- dimensional feature space, we can determine the similarity or dissimilarity between patterns P1 and P2 based on the distance between their feature factors. Therefore, P2 and P1 should be the same point, given that f1 = 3, f2 = 5, and f3 = 1. To put it another way, if P1 and P2 have the same pattern, their distance should be zero. If P1 and P2 are similar patterns, they might not be the same. The computed distance between vector features should be minimal. If P1 and P2 are widely different, there is no similarity between P1 and P2, in that case, the distance between the corresponding feature vectors in the three-dimensional feature space will be very large. So, if the distance between the feature vectors is small or negligible, we can say that those patterns are similar or they are the same patterns, A slight difference in the feature values may be due to measurement error, may be due to fabrication error, but the patterns are same if there is no error, then the feature of vectors must be identical. So, we have different sources of error, we can have measurement errors, and we can have fabrication errors. All these different types of errors may come in which does not make the features of vectors identical, but the features of vectors should be very close that is the distance between the features of vectors is very small. Measuring the similarity allows us to assess whether the patterns are similar or dissimilar, based on the distance between their corresponding feature vectors. When the distance is short, they are considered similar. That's the rule I follow. Let's assume that points P1 and P2 belong to different classes and are known as priority patterns. So, this point P1 may come from a class of C1, and this pattern P2 may come from class C2. Now, my job will be to give an unknown pattern say P, which is also represented by a similar feature vector P < x1, x2, x3>. So, We know P1 belongs to C1, P2 belongs to C2. So, we must recognize this pattern, or we must classify this pattern P, We can create a simple classification rule based on the known patterns P1 and P2. we find out the distance from P1 to P, and the distance from P2 to P, if we find that the distance from P1 to P is greater than the distance from P2 to P that means P1 this unknown pattern P is more like P2 than to P1 because the distance between P1 and P is more than the distance between P2 and P. So, this unknown pattern P is more like P2 than it is like P1. So, my simple classification rule can be that we will classify, or we will recognize this unknown pattern to be a pattern belonging to class C2. It will not be a pattern belonging to class C1, so during our course of lectures, initial few lectures we will devote ourselves to different types of features and different types of feature extraction techniques. And then next, we will talk about different types of classification problems. Now, when, the moment we came for the classification, we said that we wanted to represent every pattern by a corresponding feature vector. So, if a pattern is represented by a feature vector, our classification remains the same because what we must do depends upon my application domain. We must train my classifier so that it can work in that application domain. So, what we can do is, we can put this pattern recognition problem in a block diagram, something like this. So, we have pattern recognition or a pattern recognizer, let me call it PR, and input to this pattern recognition system, will be our feature vectors. So, these are feature vectors and the output of the pattern recognition system will be the decision about different classes of this input feature vector. This pattern recognition system requires training through a supervised learning approach. In supervised learning, we need to provide either a set or multiple sets of feature vectors as input. The supervised training of this pattern recognition system requires knowledge of the class and its associated set of feature vectors. Once the training of the pattern recognition system is complete, it can classify unknown feature vectors. We need to be able to determine or identify the class to which this feature of the vector belongs. Considering this type of block diagram. You find that this sort of pattern recognition system can now be applied in any domain. It can be used for speech recognition, speaker recognition, object recognition, or image classification. Now, what we mean by image classification, we can have images of different types; we can have indoor images, images of natural scenes, images of a shop floor. If my pattern recognition is properly trained, after properly finding out the feature vectors, then this pattern recognition system can be used to recognize or to classify patterns from any domain. Of course, the pattern recognition system for speech recognition is different from the pattern recognition system for object recognition because that domain knowledge is different. My representation of the feature vectors will be different. So, in this course what we will talk about is, we initially we talked about the different techniques to extract the features of vectors. What are the different types of features of vectors that can be used, and what are different techniques to extract the features of vectors? And then we will go for different pattern recognition systems or different types of classifiers. Some of the classifiers make use of the statistical properties of the signals or the feature vectors are used using statistical property. Then we can have probabilistic models of different classes, making use of mean and variants of the feature vectors, which we will talk about, when we talk about something called Bayes rule, which is used in statistical classification or statistical classifier. So, there again we can have two different forms of classifier one form of classifier is called a parametric classification technique. Another form of classification is called a non-parametric classification technique. So, in case of parametric classification, whenever we have a statistical model or probabilistic model of a particular class, we will assume that the probability density function will have a parametric form. In the sense say for example, a Gaussian probability density function has two different parameters, one is mean other one is variance. When we have feature vectors of multiple dimensions, we will have a mean vector and covariance matrix, which are the parameters of the probability density function. If we assume the probability density function to be Gaussian, but in most of the cases it may so happen that the probability density function, which is exhibited by the sample, they do not follow any parametric form. So, we will have different types of non-parametric classification techniques, so you will have parametric classification techniques. We will have different types of non-parametric classification techniques, then we will also have other types of classification techniques. Say, for example, a neural network many of you might have heard of a neural network is an attempt to build machines that can imitate the functioning of our human brain. So, we will also discuss different types of neural networks, which can be used for pattern recognition or pattern classification. We will talk about another type of pattern recognition or pattern classification, which is called hyper box classifier, then we will also try to combine hyper box classifier with the fuzzy measure. Later on, we will combine our hyper box classifier, fuzzy measure and neural network to have a certain model called funny mean max neural network. So, that is another type of tool fuzzy mean max neural network that can also be used for pattern recognition or pattern classification. We will also talk about something called a support vector machine, so what does support machine vector does is, it defines a plane in my feature space. So, using that plane we can divide the space into two half-spaces. So, in one of the half-spaces we will have patterns belonging to one class, in the other half-space, we will have patterns belonging to some other class. So, the support vector machine tells you that given a set of training features of the training feature vectors, where to put this plane or hyperplane, or how to sub-divide my feature space into half spaces so that my classification, when we go for classification, we can attain minimum error of classification. So, we will discuss all these different types of techniques for pattern classification. Then later we will also talk about the classification of temporal patterns. For instance, if I position my hand like this a simple palm is not enough. But, if we wave like this , this has a certain meaning, if we put it like this it has some other meaning. So, simply palm, showing a palm is not sufficient. It is also important how the palm moves over time because that can state a meaning, so it is a temporal pattern. We'll also discuss methods for recognizing and classifying these types of temporal patterns. During this course, we will cover a range of techniques related to pattern recognition and applications. So, in the next class, we shall start talking about feature extraction techniques. Thank you.

Use Quizgecko on...
Browser
Browser