# A Vision Servo System for Automated Harvest of Sweet Pepper in Korean Greenhouse Environment
## 2 Material and Methods
### Sweet Pepper Recognition  
[PERSON] et al. [26] used color information to recognize sweet pepper fruits. The color information of RGB (red, green, blue), hue, saturation, Y, Cb, and Cr in the fruit region of sweet peppers were used as learning factors of the momentum backpropagation algorithm. In general, images are represented by an RGB color model, and hue, saturation, Y, Cb, and Cr are represented by converting the RGB information of these images. \[Hue=\left\{ \begin{array}{ll}\theta&if\ B\leq G\\ 360-\theta&if\ B>G\end{array} \right., \tag{1}\]  
\[Saturation=1-\frac{3}{R+G+B}[\min(R,G,B)], \tag{2}\]  
\[\theta=\cos^{-1}\!\!\left(\frac{\frac{1}{2}[(R-G)+(R-B)]}{\sqrt{(R-G)^{2}+(R-B) (G-B)}}\right). \tag{3}\]  
\[\mathrm{Y}=0.257\mathrm{R}+0.504\mathrm{G}+0.095\mathrm{B}+16\]  
\[\mathrm{Cb}=-0.148\mathrm{R}-0.291\mathrm{G}+0.439\mathrm{B}+128,\]  
\[\mathrm{Cr}=0.439\mathrm{R}-0.368\mathrm{G}-0.071\mathrm{B}+128\]  
Hue and saturation are calculated through Equations (1)-(3), and Y, Cb, and Cr are calculated through Equation (4). Y means luminance, Cb means blue-difference, and Cr means red-difference. According to [PERSON] et al. [27], the process of establishing the connection strength of a neural network was called learning. The error signal (8) was calculated using the difference between the output calculated by the input and the expected output of the input, and the process of correcting the connection strength by propagating the error signal to the previous layer was repeated. At this time, the process of propagating the error signal to the previous layer was called the backpropagation algorithm, and neural network learning was performed through this process. In the backpropagation  
Figure 8: The stereo vision system (Cam1 and Cam2) attached laser source and end-effector attached to Cam3. algorithm, the connection strength is changed by the error signal, and if the learning rate is set small, the amount of connection strength variation is reduced, and the learning process is slowed down. In order to prevent the learning process from being slowed down, the variation of the previous learning phase is supplementary used when the connection strength is changed. This method is referred to as a momentum backpropagation algorithm [28]. \[v^{new}=\frac{\beta\ v^{old}}{\|v^{old}\|},\ \beta=0.7^{n}\sqrt{p}, \tag{5}\]  
For initial connection strength setting, the initial connection strengths were set in the range of \(w=-0.5\) to +0.5 and \(v=-0.5\) to +0.5 according to [PERSON] and [PERSON] [29]. Connecting strength \(v\) was initialized by Equation (5) at the start of learning. In Equation (5), \(n\) is the number of neurons in the input layer and \(p\) is the number of neurons in the hidden layer. The method of [PERSON] and [PERSON] [30] was used to determine the number of hidden neurons. The maximum number M of linearly separable regions was calculated as Equation (6); \(n\) is the number of dimensions of the input pattern space and \(p\) is the number of neurons in the hidden layer. In Equation (6), _if_\(k\) is less than \(p\) and \(n\) is larger than or equal to \(p\), then M was calculated as Equation (7). \[\text{M}=\sum_{k=0}^{n}pC_{k}, \tag{6}\]  
\[\text{M}={}_{p}C_{0}+{}_{p}C_{1}+\cdots+{}_{p}C_{p}=2^{p}, \tag{7}\]  
the number of neurons in the hidden layer to solve the problem of the linearly separable region, p, was calculated by Equation (8). \[p=\log_{2}M, \tag{8}\]  
\[\theta=\cos^{-1}\!\!\left(\frac{\frac{1}{2}[(R-G)+(R-B)]}{\sqrt{(R-G)^{2}+(R-B) (G-B)}}\right). \tag{3}\]0 \[\theta=\cos^{-1}\!\!\left(\frac{\frac{1}{2}[(R-G)+(R-B)]}{\sqrt{(R-G)^{2}+(R-B) (G-B)}}\right). \tag{3}\]1  
The learning rate a was changed within the range of 0.001-0.1, and it was set with reference to the progress of learning. In this study, a unipolar sigmoid function was used. This is because the size of the image information transmitted as the input was normalized to a size of 0 to 255. In Equation (9), \(\alpha\) means learning rate and \(\beta\) means momentum constant.