# Towards Automatic License Plate Recognition in Challenging Conditions
## 3 Methodology
### Vehicle Detection  
To locate objects, for instance, vehicle detection is a critical phase in developing an intelligent traffic monitoring system. In the past few years, the computer vision domain has introduced efficient object detection algorithms. Particularly, Faster RCNN and deep learning-based vehicle detection methods report high detection accuracy in near real-time in different environments [29]. Ultimately, these approaches have become a significant part of autonomous vehicles and self-driving applications. Our research reveals that real-time processing to locate vehicles, as well as good detection accuracy, are essential requirements that any object or vehicle detector should meet. We use a fine-tuned version of the Faster R-CNN [30] to find a vehicle quickly. The reason to detect the vehicle is that it considerably reduces the area to be explored for the existence of the LP in later stages. The purpose of using the Faster R-CNN at this stage is that, during the data training phase, it is at least  
Figure 2: Flow of the proposed license plate recognition procedure. nine times more rapid than the standard R-CNN. Moreover, it is 213\(\times\) faster during the test phase and yields higher detection accuracy than its counterpart [30]. Algorithm 1 demonstrates the pseudocode of the employed vehicle detection module. In lines (2) to (17), Faster RCNN is used to locate vehicles' positions. In lines 3-9, Faster R-CNN is fine-tuned to obtain the appropriate region of interests (RoIs) to look for the possible existence of a vehicle in an input image. Therefore, we perform the mini-batch sampling by empirically choosing 128 region proposal networks (RPNs). To generate the RPN, a small network is made to slide over the _conv_ feature map, which is output by the last shared _conv_ layer. This small network takes as input an \(N\times N\) spatial window of the input _conv_ feature map. This feature is fed into two siblings' fully connected layers. We use \(N=2\) during our tuning, keeping in mind the fact that the effective receptive field on the input image is large. As a result, 64 RoIs are extracted from an input image. Moreover, to describe the foreground of an object mask, we choose an object proposal with an IoU overlap that contains at least 0.5 ground truth. In lines 10-16 of Algorithm 1, we process an RGB vehicle image with thirteen _conv_ layers. As a result, a _conv_ feature map (\(\Psi\)) is obtained. ```
1. Input: colored RGB vehicle image
2. begin Faster R-CNN
3. initialize fine-tuning
4. do
5. extract features \(\blacktriangleright\) during training initialization
6. perform mini-batch sampling by \(\left(\frac{RPN=128}{N=2}\right)\); 64 RoIs from each image
7. select IoU overlap with ground truth \(>0.5\)
8. back-propagate errors across network layers \(\blacktriangleright\) weights optimization for nodes
9. end for
10. for\(I\in\{R,G,B\}\)do
11. process RGB data with 13 _conv_ layers to obtain \(\Psi\)
12. generate the RPN by using 3 scales and aspect ratios on \(\Psi\)
13. feature map (\(\Psi\)) and region proposals are fed to the RoI pooling layer (\({}^{\prime}\)I)
14. \({}^{\prime}\)I \(\rightarrow\) (\(r,c,h,w\))
15. for all feature vectors (\(\eta\)), generate the FC layer
16. end for
17. end for
18. Output: vehicle detection
```  
**Algorithm 1**Pseudocode of the vehicle detection method. For every region of the vehicle region proposal network (RPN), we apply nine diverse anchors on \(\Psi\) that calculate the probable vehicle regions. Meanwhile, for anchors, three scales are employed, which have resolutions of 128\({}^{2}\), 256\({}^{2}\), and 512\({}^{2}\) pixels along with three aspect ratios, which are 1:1, 1:2, and 2:1, respectively. As shown in line 14, max pooling is performed using five layers on \(\left(\frac{h}{Height}\times\frac{w}{Width}\right)\) with a \(7\times 7\) of \(Height\times Width\) with \(h\) and \(w\) being the layer hyper-parameters that are independent of any particular RoI.