# Person Search via Deep Integrated Networks
## 3 Overview of the Deep Integrated Networks for Person Search
### Similarity Measure with a Learnable Distance Metric  
The similarity between the vectors is measured and the results are sorted after extracting the feature vector for each bounding box. Studies have showed that the Mahalanobis distance can obtain better results than the Euclidean distance, and many learnable metrics have been proposed [12; 40; 41; 48; 49]. Among them, KISSME [12] can easily obtain the metric based on the statistic models \(\theta_{P}\) and \(\theta_{N}\). The log likelihood ratio is given as follows:  
\[\delta\Big{(}x_{i},x_{j}\Big{)}=log\Bigg{(}\frac{f(x_{ij}|\theta_{N})}{f(x_{ ij}|\theta_{P})}\Bigg{)} \tag{10}\]  
where \(x_{ij}=x_{i}-x_{j}\) is the pairwise difference. Thus, a higher value of \(\delta\Big{(}x_{i},x_{j}\Big{)}\) means that the probability of pair \(\Big{(}x_{i},x_{j}\Big{)}\) being negative is larger. Furthermore, statistic models \(\theta_{P}\) and \(\theta_{N}\) can be modelled as a multi-dimensional Gaussian model, and the mean is a zero vector (i.e., \(\mu_{ij}^{P}=\sum\limits_{y_{ij}=1}\Big{(}x_{i}-x_{j}\Big{)}=0\) and \(\mu_{ij}^{N}=\sum\limits_{y_{ij}=0}\Big{(}x_{i}-x_{j}\Big{)}=0\)). Therefore, Equation (10) can be rewritten as follows [12]:  
\[\begin{array}{ll}\delta\Big{(}x_{ij}\Big{)}&=log\Bigg{(}\frac{\frac{1}{\sqrt {\frac{\left|x_{ij}^{2}\right|}{N_{ij}-0}\right|}}exp(-1/2x_{ij}^{T}y_{ij}^{- -1}-\alpha x_{ij})}{\Bigg{(}\frac{1}{\sqrt{\left|x_{ij}^{2}\right|}}exp(-1/2x _{ij}^{T}y_{ij}^{-1}-x_{ij})}\Bigg{)}\wedge\ \Sigma_{y_{ij}=1}\\ &=\sum\limits_{y_{ij}=1}\Big{(}x_{i}-x_{j}\Big{)}(x_{i}-x_{j})^{T},\Sigma_{y _{ij}=0}=\sum\limits_{y_{ij}=0}\Big{(}x_{i}-x_{j}\Big{)}(x_{i}-x_{j})^{T}\\ \end{array} \tag{11}\]  
After the log function, the log likelihood can be represented as follows [12]:  
\[\delta\Big{(}x_{ij}\Big{)}=x_{ij}^{T}\sum\limits_{y_{ij}=1}^{-1}x_{ij}+log \Bigg{(}\left|\Sigma_{y_{ij}=1}\right|\Bigg{)}-x_{ij}^{T}\sum\limits_{y_{ij}= 0}^{-1}x_{ij}-log\Bigg{(}\left|\Sigma_{y_{ij}=0}\right|\Bigg{)} \tag{12}\]  
The \(log\Bigg{(}\left|\Sigma_{y_{ij}=0}\right|\Bigg{)}\) and \(log\Bigg{(}\left|\Sigma_{y_{ij}=1}\right|\Bigg{)}\) terms are constant; hence, Equation (12) can be simplified and represented as follows:  
\[d\Big{(}x_{i},x_{j}\Big{)}=x_{ij}^{T}\bigg{(}\Sigma_{y_{ij}=1}^{-1}-\Sigma_{y _{ij}=0}^{-1}\bigg{)}x_{ij}=(x_{i}-x_{j})^{T}M\Big{(}x_{i}-x_{j}\Big{)} \tag{13}\]  
where \(d\Big{(}x_{i},x_{j}\Big{)}\) is the Mahalanobis distance between two points \(x_{i}\) and \(x_{j}\). Since the distance cannot be negative, the matrix \(M\) must satisfy the positive semidefinite constraint [43]; in other words, all the eigenvalues of \(M\) are non-negative. However, in Equation (13), \(M=\bigg{(}\Sigma_{y_{ij}=1}^{-1}-\Sigma_{y_{ij}=0}^{-1}\bigg{)}\) is a symmetric matrix but would semidefinitely not be positive. Hence, in order to enforce the constraint to the matrix \(M\), one method is to resort to the eigenvalues of \(M\) and construct matrix \(\hat{M}\) using those vectors with a positive eigenvalue [48]. The dimension reduction was first applied for \(x_{i}\) using the PCA to ensure that inverse matrices \(\Sigma_{y_{ij}=1}\) and \(\Sigma_{y_{ij}=0}\) exist [12]. However, the discriminate features would be discarded via dimensional reduction. In [11], the authors were inspired by the linear discriminant analysis (LDA) and proposed a transformation \(w\) to enlarge the distance between dissimilar pairs while shortening the distance between the same pairs, as follows:  
\[J(w)=\frac{w^{T}\Sigma_{ij=0}w}{w^{T}\Sigma_{ij=1}w} \tag{14}\]where \(w\) is a projected matrix that can be resolved by the eigenvalue decomposition that can factorize a matrix into a form of eigenvalues and eigenvectors. Thus, Equation (14) can be reformulated as follows to maximise \(J(w)\)[11]:  
\[w*=\underset{w}{argmax}w^{T}\Sigma^{\prime}_{ij=0}ws.t.w^{T}\Sigma^{\prime}_{ ij=1}w \tag{15}\]