The rapid development of the information field has made people's lives more convenient. To prevent drivers from violating traffic laws, a deep learning model has been developed to detect vehicle violations. The main function is to detect if the vehicle body touches the lane line and occupies more than one lane. The increasing accuracy of vehicle body recognition measurements calls for consideration of the impact of the camera on the vehicle body and lane line detection. The specific objective of the article is to analyze the vehicle dataset model; the calculation formula for lane line detection; and the precision, accuracy, and recall rate of the model of convolutional neural network (CNN). In addition to improving the detection of illegal vehicles by the traffic police system, this can provide information for autonomous driving in the coming years.