Abstract:Due to the popularity of electric vehicles, more and more electric vehicles are illegally modified with rain shields. However, this modification increases safety hazards. Firstly, rain shields block riders’ view, increasing the risk of accidents. Secondly, rain shields can inadvertently scratch pedestrians when the modified vehicles are at excessive speeds, posing a great safety hazard and a serious threat to traffic safety. This study proposes an improved YOLOv7-tiny algorithm for detecting illegally modified electric vehicles. Firstly, a BiFormer attention mechanism is added to the network structure, enabling the model to capture more details of electric vehicles and focus more on smaller target information. Secondly, an improved feature pyramid structure is combined with the tensor concatenation of a feature fusion network to enhance the detection ability of the model for small and medium-sized targets. Finally, the ELAN and SPPCSPC modules of the framework are optimized, which improves the detection accuracy of small and medium-sized targets and enhances the effectiveness of feature extraction without adding too many parameters.