# Motion Control System of Unmanned Railars Based on Image Recognition
## 2 Detecting Predefined Signs with Image Recognition
### Image Recognition of Predefined Signs
On the other hand, \(y_{i}=-1\) indicates the predefined sign does not show up in the training image and the corresponding sample \(x_{i}\) is a negative sample. Therefore, \(m\) training sets contain both positive and negative samples and their corresponding labels. We should then set the training iteration number \(K\), and assign the initial weight \(W_{i}^{0}=\frac{1}{m}\) to every feature vector in the training sets. Collecting the jth element from every n \(\times\) 1 Haar-like feature vector \(x_{i}\) in the \(m\) training set to form \(n\) new sets \(\Gamma_{j}\) described in (10) as follows:  
\[\Gamma_{j}=\Big{\{}x_{i(j)}\Big{|}\forall i\in\{1,2,\ldots,m\},\ j\in\{1,2, \ldots,n\}\Big{\}}. \tag{10}\]  
Sorting the elements of \(\Gamma_{j}\) according to numeric values, from left to right and from the smallest to the greatest, we have another \(n\) new sets \(\mathrm{V}_{j}\), which have sorted elements in (11):  
\[\mathrm{V}_{j}=\Big{\langle}v_{1(j)^{\prime}},v_{2(j)^{\prime}},\ldots,v_{m(j )}\ \Big{\rangle}. \tag{11}\]  
\[ii_{1}=Sum(A), \tag{3}\]0 Integral image blocks. The threshold value candidate set for the jth element of Haar-like feature vectors is calculated by  
\[ii_{1}=Sum(A), \tag{3}\]1  
Basically, \(T_{V_{j}}\) in (12) is formed by taking the averages of every two adjacent elements in V\({}_{j}\) in (11). Therefore, \(T_{V_{j}}\) sets consist of n \(\times\)\((m-1)\) threshold value candidates for weak classifiers. In the kth iteration, every element in \(\Gamma_{j}\) goes through both greater than and smaller than comparisons with threshold candidates \(t_{s}\) in (12). The comparison results \(R_{t_{s},\Gamma_{j}}^{k}\) are given as  
\[ii_{1}=Sum(A), \tag{3}\]2  
In (13), \(h_{t_{s}}^{k}\Big{(}x_{i(j)}\Big{)}\) represents weak classifier candidates. \[h_{t_{s}}^{k}\Big{(}x_{i(j)}\Big{)}=\left\{ \begin{array}{c}1,\ if\ px_{i(j)}< pt_{s}\\ -1,\ otherwise\end{array} \right. \tag{14}\]  
In (14), each weak classifier candidate has two associated variables. They are threshold \(t_{s}\) and polarity \(p\). Polarity \(p=1\) for the classifier candidates in which \(x_{i(j)}<t_{s}\), while polarity \(p=-1\) for the classifier candidates in which \(x_{i(j)}>t_{s}\). If the result of the weak classifier \(h_{t_{s}}^{k}\Big{(}x_{i(j)}\Big{)}\) in (14) is the same as the corresponding label \(y_{i}\) in the training set of \(\langle x_{i},y_{i}\rangle\); this weak classifier works correctly for \(x_{i}\); otherwise, it does not, and error occurs. In every training iteration, the error rates \(\phi_{j}^{k}\) of classifier candidates are calculated with the following equations in (15)-(17). \[\omega_{i}^{k}\Big{(}R_{t_{s},\Gamma_{j}}^{k}\Big{)}=\left\{ \begin{array}{c} W_{i}^{k},\ if\ h_{t_{s}}^{k}\Big{(}x_{i(j)}\Big{)}\
eq y_{i}\\ 0,\ otherwise\end{array} \right., \tag{15}\]  
\[e_{s}^{k}\Big{(}R_{t_{s},\Gamma_{j}}^{k}\Big{)}=\sum_{i=1}^{m}\omega_{i}^{k} \Big{(}R_{t_{s},\Gamma_{j}}^{k}\Big{)}, \tag{16}\]  
\[\phi_{j}^{k}=\Big{\{}e_{s}^{k}\Big{(}R_{t_{s},\Gamma_{j}}^{k}\Big{)}|\forall s \in\{1,2,\ldots,m-1\},\forall t_{s}\in\Gamma_{V_{j}}\Big{\}}. \tag{17}\]  
The best classifier candidate \(h_{t_{s(j)}^{k}}^{k}\Big{(}x_{i(j^{\prime})}\Big{)}\), whose polarity \(p^{k}\) and threshold \(t_{o}^{k}\) for the \(\eta^{k}\)th element of Haar-like feature vectors, has the smallest error rate \(\varnothing^{k}\), and is selected as a weak classifier in the kth iteration. In the kth iteration, the voting weight \(\rho^{k}\) of the selected weak classifier \(h_{t_{o(p^{k})}}^{k}\Big{(}x_{i(\eta^{k})}\Big{)}\) in the final strong classifier is calculated based on the \(\varnothing^{k}\) and given in (18):  
\[\rho^{k}=\frac{1}{2}ln\left[\frac{\left(1-\phi^{k}\right)}{\phi^{k}}\right]. \tag{18}\]  
The correct rate of the selected weak classifier should be higher than 0.5, which is the  
According to (19), the normalized weight updates are  
\[W_{i}^{k+1}=\frac{W_{i}^{k}}{Z^{k}}\times\left\{