Vehicle Detection Using Fuzzy C-Means Clustering Algorithm

Vehicle detection and identification are very important functions in the field of traffic control and management. Generally, a study should be conducted on big data sets and area characteristics to get closer to this function. The aim is to find the most appropriate model for these data. Also, the model that is prepared for the data aims to recognize the factors on the image. In other words, it aims to assign factors to the right classes and differentiate them. A classification of the image is made in that way. In this study, a vehicle identification system, in which Fuzzy C-Means Algorithm is used for image segmentation and the Support Vector Machine is used for image classification, is presented. The currentness of these methods is their most important property. The obtained results show that the selected methods are applied successfully and effectively. This is an


Introduction
Nowadays, computers help us do the works in shorter times and get better results than we normally do by coming to our life rapidly. We are taking the advantage of image processing technologies which is a sub-branch of computer science and helps us analyze the images with the help of computers. Image processing is a technique which enables us to make changes to the images that are taken via a random equipment [1].
Generally, image processing can be defined as a method aimed at the analysis of the pictorial information. Image processing is depending on the analysis and change of the pictorial information, and it is related to them. We can see different examples of image processing in daily life. Glasses can be the most common among these. Image classification is a complex process that depends on various factors. A need for classification arises when an object needs to be assigned to a certain class according to its features. Images may contain confusion of noise, low quality, deadlock and background. Due to these reasons, the recognition of an object in the image becomes very hard [2]. Several classification methods are developed for image classification. The most important ones among them are; Artificial Neural Networks (ANN), Decision Tree, Support Vector Machines (SVM) [3]. The methods that will be used on that project are SVM and FCM, and their most important property of those methods is their currentness [4].
SVM is a universal learning machine which is valid for both pattern recognition and regression. SVMs are controlled learning models that analyze data, recognize patterns and works on related learning algorithms in machine learning. Using a successful SVM is appropriate because image classification means marking the image to a range of identified categories. Vehicle classification has a crucial area of usage in traffic surveillance and management. There are a lot of methods which are advised by using various methods to carry out this duty. In this article, a method is introduced which is based on Fuzzy Cmeans Clustering Algorithm and which uses the dimensions of every vehicle. A method is suggested to identify the dimensions of the vehicle and linearity of the edges. By using these two properties, a classifier is used to classify the vehicles as "small vehicle", "big vehicle" and "others".
Principal Component Analysis (PCA) is a statistical method which is used in areas like face recognition, image compression and pattern recognition. To understand the PCA subject, Singular Value Decomposition subject should be analyzed primarily. Eigenvalue-Eigenvector Calculations and Orthographical Projection are among the subjects which need to be analyzed to understand PCA subject. For this reason, the mentioned subjects are checked, and the mathematical basis is explained firstly, and then PCA and PCA's application areas are included. A counting process based on the vehicle classes will be beneficial in the detection of the intensity and solutionseeking. At the same time, this model will be useful in studies that are aimed at detection and reduction of time and pollution factors.

