# A Super-Resolution Reconstruction Driven Helmet Detection Workflow
## 3 Method
### SR Module  
We take the dual regression network as our backbone architecture for super-resolution reconstruction [30]. The main idea is to add a dual regression task (from high-resolution image to low-resolution image) alongside the primal regression task (from low-resolution image to high-resolution image). Through the constraint of the reversible reconstruction, the mapping space between the low-high-resolution images is compressed and it is easier to fit to the real degrading relationship. The details of the SR model are shown in Figure 3.  
Figure 3: The architecture details of the SR module.  
Figure 2: The workflow of the proposed end-to-end helmet monitoring system.  
We employ a simple U shape symmetric architecture to produce the primal task. The input low-resolution images are fed into feature extractor consisting of stacked convolution layers. Then, the abstracted features are mapped onto the target image space through trans-convolution. Alongside the easy-to-understand primal architecture, we attach a one-way path to map the resolution of image from high to low. Through improving the deep supervision of the mapping loop, we can achieve the advanced reconstruction performance.  
Normally, the two regression tasks in SR are optimized following the classic \(l_{1}\) loss, that is to say, the mean absolute error (MAE). However, taking into consideration that the main purpose of our SR module is to perform the preparation for the following object detection module, when comparing with pixel-wise similarity, we should pay more attention to the sematic information. Therefore, we employ a combination of \(l_{1}\) loss and contextual loss as follows  
\[l=\sum_{i=1}^{N}[l_{1}(P(x_{i}),y_{i})+\alpha l_{c}(P(x_{i}),y_{i})+l_{1}(D(P( x_{i})),x_{i})] \tag{1}\]  
where \((x_{i},y_{i})\) is the \(i\)th low-resolution and high-resolution image pair. \(P(\cdot)\) and \(D(\cdot)\) are the primal regression and dual regression, respectively. \(\alpha\) is weighting coefficients of the contextual loss component. \(l_{1}\) indicates the MAE and \(l_{c}\) denotes the contextual loss calculated from Equation (2).  
\[l_{c}(x_{i},y_{i})=-\log(CX(F_{P}(x_{i}),F_{D}(y_{i}))) \tag{2}\]  
where \(F_{P}(\cdot)\) and \(F_{D}(\cdot)\) are the feature maps obtained from the feature extractor during primal task and dual task, respectively. Based on our symmetric architecture shown in Figure 3, the two feature maps always have the same size \(N\). In order to measure how similar the two feature maps are, we refer to the similarity in [31]. \(CX(F_{P}(x_{i}),F_{D}(y_{i}))=\frac{1}{N}\sum\limits_{l}\max\limits_{k}CX_{kj}\), where \(CX_{kj}\) calculates the similarity between the \(k\)th and the \(j\)th features from \(F_{P}(\cdot)\) and \(F_{D}(\cdot)\).  
\[CX_{kj}(F_{P}(\cdot),F_{D}(\cdot))=\frac{\exp(\frac{1-\widetilde{d_{kj}}}{h})} {\sum_{l}\exp(\frac{1-\widetilde{d_{kl}}}{h})} \tag{3}\]  
where \(\widetilde{d_{kj}}=d_{kj}/\left(\min\limits_{l}d_{kl}+\epsilon\right)\), and \(d_{kj}\) is the cosine distance between the \(k\)th and the \(j\)th features from \(F_{P}(\cdot)\) and \(F_{D}(\cdot)\). The parameters \(h=0.5\) and \(\epsilon=10^{-8}\). Due to the setting, the closer the two features, the smaller the \(d_{kj}\). Consequently, the smoothed \(\widetilde{d_{kj}}\) approaches 1 so as to produce large \(CX_{kj}\) as well as large \(CX(F_{P}(x_{i}),F_{D}(y_{i}))\). Because the \(F_{P}(\cdot)\) and \(F_{D}(\cdot)\) are abstracted information obtained from backbone network, they are full of sematic information and could help the SR module focus more on high level similarity instead of pixel-wise alignment. This proved to be great help for our detection.