Detection and classification of vehicle types using machine learning technology

Received Feb 25, 2019 In this paper, we focus on detection and recognition of vehicles from a video stream. Contrasted with conventional techniques for article identification and arrangement, Machine learning strategies are another idea in the field of PC vision. Our model works in two phases: an information planning step, it comprises of applying Treatments on the pictures forming the dataset so as to separate the qualities, the subsequent advance is to apply the idea of convolutional neural systems to order vehicles. Vehicle discovery permits the utilization of different uses of computerized reasoning framework for a few purposes, particularly: canny transportation, programmed checking, selfsufficient driving, and driver wellbeing ensure. The motivation behind this article is to enable us to identify vehicles moving before us by means of a camera put under the rearview mirror and draw the direction lines of our vehicle. In this work, we center on the location and acknowledgment of vehicles in a video stream. We have demonstrated that our strategy for work extraordinarily improves the exactness rate and diminishes the mistake rate, however in spite of the utilization of regularization, institutionalization and advancement systems, the preparation time of our model remains an issue to raise. Our method gave better results in terms of precision, detection and classification where we obtained an accuracy of 99.2%. Keyword:


Introduction
In this paper, vehicle detection allows the use of various applications of artificial intelligence system for several purposes, especially intelligent transportation, automatic monitoring, autonomous driving, and driver safety guarantee.The purpose of this article is to allow us to detect vehicles moving in front of us via a camera placed under the rearview mirror and draw the trajectory lines of our vehicle.In this work, we focus on the detection and recognition of vehicles in a video stream.For this reason, we have used the convolutional neural network technique and a dataset that contains images to enable recognition and classification of vehicles.The main purpose of our work is therefore to reduce human effort and offers research perspectives to make driving more enjoyable and almost autonomous.Our paper is organized as follows: the next part will discuss previous work that uses learning methods for vehicle detection, then we will explain our proposed architecture (model), then we will calculate the estimate of the deviation of the vehicle, in the following part we will present the results obtained from this research.Finally, we will finish our work with a conclusion, and we will propose perspectives.
Figure 1.Basic 3x3 convolving filter on a minor region of image.

Background
Convolutional neural networks are inspired from the visual brain cortex; they are used in recognition systems, robotics and self-driving cars as well as in other areas.They provide good results and a higher accuracy rate compared to traditional methods.A vehicle detection method presented by Chabot.F and al whose goal is to recognize the brand and model of vehicles.This approach is based sure setting correspondence between the vehicle in the picture and real 3D model.This method is based on a detector based on convolutional neural networks (CNN); its principle is based on the extraction of the points of interest corresponding to predefined parts on the image of the vehicle.These points will then be filtered and matched with the points of the 3D model [1].A method of detecting vehicles from high resolution aerial imagery called HEM whose learning process uses convolutional neural networks.This method is proposed by Koga.Y and al [2].Yang.M and al have adopted the use of a double-focal loss function (DFL-CNN) for the detection of vehicles in aerial images.This method is used to improve network capacity in order to distinguish vehicles in a crowded scene [3].Zhou.Y and al are working on the problems of detection and classification of vehicles using deep neural network (DNN) approaches.They answer the three questions specific to their application, the first question is asked about the use of DNN for vehicle detection, the second question about useful functions for the classification of vehicles and one last question is how to extend a model on a set of limited size of data in the case of extreme lighting [4].Mengxi.W used the algorithm You Only Look Once (YOLO) to detect vehicles from a video stream dashboard camera [5].The YOLO algorithm is developed by J.Redmon and al in 2015.This algorithm is used for the detection of objects, it is based on two stages; the first is to detect objects by convolutional neural networks, the second step makes the grid of the image and does the prediction of the detected object class if it exists.The advantage of this prediction is that it can be done independently since the first detection but that she does not target objects in particular.The disadvantage of this method is the difficulty of detecting the smallest objects as well as objects that are overlapping.The Faster R-CNN method is created by S.Ren and al in 2015 it is based on convolutional neural networks.She is considered as the first detector tested for the detection of apples [6].

Methodology
In this paper, machine learning and deep learning based techniques were utilized to detect and recognize the vehicles and follow up their types.Convolutional neuron network efficiency depends to a large extent on the quality of the training data set; the network will produce good results only if the training data used contain sufficient important characteristics so that they can produce new predictions.

The dataset used
In order to evaluate our method, the dataset used includes two files (vehicle file and non-vehicle file).Our database has images extracted by video sequences (obtained by a front camera mounted on a car).To ensure good data learning, images are captured in different road conditions (far, near, left, right).The vehicle file includes 8798 images and the non-vehicle file includes 8971 images.Each image is of dimension: 64 * 64 pixels.

Model Architecture
Our model is composed of six layers of convolution, The first five convolutional layers use a ReLU activation function, knowing that there are several activation functions such as (sigmoid, TanhLeaky, ReLU, ... etc.) at the output of each of these layers, the Dropout layer is used to regularize the CNN.We add to the fifth convolutional layer the MaxPooling2D layer that will be explained later.The convolutional sixth layer uses a sigmoid activation function.