Literature Review
FCM algorithm can be applied to several data analysis problems. This method generates fuzzy sections for any numerical data set and prototypes. These sections are useful for the validation of known patterns and the exploration of new patterns in data. There are trio norms (Euclid, Diagonal or Mahalanobis), a controllable mass factor that takes sensitivity to noise as the base, outcomes which contain approval of variable number groups and several clustering validity measurements among the characteristics of this methods. Conventional Fuzzy C-Means is used to develop a method that will be used to surpass the noise sensitivity of the clustering algorithm.
Bezdek [5] developed a punishment mechanism that focuses on the effect of neighbor pixels on the central pixels to overcome the noise sensitivity problem of FCM method in image processing. The performance of the algorithm is discussed and compared. And, experimental results based on the segmentation of synthetic and real images showed that the proposed algorithm is effective and solid.
Pham et al. [6] suggested a new algorithm that is useful for predictions of density inhomogeneity by using the fuzzy division of MRI data and fuzzy logic. Compensation of these types of inhomogeneity and allowance of one pixel to be affected by adjacent labels are provided with changing the objective function of the standard FCM algorithm. Both artificial images and experimental results on MR data demonstrated the effectiveness and efficiency of the suggested algorithm. Clustering algorithms highly depend on the used characteristics and the kind of images which have certain types of sights.
A fuzzy image segmentation improved by considering the surface of the object and flexibility of FCM algorithm along with object similar surface variations (SSV) [7]. In the fragmentation of objects with SSV, an approach including an FCM compressed by using pixel and directly considering SSV of the object is adopted to increase the efficiency of the method. The algorithm also selects the threshold between human optical interval perceptively. Qualitative and quantitative results approve the performance of several approved algorithms.
The aim of the image segmentation is to separate the pixels into areas which is defined as the split of an image into a pixel band. Object fitting is used in the imaging types such as satellite images, face recognition, iris recognition, agricultural imaging and medical imaging. Clustering is a technique that groups objects and used for scanning of neoplasms. Ambroise and Govaert [8], suggested a new method, a new FCM algorithm which is based on a distance metric to provide segmentation for noise-induced images and inhomogeneity for the density. The fuzzy clustering model is a required tool to find the appropriate grouping structure in model and image classification. Mcinernery and Terzopoulos [9] suggested a newly developed algorithm which aims to increase the performance of FCM and FWCM models in high dimensioned, polyatomic model recognition problems. The motivation of this problem is to develop the wellknown FCM algorithm and the newly suggested weighted C-means algorithm. Experimental results in both real data and synthetic data show that the suggested clustering algorithm generates better solutions than FCM and FWCM, especially for hyperspectral images.
Zhang and Chen [10] compared five clustering methods by classifying a polarimetric synthetic aperture radar image. Pixels are the complex covariance matrices which have complex Wishart distribution. Two techniques are the fuzzy clustering algorithms which are based on I1 and I2 measurements. The other two techniques combined a new, strong FCM clustering technique with a distance measure that is built upon Wishart distribution. The fifth clustering algorithm is one of the applications of the expectationmaximization algorithm. The results corroborate that the pixel model is more important than the clustering mechanism. The problem of classification of an image to different homogeneous areas is considered as the function of the clustering of pixels in density space. Especially, some satellite images include relatively small places (bridges, roads, etc.) and some of them show types of large land covers that cover large spaces.
It is a hard job to detect groups or areas in widely changing dimensions. Meyer and Beucher [11] suggested an approach which is a new coded modified automatic fuzzy clustering algorithm based on differential evolution. This approach automatically develops the right classification of a data set and number of groupings. The effectiveness of the suggested method is shown for two digital remote perception data which is firstly explained in terms of feature vectors and then used for the identification of different terrain areas. The superiority of the method is shown by comparing it with the existing one.
The problem of classification of an image to different homogeneous areas is considered as the function of the clustering of pixels in density space. Shamsi et al. [12] used genetic fuzzy clustering with real coded variable series length and automatic evolution of clustering in his study. Xie and Beni index is codded in the chromosomes in cluster centers and used as a measure to represent the validity of the corresponding part. The effectiveness of the suggested method is shown for the classification of different land covers in the images of remote sensing. Results are compared with the other results which are obtained using the FCM algorithm.
Khwairakpam et al. [13] used fuzzy rules to identify the noise of images and filtered them using fuzzy weighted mean. They used genetic algorithm (GA) to optimize the parameters for fuzzy membership function. To evaluate the proposed filter edge-preserving factor and peak signalto-noise ratio were used.
Clustering algorithms can be further divided into two basic categories: hard and fuzzy. Hard clustering methods assign each object to a single group, while fuzzy clustering methods introduce membership degrees between objects and the different clusters of the dataset and assign each element of a dataset to multiple clusters simultaneously in accordance with the membership function matrix [14].

Material and Methods
In this section, the information is given about the stages of proposed systems, the methods and data used in studies. FCM and SVM methods are elaborated. A basis for the application stage is tried to be formed.

