# A Fire Detection Algorithm Based on Tchebichef Moment Invariants and PSO-SVM
## 4 Particle Swarm Optimization-Support Vector Machine (PSO-SVM)  
### Support Vector Machine (SVM)  
SVM is a supervised learning method based on the statistical learning theory and principle of structural risk minimization. Compared with neural network learning, SVM can solve the problems of over-fitting and local optimum. It can learn in high-dimensional feature spaces and obtain excellent learning performance with limited training samples. Therefore, SVM is particularly suitable for detecting whether the candidate area is on fire or not. As for the SVM, the training samples include several consecutive images of the candidate area. The training sample set \(D_{t}\) can be expressed as follows:  
\[D_{t}=\left\{\left(\mathbf{V}_{i},y_{i}\right)\right|\mathbf{V}_{i}\in\mathbf{R}^{d},\,y_{i }\in\{-1,+1\},\,i=1,\,2,\,3,\,\cdots,\,n\right\} \tag{25}\]  
where \(\mathbf{V_{i}}\) is the input feature vector of an image to train the SVM classifier; \(y_{i}\) is either \(-1\) or \(+1\), indicating that the training sample belongs to a fire or non-fire image; and \(n\) is the size of the training sample set. In the d-dimensional space, the essential problem of SVM is to find a hyper-plane to divide the training samples into two different classes. In the case of non-linear classification, the input vector \(\mathbf{V_{i}}\) needs to be mapped into a very high-dimensional feature space by non-linear mapping \(\theta(\mathbf{V_{i}})\). Afterwards, they can become linearly classified, as shown in Figure 1, just like achieving the non-linear classification algorithm in the relative original space. The hyper-plane can be denoted by:  
\[\mathbf{w}^{T}\theta(\mathbf{V})+b=0 \tag{26}\]  
in which every sample is subjected to:  
\[\left\{ \begin{array}{l}\mathbf{w}^{T}\theta(\mathbf{V}_{i})+b\geq+1,\,y_{i}=+1\\ \mathbf{w}^{T}\theta(\mathbf{V}_{i})+b\leq-1,\,y_{i}=-1\end{array} \right. \tag{27}\]  
where \(\mathbf{w}\) is the weight coefficient and \(b\) is the offset coefficient. As shown in Figure 1, the margin between different classes can be derived as \(2/\left\|\mathbf{w}\right\|\). The optimal separating hyper-plane is that which separates the different classes with the maximal margin. It is easy to check that the maximum of \(2/\left\|\mathbf{w}\right\|\) is equivalent to the minimum of \(\left\|\mathbf{w}\right\|^{2}/2\). Considering the case in which the training sample set \(D_{t}\) cannot be separated without error, the purpose of SVM can be described as:  
\[\left\{ \begin{array}{l}\min\,\frac{1}{2}\left\|\mathbf{w}\right\|^{2}+C\sum\limits _{i=1}^{n}\xi_{i}\\ s.t.\,y_{i}\big{(}\mathbf{w}^{T}\theta(\mathbf{V}_{i})+b\big{)}\geq 1-\xi_{i}\end{array} \right. \tag{28}\]  
where \(C\) is the penalty factor of error classification; \(\xi\) is the slack variable; and \(\xi\geq 0\). Figure 1: The schematic diagram of support vector machine (SVM) classification. According to Equation (28), the purpose is obviously a convex optimization problem. For the convenience of calculations, Equation (28) can be substituted into [PERSON]'s dual formulation, as shown in the following expression [18; 37]:  
\[\left\{ \begin{array}{c}\min\sum\limits_{i=1}^{n}\beta_{i}-\frac{1}{2}\sum \limits_{i=1}^{n}\sum\limits_{j=1}^{n}y_{i}y_{j}\beta_{i}\beta_{j}\theta(\mathbf{V _{i}})^{T}\theta(\mathbf{V_{j}})\\ s.t.\ 0\leq\beta_{i}\leq C,\ \sum\limits_{i=1}^{n}\beta_{i}y_{i}=0\end{array} \right. \tag{29}\]  
where \(\beta_{i}\) is the Lagrange multiplier corresponding to every training sample and \(\beta_{i}\geq 0\). The sample is the support vector for which \(\beta_{i}\
eq 0\), lying on one of the two hyper-planes: \(\mathbf{w}^{T}\theta(\mathbf{V}^{+})+b=+1\) and \(\mathbf{w}^{T}\theta(\mathbf{V}^{-})+b=-1\). To deal with the nonlinear SVM problem easily, a kernel function satisfying the [PERSON]'s condition is introduced to map the data into a high dimensional space. \(K(\mathbf{V_{i}},\mathbf{V_{j}})\) denotes the kernel function, and \(K(\mathbf{V_{i}},\mathbf{V_{j}})=\theta(\mathbf{V_{i}})^{T}\theta(\mathbf{V_{j}})\) in the feature space [37].