# DB-Net: Detecting Vehicle Smoke with Deep Block Networks
## 4 Method
### DB-Net  
The FCN [20] dramatically impacted the field of semantic segmentation through its encoder-decoder architecture. The encoder is utilized for feature extraction, while the decoder is for aggregating and classifying features. The operations were executed sequentially in the encoder-decoder structured model. Inspired by the encoder-decoder structure and based on the block-wise prediction formulation, we propose the DB-Net, a dual-branch network with a main branch and an aggregation branch. The main branch is designed for feature extraction, and the aggregation branch is for feature enhancement. With the help of the dual-branch architecture, DB-Net can extract and aggregate features parallelly, which is more efficient than the encoder-decoder structured models.  
The architecture of the proposed DB-Net is presented in Figure 4. In detail, the main branch is a four-stage convolutional neural network; the feature map yielded by each stage is reduced to 1/2 the size of the stage input along each spatial dimension. In this work, we used the top four stages of a 50-layer ResNet [27] as the main branch to achieve a balance between computation efficiency and performance effectiveness. After a \(1/2^{4}\) downsampling in the main branch, an input image with the spatial size of \(960\times 540\) was reached to a feature map with \(60\times 34\) spatial size. The feature map was already the same size as the labeled ground truth, but it discarded lots of detailed information during the forward propagation. Therefore, we have designed an aggregation branch which fuses the features yielded by each stage of the main branch from shallow to deep to obtain contextual information.  
In the aggregation branch, convolution and downsampling operations are utilized to unify the output of the shallower stage and the next stage to the same shape. In detail, convolutional operations ensure channel consistency, while downsampling operations adjust the size of the shallower feature map to match the feature map produced by the next stage. For example, the first and second stages of the main branch produce feature maps of sizes \(64\times 480\times 270\) and \(256\times 240\times 135\), respectively. The aggregation branch first uses a convolution layer to unify the channel size of both feature maps. It then downsamples the feature map produced by the first stage to match the size of the feature map produced by the second stage. After downsampling, both feature maps have the same shape of \(2\times 240\times 135\). Subsequently, the aggregation branch performs a pixel-wise summation of the two feature maps for aggregating. We repeated the process from shallow to deep until features from each stage were fused.  
After obtaining the features, a softmax function gives the probability of features, which can be written as:  
\[P_{i,j,:}=Softmax(X_{i,j,:}) \tag{4}\]  
\(X_{i,j,:}\) represent the feature at the position (\(i\), \(j\)). In the training phase, a standard cross-entropy (CE) loss function is applied to regularize the parameter optimization. Suppose\(G_{i,j,:}\) is the ground truth of the block at the \(i\)-th row, \(j\)-th column label. The classification loss can be expressed as:  
\[L_{cls}=\sum_{i=1}^{C}\sum_{j=1}^{R}CE(P_{i,j,:},G_{i,j:}) \tag{5}\]