report.tex 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652
  1. \documentclass[a4paper]{article}
  2. \usepackage{amsmath}
  3. \usepackage{hyperref}
  4. \usepackage{graphicx}
  5. \usepackage{float}
  6. \title{Using local binary patterns to read license plates in photographs}
  7. % Paragraph indentation
  8. \setlength{\parindent}{0pt}
  9. \setlength{\parskip}{1ex plus 0.5ex minus 0.2ex}
  10. \begin{document}
  11. \maketitle
  12. \section*{Project members}
  13. Gijs van der Voort\\
  14. Raichard Torenvliet\\
  15. Jayke Meijer\\
  16. Tadde\"us Kroes\\
  17. Fabi\"en Tesselaar
  18. \tableofcontents
  19. \pagebreak
  20. \setcounter{secnumdepth}{1}
  21. \section{Problem description}
  22. License plates are used for uniquely identifying motorized vehicles and are
  23. made to be read by humans from great distances and in all kinds of weather
  24. conditions.
  25. Reading license plates with a computer is much more difficult. Our dataset
  26. contains photographs of license plates from various angles and distances. This
  27. means that not only do we have to implement a method to read the actual
  28. characters, but given the location of the license plate and each individual
  29. character, we must make sure we transform each character to a standard form.
  30. Determining what character we are looking at will be done by using Local Binary
  31. Patterns. The main goal of our research is finding out how effective LBP's are
  32. in classifying characters on a license plate.
  33. In short our program must be able to do the following:
  34. \begin{enumerate}
  35. \item Extracting characters using the location points in the xml file.
  36. \item Reduce noise where possible to ensure maximum readability.
  37. \item Transforming a character to a normal form.
  38. \item Creating a local binary pattern histogram vector.
  39. \item Matching the found vector with a learning set.
  40. \item And finally it has to check results with a real data set.
  41. \end{enumerate}
  42. \section{Language of choice}
  43. The actual purpose of this project is to check if LBP is capable of recognizing
  44. license plate characters. We knew the LBP implementation would be pretty
  45. simple. Thus an advantage had to be its speed compared with other license plate
  46. recognition implementations, but the uncertainty of whether we could get some
  47. results made us pick Python. We felt Python would not restrict us as much in
  48. assigning tasks to each member of the group. In addition, when using the
  49. correct modules to handle images, Python can be decent in speed.
  50. \section{Theory}
  51. Now we know what our program has to be capable of, we can start with the
  52. defining what problems we have and how we want to solve these.
  53. \subsection{Extracting a character and resizing it}
  54. We need to extract a character from a photo made of a car. We do not have to
  55. find where in this image the characters are, since this is provided in an XML
  56. file with our dataset.
  57. Once we have extracted the points from this XML file, we need to get this
  58. character from the image. For the nature of the Local Binary Pattern algorithm,
  59. we want a margin around the character. However, the points stored in the XML
  60. file are chosen in such a fashion, that the character would be cut out exactly.
  61. Therefore, we choose to take points that are slightly outside of the given
  62. points.
  63. When we have the points we want, we use a perspective transformation to get
  64. an exact image of the character.
  65. The final step is to resize this image in such a fashion, that the stroke
  66. of the character is more or less equal in each image. We do this by setting
  67. the height to a standard size, since each character has the same height on a
  68. license plate. We retain the height-width ratio, so we do not end up with
  69. characters that are different than other examples of the same character,
  70. because the image got stretched, which would of course be a bad thing for
  71. the classification.
  72. \subsection{Transformation}
  73. A simple perspective transformation will be sufficient to transform and resize
  74. the characters to a normalized format. The corner positions of characters in
  75. the dataset are supplied together with the dataset.
  76. \subsection{Reducing noise}
  77. Small amounts of noise will probably be suppressed by usage of a Gaussian
  78. filter. A real problem occurs in very dirty license plates, where branches and
  79. dirt over a letter could radically change the local binary pattern. A question
  80. we can ask ourselves here, is whether we want to concentrate ourselves on these
  81. exceptional cases. By law, license plates have to be readable. However, the
  82. provided dataset showed that this does not mean they always are. We will have
  83. to see how the algorithm performs on these plates, however we have good hopes
  84. that our method will get a good score on dirty plates, as long as a big enough
  85. part of the license plate remains readable.
  86. \subsection{Local binary patterns}
  87. Once we have separate digits and characters, we intent to use Local Binary
  88. Patterns (Ojala, Pietikäinen \& Harwood, 1994) to determine what character
  89. or digit we are dealing with. Local Binary
  90. Patterns are a way to classify a texture based on the distribution of edge
  91. directions in the image. Since letters on a license plate consist mainly of
  92. straight lines and simple curves, LBP should be suited to identify these.
  93. \subsubsection{LBP Algorithm}
  94. The LBP algorithm that we implemented can use a variety of neighbourhoods,
  95. including the same square pattern that is introduced by Ojala et al (1994),
  96. and a circular form as presented by Wikipedia.
  97. \begin{itemize}
  98. \item Determine the size of the square where the local patterns are being
  99. registered. For explanation purposes let the square be 3 x 3. \\
  100. \item The grayscale value of the middle pixel is used as threshold. Every
  101. value of the pixel around the middle pixel is evaluated. If it's value is
  102. greater than the threshold it will be become a one else a zero.
  103. \begin{figure}[H]
  104. \center
  105. \includegraphics[scale=0.5]{lbp.png}
  106. \caption{LBP 3 x 3 (Pietik\"ainen, Hadid, Zhao \& Ahonen (2011))}
  107. \end{figure}
  108. Notice that the pattern will be come of the form 01001110. This is done when a
  109. the value of the evaluated pixel is greater than the threshold, shift the bit
  110. by the n(with i=i$_{th}$ pixel evaluated, starting with $i=0$).
  111. This results in a mathematical expression:
  112. Let I($x_i, y_i$) an Image with grayscale values and $g_n$ the grayscale value
  113. of the pixel $(x_i, y_i)$. Also let $s(g_i, g_c)$ (see below) with $g_c$ =
  114. grayscale value of the center pixel and $g_i$ the grayscale value of the pixel
  115. to be evaluated.
  116. $$
  117. s(g_i, g_c) = \left\{
  118. \begin{array}{l l}
  119. 1 & \quad \text{if $g_i$ $\geq$ $g_c$}\\
  120. 0 & \quad \text{if $g_i$ $<$ $g_c$}\\
  121. \end{array} \right.
  122. $$
  123. $$LBP_{n, g_c = (x_c, y_c)} = \sum\limits_{i=0}^{n-1} s(g_i, g_c)^{2i} $$
  124. The outcome of this operations will be a binary pattern.
  125. \item Given this pattern, the next step is to divide the pattern in cells. The
  126. amount of cells depends on the quality of the result, so trial and error is in
  127. order. Starting with dividing the pattern in to cells of size 16.
  128. \item Compute a histogram for each cell.
  129. \begin{figure}[H]
  130. \center
  131. \includegraphics[scale=0.7]{cells.png}
  132. \caption{Divide in cells(Pietik\"ainen et all (2011))}
  133. \end{figure}
  134. \item Consider every histogram as a vector element and concatenate these. The
  135. result is a feature vector of the image.
  136. \item Feed these vectors to a support vector machine. This will ''learn'' which
  137. vector indicates what vector is which character.
  138. \end{itemize}
  139. To our knowledge, LBP has yet not been used in this manner before. Therefore,
  140. it will be the first thing to implement, to see if it lives up to the
  141. expectations. When the proof of concept is there, it can be used in a final
  142. program.
  143. Later we will show that taking a histogram over the entire image (basically
  144. working with just one cell) gives us the best results.
  145. \subsection{Matching the database}
  146. Given the LBP of a character, a Support Vector Machine can be used to classify
  147. the character to a character in a learning set. The SVM uses a concatenation
  148. of each cell in an image as a feature vector (in the case we check the entire
  149. image no concatenation has to be done of course. The SVM can be trained with a
  150. subset of the given dataset called the ''Learning set''. Once trained, the
  151. entire classifier can be saved as a Pickle object\footnote{See
  152. \url{http://docs.python.org/library/pickle.html}} for later usage.
  153. In our case the support vector machine uses a radial gauss kernel function. The
  154. SVM finds a seperating hyperplane with minimum margins.
  155. \section{Implementation}
  156. In this section we will describe our implementations in more detail, explaining
  157. choices we made.
  158. \subsection{Character retrieval}
  159. In order to retrieve the characters from the entire image, we need to
  160. perform a perspective transformation. However, to do this, we need to know the
  161. coordinates of the four corners of each character. For our dataset, this is
  162. stored in XML files. So, the first step is to read these XML files.
  163. \paragraph*{XML reader}
  164. The XML reader will return a `license plate' object when given an XML file. The
  165. licence plate holds a list of, up to six, NormalizedImage characters and from
  166. which country the plate is from. The reader is currently assuming the XML file
  167. and image name are corresponding, since this was the case for the given
  168. dataset. This can easily be adjusted if required.
  169. To parse the XML file, the minidom module is used. So the XML file can be
  170. treated as a tree, where one can search for certain nodes. In each XML
  171. file it is possible that multiple versions exist, so the first thing the reader
  172. will do is retrieve the current and most up-to-date version of the plate. The
  173. reader will only get results from this version.
  174. Now we are only interested in the individual characters so we can skip the
  175. location of the entire license plate. Each character has
  176. a single character value, indicating what someone thought what the letter or
  177. digit was and four coordinates to create a bounding box. If less then four
  178. points have been set the character will not be saved. Else, to make things not
  179. to complicated, a Character class is used. It acts as an associative list, but
  180. it gives some extra freedom when using the data.
  181. When four points have been gathered the data from the actual image is being
  182. requested. For each corner a small margin is added (around 3 pixels) so that no
  183. features will be lost and minimum amounts of new features will be introduced by
  184. noise in the margin.
  185. In the next section you can read more about the perspective transformation that
  186. is being done. After the transformation the character can be saved: Converted
  187. to grayscale, but nothing further. This was used to create a learning set. If
  188. it does not need to be saved as an actual image it will be converted to a
  189. NormalizedImage. When these actions have been completed for each character the
  190. license plate is usable in the rest of the code.
  191. \paragraph*{Perspective transformation}
  192. Once we retrieved the corner points of the character, we feed those to a
  193. module that extracts the (warped) character from the original image, and
  194. creates a new image where the character is cut out, and is transformed to a
  195. rectangle.
  196. \subsection{Noise reduction}
  197. The image contains a lot of noise, both from camera errors due to dark noise
  198. etc., as from dirt on the license plate. In this case, noise therefore means
  199. any unwanted difference in color from the surrounding pixels.
  200. \paragraph*{Camera noise and small amounts of dirt}
  201. The dirt on the license plate can be of different sizes. We can reduce the
  202. smaller amounts of dirt in the same way as we reduce normal noise, by applying
  203. a Gaussian blur to the image. This is the next step in our program.\\
  204. \\
  205. The Gaussian filter we use comes from the \texttt{scipy.ndimage} module. We use
  206. this function instead of our own function, because the standard functions are
  207. most likely more optimized then our own implementation, and speed is an
  208. important factor in this application.
  209. \paragraph*{Larger amounts of dirt}
  210. Larger amounts of dirt are not going to be resolved by using a Gaussian filter.
  211. We rely on one of the characteristics of the Local Binary Pattern, only looking
  212. at the difference between two pixels, to take care of these problems.\\
  213. Because there will probably always be a difference between the characters and
  214. the dirt, and the fact that the characters are very black, the shape of the
  215. characters will still be conserved in the LBP, even if there is dirt
  216. surrounding the character.
  217. \subsection{Creating Local Binary Patterns and feature vector}
  218. Every pixel is a center pixel and it is also a value to evaluate but not at the
  219. same time. Every pixel is evaluated as shown in the explanation
  220. of the LBP algorithm. There are several neighbourhoods we can evaluate. We have
  221. tried the following neighbourhoods:
  222. \begin{figure}[H]
  223. \center
  224. \includegraphics[scale=0.5]{neighbourhoods.png}
  225. \caption{Tested neighbourhoods}
  226. \end{figure}
  227. We name these neighbourhoods respectively (8,3)-, (8,5)- and
  228. (12,5)-neighbourhoods, after the number of points we use and the diameter
  229. of the `circle´ on which these points lay.\\
  230. \\
  231. We chose these neighbourhoods to prevent having to use interpolation, which
  232. would add a computational step, thus making the code execute slower. In the
  233. next section we will describe what the best neighbourhood was.
  234. Take an example where the full square can be evaluated, so none of the
  235. neighbours are out of bounds. The first to be checked is the pixel in the left
  236. bottom corner in the square 3 x 3, with coordinate $(x - 1, y - 1)$ with $g_c$
  237. as center pixel that has coordinates $(x, y)$. If the grayscale value of the
  238. neighbour in the left corner is greater than the grayscale
  239. value of the center pixel than return true. Bit-shift the first bit with 7. The
  240. outcome is now 1000000. The second neighbour will be bit-shifted with 6, and so
  241. on. Until we are at 0. The result is a binary pattern of the local point just
  242. evaluated.
  243. Now only the edge pixels are a problem, but a simple check if the location of
  244. the neighbour is still in the image can resolve this. We simply state that the
  245. pixel has a lower value then the center pixel if it is outside the image
  246. bounds.
  247. \paragraph*{Histogram and Feature Vector}
  248. After all the Local Binary Patterns are created for every pixel, this pattern
  249. is divided into cells. The feature vector is the vector of concatenated
  250. histograms. These histograms are created for cells. These cells are created by
  251. dividing the \textbf{pattern} in to cells and create a histogram of that. So
  252. multiple cells are related to one histogram. All the histograms are
  253. concatenated and fed to the SVM that will be discussed in the next section,
  254. Classification. We did however find out that the use of several cells was not
  255. increasing our performance, so we only have one histogram to feed to the SVM.
  256. \subsection{Classification}
  257. For the classification, we use a standard Python Support Vector Machine,
  258. \texttt{libsvm}. This is an often used SVM, and should allow us to simply feed
  259. data from the LBP and Feature Vector steps into the SVM and receive results.
  260. Using a SVM has two steps. First, the SVM has to be trained, and then it can be
  261. used to classify data. The training step takes a lot of time, but luckily
  262. \texttt{libsvm} offers us an opportunity to save a trained SVM. This means that
  263. the SVM only has to be changed once.
  264. We have decided to only include a character in the system if the SVM can be
  265. trained with at least 70 examples. This is done automatically, by splitting the
  266. data set in a learning set and a test set, where the first 70 examples of a
  267. character are added to the learning set, and all the following examples are
  268. added to the test set. Therefore, if there are not enough examples, all
  269. available examples end up in the learning set, and non of these characters end
  270. up in the test set, thus they do not decrease our score. However, if this
  271. character later does get offered to the system, the training is as good as
  272. possible, since it is trained with all available characters.
  273. \subsection{Supporting Scripts}
  274. In order to work with the code, we wrote a number of scripts. Each of these
  275. scripts is named here and a description is given on what the script does.
  276. \subsection*{\texttt{create\_characters.py}}
  277. \subsection*{\texttt{create\_classifier.py}}
  278. \subsection*{\texttt{find\_svm\_params.py}}
  279. \subsection*{\texttt{generate\_learning\_set.py}}
  280. \subsection*{\texttt{load\_learning\_set.py}}
  281. \subsection*{\texttt{run\_classifier.py}}
  282. \section{Finding parameters}
  283. Now that we have a functioning system, we need to tune it to work properly for
  284. license plates. This means we need to find the parameters. Throughout the
  285. program we have a number of parameters for which no standard choice is
  286. available. These parameters are:\\
  287. \\
  288. \begin{tabular}{l|l}
  289. Parameter & Description\\
  290. \hline
  291. $\sigma$ & The size of the Gaussian blur.\\
  292. \emph{cell size} & The size of a cell for which a histogram of LBP's
  293. will be generated.\\
  294. \emph{Neighbourhood}& The neighbourhood to use for creating the LBP.\\
  295. $\gamma$ & Parameter for the Radial kernel used in the SVM.\\
  296. $c$ & The soft margin of the SVM. Allows how much training
  297. errors are accepted.\\
  298. \end{tabular}\\
  299. \\
  300. For each of these parameters, we will describe how we searched for a good
  301. value, and what value we decided on.
  302. \subsection{Parameter $\sigma$}
  303. The first parameter to decide on, is the $\sigma$ used in the Gaussian blur. To
  304. find this parameter, we tested a few values, by trying them and checking the
  305. results. It turned out that the best value was $\sigma = 1.4$.\\
  306. \\
  307. Theoretically, this can be explained as follows. The filter has width of
  308. $6 * \sigma = 6 * 1.4 = 8.4$ pixels. The width of a `stroke' in a character is,
  309. after our resize operations, around 8 pixels. This means, our filter `matches'
  310. the smallest detail size we want to be able to see, so everything that is
  311. smaller is properly suppressed, yet it retains the details we do want to keep,
  312. being everything that is part of the character.
  313. \subsection{Parameter \emph{cell size}}
  314. The cell size of the Local Binary Patterns determines over what region a
  315. histogram is made. The trade-off here is that a bigger cell size makes the
  316. classification less affected by relative movement of a character compared to
  317. those in the learning set, since the important structure will be more likely to
  318. remain in the same cell. However, if the cell size is too big, there will not
  319. be enough cells to properly describe the different areas of the character, and
  320. the feature vectors will not have enough elements.\\
  321. \\
  322. In order to find this parameter, we used a trial-and-error technique on a few
  323. cell sizes. During this testing, we discovered that a lot better score was
  324. reached when we take the histogram over the entire image, so with a single
  325. cell. Therefore, we decided to work without cells.\\
  326. \\
  327. A reason we can think of why using one cell works best is that the size of a
  328. single character on a license plate in the provided dataset is very small.
  329. That means that when dividing it into cells, these cells become simply too
  330. small to have a really representative histogram. Therefore, the
  331. concatenated histograms are then a list of only very small numbers, which
  332. are not significant enough to allow for reliable classification.
  333. \subsection{Parameter \emph{Neighbourhood}}
  334. The neighbourhood to use can only be determined through testing. We did a test
  335. with each of these neighbourhoods, and we found that the best results were
  336. reached with the following neighbourhood, which we will call the
  337. (12,5)-neighbourhood, since it has 12 points in a area with a diameter of 5.
  338. \begin{figure}[H]
  339. \center
  340. \includegraphics[scale=0.5]{12-5neighbourhood.png}
  341. \caption{(12,5)-neighbourhood}
  342. \end{figure}
  343. \subsection{Parameters $\gamma$ \& $c$}
  344. The parameters $\gamma$ and $c$ are used for the SVM. $c$ is a standard
  345. parameter for each type of SVM, called the 'soft margin'. This indicates how
  346. exact each element in the learning set should be taken. A large soft margin
  347. means that an element in the learning set that accidentally has a completely
  348. different feature vector than expected, due to noise for example, is not taken
  349. into account. If the soft margin is very small, then almost all vectors will be
  350. taken into account, unless they differ extreme amounts.\\
  351. $\gamma$ is a variable that determines the size of the radial kernel, and as
  352. such determines how steep the difference between two classes can be.\\
  353. \\
  354. Since these parameters both influence the SVM, we need to find the best
  355. combination of values. To do this, we perform a so-called grid-search. A
  356. grid-search takes exponentially growing sequences for each parameter, and
  357. checks for each combination of values what the score is. The combination with
  358. the highest score is then used as our parameters, and the entire SVM will be
  359. trained using those parameters.\\
  360. \\
  361. The results of this grid-search are shown in the following table. The values
  362. in the table are rounded percentages, for easy displaying.
  363. \begin{tabular}{|r|r r r r r r r r r r|}
  364. \hline
  365. c $\gamma$ & $2^{-15}$ & $2^{-13}$ & $2^{-11}$ & $2^{-9}$ & $2^{-7}$ &
  366. $2^{-5}$ & $2^{-3}$ & $2^{-1}$ & $2^{1}$ & $2^{3}$\\
  367. \hline
  368. $2^{-5}$ & 61 & 61 & 61 & 61 & 62 &
  369. 63 & 67 & 74 & 59 & 24\\
  370. $2^{-3}$ & 61 & 61 & 61 & 61 & 62 &
  371. 63 & 70 & 78 & 60 & 24\\
  372. $2^{-1}$ & 61 & 61 & 61 & 61 & 62 &
  373. 70 & 83 & 88 & 78 & 27\\
  374. $2^{1}$ & 61 & 61 & 61 & 61 & 70 &
  375. 84 & 90 & 92 & 86 & 45\\
  376. $2^{3}$ & 61 & 61 & 61 & 70 & 84 &
  377. 90 & 93 & 93 & 86 & 45\\
  378. $2^{5}$ & 61 & 61 & 70 & 84 & 90 &
  379. 92 & 93 & 93 & 86 & 45\\
  380. $2^{7}$ & 61 & 70 & 84 & 90 & 92 &
  381. 93 & 93 & 93 & 86 & 45\\
  382. $2^{9}$ & 70 & 84 & 90 & 92 & 92 &
  383. 93 & 93 & 93 & 86 & 45\\
  384. $2^{11}$ & 84 & 90 & 92 & 92 & 92 &
  385. 92 & 93 & 93 & 86 & 45\\
  386. $2^{13}$ & 90 & 92 & 92 & 92 & 92 &
  387. 92 & 93 & 93 & 86 & 45\\
  388. $2^{15}$ & 92 & 92 & 92 & 92 & 92 &
  389. 92 & 93 & 93 & 86 & 45\\
  390. \hline
  391. \end{tabular}
  392. We found that the best values for these parameters are $c = 32$ and
  393. $\gamma = 0.125$.
  394. \section{Results}
  395. The goal was to find out two things with this research: The speed of the
  396. classification and the accuracy. In this section we will show our findings.
  397. \subsection{Accuracy}
  398. Of course, it is vital that the recognition of a license plate is correct,
  399. almost correct is not good enough here. Therefore, we have to get the highest
  400. accuracy score we possibly can.\\
  401. \\ According to Wikipedia
  402. \footnote{
  403. \url{http://en.wikipedia.org/wiki/Automatic_number_plate_recognition}},
  404. commercial license plate recognition software score about $90\%$ to $94\%$,
  405. under optimal conditions and with modern equipment.\\
  406. \\
  407. Our program scores an average of $93\%$. However, this is for a single
  408. character. That means that a full license plate should theoretically
  409. get a score of $0.93^6 = 0.647$, so $64.7\%$. That is not particularly
  410. good compared to the commercial ones. However, our focus was on getting
  411. good scores per character, and $93\%$ seems to be a fairly good result.\\
  412. \\
  413. Possibilities for improvement of this score would be more extensive
  414. grid-searches, finding more exact values for $c$ and $\gamma$, more tests
  415. for finding $\sigma$ and more experiments on the size and shape of the
  416. neighbourhoods.
  417. \subsection{Speed}
  418. Recognizing license plates is something that has to be done fast, since there
  419. can be a lot of cars passing a camera in a short time, especially on a highway.
  420. Therefore, we measured how well our program performed in terms of speed. We
  421. measure the time used to classify a license plate, not the training of the
  422. dataset, since that can be done offline, and speed is not a primary necessity
  423. there.\\
  424. \\
  425. The speed of a classification turned out to be reasonably good. We time between
  426. the moment a character has been 'cut out' of the image, so we have a exact
  427. image of a character, to the moment where the SVM tells us what character it
  428. is. This time is on average $65$ ms. That means that this
  429. technique (tested on an AMD Phenom II X4 955 CPU running at 3.2 GHz)
  430. can identify 15 characters per second.\\
  431. \\
  432. This is not spectacular considering the amount of calculating power this CPU
  433. can offer, but it is still fairly reasonable. Of course, this program is
  434. written in Python, and is therefore not nearly as optimized as would be
  435. possible when written in a low-level language.\\
  436. \\
  437. Another performance gain is by using one of the other two neighbourhoods.
  438. Since these have 8 points instead of 12 points, this increases performance
  439. drastically, but at the cost of accuracy. With the (8,5)-neighbourhood
  440. we only need 1.6 ms seconds to identify a character. However, the accuracy
  441. drops to $89\%$. When using the (8,3)-neighbourhood, the speedwise performance
  442. remains the same, but accuracy drops even further, so that neighbourhood
  443. is not advisable to use.
  444. \section{Conclusion}
  445. In the end it turns out that using Local Binary Patterns is a promising
  446. technique for License Plate Recognition. It seems to be relatively indifferent
  447. for the amount of dirt on license plates and different fonts on these plates.\\
  448. \\
  449. The performance speed wise is fairly good, when using a fast machine. However,
  450. this is written in Python, which means it is not as efficient as it could be
  451. when using a low-level languages.
  452. \\
  453. We believe that with further experimentation and development, LBP's can
  454. absolutely be used as a good license plate recognition method.
  455. \section{Reflection}
  456. \subsection{Difficulties}
  457. During the implementation and testing of the program, we did encounter a
  458. number of difficulties. In this section we will state what these difficulties
  459. were and whether we were able to find a proper solution for them.
  460. \subsubsection*{Dataset}
  461. We did experience a number of problems with the provided dataset. A number of
  462. these are problems to be expected in a real world problem, but which make
  463. development harder. Others are more elemental problems.\\
  464. The first problem was that the dataset contains a lot of license plates which
  465. are problematic to read, due to excessive amounts of dirt on them. Of course,
  466. this is something you would encounter in the real situation, but it made it
  467. hard for us to see whether there was a coding error or just a bad example.\\
  468. Another problem was that there were license plates of several countries in
  469. the dataset. Each of these countries has it own font, which also makes it
  470. hard to identify these plates, unless there are a lot of these plates in the
  471. learning set.\\
  472. A problem that is more elemental is that some of the characters in the dataset
  473. are not properly classified. This is of course very problematic, both for
  474. training the SVM as for checking the performance. This meant we had to check
  475. each character whether its description was correct.
  476. \subsubsection*{SVM}
  477. We also had trouble with the SVM for Python. The standard Python SVM, libsvm,
  478. had a poor documentation. There was no explanation what so ever on which
  479. parameter had to be what. This made it a lot harder for us to see what went
  480. wrong in the program.
  481. \subsection{Workload distribution}
  482. The first two weeks were team based. Basically the LBP algorithm could be
  483. implemented in the first hour, while some talked and someone did the typing.
  484. Some additional 'basics' where created in similar fashion. This ensured that
  485. every team member was up-to-date and could start figuring out which part of the
  486. implementation was most suited to be done by one individually or in a pair.
  487. \subsubsection*{Who did what}
  488. Gijs created the basic classes we could use and helped everyone by keeping
  489. track of what was required to be finished and whom was working on what.
  490. Tadde\"us and Jayke were mostly working on the SVM and all kinds of tests
  491. whether the histograms were matching, and what parameters had to be used.
  492. Fabi\"en created the functions to read and parse the given xml files with
  493. information about the license plates. Upon completion all kinds of learning
  494. and data sets could be created. Richard helped out wherever anyone needed a
  495. helping hand, and was always available when someone had doubts about what they
  496. where doing or needed to ask something. He also wrote an image cropper that
  497. automatically exactly cuts out a character, which eventually turned out to be
  498. obsolete.
  499. \subsubsection*{How it went}
  500. Sometimes one cannot hear the alarm bell and wake up properly. This however was
  501. not a big problem as no one was afraid of staying at Science Park a bit longer
  502. to help out. Further communication usually went through e-mails and replies
  503. were instantaneous! A crew to remember.
  504. \section{Discussion}
  505. \begin{thebibliography}{9}
  506. \bibitem{lbp1}
  507. Matti Pietik\"ainen, Guoyin Zhao, Abdenour hadid,
  508. Timo Ahonen.
  509. \emph{Computational Imaging and Vision}.
  510. Springer-Verlag, London,
  511. 1st Edition,
  512. 2011.
  513. \bibitem{wikiplate}
  514. \emph{Automatic number-plate recognition}. (2011, December 17).\\
  515. Wikipedia.
  516. Retrieved from http://en.wikipedia.org/wiki/Automatic\_number\_plate\_recognition
  517. \end{thebibliography}
  518. \appendix
  519. \section{Faulty Classifications}
  520. \begin{figure}[H]
  521. \center
  522. \includegraphics[scale=0.5]{faulty.png}
  523. \caption{Faulty classifications of characters}
  524. \end{figure}
  525. \end{document}