Electric motorcycles are widely used due to their economic, portable, and easy‐to‐use characteristics. Power batteries are the primary power source of electric motorcycles. Electric motorcycles are usually pushed into elevators and parked at home or in enclosed corridor spaces for charging, which may pose serious safety hazards due to using inferior or expired batteries. The traditional manual management method is limited by human resources, making it difficult to manage and monitor such behavior. Automated detection of electric motorcycles based on artificial intelligence technology is an effective solution. Considering that common monitoring systems typically have limited data processing capabilities, this study proposes an electric motorcycle detection model based on improved You Only Look Once version 5s (YOLOv5s). Firstly, we develop the model by adding a transformer encoder module to the backbone of classical YOLOv5s. Next, the Bidirectional Feature Pyramid Network (BiFPN) is used for cross‐scale connectivity and multiscale feature fusion. Finally, the Coordinate Attention module (CA) is added to improve the representation capacity of the target features and enhance the detection accuracy. The results of comparative experiments and ablation experiments verified the effective performance of the proposed model, which attained a mean average precision of 81.2%. Compared to classical models like faster R‐CNN and YOLOv5, this methodology achieves higher performance with fewer parameters and computational complexity, meeting real‐time requirements.