In real traffic scenarios,vehicle and pedestrian detectors are susceptible to interference from com-plex backgrounds,leading to serious false and missed detections.Additionally,most detection methods have poor detection performance for small objects and are difficult to adapt to the diversity of traffic objects due to the presence of various targets of different scales in the traffic scene images.To address these problems,an ef-ficient anchor-free method called VHA-CenterNet is proposed based on attention and foreground attention modules.Firstly,a convolutional block attention module(CBAM)is added to the backbone network to im-prove the ability to focus on small targets.Secondly,the foreground attention module(FAM)introduces fore-ground information and reduces the interference of complex backgrounds.The results show that at moderate difficulty,the VHA-CenterNet method proposed achieves a mAP of 71.92%on the KITTI dataset and an in-ference speed of 10.68 FPS on RTX 2080 Ti,which can significantly improve the accuracy and speed of the human-vehicle recognition.The accuracy of the human-vehicle detection for traffic scenes is higher than that of the traditional model in all cases.