# Fusing Context Features and Spatial Attention to Improve Object Detection
###### Abstract  
Context features are mostly used to determine the boundary of a target, which allows one to better locate an object. In this paper, we propose the fusion of the spatial attention mechanism and contextual features to simulate the recognition of objects based on the human eye, thereby improving the detection accuracy of detectors. We chose the PASCAL VOC2007+2012 general dataset to test the generality of our method and examined the improved accuracy of our proposed detector on various targets. Our method showed improved accuracy for small targets and partially overlapping targets. Our proposed model improved the detector's accuracy by 3.34%.  
context feature; attention mechanism; YOLO-v3; object detection +
Footnote †: journal:  
0000-0001-5000-0000-00001-5000][PERSON]  
0000-0001-5000-0000-0000-0000-00000-0000-0  
while [13; 14] is tailored to design algorithms for low-precision complex objects. Most two-stage and one-stage object detection algorithms are based on anchor frames. A anchor frame is an a priori frame with different aspect ratios predefined in the object detection algorithm. In object detection, multiple anchor frames are first generated, and then the category and offset are predicted for each anchor frame. Next, the anchor frame is adjusted according to the predicted offset to obtain the predicted bounding box. Finally, the predicted bounding box needed by the output is screened. The size, aspect ratio, and number of anchor frames have an important influence on the performance of target detectors based on anchor boxes. When selecting the size of the anchor box, the aim is that the anchor box perfectly fits the size of the object itself. Therefore, YOLO-900 [1] was proposed, which uses \(K\)-means [4] instead of the manual selection method to determine the average size of the object, so that the size of the anchor box fits the object more perfectly; however, as the anchor box is closer to the object, the loss of surrounding environment information is greater. Context features can better help us determine the boundaries of objects and better localize objects. For example, birds and airplanes are small colored or white objects in a blue sky. Comparing the blue background information with the white object information can better help determine the boundaries and object positions. At the same time, the context features can also help determine the category of the object. If the background is a blue sky, the target may be a bird or an airplane. If the background is a beach, the object may be a human or a vehicle. Context features can help us further narrow the range of information to ensure feature extraction. Adding context features [15] to target detectors can help improve the object detection accuracy. Meanwhile, context features cannot be used alone. Just like human eyes, if the object is as important as the background, then most of the attention may be paid to the relationship between the background and the object rather than the properties of the object itself, which is also an attention mechanism [16] source. Therefore, we ignore most of the background information and only fuse a small part of the background information and object information for object detection.  
This paper proposes the following three contributions:  
1. Improving the YOLO-v3 model to better extract the features of small objects;
2. Adding context features to improve the detection accuracy of overlapping objects;
3. Integrating an attention mechanism to better detect difficult targets.