Segmentation
Generally, segmentation is the first step in image analysis. Image segmentation can be defined as separating an image into significant areas which have different characteristics. For instance, there may be similar brightness in an image and this brightness can represent the objects in different areas of the related image. Image segmentation according to the similarities in the gray level, is also known as region segmentation. Thresholding is performed based on growing, split and merge processes.
The concept of segmentation of an image based on similarities or differences in gray level values of pixels can be applied to both static and dynamic (time-varying) images. The FCM algorithm is applied to image segmentation widely. Because it has the ability to hold much more information than uncertainty and thresholdbased segmentation methods. FCM clustering is an uncontrolled clustering technique that is used to separate images into clusters with similar spectral properties. It uses the distance between pixels in the spectral domain and cluster centers to calculate the membership function. Pixels in an image are highly correlated and this information is an important feature that can be used to improve clustering. This technique was first introduced by Bezdek in 1981 as an improvement in earlier clustering methods. It provides a method that demonstrates how to group data points that provide multidimensional fields to be aggregated into a specific number of different sets. the cost function: m is any real number greater than 1, M × N is number of pixels in the image, i is membership degree to cluster k, Xi is i'th element of d-dimensioned data, Uk is d-dimensioned cluster center (for 2D images), d_(i,k)^2 is measure for the distance between object xi and cluster center µk, and any norm that represents the similarity between a data and a center µk measured with || * | | Fuzzy c-means (FCM) clustering is one of the most widely used algorithms in real practice. FCM was originally proposed by Dunn and was modified by Bezdek, who proved the convergence of the algorithm, providing the iterative optimization method based on the least squares principle. FCM is widely and successfully used in magnetic resonance images and remote sensing satellite images. To overcome the drawbacks of clustering algorithms, several methods have been proposed, including local spatial information. Among these, Ahmed et al. proposed a bias-corrected FCM (BCFCM). Zhang and Chen proposed FCM S, which improved BCFCM [10]. However, the choice of average or median value requires prior knowledge, it selects the spatial neighbors in meaningful, Duda ve Hart [15] extended the objective function of the root square mean error to the group total of the weighted square error version. It is given as below: If noise-affected images are segmented by standard FCM, partitioning performance would be poor. However, images are often affected by noise during viewing, storage, or transfer. Therefore, noise in image segmentation should be considered to suppress the effect of noise by adding a spatial restriction term in the objective function of FCM, Nk, xk means neighbor clusters which window and NR is the cardinality. The parameter α in the second term controls the effect of the penalty. A shortcoming of the formula is that it will take much longer to calculate the conditions than FCM. When the size of the candidate image is large, the calculation time is also increased. Based on (2), Chen et al. proposed a simplification approach. The new low-complex target function called FCM S:

Principal Component Analysis
Many of the machine learning problems include thousands of characteristics (dimensions) for each education type. This not only slows down the education but makes it difficult to find a good solution. This problem is often called the curse of dimensionality. There are three main techniques that will help us summarize the information of a data set by converting it to low dimensions than the original cluster and a new characteristics subspace. PCA, Linear Discriminant Analysis (LDA) and Kernel Principal Component Analysis (KPCA). data compression is an important subject in machine learning. It helps us to store and analyze the increasing amounts of data produced and collected in the modern era. PCA is an uncontrolled and common linear transformation technique that is used to reduce dimensionality. PCA helps us identify the patterns in the data based on the correlation between properties. In summary, PCA allows us to find the maximum variances in the high dimensional data and project it onto a new subspace that is equal to or less than the original one. As shown in Figure 2, the orthogonal axes of the new subspace (main components PC1 and PC2) are the directions of maximum variance.

