# Sample Reduction-Based Pairwise Linear Regression Classification for IoT Monitoring Systems
## 3 SRbPLRC Framework for Large-Size Video Face Recognition
### DSRbPLRC Algorithm  
Suppose that there are \(C\) large-size videos/image sets, denoted as \(\{X_{1},\cdots,X_{C}\}\), with each video containing \(N_{i}\) images and each image being \(x^{i}_{m}\in\mathcal{R}^{q\times 1}\). Additionally, suppose that the image vector \(x^{i}_{m}\) is normalized to [0, 1]. Using these definitions, the \(i^{th}\) gallery video or image set can be formulated as \(X_{i}=\{x^{i}_{j}|j=1,\cdots,N_{i}\}\) and the probe video or image set can be represented as \(Y=\{y_{j}|j=1,\cdots,n\}\), where \(n\) is the number of images in the probe video \(Y\). The DSRbPLRC algorithm aims to divide large-size videos into several small-size sub-videos to improve its ability to deal with the large-size video recognition task. Assuming that \(t\) is the division threshold, i.e., the number of samples in the divided video is no larger than \(t\), the related (or unrelated) gallery video \(X_{i}\) can be randomly divided into \(X_{i1},X_{i2},\cdots,X_{ia}\), where \(a=[N_{i}/t+1]\) is the number of the divided sub-videos, and  
\[ \begin{array}{l}X_{ij}=\{x^{ij}_{1},\cdots,x^{ij}_{i}\},\ \ j=1,\cdots,a-1,\\ X_{ia}=\{x^{ia}_{1},\cdots,x^{ia}_{N_{i}-t(a-1)}\},\end{array}  \tag{1}\]  
where \(i\) means the sub-video \(X_{ij}\) or \(X_{ia}\) comes from the original \(i^{th}\) gallery video, and \(j\) means that it is the \(i^{th}\) sub-video of \(X_{i}\). Figure 2: A diagram of the unrelated S3 and S4 set-constructing strategies. In S3, the sparse representation is used to learn the distances, while in S4, the collaborative representation is used. Similarly, the probe video \(Y\) can be divided into \(Y_{1},Y_{2},\cdots,Y_{b}\), where \(b=[n/t+1]\) is the number of the divided sub-videos of \(Y\), and  
\[ \begin{array}{l}Y_{e}=\{y_{1}^{e},\cdots,y_{e}^{e}\},\ e=1,\cdots,b-1,\\ Y_{b}=\{y_{1}^{e},\cdots,y_{n-t(b-1)}^{b}\},\end{array}  \tag{2}\]  
where \(e\) means the \(e^{th}\) sub-video of \(Y\). The DSRbPLRC algorithm uses spanning subspaces to represent each sub-video; thus, the gallery set \(X_{ij}\) can be represented as \(X_{ij}\alpha=[x_{1}^{ij},\cdots,x_{t}^{ij}]\alpha\in\mathcal{R}^{q\times 1},\ \ i=1, \cdots,C\), \(j=1,\cdots,a\), which can represent all images in \(X_{ij}\). The probe set \(Y_{e}\) can be represented as \(Y_{e}\eta=[y_{1}^{e},\cdots,y_{t}^{e}]\eta,\ \ e=1,\cdots,b\). Finally, the unrelated set \(U_{ij}\) that corresponds to the gallery set \(X_{ij}\) can be represented as \(U_{ij}\gamma=[u_{1}^{ij},u_{2}^{ij},\cdots,u_{N_{i}}^{ij}]\gamma_{\mathcal{R }}\in\mathcal{R}^{q\times 1}\). By minimizing the Euclidean distance between \(Y_{e}\eta\) and \(X_{ij}\alpha\) (or \(U_{ij}\gamma\)), we obtain the following optimization problem:  
\[ \begin{array}{l}\min\ \ ||X_{ij}\alpha-Y_{e}\eta||_{2}^{2}\\ s.t.\ \ \sum\limits_{i}\alpha_{i}=1,\ \ \sum\limits_{i}\eta_{i}=1,\end{array}  \tag{3}\]  
and  
\[ \begin{array}{l}\min\ \ ||U_{ij}\gamma-Y_{e}\eta||_{2}^{2}\\ s.t.\ \ \sum\limits_{i}\gamma_{i}=1,\ \ \sum\limits_{i}\eta_{i}=1.\end{array}  \tag{4}\]  
Then, using the least squares algorithm, the related and unrelated representation coefficients \(\beta_{e,r}^{ij}\) and \(\beta_{e,u}^{ij}\) between \((X_{ij},Y_{e})\) and \((U_{ij},Y_{e})\), respectively, can be computed as follows:  
\[ \begin{array}{l}\beta_{e,r}^{ij}=(S_{e,r}^{ij}\ \,T_{e,r}^{ij})^{-1}S_{e,r}^{ij}\ \,T_{e,r}^{ij},\\ \beta_{e,u}^{ij}=(S_{e,u}^{ij}\ \,T_{e,u}^{ij})^{-1}S_{e,u}^{ij}\ \,T_{e,u}^{ij},\end{array}  \tag{5}\]  
where \(S_{e,r}^{ij}=y_{mean}^{i}-x_{mean}^{ij}\), \(\beta_{e,u}^{ij}=y_{mean}^{m}-u_{mean}^{ij}\), \(S_{e,r}^{ij}=[\bar{X}_{ij},-\bar{Y}_{e}]\), \(S_{e,u}^{ij}=[\bar{U}_{ij},-\bar{Y}_{e}]\), \(\bar{X}_{ij}=[x_{1}^{ij}-x_{mean}^{ij}\cdots,x_{N_{i}}^{ji}-x_{mean}^{ij}]\), \(\beta_{e,r}^{ij}=[\alpha;\eta]\), \(\beta_{e,u}^{ij}=[\gamma_{i};\eta]\), and the definitions of \(\bar{Y}_{e}\), \(\bar{U}_{ij}\) are the same as in \(\bar{X}_{ij}\). Thus, the related metric distance \(d_{e,r}^{ij}\) and the unrelated metric distance \(d_{e,u}^{ij}\) between \(X_{ij}\) and \(Y_{e}\) can be calculated as follows:  
\[