# Semantic Segmentation Based on Depth Background Blur
## 3 Proposed Method
### The Algorithm of Bokeh  
For any input image and the corresponding label in the training stage, \(img\in\mathbb{R}^{H\times W\times C}\), \(GT\in\mathbb{R}^{H\times W}\), \(\varphi\in\mathbb{R}^{H\times W\times C}\), where \(H\times W\) is the size of the image, and \(C\) represents the number of image channels (for RGB, \(C=3\)), the background blur module bokeh can be summarized as follows  
\[\varphi(img,GT,\sigma)=\varphi^{l}(img,GT,1)+\varphi^{B}(img,GT,\sigma) \tag{2}\]  
\[\varphi^{l}(img,GT,1)=img(i,j,k)\times[I(i,j)-BGL(i,j)]\times 1 \tag{3}\] \begin{table}
\begin{tabular}{l c c c c c c c c c} \hline
**Class** & **Background** & **Aeroplane** & **Bicycle** & **Bird** & **Boat** & **Bottle** & **Bus** & **Car** & **Cat** & **Chair** \\ \hline P(\%) & 74.81 & 0.68 & 0.29 & 0.85 & 0.58 & 0.58 & 1.67 & 1.33 & 2.57 & 1.09 \\ \hline
**Cow** & **Dining Table** & **Dog** & **Horse** & **MotorBike** & **Person** & **Potted Plant** & **Sheep** & **Sofa** & **Train** & **Monitor** \\ \hline
0.79 & 1.29 & 1.66 & 0.87 & 1.10 & 4.57 & 0.64 & 0.86 & 1.38 & 1.52 & 0.90 \\ \hline \end{tabular}
\end{table} 
Table 2: of 21 categories (with background) on the PASCAL VOC 2012 [19] training dataset. Figure 4: The distribution map of the interested domain \(\varphi^{l}\) and background domain \(\varphi^{B}\). \[\varphi^{B}(img,GT,\sigma)=img(i,j,k)\times BGL(i,j)\times\sigma \tag{4}\]  
where:  
\[0\leq i\leq H-1,\;0\leq j\leq W-1,\;k=1,2,\cdots,C,\;\sigma\in(0,1]\]  
We denote \(\varphi^{I}(img,GT,1)\) as the interest domain, and \(\varphi^{B}(img,GT,\sigma)\) as the background blur domain. When \(BGL(i,j)=1\), it means that the pixel at \((i,j)\) belongs to the background; otherwise, it belongs to the interest domain. \(I\) is an H-by-W matrix of ones. \"\(\ast\)\" is the matrix Hadamard product operator. \(\sigma\) denotes the fuzzy factor, whose value is inversely proportional to the degree of blur. Its selection strategy will be given later. Background label variable \(BGL(i,j)\) can be presented as:  
\[BGL(i,j)= \begin{cases}1,&GT(i,j)=0\\ 0,&Otherwise\end{cases}  \tag{5}\]  
Assume that \(R^{B}\) is the proportion of the background field in an image, and \(R^{I}\) is the proportion of the field of interest. Obviously, we obtain \(R^{B}+R^{I}=1\), where \(R^{B}\) and \(R^{I}\) are defined as follows:  
\[R^{B}=\frac{Num(\varphi^{B})}{H\times W},R^{I}=\frac{Num(\varphi^{I})}{H \times W} \tag{6}\]  
where \(Num(\varphi^{B})\) is the sum of the pixel number of the background domain, and \(Num(\varphi^{I})\) is the sum of the pixel number of the interested domain. For PASCAL VOC 2012 train dataset, \(Num(\varphi^{B})=Num(pixel=0)+Num(pixel=255)\), \(Num(\varphi^{I})=\sum_{i=1}^{20}Num(pixel=i)\). For the selection of the fuzzy factor \(\sigma\), we initially set \(R^{B^{*}}\) equal to the background rate of the whole dataset (e.g., for PASCAL VOC train dataset, \(R^{B^{*}}=0.7481\)). Suppose \(\sigma\in[1-R^{B^{*}},1]\). The degree of background blur of each image depends on the distribution of its own background. If its background proportion is larger, the background blurring degree should be aggravated. Hence, \(\sigma\) should be smaller. Conversely, \(\sigma\) should be greater. Specifically, when \(R^{B}=0\), only the field of interest is involved, the corresponding background blurred factor \(\sigma\) should be maximized. When \(R^{B}=1\), the background domain is barely included, the \(\sigma\) should be minimized. Let \(R^{B}\) and \(\sigma\) satisfy the linear relation:  
\[\sigma=-\alpha\times R^{B}+\beta \tag{7}\]  
such that  
\[\left\{ \begin{array}{l}R^{B}=0,\sigma=1\\ R^{B}=1,\sigma=1-R^{B^{*}}\end{array} \right.\]  
where \(\alpha,\beta\in\mathbb{R}\).