Figure 2. Axis of PCA
PCA is a multivariate statistical method that provides recognition, classification, size reduction and interpretation. This approach tries to find the strongest pattern in the data. Therefore, it can be used as a patternfinding technique. Usually, the variety of data can be captured by a small set of dimensions selected from the entire set of dimensions. Noises in the data can be cleared by size reduction since they are less powerful than patterns.
There are three main purposes of PCA: 1. Reducing the size of the data 2. Making estimations 3. Displaying the data set for some analysis.
When PCA is applied, the actual size of the pdimensional space is determined. This real dimension is called the basic components. Basic components have three characteristics: 1. They are not related. 2. The first main component is the variable that explains the total variability most. 3. The next main component is the variable that explains the remaining variability most.
Principal Component Analysis approaches a. Generally, the relationships in the data can be explained by looking at the multi-dimensional data from the right angle. b. The aim of the PCA is to find the "right angle". As shown in Figure 3a, the data is multi-dimensional and the relationships are not clear. When it is looked at from the right angle to figure 3b, figure 3c and figure 3d, it can be observed that the relationship in the complex multi-dimensional data set is linear.
The key point of the PCA is to select an appropriate "angle", in other words, an appropriate coordinate system to solve the problem. Looking at the data from the proper angle means analyzing the data using this coordinate system [16]. As a result: PCA is a very beneficial method in size reduction. The aim of the PCA is to find the "right angle".c) Complex data set became linear d) the image of the is obtained coordinate system PCA represents multidimensional data approximately and with less dimensional data. The PCA finds the perpendicular greatest variance directions for the original data and displays the original data in this coordinate system. PCA can be used to provide visual display and analysis of multi-dimensional data. PCA as the machine learning, the size of the data can be reduced, little changing PCA features can be insignificant for modeling, in this way, calculation related to modeling can be faster. PCA can also be used for data compression. In a nutshell, PCA is a statistical method. It can be used when defining the pattern in a data set, explaining the data set, defining the similar and different patterns in the data. PCA allows for compression of the data by reducing the size. Furthermore, there is no data loss while reducing the size. This technique is commonly used in image processing in computer sciences. In the following part of the study, PCA will be applied on a data set and the stages will be discussed step by step.

Support Vector Machines
SVM is a non-parametric classification method which is based on statistical learning theory [17]. SVM is developed for binary classifications and with this method, it is possible to obtain accurate classification results with few sampling data. It is a method that uses the optimal algorithm to determine the boundary between classes in property space. The method was originally designed for the classification of two-class linear data, then it has developed again for the classification of multi-class and non-linear data. It is fundamentally based on the principle of determining the hyperplane which can separate two classes from each other [17]. Advantages: •They are effective in high dimensional space. •They are effective when the number of dimensions is greater than the number of samples. •A set of training points are used in the decision function ("support vectors"). Hence, the memory is used efficiently.
Versatile: Many different core functions ("kernel functions") can be used for the decision function.
Kernel function selection and parameter optimization play an important role in the implementation of Support Vector Machines for solving the classification problem for various data sets.In the classification made with support vector machines, it is aimed to separate the samples of the two classes which are usually shown with class labels {-1, + 1} with the help of a decision function obtained from the training data. Using this decision function, the hyperplane that can optimally separate the training data is found.
As shown in Figure 4(a), several hyperplanes that are capable of separating two-class data from each other can be plotted. However, the purpose of SVM is to find the hyperplane that maximizes the distance between the closest points to itself. As shown in Figure 4(b), the hyperplane making the most appropriate distinction by maximizing the boundary is called optimum, and the points limiting the hyperplane and boundary width are called support vectors. If it is assumed that the training data {i i x, y}, i = 1, ....., k for the training of SVM in a linearly separable two-class classification problem, the inequalities of the optimal hyperplane are as follows: w.xi+b≥ +1 for every y=+1 w.xi+b≤ +1 for every y=-1 Here, x ∈ R N and it represents N-dimensional space, y ∈ {-1, +1} represent class labels, w represents weight vector (normal of hyperplane) and b represents the trend value. Two hyperplanes parallel to this plane and forming their boundaries should be defined to define the optimum hyperplane. The points that create these hyperplanes are called support vectors and these planes are expressed as w.xi+ b =±1.

Data Sets
The data used in this study consists of 5 videos taken from Van Yüzüncü Yıl University vehicle entry point that have a total duration of 190 seconds. In Figure 5 there is an image belongs to used data set. Also, there is a video set that is used for testing. SVM is used in all classification processes to fulfil the objectives of this study.

