# Ball Tracking Based on Multiscale Feature Enhancement and Cooperative Trajectory Matching
## 3 Methods
### Detection Based on MNet
#### 3.3.3 Detection Module  
Ball detection has a priori characteristics. In general, it can be considered that in a sports match, the number of balls in each frame does not exceed 1. Under this simple assumption, this article converts global detection into regional detection, that is, it first determines the original image area RoI (Region of Interest, RoI) [35] where the ball may appear and then performs conventional detection tasks on this RoI to output soccer. The precise detection frame is similar but not identical to RPN. In order to enhance the detection accuracy of soccer and reduce the computational cost, based on the basic structure of CenterNet, the heuristic composite sampling strategy and multiscale-enhanced backbone network mentioned above are used to improve it into a new ball detection model with a foreground and background classifier. Specifically, for the complete input image, the local area patch needs to be cut out through the heuristic composite sampling strategy mentioned above. Each patch contains a label, whether it belongs to the background or the foreground. That is, it contains a ball or does not contain a ball. Each patch needs to extract features through the MNet we proposed and then output the center point prediction, detection frame size prediction, and classifier prediction. Figure 3: The architecture of MNet. (**a**) MNet. The input image shape is 256 \(\times\) 256 \(\times\) 3. After 3 MC downsampling blocks, the feature map size is 32 \(\times\) 32 \(\times\) 256, and then it is restored to 256 \(\times\) 256 \(\times\) 3 after 3 Up Blocks. (**b**) MC block contains 4 groups of different scale feature extraction branches. The output features of each branch are concatenated and then residual connections are performed. (**c**) Up block uses bilinear interpolation to complete upsampling. \(p\) is the true position of a certain object key point in the picture, and \(c\) is the category. \(\hat{p}=\lfloor\frac{p}{r}\rfloor\) is the position on the low-resolution image corresponding to \(p\), then Equation (14) is the heat map estimate of category \(c\). \[Y_{xyc}=exp(-\frac{(x-\hat{p}_{x})^{2}+(y-\hat{p}_{y})^{2}}{2\sigma_{p}^{2}}) \tag{14}\]  
where \(\sigma_{p}\) represents the standard deviation appropriate to the object size. If the radius of the label area formed by the two objects overlaps, the overlapping area will take the maximum value. The objective function during training is Focal Loss, which is the logistic regression function at the pixel level shown as Equation (15). \[L_{k}=\frac{-1}{N}\sum\left\{ \begin{array}{cl}(1-\hat{Y}_{xyc})^{\alpha}log( \hat{Y}_{xyc}),&\quad\text{ if }Y_{xyc}=1\\ (1-Y_{xyc})^{\beta}(\hat{Y}_{xyc})^{\alpha}log(1-\hat{Y}_{xyc}),&\quad\text{ otherwise}\end{array} \right. \tag{15}\]  
where \(\alpha\) and \(\beta\) are the hyperparameters when training according to the Focal Loss set in CornerNet, and \(N\) is the total number of samples that control the loss normalization of all positive samples. For each real object frame \(k\) and its boundary position data, its real size can be obtained by \(S_{k}=(x_{2}^{(k)}-x_{1}^{(k)},y_{2}^{(k)}-y_{1}^{(k)})\), so the width and height size output of the object can still be trained through L1 loss, shown as Equation (16). \[L_{size}=\frac{1}{N}\sum_{k-1}^{N}|\hat{S}_{p_{k}}-S_{k}| \tag{16}\]  
The improved predictor we proposed uses \(r=1\) equal resolution processing in ball detection, and its advantage is that it can remove the prediction of the center point offset. At the same time, a classifier is added to determine whether the current Patch contains a ball. Finally, each Patch will get a \(0<\hat{y}<1\) probability output to indicate whether other predictions corresponding to the current Patch are valid. For foreground or background classification problems, the cross-entropy function can be used as the objective function for classifier prediction.