In the urban battlefield environment, the rapid movement and frequent occlusion of military targets often lead to low detection accuracy during target recognition, and the existing models are difficult to meet the real-time requirements of battlefield recognition. To address this problem, this study proposes an innovative method that combines graph neural networks and YOLO models to solve the problem of low detection accuracy caused by slow detection speed and fuzziness of existing models. First, we improved the YOLOv7 model by introducing the SPPFPC structure, CARAFE structure and DSConv. These improvements not only reduced the complexity of the model and achieved lightweight, but also optimized the regression box by using the latest Shape-IoU method, effectively reducing the positioning loss of the model. Then, the model performance was improved by introducing intelligent reasoning and optimization processes in the model output stage, so that the model can re-reason the confidence of objects based on the spatial position relationship between objects. We constructed a graph relationship model based on the detection results and input it into the adjusted SeHGNN network. The SeHGNN network is responsible for learning the complex relationship between targets and recalculating the confidence. Through experimental verification, the improved model shows significant performance improvement on [email protected], proving the effectiveness of this method.Through this method that combines traditional target detection technology with the knowledge reasoning function of graph neural networks, the model's detection performance for military targets in urban battlefields is significantly improved.