In order to improve the performance of automatic driving target detection in foggy scenarios, this paper proposes an end-to-end domain adaptive target detection method based on YOLOV5 algorithm. The domain adaptive network is added to the last layer of the feature extractor of YOLOV5 algorithm, and the gradient inversion layer (GRL) is added between the label classifier and the domain classifier by adversarial training strategy, which confuses the ability of the network to distinguish the source domain from the target domain and maximizes the feature extractor to generate domain-invariant features. According to the training results on the dataset Cityscapes, compared with directly using the original YOLOV5 model, the average accuracy of the proposed algorithm is improved by 10.3%, and the FPS of the model reaches 42.8. Compared with the two-stage detection model Faster-RCNN, it is more suitable for the real-time scene of automatic driving.