Autonomous vehicles must maintain awareness of their surroundings, encompassing other vehicles, pedestrians, traffic signs, and varying road conditions. Among numerous objectives, the most crucial one is the detection of vehicles and pedestrians. Despite advancements, complex traffic scenarios still pose challenges in target detection. Variations in target size and occlusion often lead to misjudgments and missed detections. To address these issues, an enhanced vehicle and pedestrian detection model, YOLOv8nRLD, is proposed. It integrates several innovations to enhance target detection accuracy. Firstly, the introduction of the Receptive-Field Convolutional Block Attention Module enhances the model's ability to detect and emphasize salient features, facilitating more precise target localization and identification. Additionally, the Spatial Pyramid Pooling Fast module within the backbone feature extraction network is refined with the inclusion of the Large Separated Kernel Attention module. This augmentation significantly boosts the network's feature extraction capabilities. Furthermore, the adoption of a dynamic target detection head, termed Dynamic Head, incorporating attention mechanisms and diverse perception capabilities, enhances the model's feature expression capacity. Experimental validation on the BDD100K and Cityscapes datasets demonstrates notable performance enhancements, with mean Average Precision increasing by 4% and 2.5%, respectively. Ablation experiments confirm the effectiveness of individual modules, underscoring the method's efficacy and versatility in vehicle and pedestrian detection tasks. © 2024, Cefin Publishing House. All rights reserved.