Vehicle detection in foggy weather plays an indispensable role in the field of intelligent transportation. This article proposes an improved YOLOv5 vehicle detection model based on the problems of insufficient detection accuracy and high fault tolerance of most algorithms in foggy weather. First, the AOD-Net network is used for defogging preprocessing of the original image. Then, the SE attention mechanism is fused in the C3 module of the Backbone feature extraction backbone network to adaptively allocate weight information, enhance the attention to important features, and reduce the impact of noise and irrelevant information. Finally, BiFPN is used in the Neck feature fusion network to replace the original PANet and enhance the model’s feature fusion ability. Experiments are conducted on the Cityscapes and RTTS datasets, and the results show that the improved YOLOv5 algorithm in this article has significant improvements in precision, recall rate, and average precision mean compared to the original model, with increases of 8.4%, 9.5%, and 9.2%, respectively. It can better adapt to vehicle detection tasks in foggy weather.