Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Image Clustering For Feature Extraction Using K-mean Clustering and Viola & Jones Object Detection technique DATA MINING Zeeshan Anjum EP 115051 BSSE VI Muzammil Hussain Zaidi EP115043 Submitted to Dr. Tahseen Ahmed Jilani Index Zeeshan Anjum EP115051 | Muzammil Hussain Zaidi EP 115043 Introduction of Image Classification 1. What is Classification? The classification problem becomes very hard when there are many parameters. There are so many different combinations of parameters that techniques based on exhaustive searches of the parameter space are computationally infeasible. Practical methods for classification always involve a heuristic approach intended to find a “good-enough” solution to the optimization problem. Zeeshan Anjum EP115051 | Muzammil Hussain Zaidi EP 115043 Abstract There are various method to classify images but most of the time we have calculate those area features which aren’t much useful, usually those are very small in ratio to overall image. So we have introduce a new technique by which it would be easier for any classifier to classify any image or image sequence (real-time) in a fractions of second. First we blur the image to reduce noise from image, because in next step we are going to find k-mean clusters where k is specified before; using some predetermined value. It must be dynamic to overcome color variation problem. Next we are going to use canny edge detection method we can also use Sober, Robert cross or Prewitt as well. The reason for using clustering before edge detection is to minimize small details such as patch, hole, dirt etc. as our aim in this project is to find the clear area where an autonomous vehicle can drive with the extremely lowest value of error. When k-clusters are detected, it will generate 2-D map of RGB values with high contrast edges, and provide flexibility to edge detection algorithm. When proper edges are detected. We pass that image to classifier at this stage generated edges should be scaled up to half the size of original image and that image size should be reduced to match both the image and edge filter. We can only use edge feature to predict feature such as board, road, U-turn, crossing, square etc. but some advance feature required the actual image to merge with these edges to boost the feature edge pixel intensity. Zeeshan Anjum EP115051 | Muzammil Hussain Zaidi EP 115043 Data Mining Data mining (the analysis step of the "Knowledge Discovery and Data Mining" process, or KDD), an interdisciplinary subfield of computer science, is the computational process of discovering patterns in large data sets involving methods at the intersection of artificial intelligence, machine learning, statistics, and database systems. The overall goal of the data mining process is to extract information from a data set and transform it into an understandable structure for further use. Aside from the raw analysis step, it involves database and data management aspects, data pre-processing, model and inference considerations, interestingness metrics, complexity considerations, postprocessing of discovered structures, visualization, and online updating. The term is a buzzword, and is frequently misused to mean any form of largescale data or information processing (collection, extraction, warehousing, analysis, and statistics) but is also generalized to any kind of computer decision support system, including artificial intelligence, machine learning, and business intelligence. In the proper use of the word, the key term is discovery[citation needed], commonly defined as "detecting something new". Even the popular book "Data mining: Practical machine learning tools and techniques with Java" (which covers mostly machine learning material) was originally to be named just "Practical machine learning", and the term "data mining" was only added for marketing reasons. Often the more general terms "(large scale) data analysis", or "analytics" – or when referring to actual methods, artificial intelligence and machine learning – are more appropriate. Zeeshan Anjum EP115051 | Muzammil Hussain Zaidi EP 115043 Data Mining The actual data mining task is the automatic or semi-automatic analysis of large quantities of data to extract previously unknown interesting patterns such as groups of data records (cluster analysis), unusual records (anomaly detection) and dependencies (association rule mining). This usually involves using database techniques such as spatial indices. These patterns can then be seen as a kind of summary of the input data, and may be used in further analysis or, for example, in machine learning and predictive analytics. For example, the data mining step might identify multiple groups in the data, which can then be used to obtain more accurate prediction results by a decision support system. Neither the data collection, data preparation, nor result interpretation and reporting are part of the data mining step, but do belong to the overall KDD process as additional steps. The related terms data dredging, data fishing, and data snooping refer to the use of data mining methods to sample parts of a larger population data set that are (or may be) too small for reliable statistical inferences to be made about the validity of any patterns discovered. These methods can, however, be used in creating new hypotheses to test against the larger data populations. Zeeshan Anjum EP115051 | Muzammil Hussain Zaidi EP 115043 Machine Learning Machine learning, a branch of artificial intelligence, concerns the construction and study of systems that can learn from data. For example, a machine learning system could be trained on email messages to learn to distinguish between spam and non-spam messages. After learning, it can then be used to classify new email messages into spam and non-spam folders. The core of machine learning deals with representation and generalization. Representation of data instances and functions evaluated on these instances are part of all machine learning systems. Generalization is the property that the system will perform well on unseen data instances; the conditions under which this can be guaranteed are a key object of study in the subfield of computational learning theory. “Field of study that gives computers the ability to learn without being explicitly programmed” 1959, Arthur Samuel Zeeshan Anjum EP115051 | Muzammil Hussain Zaidi EP 115043 Data Mining and Machine Learning These two terms are commonly confused, as they often employ the same methods and overlap significantly. They can be roughly defined as follows: Machine Learning focuses on prediction, based on known properties learned from the training data. Data mining focuses on the discovery of (previously) unknown properties in the data. This is the analysis step of Knowledge Discovery in Databases. The two areas overlap in many ways: data mining uses many machine learning methods, but often with a slightly different goal in mind. On the other hand, machine learning also employs data mining methods as "unsupervised learning" or as a preprocessing step to improve learner accuracy. Much of the confusion between these two research communities (which do often have separate conferences and separate journals, ECML PKDD being a major exception) comes from the basic assumptions they work with: in machine learning, performance is usually evaluated with respect to the ability to reproduce known knowledge, while in Knowledge Discovery and Data Mining (KDD) the key task is the discovery of previously unknown knowledge. Evaluated with respect to known knowledge, an uninformed (unsupervised) method will easily be outperformed by supervised methods, while in a typical KDD task, supervised methods cannot be used due to the unavailability of training data. Zeeshan Anjum EP115051 | Muzammil Hussain Zaidi EP 115043 Cluster analysis Cluster analysis or clustering is the task of grouping a set of objects in such a way that objects in the same group (called a cluster) are more similar (in some sense or another) to each other than to those in other groups (clusters). It is a main task of exploratory data mining, and a common technique for statistical data analysis, used in many fields, including machine learning, pattern recognition, image analysis, information retrieval, and bioinformatics. onlinecourses.science.psu.edu Zeeshan Anjum EP115051 | Muzammil Hussain Zaidi EP 115043 K-Mean Clustering k-means clustering is a method of vector quantization, originally from signal processing, that is popular for cluster analysis in data mining. k-means clustering aims to partition n observations into k clusters in which each observation belongs to the cluster with the nearest mean, serving as a prototype of the cluster. This results in a partitioning of the data space into Voronoi cells. Zeeshan Anjum EP115051 | Muzammil Hussain Zaidi EP 115043 Steps of Feature Classification • • • • It is difficult to convolve image with large dimension so make a small frame of 240x240 or 360x360, this size can be vary depends on the computational power and accuracy requirement. Now convolve image I with blur filter like Gaussian or LoG Laplacian of Gaussian kernel. This method help us to reduce noise. But in our given example we have implemented disk filter in matlab. Which can be used as “fspecial('disk', radius) returns a circular averaging filter (pillbox) within the square matrix of side 2*radius+1. The default radius is 5.” It is best practice to use desired color space control video recording device, in our example we convert RGB to LAB color space because the reason for this conversion is to get lightness separately from color opponent dimensions. It is defined as L, a, b. I suggest to use this conversion otherwise it would produce noisy objects with features. Since we have now converted values to a and b, we can now apply kmean algorithm, remember to use a good estimated value depends on the environment factor. – – – • High cluster value could result in detail segmentation of road like patches, dirt etc. Low cluster value could be result in minimum feature detection as in our example, when we use 2 as the value of cluster it make a separate sky and complete earth as 2 cluster, sometimes clouds and rest of the environment as 2 separate cluster. Idea to choose the good value is depends on the view we are focusing, we use 3-4 cluster to get rid out of the problem. Now calculate k-mean using distance formula either Euclidean or city block we use city block, because to get rid out of square root calculation for each pixel pair. We limit this process to 4, this make sense because in real-time at each second you have to calculate at least 10 frames, with dynamic changing of environment. We are assuming that we‘ll get satisfactory result from 4 time centroid shifting. Zeeshan Anjum EP115051 | Muzammil Hussain Zaidi EP 115043 Steps of Feature Classification – • • • • Now we have we have color segmented image. Next we are going to apply canny edge detection filter to get fine tuned edges from segmented image. Advantage of this technique is to reduce load of computation and memory on onboard autonomous vehicle. Application includes AGV,AAV etc. Disadvantage is that this method is more error prune to high density of normalized color in frame. – • Then we reshape that array using reshape function, which takes an 1-D Array with 2 parameters m, n such that B = reshape( A, m, n) where A is 1-D and satisfy size(A) = m*n , B is n-dimension matrix. This function has other overloaded functions as well. Solution: system should build in a way that it can switch this algorithm b/w other with the constrain of color space. It is highly suggested that fuzzy logic model should be used instead of Boolean logic for switching operation to reduce frequent switching of segmentation methods. Next the segmented image is passed to Classifier which used the technique of Adaptive Boosting by combining weak classifiers into a stronger one. This technique use semi automatic machine learning, we have to provide Haar cascades of possible interested geometry. The best technique to classify the image is to use Viola–Jones object detection framework. Zeeshan Anjum EP115051 | Muzammil Hussain Zaidi EP 115043 Workflow of Classification Input Image > Blur > K-Mean > Canny Edge Detection > Merge Image + Edges Original K-mean Clusters (6) Canny Edge Zeeshan Anjum EP115051 | Muzammil Hussain Zaidi EP 115043 Example Original K-mean Clusters (6) Canny Edge a K-mean Clusters (3) b K-mean Clusters (3) c It is clearly visible how perfectly this technique make clusters of interesting patterns. Lane mark on image 3 cause problem because of highly color separation. In this classification but in next stage (classification) it can be easily removed using pattern detection. Zeeshan Anjum EP115051 | Muzammil Hussain Zaidi EP 115043 Code- Matlab • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • clear; clc; img = imread('02.jpg'); backup=img; %blur this image out H = fspecial('disk',3); blurred=imfilter(img,H,'replicate',1); img=blurred; %doing main stuff cform = makecform('srgb2lab'); lab = applycform(img,cform); ab = double(lab(:,:,2:3)); nrows =size(ab,1); ncols=size(ab,2); ab = reshape(ab,nrows*ncols,2); nColors=4; [cluster_idx cluster_center] = kmeans(ab,nColors,'distance','cityblock',... 'Replicates',6); pxl_lbl=reshape(cluster_idx,nrows,ncols); ZX=edge(pxl_lbl,'canny'); %imshow(ZX,[]) segmented_images = cell(9,9); %rgb_label = repmat(ZX,[1 1 1]); %rgb_label = repmat(ZX,[0 0 0]); rgb_label = repmat(ZX,[1 1 1]); for k = 1:nColors color = img; color(rgb_label ~= k) =1; segmented_images{k} = color; end %imshow(segmented_images{1}) %imshow(pxl_lbl,[]); imshow(ZX,[]) %imshow(segmented_images{1}) Zeeshan Anjum EP115051 | Muzammil Hussain Zaidi EP 115043 Classification using Viola and Jones • Feature extraction and feature evaluation. – Rectangular features are used, with a new image representation their calculation is very fast. • Features are extracted from sub windows of a sample image. The base size for a sub window is 24 by 24 pixels. Each of the four feature types are scaled and shifted across all possible combinations In a 24 pixel by 24 pixel sub window there are ~160,000 possible features to be calculated. • Classifier training and feature selection using a slight variation of a method called AdaBoost. • A combination of simple classifiers is very effective since it is using multiple weak classifier to make a stronger classifier. Four basic types. • – They are easy to calculate. – The white areas are subtracted from the black ones. – A special representation of the sample called the integral image makes feature extraction faster. Zeeshan Anjum EP115051 | Muzammil Hussain Zaidi EP 115043 Integral Image And Haar Cascade These cascade starts with either a large (or small) window and scans the image exhaustively (i.e. such as by dislocating the window some points to the right, and going down at the end of the line). When a scan finishes, it shrinks (or grows) this window, repeating the process all over again. Zeeshan Anjum EP115051 | Muzammil Hussain Zaidi EP 115043 AdaBoost The classification scheme used by the Viola-Jones method is actually a cascade of boosted classifiers. Each stage in the cascade is itself a strong classifier, in the sense it can obtain a really high rejection rate by combining a series of weaker classifiers in some fashion. A weak classifier is a classifier which can operate only marginally better than chance. This means it is only slightly better than flipping a coin and deciding if there is something in the image or not. Nevertheless, it is possible to build a strong classifier by combining the decision of many weak classifiers into a single, weighted decision. This process of combining several weak learners to form a strong learner is called boosting. Learning a classifier like this can be performed, for example, using many of the variants of the AdaBoost learning algorithm. Haar Cascades link: http://www.cs.utah.edu/~turcsans/DUC_files/ and C# code is from open source library. opencv also used in DARPA Grand Challenge. Reference: Viola and Jones, "Rapid object detection using a boosted cascade of simple features", Computer Vision and Pattern Recognition, 2001 Zeeshan Anjum EP115051 | Muzammil Hussain Zaidi EP 115043 Creating new Haar cascades for a unique/new object we have to required ~80% positive images and ~20% negative images. This task is very easy but extremely time consuming because a good classifier required approx. 2000 images of a feature which is sometime not appropriate. Cascade of Classifiers Zeeshan Anjum EP115051 | Muzammil Hussain Zaidi EP 115043 Reference and links • • • • • • • • • • • Fayyad, Usama; Piatetsky-Shapiro, Gregory; Smyth, Padhraic (1996). "From Data Mining to Knowledge Discovery in Databases". Retrieved 17 December 2008. "Data Mining Curriculum". ACM SIGKDD. 2006-04-30. Retrieved 2011-10-28. Clifton, Christopher (2010). "Encyclopædia Britannica: Definition of Data Mining". Retrieved 201012-09. Hastie, Trevor; Tibshirani, Robert; Friedman, Jerome (2009). "The Elements of Statistical Learning: Data Mining, Inference, and Prediction“ See e.g. OKAIRP 2005 Fall Conference, Arizona State University, About.com: Datamining Witten, Ian H.; Frank, Eibe; Hall, Mark A. (30 January 2011). Data Mining: Practical Machine Learning Tools and Techniques (3 ed.). Elsevier. ISBN 978-0-12-374856-0. Bouckaert, Remco R.; Frank, Eibe; Hall, Mark A.; Holmes, Geoffrey; Pfahringer, Bernhard; Reutemann, Peter; Witten, Ian H. (2010). "WEKA Experiences with a Java open-source project". Journal of Machine Learning Research 11: 2533–2541. http://en.wikipedia.org/wiki/Machine_learning#Machine_learning_and_data_mining http://en.wikipedia.org/wiki/K-means_clustering http://reason.cs.uiuc.edu/jaesik/research/research-computer-vision/realtime-on-roadvehicle-detection/ Jaesik Choi , Realtime On-Road Vehicle Detection with Optical Flows and Haar-Like Feature Detector, Computer Science Research and Tech Reports, University of Illinois at UrbanaChampaign, 2012. onlinecourses.science.psu.edu Zeeshan Anjum EP115051 | Muzammil Hussain Zaidi EP 115043