# Position Detection of Doors and Windows Based on DSPP-YOLO
## 3 Dspp-Yolo
### Pseudocode
\begin{table}
\begin{tabular}{c c} \hline \hline
**Input:** & \(I\): set of \(n\) training images \\ \hline \multicolumn{2}{c}{\(M\): the width of anchor boxes} \\ \hline \multicolumn{2}{c}{\(N\): the height of anchor boxes} \\ \hline
**Output:** & \(P\): the target category \\ \hline \multicolumn{2}{c}{\((X,Y)\): coordinates of the center of the bounding boxes} \\ \hline \multicolumn{2}{c}{\(W\): the width of the bounding boxes} \\ \hline \multicolumn{2}{c}{\(H\): the height of the bounding boxes} \\ \hline \multicolumn{2}{c}{1. For \(n=1\) to \(I\) do:} \\ \hline
2. & According to the feature extraction algorithm to extract the training picture: \(P,X,Y,W,H\) \\ \hline
3. & Calculate the error between the target center coordinates predicted by the model \((X,Y)\) and the real training images \((X_{n},Y_{n})\) \\ \hline
4. & Calculate the error between the width-height coordinates of the model predicted detection box \((W,H)\) and the real detection box \((W_{n},H_{n})\) \\ \hline
5. & Calculate the confidence errors of the objects in the predictive detection boxes of models \(C_{n}\) \\ \hline
6. & Calculate the confidence errors of the objects is not found in the predictive detection boxes of models \\ \hline
7. & Calculate the error between the prediction categories \(P_{n}\) and \(P\) \\ \hline
8. & The training model adaptively adjusts learning according to the loss function \\ \hline
9. & Convergence of loss function \\ \hline
10. & Obtain the training model with the minimum loss function to achieve target detection \\ \hline \hline \end{tabular}
\end{table} 
Table 2: The hardware configuration of the experiment in this paper. This experiment is trained by GPU acceleration. The relevant configuration of the experiment is shown in Table 2. The training parameters are selected according to the experience of multiple experiments. In training, batch refers to the number of samples for updating training parameters in each batch of batch training, and subdivisions are subdivisions. The number of batches is used to reduce the burden on the graphics card. The batch is set to 32, and the subdivisions are set to 8; the momentum parameter is set to 0.9; the weight decay regular coefficient is set to 0.0005; the initial learning rate is set to 0.01; and the threshold value of IOU in NMS is 0.5. Figure 5: The dataset used in the experiment. (**a**) Public image. (**b**) Mobile phone camera shot. (**c**) Binocular camera (left eye) shot. ### Experimental Results

The loss function of DSPP-YOLO algorithm in training is shown in Figure 6 When the DSPP-YOLO algorithm has been trained for 22,000 times, the loss function has dropped below 0.1, and gradually becomes flat, but the loss function fluctuates greatly, due to the DSPP-YOLO algorithm changing some Res-n modules to Des-n modules. Under the same experimental conditions, the YOLOV1 algorithm, the YOLOV2 algorithm, the YOLOV3 algorithm, the YOLOV3-Tiny algorithm, the YOLOV3-144884 algorithm after extending the Darknet53 backbone network, and the DSPP-YOLO algorithm in this paper were trained separately, and the test results are shown in the Table 3 shown. Figure 6: DSPP-YOLO loss function. \begin{table}
\begin{tabular}{c c c c c} \hline \hline  & & **AP (Average** & **mAP (Mean** & **Detection Time** \\  & & **Precision**) & **Average Precision**) & **(136 Images)** \\ \hline YOLO & door & 70.2\% & & 45.85\% & 7.7032 s \\  & window & 21.5\% & & 48\% & 7.7124 s \\ \hline YOLOV2 & door & 72.6\% & & & \\  & window & 23.4\% & & & \\ \hline YOLOV3-Tiny & door & 73.9\% & & & \\  & window & 27.5\% & & & \\ \hline YOLO-144884 & door & 71.3\% & & & \\  & window & 25.4\% & & & \\ \hline YOLOV3 & door & 74.1\% & & & \\  & window & 29.3\% & & & \\ \hline DSPP-YOLO &door & 77.4\% & & & \\  & window & 38.1\% & & & \\ \hline \hline \end{tabular}
\end{table} 
Table 3: Comparison of detection indexes between YOLOV3 and DSPP-YOLO. According to the Table 3, the detection accuracy of DSPP-YOLO algorithm is 77.4% for door, 38.1% for window, and the mean average precision is 57.75%.