Implementation
Firstly, the images are taken by a camera in the works which are conducted using image processing techniques. The steps of Image Prior-Processing techniques are performed, and feature extraction of the objects of interest is performed. Accurate detection of the objects is very important for the feature extraction phase. Different methods are suggested in the studies carried out for the purpose of detecting or recognizing objects. A three-step method is proposed in the classification and identification of the same objects in the environment. The steps of the proposed method are presented in Figure 6. The image taken from the environment where the objects are located is subjected to the "Image Prior-Processing" in step 1. In step 2, the characteristics like dimension and area are extracted with "Finding the Objectives and Feature Extraction Process". In the last step, the classification of each object is done by using the data obtained in step 2. In image prior-processing step, the operations that include filtering, making the image gray, and converting it to a dual image are applied to the image taken from the camera respectively. After these operations, the objects on the image and the objects of interest become more apparent and easier to process. A study about the methods of detection and classification of the objects by using image processing techniques is presented. A three-step method is proposed for the classification and identification of the objects in the work environment. In the image preprocessing step which is in the first stage of the proposed method, filtering and graying are applied to the image taken from the camera. In the object detection and feature extraction stage, the presence of objects in the environment, and property information such as area, dimension, and location are obtained. In the classification stage, the information in the database is classified using the average-based and Fuzzy c-means algorithms. In the sampling process of the experimental study, the videos taken from the cameras on the campus are used.
Segmentation makes vehicles more significant and facilitates vehicle identification. The first step is the arrangement of edges. The images are converted into vectors, we use both feature-matching and patternmatching techniques like CNN based on neural network usage to determine whether they are vehicle or human. Due to the low speed of CNN networks and the need for high equipment, the PCA method based on scoring and obtaining effect quality is used for the matrix transformation of transforming images into vectors. The properties should be known to define the objects. Image is a set of numbers, and these numbers vary between 0-255, and they represent every pixel and define the neighborhood between pixels and their dimensions. The dimension distributions of neighbor pixels are calculated with the method of edge finding. FCM is used for segmentation at this stage. It makes the objects in the image more apparent. As a result of segmentation in which FCM is used, objects are shown in bold, and a sample image is shown in Figure 7.
PCA is used to reduce the size of the image in the separation and classification processes. The number of qualifications obtained from the image is 400, but it is reduced to 10. The object recognition process is done with SVM. Each second of a video is comprised of 25 squares. First, the part where the vehicle is located must be clipped. PCA method is applied to dynamic clipped images. SVM is trained through feature extraction on clipped animations. Background and foreground methods are used for moving objects. Edge detection is used to increase the accuracy of object identification. All of the added objects form an edge because the dimension of the pixels is depending on the contrast of the image. Contrast is an increase in the distance of neighbor pixels when they belong to two different objects. The higher the contrast, the better the image's quality. For the distinction of foreground and background, the object is marked as white and the background is black. The filter is used to prevent noise and reduce the number of pixels. The clipped PCA images are exported to the SVM to determine whether they are tools or a group of people. The outcome is a vector. Each row of a vector represents a square, and each column represents an object, 100x5 matrix is obtained, 100 refers to the frame, and 5 refers to the objects in this frame. SVM is used to distinguish only vehicles and other objects, and field method is used for large vehicle detection. If the area size is bigger than a specific amount, it shows that the object is a large vehicle. SVM is an attended learning algorithm that is based on statistical learning theorem founded by Vapnik and Chervonenkis in 1963. In this study, a classification is made with the help of the SVM technique, and objects are divided into two classes (vehicle and others). Afterward, a second decomposition is made according to the number of pixels of objects defined as vehicles (large vehicles and small vehicles). Here, the analysis of the selection of the most appropriate parameters in the SVM technique, which is suggested as an alternative method for preventing the disadvantages of fuzzy logic and which uses the zerocrossing algorithm as one of the optimization methods of Adaptive Fuzzy Masking filter, is done. On the other hand, the use of Laplacian filters which is one of the edge detection filters used in the scope of image processing and filter reinforcement was examined comparatively for the BM technique. The application results on experimental data sets are given in Table 2.

Conclusion
Image processing and computer vision applications have increased significantly in recent years. Especially, they are used commonly in vehicle automation, security systems, mobile robot applications, surveillance of friendly and enemy forces in military fields, agricultural applications, biomedical and medical fields, geographical information systems, design and manufacturing applications.
In this study, the vehicles in the dynamic images are subjected to a segmentation using the FCM clustering method and classified as large, small, and others by using SVM. PCA is also used in the study to reduce qualification. The results showed that the approach is successful. Convolutional neural networks (CNN or ConvNet) are deep, feed-forward artificial neural networks that are used commonly in the analysis of visual images. CNN uses less amount of pre-treatment compared to other image classification algorithms. There are a lot of architecture, different layer numbers, and different activation functions on CNN. To improve this study, better classification results can be obtained by using deep learning techniques.