Novel lightweight human body abnormal posture detection method based on YOLOv8n
By integrating the PoseMSA attention module, KA-Sample upsampling module, and Detect-PSA detection head into the YOLOv8n model, the problem of abnormal human pose detection in complex backgrounds is solved, achieving efficient and accurate abnormal pose recognition.
Patent Information
- Application Number
- CN202511904640.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-17
- Publication Date
- 2026-03-17
AI Technical Summary
Existing technologies face challenges in detecting abnormal human postures in complex backgrounds, occlusion interference, and scenarios with significant differences in human posture. These challenges include difficulties in recognition, difficulty in ensuring real-time performance, and blurred boundaries.
The PoseMSA attention module is fused with the C2f module in the YOLOv8n model. The KA-Sample upsampling module and Detect-PSA detection head are used, combined with depthwise separable convolution to enhance feature representation and reduce the number of parameters. Multi-scale features and distributed regression methods are used to improve detection accuracy and robustness.
In environments with limited computing power, it improves the accuracy and robustness of abnormal human posture detection, significantly reduces false negatives and false positives, achieves a good balance between detection accuracy and inference speed, and adapts to complex environments and diverse postures.
Smart Images

Figure CN121686569A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of human posture detection technology, specifically to a novel lightweight method for detecting abnormal human postures based on YOLOv8n. Background Technology
[0002] In recent years, with the continuous development of fields such as smart healthcare, security monitoring, and elderly care, human behavior recognition technology has gradually become an important direction in computer vision research. Among these, abnormal human posture detection, as a highly practical subtask, aims to automatically identify abnormal behaviors such as falls, vomiting, and chest pain from images or videos, which is of great significance for building intelligent monitoring systems and realizing early warning of emergencies. Abnormal human posture detection differs from conventional human behavior recognition. Abnormal postures are typically sudden, transient, and highly uncertain, exhibiting exceptional complexity in both spatiotemporal dimensions and severe imbalance in data distribution. Furthermore, abnormal behaviors are diverse in form, have blurred boundaries, and are highly susceptible to external environmental factors such as changes in lighting and occlusion interference, further increasing the learning difficulty and generalization challenge of the detection model. Currently, although significant progress has been made in improving detection accuracy, in resource-constrained practical applications, model size, computational efficiency, and deployment costs remain crucial factors that must be carefully considered. Therefore, how to effectively improve the robustness and lightweight nature of the model while ensuring detection accuracy, so as to achieve real-time, stable and low-resource-consumption detection of abnormal postures, has become a key problem that urgently needs to be solved in this field.
[0003] With the development of computer vision and machine learning technologies, human anomaly pose recognition technology has also advanced. Traditional object detection methods often perform poorly when faced with complex scenes and diverse targets. However, the introduction of neural networks has provided a new approach to solving these problems. The Convolutional Neural Network (CNN) architecture in deep learning has become the mainstream in the field of object detection. Deep learning-based object detection methods are mainly divided into two categories: two-stage object detection algorithms and regression-based one-stage object detection algorithms. However, human anomaly pose detection still faces many challenges. In anomaly detection scenarios with complex backgrounds, occlusion interference, and significant differences in human pose, problems such as difficulty in recognition, difficulty in ensuring real-time performance, and blurred boundaries still exist. Summary of the Invention
[0004] To address the aforementioned shortcomings in existing technologies, this invention provides a novel lightweight human anomaly pose detection method based on YOLOv8n. This method solves the problems of difficulty in recognition, difficulty in ensuring real-time performance, and blurred boundaries that still exist in anomaly detection scenarios with complex backgrounds, occlusion interference, and significant differences in human pose.
[0005] To achieve the above-mentioned objectives, the technical solution adopted by this invention is as follows: a novel lightweight human abnormal posture detection method based on YOLOv8n, comprising the following steps:
[0006] S1: Add the PoseMSA attention module to the original YOLOv8n backbone network and merge the attention module with the C2f module in the backbone network;
[0007] S2: Replace the original YOLOv8n upsampling module with the KA-Sample upsampling module;
[0008] S3: Replace the original YOLOv8n detection head with the Detect-PSA detection head to obtain the lightweight human abnormal pose detection model PSD-YOLOv8n;
[0009] S4: Apply the lightweight human abnormal posture detection model PSD-YOLOv8n to the actual detection scenario to complete the detection of human abnormal posture.
[0010] Furthermore, the PoseMSA attention module integrates spatial attention and channel self-attention, and the implementation process includes:
[0011] The spatial attention branch performs average pooling on the input feature map along the height and width directions to obtain two one-dimensional projections. Each projection is divided into four groups along the channel dimension, and multi-scale responses are extracted using convolutional kernels of different sizes. After concatenation, group normalization and sigmoid activation are performed to obtain spatial attention maps in the height and width directions. The spatial attention maps are then multiplied back into the original feature map.
[0012] The channel self-attention branch downsamples the spatially weighted feature map. After applying the self-attention mechanism to the downsampled result, it undergoes global average pooling and Sigmoid activation to obtain the channel attention coefficients. These channel coefficients are then multiplied back into the spatially weighted feature map. The function implementation formula is as follows:
[0013]
[0014]
[0015]
[0016] in, For spatial weighting functions, and These are the average pooling operations on the height and width of the input features, respectively. For the input feature map, For a four-dimensional tensor space of real numbers, For batch size, For the number of channels, For the height of the input feature map, The width of the input feature map, For channel attention coefficients, It is the Sigmoid activation function. For global average pooling, For the composition of the concatenation operation and subsequent functions, To output the final feature map.
[0017] Furthermore, the backbone network includes a C2f_MSA module, which integrates a PoseMSA attention module based on the C2f module. The implementation process includes:
[0018] A1: The input feature map is enlarged by a 1×1 convolution and then compressed to obtain the compressed features;
[0019] A2: Divide the compressed and transformed features into two equal parts according to each channel. and Branch 1 receives It retains the original convolutional features and local spatial pattern features, and branch 2 receives... It consists of multiple PoseMSA attention modules connected in series;
[0020] A3: The outputs of the two branches are concatenated along the channel dimension and then subjected to a 1×1 convolution to adjust the number of channels, resulting in the final output features:
[0021]
[0022]
[0023] in, Features are spliced together along the channel dimension. For splicing operations, Output for branch 1. Output for branch 2. The number of attention modules in PoseMSA. For the final output features, This is the adjusted number of channels.
[0024] Furthermore, the backbone network employs depthwise separable convolutions in each convolutional layer, and the total number of parameters for the depthwise separable convolutions is:
[0025]
[0026] in, The total number of parameters for depthwise separable convolution. The number of parameters for depthwise convolution. For pointwise convolution parameters, and For the number of channels, is the spatial size of the convolution kernel.
[0027] Furthermore, the implementation process of the KA-Sample upsampling module includes:
[0028] B1: Apply Pixel Shuffle to the input feature map to reduce the number of channels. Space size increased to Generate high-resolution features ,in, The upsampling factor;
[0029] B2: High-resolution features Perform 1×1 convolution to output the offset vector channel, and predict the scaling factor in parallel with the predicted offset 2D convolutional layer through dynamic gated convolution. After activation by Sigmoid, the constraint is in the interval [0,1].
[0030] B3: The high-resolution offset is rearranged using the PixelUnshuffle operation. The rearranged offset provides an offset vector for each pixel in the same spatial size as the original feature.
[0031] B4: Offset sampling is implemented through the Grid Sample module, which supports bilinear interpolation and maintains gradient transitivity.
[0032] Furthermore, the implementation process of the Detect-PSA detection head includes:
[0033] C1: Construct regression and classification branches for each scale feature map:
[0034] The regression branch expression is:
[0035]
[0036] in, For the first The number of channels in a scale feature map. This represents the number of intermediate channels in the regression branch. The number of distributed buckets in the DFL module;
[0037] The classification branch expression is:
[0038]
[0039] in, The number of intermediate channels in the classification branch. The number of categories for human postures;
[0040] C2: The outputs of the regression and classification branches are concatenated along the channel dimension to obtain the final prediction tensor containing bounding box information and class confidence.
[0041] Furthermore, a DFL module is introduced into the regression branch, which represents each border margin as a discrete probability distribution. The formula for calculating continuous margins is:
[0042]
[0043] in, For continuous margins, For the boundary to belong to the first The probability weights of each offset.
[0044] The beneficial effects of this invention are as follows: The lightweight PoseMSA module proposed in this invention combines spatial attention and channel attention, and adopts a depthwise separable convolutional structure to enhance the model's feature representation ability and reduce the number of model parameters, thus enabling efficient extraction of abnormal action features even under limited computing power. The KA-Sample upsampling module combines human keypoint information for feature guidance, making the model more robust in judging fine-grained abnormal actions (such as chest pain, vomiting, etc.). The improved Detect-PSA detection head integrates multi-scale features and distributed regression methods, maintaining the stability and accuracy of the detection box in complex backgrounds and effectively mitigating the recognition bias caused by boundary blurring. Experimental results on a self-built dataset show that PSD-YOLOv8n achieves a good balance between detection accuracy and inference speed, significantly reducing false negatives and false positives. This improved algorithm effectively enhances the accuracy and robustness of human abnormal pose detection, demonstrating strong adaptability in complex environments and diverse poses. Attached Figure Description
[0045] Figure 1 This is a structural diagram of the PSD-YOLOv8n model.
[0046] Figure 2 This is a diagram of the PoseMSA module structure.
[0047] Figure 3 This is a diagram of the C2f_MSA structure.
[0048] Figure 4 This is a diagram of the KA-Sample structure.
[0049] Figure 5 This is a diagram of the Detect-PSA structure. Detailed Implementation
[0050] The present invention will be further described below with reference to the accompanying drawings and specific embodiments.
[0051] This invention addresses the challenges of abnormal human pose detection and real-time performance in complex scenarios using the YOLOv8n model. It proposes an improved model, PSD-YOLOv8n, with the following structure: Figure 1 As shown in the figure, improvements are made to the backbone network, upsampling module, and detection head module. First, a PoseMSA attention module is added to the original YOLOv8n backbone network, and this attention module is fused with the C2f module in the backbone network to better capture contextual information and obtain a more lightweight backbone network. Second, regarding model upsampling, a KA-Sample (Keypoint Aware Upsample) upsampling module is designed to achieve more sensitive abnormal pose detection capabilities, further improving the model's accuracy. Finally, the Detect-PSA detection head module is replaced in the original YOLOv8n detection head to better capture the global spatial relationships in human pose. The specific implementation process is as follows.
[0052] like Figure 1 As shown, a novel lightweight human abnormal posture detection method based on YOLOv8n includes the following steps:
[0053] S1: Add the PoseMSA attention module to the original YOLOv8n backbone network and merge the attention module with the C2f module in the backbone network;
[0054] In abnormal pose detection, abnormal behaviors captured in videos are often accompanied by interference factors such as differences in human body shape, occlusion, and complex backgrounds, which can easily lead to insufficient model response to key regions, thereby reducing detection accuracy. To address these issues, this invention designs a lightweight backbone network that integrates spatial-channel self-attention, depthwise separable convolution, and residual bottlenecks. After receiving the input feature map, this network generates two attention coefficients through parallel spatial attention branches and channel attention branches, and finally outputs weighted features. The overall framework is shown in Figure 2.
[0055] The PoseMSA attention module integrates spatial attention and channel self-attention. The implementation process includes:
[0056] The spatial attention branch performs average pooling on the input feature map along the height and width directions to obtain two one-dimensional projections. Each projection is divided into four groups along the channel dimension, and multi-scale responses are extracted using different sizes of depth convolution kernels (3×3, 5×5, 7×7, 9×9). After concatenation, group normalization and sigmoid activation are performed to obtain spatial attention maps in the height and width directions. The spatial attention maps are multiplied back into the original feature map to achieve feature enhancement at key row and column positions.
[0057] The channel self-attention branch downsamples the spatially weighted feature map (using average pooling, max pooling, or window rearrangement, etc.) to reduce spatial resolution and computational cost. After applying the self-attention mechanism to the downsampled result, global average pooling and sigmoid activation are used to obtain the channel attention coefficients. These channel coefficients are then multiplied back into the spatially weighted feature map. The function implementation formula is as follows:
[0058]
[0059]
[0060]
[0061] in, For spatial weighting functions, and These are the average pooling operations on the height and width of the input features, respectively. For the input feature map, For a four-dimensional tensor space of real numbers, For batch size, For the number of channels, For the height of the input feature map, The width of the input feature map, For channel attention coefficients, It is the Sigmoid activation function. For global average pooling, For the composition of splicing operations with subsequent functions (such as GAP), To output the final feature map.
[0062] To reduce the number of parameters and computational burden, this network uses depthwise separable convolutions instead of standard convolutions in each convolutional layer. Assume the input feature map size is... The convolution kernel spatial size is The number of output channels is Each convolutional layer is split into two steps: depthwise convolution and pointwise convolution. For depthwise convolution, each input channel uses a separate convolution. Convolution kernel, output remains the same There are 1 channel, and its parameter count is:
[0063]
[0064] For pointwise convolution, a 1×1 convolution starts from... Channel mapping to The channel has the following parameters:
[0065]
[0066] The total number of parameters for depthwise separable convolution is:
[0067]
[0068] In contrast, if the standard is adopted Convolution, then the number of parameters is:
[0069]
[0070] Its reduction ratio is:
[0071]
[0072] This decomposition not only preserves the expressive power of convolution but also significantly reduces detection time. PoseMSA attention reduces the number of model parameters while improving detection accuracy, making it more suitable for abnormal pose detection in real-time or embedded scenarios.
[0073] To enhance the spatial and channel information interaction capabilities during feature extraction while maintaining high computational efficiency, this invention proposes a novel C2f_MSA module. This module integrates PoseMSA attention on top of C2f, ensuring no loss of local human body details and improving the ability to detect abnormal poses. This module design also significantly reduces the computational complexity and number of parameters of the model, enabling it to run efficiently even in resource-constrained environments. The specific structure of the C2f_MSA module is as follows: Figure 3 As shown.
[0074] The backbone network includes a C2f_MSA module, which integrates a PoseMSA attention module on top of the C2f module. The implementation process includes:
[0075] A1: Input feature map is Where B is the batch size. Let H be the number of channels, and H and W be the height and width of the feature map, respectively. After a 1×1 convolution to increase the number of channels and performing feature compression transformation, the compressed features are obtained:
[0076]
[0077] This can enhance the expressive power of the channel dimension without increasing spatial resolution, providing a foundation for subsequent discrimination of human pose details and global dependencies;
[0078] A2: Divide the compressed and transformed features into two equal parts according to each channel. and Branch 1 receives It preserves the original convolutional features and local spatial pattern features, preventing the loss of fine-grained information required for abnormal pose detection during global discrimination. Branch 2 receives... It consists of multiple PoseMSA attention modules connected in series;
[0079]
[0080] in, This indicates a channel splitting operation;
[0081] Each PoseMSA attention module includes local convolutional preprocessing, multi-head self-attention, and convolutional fusion. Local convolutional preprocessing generates query Q, key K, and value V. Convolutional fusion integrates channels based on the results of multi-head self-attention through 1×1 convolution. Multi-head self-attention can not only calculate dependencies based on feature values but also utilize the geometric positional relationships between human spatial features, thereby improving the recognition of abnormal poses. Its calculation formula is as follows:
[0082]
[0083] in, For the sake of the bulls' self-attention, To query the position code of Q, Encode the position of key K. For transpose operation, The dimension of key K is the channel dimension after dividing by the number of heads;
[0084] A3: The outputs of the two branches are concatenated along the channel dimension and then subjected to a 1×1 convolution to adjust the number of channels, resulting in the final output features:
[0085]
[0086]
[0087] in, Features are spliced together along the channel dimension. For splicing operations, Output for branch 1. Output for branch 2. The number of attention modules in PoseMSA. For the final output features, This is the adjusted number of channels.
[0088] S2: Replace the original YOLOv8n upsampling module with the KA-Sample upsampling module;
[0089] Traditional upsampling methods (such as bilinear interpolation or deconvolution) suffer from insufficient adaptability when handling non-standard human body structures such as pose distortions and falls. This invention designs a human feature enhancement network based on dynamic resampling. This framework is based on a conventional convolutional backbone network and embeds a learnable upsampling module—KA-Sample (Keypoint Aware Upsample). This network introduces learnable offset prediction and group sampling mechanisms to capture complex spatial geometric transformations. KA-Sample can adaptively generate spatial offsets based on input features and achieve high-fidelity spatial reconstruction through differentiable interpolation, providing a more discriminative representation for abnormal pose regions. The overall framework is as follows: Figure 4 As shown.
[0090] The implementation process of the KA-Sample upsampling module includes:
[0091] B1: Input feature map Applying Pixel Shuffle reduces the number of channels to Space size increased to Generate high-resolution features ,in, The upsampling factor;
[0092] The high-resolution features generated in this step It allows for more granular representation of the original human body contours and local textures. Although the spatial dimensions increase, the number of channels is reduced to the original level. The overall computational cost of convolution did not increase proportionally.
[0093] B2: High-resolution features Perform a 1×1 convolution to output the offset vector channel, and predict the scaling factor in parallel with a dynamically gated convolution (Scope Conv2d) and a prediction offset 2D convolutional layer (Offset Conv2d). After activation by Sigmoid, the values are constrained to the [0,1] interval. The purpose of this is to avoid the offset values becoming too large too early, which could lead to training instability or gradient explosion.
[0094] After the offset prediction is completed at high resolution, it needs to be mapped back to the original low-resolution coordinate system before it can be applied to the original features. Sampling is performed on the surface.
[0095] B3: Offset high resolution Rearranged using PixelUnshuffle operation The rearranged offset provides an offset vector for each pixel in the same spatial size as the original feature;
[0096] B4: Offset sampling is implemented through the Grid Sample module.
[0097] The Grid Sample module supports bilinear interpolation and maintains gradient transitivity, enabling the entire module to be trained end-to-end. In abnormal pose detection scenarios, human pose amplitude is large or structural distortion often has certain discontinuities. Differentiable interpolation mechanism allows the network to dynamically adjust sampling coordinates in continuous space, thereby capturing detailed information about spatial perturbations and achieving more sensitive anomaly detection capabilities.
[0098] In summary, KA-Sample's high-resolution modeling capabilities, grouped enhanced representation, multi-scale dynamic adjustment, and spatial alignment mechanism effectively improve the model's ability to discriminate abnormal pose regions. In the human abnormal pose detection framework proposed in this invention, this module adaptively reconstructs the spatial distribution of features, providing a more discriminative input basis for the subsequent anomaly judgment module.
[0099] S3: Replace the original YOLOv8n detection head with the Detect-PSA detection head to obtain the lightweight human abnormal pose detection model PSD-YOLOv8n;
[0100] Traditional YOLOv8 detection heads use a pure convolutional structure for bounding box and class prediction. While this is efficient, it has limitations in complex human spatial structures and situations with blurred boundaries, making it difficult to fully capture the global spatial relationships within human poses. To improve the model's detection accuracy, this invention proposes a model that integrates multi-scale features, utilizing self-attention mechanisms and distributed regression to replace the traditional YOLOv8 detection head, named Detect-PSA. The overall framework is as follows: Figure 5 As shown.
[0101] The implementation process of the Detect-PSA detection head includes:
[0102] C1: Feature map at each scale Construct regression and classification branches separately:
[0103] The regression branch expression is:
[0104]
[0105] in, For the first The number of channels in a scale feature map. This represents the number of intermediate channels in the regression branch. The number of distributed buckets in the DFL module;
[0106] The classification branch expression is:
[0107]
[0108] in, The number of intermediate channels in the classification branch. The number of categories for human postures;
[0109] C2: Concatenate the outputs of the regression and classification branches along the channel dimension to obtain the final prediction tensor containing bounding box information and class confidence. .
[0110] To enhance the model's robustness and prediction accuracy in scenarios with abnormal human postures, this invention introduces the Distribution Focal Loss (DFL) module into the regression branch. During detection, bounding boxes are often affected by posture distortion and scene occlusion; for example, a leg in a fall may extend beyond the normal bounding box area. The probabilistic modeling method provided by DFL can capture this structural uncertainty.
[0111] The DFL module represents each border margin (left, top, right, bottom) as a discrete probability distribution. The model outputs four distribution vectors, representing the predicted probabilities of the four boundaries. The final formula for calculating the continuous margin is:
[0112]
[0113] in, For continuous margins, For the boundary to belong to the first The probability weights of each offset.
[0114] S4: Apply the lightweight human abnormal posture detection model PSD-YOLOv8n to the actual detection scenario to complete the detection of human abnormal posture.
[0115] In one embodiment of the present invention, the experimental environment configuration is shown in Table 1. The input image size is 640×640, the training batch size is 16, the number of data loading worker threads is 4, the number of training epochs is 150, the initial learning rate is 0.01, the SGD optimizer is used, and the momentum is 0.937. In all experiments of this embodiment, the same experimental configuration is used for the training, testing, and validation processes of all models.
[0116] Table 1 Experimental Environment Configuration
[0117]
[0118] This embodiment utilizes videos of human movements captured by cameras at various angles from the ROSE Lab, observing different scenes, people, and backgrounds. After rigorous selection of suitable videos depicting abnormal human behavior, frames were extracted to obtain 6538 high-quality images, which were then meticulously annotated using the professional LabelImage online annotation tool. To further enhance the diversity and richness of the dataset, data augmentation techniques were employed. Through geometric transformations and color transformations, the dataset was successfully expanded to 9000 images and named the SSHDataset, a dataset of abnormal human postures and behaviors. This dataset is divided into four labels: normal, chest pain, vomiting, and fall.
[0119] The SSHDataset is divided into three parts: training set, validation set, and test set. 6300 randomly selected labeled images are used as the training set for model learning and optimization; 1800 and 900 randomly selected labeled images are used as the test and validation sets, respectively, for model selection and performance evaluation.
[0120] The experiment selected precision (P), recall (R), mean average precision (mAP@0.5) with an IoU threshold of 0.5, the average precision after weighted averaging of IoU from 0.5 to 0.95 (with a step size of 0.05), and weight size as metrics to evaluate the reliability, accuracy, and lightweight nature of the identification.
[0121] To verify the effectiveness of the improved model's attention mechanism, this embodiment selects four mainstream lightweight attention mechanisms—PSA, IRMB, MLCA, and SEAM—from the perspective of balancing lightweight design and detection accuracy. These mechanisms are embedded into the YOLOv8n benchmark model (keeping other module architectures unchanged), and comparative experiments are conducted on the SSPDataset dataset. By unifying the experimental environment configuration (including hardware platform, training hyperparameters, and data preprocessing procedures), the horizontal comparability of the results is ensured. The experimental results are shown in Table 2, demonstrating the impact of different attention mechanisms on model performance.
[0122] Table 2 Comparison of Attention Experiment Results
[0123]
[0124] As shown in Table 2, the method of this invention achieves excellent results in both mAP@0.5 and mAP@0.5:0.95, reaching 97.6% and 75.0% respectively, significantly outperforming existing methods such as SEAM (97.3%, 73.7%) and MLCA (97.2%, 74.0%). This indicates that the attention mechanism of this invention has stronger expressive power in extracting key features of abnormal human poses, more accurate detection of global pose anomalies, and better ability to capture local anomalies. Regarding model complexity, the method of this invention has 2.20M parameters, far lower than PSA (3.26M) and IRMB (3.11M), while the computational cost (GFLOPs) is only 6.3, significantly lower than the 8.2–8.4 of other comparative methods. Furthermore, its weight file size is 4.70MB, the smallest among all methods, further verifying the lightweight advantage of this method.
[0125] To verify the effectiveness of each module optimization, this invention conducted six ablation experiments on the SSHDataset dataset, the details of which are as follows:
[0126] Experiment 1: Model detection after adjusting only the PoseMSA module;
[0127] Experiment 2: Model detection after adjusting only the KA-Sample module;
[0128] Experiment 3: Model detection after adjusting only the Detect-PSA module;
[0129] Experiment 4: Model detection after simultaneously adjusting the PoseMSA module and the KA-Sample module;
[0130] Experiment 5: Model detection after simultaneously adjusting the PoseMSA and Detect-PSA modules;
[0131] Experiment 6: Model detection after simultaneously adjusting the KA-Sample module and the Detect-PSA module. The experimental results are shown in Table 3.
[0132] Table 3 Ablation experiments using the PSD-YOLO model
[0133]
[0134] First, Experiment 1 shows that compared to the YOLOv8n baseline model, mAP@0.5 improved from 96.8% to 97.6%, and mAP@0.5:0.95 increased to 75.0%. Simultaneously, the number of parameters decreased from 3.01M to 2.20M, and GFLOPs decreased to 6.3. This indicates that PoseMSA, while improving the response capability in key regions, also contributes to model lightweighting and enhances the network's structural perception of human pose. Experiment 2 shows that introducing the KA-Sample module on top of the YOLOv8n model enhances the sampling representation of anomalous key regions. Experimental results show that mAP@0.5 increased to 97.8%, and mAP@0.5:0.95 increased to 75.7%, performing best among all single modules, with the number of parameters controlled at 3.02M and GFLOPs at 8.2, indicating that the KA-Sample module has a significant effect on feature representation enhancement. As can be seen from Experiment 3, the Detect-PSA module is an attention-guided separation detection head that enhances the ability to utilize multi-scale information, making mAP@0.5 reach 97.8% and mAP@0.5:0.95 reach 75.4%, further strengthening the target localization capability at different scales.
[0135] Furthermore, Experiment 4 shows that although the detection accuracy did not reach the highest value of a single module (97.0% for mAP@0.5 and 74.4% for mAP@0.5:0.95), the model parameter size was well controlled, at only 2.21M, and GFLOPs were 6.3. Experiments 5 and 6 demonstrate that the model accuracy remained at a high level, fully reflecting its complementarity in accuracy and lightweight design. Finally, the three modules (PoseMSA + KA-Sample + Detect-PSA) were integrated to construct a complete PSD-YOLO model. This model achieved optimal performance on the SSPDataset: 97.8% for mAP@0.5, 75.8% for mAP@0.5:0.95, 2.07M parameters, GFLOPs reduced to 5.2, and the weight file size was only 4.5MB. Compared with the original YOLOv8n model, the detection accuracy was improved by 1.0 and 1.9 percentage points respectively, the number of parameters was reduced by 31.2%, and the computational cost was reduced by 36.6%, which verified the efficiency of its lightweight design and further proved the effectiveness and practical application value of the PSD-YOLO model in the human abnormal pose detection task.
[0136] To compare the accuracy of different detection models, the experiment selected representative models such as CenterNet, Faster R-CNN, Fcos (Fully Convolutional One-Stage Object Detection), Fasf (Feature Selective Anchor-Free), YOLOv5, YOLOv7-Tiny, YOLOv8n, YOLOv9-T, YOLOv10n, YOLOv11n, and YOLOv12n for comparison with the PSD-YOLOv8n model proposed in this invention. In this section, accuracy, recall, mAP@0.5, mAP@0.5:0.95, number of parameters, and weight size were used as evaluation metrics to assess the model performance. The models were trained and tested on the SSHDataset dataset. The experimental results are shown in Table 4. As shown in Table 4, PSD-YOLO achieves 97.8% mAP@0.5, the highest among all models, and significantly improves upon advanced models such as YOLOv11n (97.4%) and YOLOv12n (97.2%). Simultaneously, PSD-YOLO also achieves a high accuracy of 75.8% in the mAP@0.5:0.95 metric, reflecting its superior detection and localization accuracy across multiple IoU thresholds. Furthermore, PSD-YOLO's model parameters are only 2.07M, and the weight file size is 4.50MB, demonstrating lightweight design while maintaining high accuracy. In comparison, traditional detectors such as Faster R-CNN (145.2M, 330.5MB) and CenterNet (32.6M, 231.6MB) not only lack accuracy but also have a much larger model size than PSD-YOLO. This characteristic highlights the advantages of PSD-YOLO in resource-constrained scenarios such as edge computing and deployment.
[0137] Table 4 Comparative experiments on the SSHDataset dataset
[0138]
[0139] Although PSD-YOLO is slightly lower than some models (such as YOLOv10n with a precision of 95.0%) in terms of precision (92.2%) and recall (92.3%), its excellent performance in terms of overall accuracy (mAP) and model lightweight fully demonstrates the scientific nature and practical application value of our structural improvements based on YOLOv8n, providing an efficient and reliable solution for abnormal human posture detection.
[0140] Those skilled in the art will recognize that the embodiments described herein are intended to help the reader understand the principles of the invention, and should be understood that the scope of protection of the invention is not limited to such specific statements and embodiments. Those skilled in the art can make various other specific modifications and combinations based on the technical teachings disclosed in this invention without departing from the spirit of the invention, and these modifications and combinations are still within the scope of protection of the invention.
Claims
1. A new lightweight human abnormal posture detection method based on YOLOv8n, characterized by, The method comprises the following steps: S1: adding a PoseMSA attention module in the backbone network of the original YOLOv8n, and fusing the attention module with a C2f module in the backbone network; S2: replacing the upsampling module of the original YOLOv8n with a KA-Sample upsampling module; S3: replacing the detection head of the original YOLOv8n with a Detect-PSA detection head to obtain a lightweight human abnormal posture detection model PSD-YOLOv8n; S4: applying the lightweight human abnormal posture detection model PSD-YOLOv8n to an actual detection scene to complete human abnormal posture detection.
2. The new lightweight human abnormal posture detection method based on YOLOv8n according to claim 1, characterized in that, The PoseMSA attention module fuses spatial attention and channel self-attention, and the implementation process comprises: The spatial attention branch respectively performs average pooling on the input feature map along the height and width directions to obtain two one-dimensional projections, divides each projection into four groups along the channel dimension, extracts multi-scale responses by using different size deep convolution kernels, performs group normalization and Sigmoid activation after splicing, and obtains the spatial attention maps in the height direction and the width direction, and multiplies the spatial attention maps back to the original feature map; The channel self-attention branch performs downsampling on the spatial weighted feature map, applies the self-attention mechanism to the down-sampling result, performs global average pooling and Sigmoid activation to obtain the channel attention coefficients, and multiplies the channel coefficients back to the spatial weighted feature map, and the function implementation formula is: wherein, is a spatial weighting function, and are average pooling operations in height and width, respectively, is an input feature map, is a four-dimensional tensor space of real numbers, is a batch size, is a number of channels, is a height of the input feature map, is a width of the input feature map, is a channel attention coefficient, is a sigmoid activation function, is a global average pooling, is a composition of concatenation operation and subsequent functions, is an output final feature map.
3. The new lightweight human abnormal posture detection method based on YOLOv8n according to claim 2, characterized in that, The backbone network comprises a C2f_MSA module, the C2f_MSA module fuses the PoseMSA attention module on the basis of the C2f module, and the implementation process comprises: A1: the input feature map is subjected to 1×1 convolution to increase the channel number and perform feature compression transformation to obtain a compressed and transformed feature; A2: the compressed and transformed features are divided into two parts by channel average and Branch 1 receives , retains the original convolutional features and local spatial pattern features, and branch 2 receives , which is composed of multiple PoseMSA attention modules in series; A3: the outputs of the two branches are spliced in the channel dimension, and then subjected to 1×1 convolution to adjust the channel number to obtain the final output feature: wherein, is a channel dimension concatenation feature, is a concatenation operation, is a branch 1 output, is a branch 2 output, is a number of PoseMSA attention modules, is a final output feature, is an adjusted number of channels.
4. The new lightweight human abnormal posture detection method based on YOLOv8n according to claim 3, characterized in that, The backbone network adopts a depth separable convolution in each convolution layer, and the total parameter quantity of the depth separable convolution is: wherein, is the total parameter amount of depth separable convolution, is the parameter amount of depth convolution, is the parameter amount of point-wise convolution, and is the number of channels, is the spatial size of the convolution kernel.
5. The new lightweight human abnormal posture detection method based on YOLOv8n according to claim 4, characterized in that, The implementation process of the KA-Sample upsampling module comprises: B1: apply Pixel Shuffle to the input feature map, which reduces the number of channels to , and increases the spatial size to , generating high-resolution feature , where is an up-sampling factor; B2: on high resolution features A 1x1 convolutional layer is used to output the offset vector channel, which is predicted in parallel with the predicted offset 2D convolutional layer by a dynamic gated convolution and is constrained in the interval [0, 1] after sigmoid activation. B3: the high-resolution offset is rearranged through a PixelUnshuffle operation, and the rearranged offset provides an offset vector for each pixel in the same spatial size as the original feature; B4: offset sampling is realized through a Grid Sample module, and the Grid Sample module supports bilinear interpolation and gradient transmissibility.
6. The new lightweight human abnormal posture detection method based on YOLOv8n according to claim 5, characterized in that, The implementation process of the Detect-PSA detection head comprises: C1: a regression branch and a classification branch are respectively constructed for each scale feature map: The regression branch expression is: wherein, is the number of channels of the first scale feature map, is the number of channels of the second scale feature map, is the number of intermediate channels of the regression branch, is the number of distribution buckets in the DFL module; The classification branch expression is: wherein, is the number of intermediate channels for the classification branch, is the number of classifications of human poses; C2: the outputs of the regression branch and the classification branch are spliced in the channel dimension to obtain a final prediction tensor containing bounding box information and class confidence.
7. The new lightweight human abnormal posture detection method based on YOLOv8n according to claim 6, characterized in that, The DFL module is introduced in the regression branch, and the DFL module represents each border margin as a discrete probability distribution The calculation formula of the continuous margin is: wherein, is a continuous margin, is a probability weight that the boundary belongs to the th offset.