The convolutional neural network of our model
We present in this part the different modules used in the CNN, these modules are: convolution layers and activation functions.The convolution layer is the main layer of CNN, which applies a specified number of convolution filters to the input image.This layer allows performing a set of mathematical operations to produce a unique value at the output, and then it applies an activation function.
Equation ( 1) explains how to calculate the output of a given neuron in a convolutional layer [7].
 Is the yield of the neuron situated in line I, section j in highlight map k of the convolutional (layer l). And are the vertical and level walks, and are the tallness and width of the responsive field, and is the quantity of highlight maps in the past (layer l -1). Is the yield of the neuron situated in layer l -, pu ′, t n j′, n ud p k′ ( nn k′ f the past layer is the information layer). Is the inclination term for highlight map k (in layer l).You can consider it a handle that changes the general splendor of the component map k.  Is the association weight between any neuron in highlight map k of the layer l and its info situated (2) (3) It allows to be disable randomly neurons during the different learning iterations to improve the compatibility of neural networks [11].The pooling layer is typically used after the convolutional layer.It is used to reduce the dimensions of an image in order to reduce the calculation time and minimize the occupied memory space.The formula (4) below illustrates the calculation of the pooling size [12,17].
(4) W1, H1: the size of the input volume, F: The spatial size of the output volume, S: the pitch, and W2, H2: The size of the output volume.In the last step, we used fully connected layer (FC) to classify the data from the previous layer.
The heatmap function is usually used to extract the hot areas in an image.We used this function to detect vehicles running in front of the camera on the road.In the first step, we transform the image of the undistorted road into an image in the form of "bird's-eye" which focuses only on the ends of the lane, and then displays the ends in such a way that they seem to be relatively parallel to each other.In the second step, we converted the image obtained in the previous step into other color spaces and then we converted the images to a shade of gray that highlight only the lines of the path and ignore everything else.To reach this objective we applied color channels (HLS, lab, LUV) and we specified the thresholds, which allowed identify the lines of the way in the images.The objective of the third step is to identify the peaks in a histogram of the image to determine the location of each line of the road, and then it identifies all the nonzero pixels around the peaks.In the fourth step, we calculated the radius of curvature, Based on the work of the authors [13,14,18], the formula of the radius of curvature at any point x of the y= f(x): In the last step, we assume that the camera is mounted in the center of the car below the mirror.The offset is calculated so that the center of the road is the midpoint of the two lines that we have detected.The offset is therefore the difference between the center of the car and the center of the lane see Figure 8.

Results
In this part, we evaluate our model in terms of precision and performance to show the effectiveness of our approach.The figure below shows us some results obtained by our model.In this figure, we find that our system has specified the road on which the vehicle must circulate.In the following figure 11, we show a graph that represents the evolution of precision curve on the learning set and the validation set.We find that accuracy increases progressively according to a number of epoch, and we observe that there is a gap between the two curves; this means that the model is become generalized in a better way especially from the fourth epoch.In the following, we show a graph that represents the curve evolution of the error function (Loss) on the learning set and the validation set.Figure .12 shows that the error function decreases as the number of epoch increases.This means that the model gives a good prediction on the learning set as well as on the validation set.We find that the error function on the validation set begins to increase gradually from the fourth epoch; this means that the model is over-adjusted.We conclude that our model is better by reaching a satisfactory accuracy rate that reaches the 99.2% and very low error rate that equals 0.8%.Our model gives good results in terms of detection and recognition of vehicles in a video stream.

Figure 2 .
Figure 2. Random image from the class vehicle of our data set with a kernel 3x3.

Figure 3 .
Figure 3. Random image from the class Non-Vehicle of our data set.

Figure 4 .
Figure 4. Histogram of the database.

Figure 5 .
Figure 5. Illustrating the CNN architecture of our model.
to improve the effectiveness of treatment by intercalating in each treatment layer a mathematical function called activation function.In our work, we used two types of activation functions: The ReLU function [8,19], which will introduce nonlinearities in the model equation (2), and the sigmoid function [9] that will arrange the ' equation (3).There are two types of class: A class vehicle and a class non-vehicle.

Figure 6 .
Figure 6.Heat Map illustrate the true prediction of our model.

Figure 7 .
Figure 7.The stages to calculate estimated vehicle offset.

Figure 8 .
Figure 8.The offset computing of the vehicle in circulation.

Figure 9
Figure 9(a).Vehicle classification and detection by our approach.

Figure 9
Figure 9(b).Vehicle classification and detection by our approach.

Figure
Figure. 10 (a) Yellow surface show the classification of vehicle on the road line.

Figure. 10
Figure. 10 (b).Yellow surface show the classification of vehicle in the tunnel road line.

Figure 11 .
Figure 11.Accuracy of training and accuracy of validation.

Figure 12 .
Figure 12.The training error and the validation error.

Figure 13 :
Figure 13: Observing the exhibition of the AI and machine learning model by looking at the test and preparing exactness for differing number of ages.

Table 1 .
Summary of different techniques used for the classification of vehicle types.