# A Multi-Loop Vehicle-Counting Method under Gray Mode and RGB Mode
## 2 Related Work  
To obtain counting information, most approaches often need two links: vehicle detection and vehicle counting. For vehicle detection, two kinds of techniques are most often applied: feature-based methods and motion-based methods. Feature-based methods are based on the visual features of a vehicle [5], such as color [6]; texture [7]; edge [8]; or characteristic parts of a vehicle, such as vehicle lights [9], license plates [10], windshield [11], etc. Extraction with low-dimension features is fast and convenient, but it cannot represent all useful information efficiently. In this case, deep learning methods were proposed. These methods need to collect a lot of information prior to training the neural network and then use the trained neural network model to recognize the target. Many deep learning models could help improve the accuracy by a lot. Two-step methods include Spatial Pyramid Pooling Network (SPPNet) [12], Region-Based Convolutional Neural Network (R-CNN) [13], Fast Region-Based Convolutional Neural Network (Fast R-CNN) [14], Faster Region-Based Convolutional Neural Network (Faster R-CNN) [15], etc., while one-step methods include You Only Look Once (YOLO) [16], Single Shot Multi-Box Detector (SSD) [17], Retina-Net [18], SqueezeDet [19], etc. Although the deep learning method has a high accuracy, it is realized at the cost of time-consuming network training by applying a large amount of prior knowledge. Meanwhile, the generality of the model is not very high. The effectiveness of the algorithm may be greatly reduced when the scene is changed. Although transfer learning is also a common way to compensate for this, the effect is often not very good. Motion-based methods are methods based on the relationship between image sequences. The principle of a motion-based method is to use the correlation between images to segment the moving vehicle from the background, and the video meets the requirements of this method perfectly for its high image refresh rate. Moreover, the motion-based method does not require much prior knowledge but based on a set of images. Therefore, its algorithm complexity is lower and its generality is high. The interframe differencing and background subtraction are the most two characteristic examples. Interframe differencing [20] is based on the difference between two or more successive image frames, whereas background subtraction is based on the difference between moving vehicles and a stationary background [3]. However, due to the influence of environment, the vehicle detected by this method is often incomplete, which further affects the accuracy of vehicle counting. More importantly, most motion-based methods were only applied under gray mode, which is a waste for a color image. For the counting step, the use of vehicle tracking is a relatively mature approach, such as using a Kalman filter [21] or exploiting feature tracking [22], but its algorithm complexity is high. By contrast, the method based on ROIs has little computational cost. The mechanism of this algorithm is to extract the detection information of the vehicle by analyzing the changes of pixel value in the ROIs and by turning it into the counting information of the vehicle. For example, a linear ROI [23] or a large loop set perpendicular to the road direction could be used to count the total number of vehicles in one direction. To count vehicles by lane, short line or small loop sets for each lane [24] could be applied. However, when the vehicle does not drive by strictly following the lane, counting based on the ROIs set by each lane could be problematic, such as repeat counts in adjacent lanes or missing counts. Based on the shortcomings introduced above, a vehicle detection and counting method is proposed. The detection of moving vehicles is based on its motion characteristics and is operated under both gray mode and RGB mode, which could greatly improve the integrity of the detected vehicle. The counting is based on multiple loops with overlapping areas to improve the accuracy of counting.