To strengthen the safety monitoring of foggy road traffic and maintain the safety of vehicle driving on foggy roads, image dehazing algorithms are used to improve the clarity of road images detected in foggy environments, thereby improving the detection ability and monitoring efficiency of intelligent transportation systems for vehicle targets. Due to the low accuracy of vehicle detection and serious problem of missed detections in haze environments, this paper proposes an improved All-in-One Dehazing Network (AOD-Net) algorithm for detecting foggy vehicles, which adds batch normalization (BN) layers after each layer of convolution in AOD-Net, accelerating the convergence of the model and controlling overfitting. To enhance image detail information, an effective pyramid-shaped PSA attention module is embedded to extract richer feature information, enrich model representation, and improve the loss function to a multi-scale structural similarity (MS-SSIM) + L1 mixed loss function, thereby improving the quality, brightness, and contrast of dehazing images. Compared with current image dehazing algorithms, the dehazing quality of our algorithm is superior to other dehazing algorithms, such as dark channel prior (DCP), Dehaze-Net, and Fusion Feature Attention Network (FFA-Net). Compared with AOD-Net, the improved algorithm has increased the peak signal-to-noise ratio by 3.23 dB. At the same time, after the improved AOD-Net image dehazing processing, YOLOv7 object detection was performed and experimentally validated on a real foggy dataset. The results showed that compared with the previous method, it had better recognition performance in foggy detection and recognition, and higher detection accuracy for vehicles.