The efficiency of distance learning can be assessed by examining specific student behaviors during online courses and assessments. Detecting abnormal student behavior can guide evaluating the effectiveness of learning. Detection speed, accuracy, and model efficiency are essential considerations in distance learning environments. This study proposes a model for detecting abnormal student behavior based on a modified YOLOv5 object detector. Firstly, to achieve model efficiency, the YOLOv5 feature extraction network is pruned by removing the portion responsible for extracting high-level feature maps of small objects, which consumes significant computing resources and parameters. Also, the model's feature fusion part and prediction layers are adjusted accordingly. A convolutional block attention module (CBAM) is added between the model's neck and prediction head to boost the model's focus on students' areas and detection accuracy. Five behaviors were tested on a recently created dataset. The results show that the suggested SPL-YOLOv5 detection method outperforms the SSD-MobileNet, Faster R-CNN, the original YOLOv5 algorithms and state-of-the-art methods regarding performance. The suggested approach increased