To address the issue of weak identification and low accuracy in recognizing features of target vehicles at different distances in road scene images, a vehicle feature recognition algorithm based on optimized convolutional neural network (CNN) was proposed.Firstly, a multi-scale input based on the PAN model was employed to capture target vehicle features at varying distances.Subsequently, improvements were made to the network model by incorporating multi-pool, batch normalization (BN) layers, and Leaky ReLU activation functions within the CNN architecture.Furthermore, the generalization ability of the network model was enhanced by introducing a hybrid attention mechanism that focuses on important features and regions in the vehicle image.Lastly, a multi-level CNN structure was constructed to achieve feature recognition for vehicles.Simulation experiment results conducted on the BIT-Vehicle database within a single scene show the proposed algorithm’s significant enhancements in single-object and multi-object recognition rates compared to CNN, R-CNN, ABC-CNN, Faster R-CNN, AlexNet, VGG16, and YOLOV8.Specifically, improvements of 16.75%, 10.9%, 4%, 3.7%, 2.46%, 1.3%, and 1% in single-object recognition, as well as 17.8%, 10.5%, 2.5%, 3.8%, 2.7%, 1.1%, and 1.3% in multi-object recognition, have been demonstrated by the proposed algorithm, respectively.Over the more complex UA-DETRAC datasets, more precise results have been also achieved by the proposed algorithm in recognizing target vehicles at various distances compared to other algorithms.