# An Automatic Counting Algorithm for Topographic Maps Based on Videos for Map Management
## 3 Materials and Methods
### The Proposed Fusion Window Counting Algorithm
#### 3.2.1 Deformable Parts Model Based on Fast Feature Pyramids  
The DPM algorithm [19; 20; 21; 22] can better detect different types of targets in complex natural environments by integrating the overall information of the target to be detected and the relationships between its components. The algorithm adopts a multi-component strategy to construct a mixed multi-angle deformable parts model for the existence of multiple views of the target; for the deformation problem of the target itself, it adopts a strategy based on the graph structure, which improves the adaptability of the model to the various deformation problems of the target. Moreover, ideal results have been achieved in the identification of mixed multi-angle targets, such as people and cars [23; 24]; so, it is feasible to use this algorithm to detect mechanical wheel targets. However, the traditional DPM algorithm suffers from the problems of being computationally intensive and time-consuming [25; 26], and therefore, it cannot satisfy the requirements for the fast checking of topographic maps. According to the detection process of the algorithm, the detection speed mainly depends on two aspects: (1)' the feature extraction of feature pyramids and (2) the sliding window method for target localization. Figure 6: The flowchart of the work. The acceleration of the feature pyramid part can not only shorten the construction time of the pyramid, it can also largely reduce the computation of the sliding convolution operation. Therefore, in this paper, we draw on the idea of fast feature pyramids for optimization and adopt the FFP-DPM algorithm to detect mechanical wheels. This process mainly includes the following key stages. 1. Model training to obtain filters  
The training phase is a crucial process that enables the model to play an ideal role in the detection phase. The essence of model training in the DPM algorithm is the obtaining of filters, which include three parts: a coarse-root filter describing the global contour of the target; several part filters describing the detailed features of the target; and a spatial model describing the deviation loss of each part filter relative to the root filter. The filter is a rectangular template defined by a d-dimensional weight vector, and a model for an object with n parts can be defined as an (\(n+2\)) tuple:  
\[\mathbf{F}=(\mathbf{F}_{0},\mathbf{P}_{1},\cdots,\mathbf{P}_{\mathrm{n}},b) \tag{1}\]  
where \(\mathbf{F}_{0}\) is a root filter, \(\mathbf{P}_{\mathrm{i}}\) is a model for the \(i\)th part, and \(b\) is a real-valued bias term. Each part model is defined by  
\[\mathbf{P}_{\mathrm{i}}=(\mathbf{F}_{i},v_{i},d_{i}) \tag{2}\]  
where \(\mathbf{F}_{\mathrm{i}}\) is a filter for the \(i\)th part, \(v_{i}\) is the coordinate of part \(i\) relative to the root position, and \(d_{i}\) defines a deformation cost for each possible placement of the part relative to the anchor position. 2. Building the fast feature pyramids  
As the size and position of the mechanical wheels in the image are not fixed, the traditional DPM algorithm adopts the idea of multi-scale to construct the feature pyramid, in which the features are based on the enhanced histogram of the oriented gradient proposed by [PERSON] (FHOG). The specific steps to build the pyramid are as follows: starting from the original image, we down-sample in each octave from the previous step \(2^{(1/\mathrm{interval})}\) times to obtain the image pyramid, with 10 scales in each octave in the model (i.e., interval = 10), and then, the feature pyramid is formed by combining the characteristic diagrams obtained by computing the features on each level of the image. The idea of the fast feature pyramid [27] approximates the features of the current scale image from the features of the adjacent scale image by extrapolation, which can improve the detection speed with almost no loss of accuracy. The specific process is as follows (as shown in Figure 7).