A Safety Compliance Testing Method for Factory Scenarios Based on FMH-YOLO11
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-05-20
- Publication Date
- 2026-08-14
AI Technical Summary
[0005]本发明所要解决的技术问题在于克服现有厂房场景安全合规性检测方法在复杂背景、小目标易漏检、细粒度违规行为识别困难以及模型鲁棒性不足等方面的缺陷,提供一种检测准确率高、小目标捕捉能力强且具备较高鲁棒性的基于FMH-YOLO11的厂房场景安全合规性检测方法
[0045]1、通过在YOLO11n主干网络中引入FCM特征互补映射模块变体,实现不同层级特征的交叉增强与互补融合,提升了复杂厂房背景下目标特征的表达能力。
Smart Images

Figure CN122574491A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of image recognition and analysis technology for violations within factory buildings, specifically relating to a method for detecting personnel violations and protective status based on FMH-YOLO11, applicable to edge monitoring of industrial plants. Background Technology
[0002] In the production management and safety assurance of modern industrial plants, the detection of personnel violations and related protective equipment status is a crucial link in ensuring personnel safety and preventing industrial accidents. Traditional plant safety monitoring mainly relies on manual inspections or visual monitoring by personnel in the control room. These methods not only suffer from high labor intensity, poor real-time performance, and a high rate of subjective missed detections, but also struggle to achieve accurate, all-weather, and comprehensive monitoring when dealing with large-area plants or multi-point work environments.
[0003] In recent years, deep learning object detection algorithms, represented by the YOLO series, have been widely applied in the field of industrial vision. However, existing general detection models still face many challenges in real-world factory scenarios. Factory interiors typically exhibit drastic lighting changes, complex equipment backgrounds, and significant personnel occlusion. Traditional convolutional feature extraction networks struggle to effectively separate subtle violation features from these complex industrial backgrounds, easily leading to false alarms. Furthermore, perceiving small targets is extremely difficult. Fine-grained targets, such as cigarette butts in "illegal smoking" or the chin strap area when not wearing a safety helmet properly, occupy very few pixels in wide-angle monitoring images. Existing deep learning models, after multiple downsampling layers, often lose detailed information about these crucial small targets, resulting in a high false negative rate. In actual factory datasets, normal work behaviors constitute the vast majority, while violations (such as smoking or falls) are a very small minority. When training models using traditional loss functions, the models tend to learn high-frequency, simple samples while neglecting regression on low-frequency, high-difficulty violation samples. This leads to insufficient accuracy in capturing key safety hazards. Finally, factory monitoring typically needs to be deployed on edge computing terminals or embedded servers, which have strict requirements on model inference latency and parameter scale.
[0004] Existing improvement schemes suffer from three main drawbacks: First, a single attention mechanism can only enhance local features and cannot simultaneously resolve the contradiction between background noise suppression and preservation of small target details; second, multi-scale enhancement modules generally have high computational costs, making them difficult to adapt to edge devices; and third, hard example mining methods are prone to introducing mislabeled samples, leading to unstable model training. Therefore, it is still necessary to propose a target detection scheme for factory scenes that can balance robustness against complex backgrounds, small target detection capabilities, and computational overhead. Summary of the Invention
[0005] The technical problem to be solved by this invention is to overcome the shortcomings of existing factory safety compliance detection methods in complex backgrounds, easy to miss small targets, difficulty in identifying fine-grained violations, and insufficient model robustness. The invention provides a factory safety compliance detection method based on FMH-YOLO11 with high detection accuracy, strong small target capture capability, and high robustness.
[0006] To achieve the above objectives, this invention proposes a safety compliance testing method for factory scenarios based on FMH-YOLO11, comprising the following steps:
[0007] 1) Use cameras deployed at key monitoring points in the factory to acquire images of the work site, construct and divide them into training set, validation set and test set. The dataset contains multiple image samples labeled with the category and location information of the illegal targets to be detected; and perform data augmentation operations on the training images to improve the model's adaptability to complex industrial environments.
[0008] 2) Based on the YOLO11n network, variants of the Feature Complementary Mapping (FCM) module are set after the C3k2 modules corresponding to layers P2, P3, P4, and P5 of the backbone network; and a Multi-Scale Feature Enhancement (MSFE) module is set after the FCM module variant in layer P3 of the backbone network; at the same time, a positive sample reweighting detection head Detect_HPR (Detect_Hard-class Positive Reweighting) is designed at the detection head, and the HPR (Hard-class Positive Reweighting) positive sample reweighting mechanism is introduced in the loss calculation stage to dynamically reweight the loss function. This yields the FMH-YOLO11 network model; the network maintains the three-scale detection output structure of P3 / P4 / P5.
[0009] 3) Input the training set into the FMH-YOLO11 network model for training and optimization until it finally converges to obtain the final FMH-YOLO11 network model.
[0010] 4) Input the test set into the model to obtain evaluation metrics such as precision, recall, and mAP50;
[0011] 5) Input the monitoring image of the factory to be detected into the trained FMH-YOLO11 network model, and output the category, bounding box coordinates and corresponding confidence scores of the target in the image to realize the automatic detection and recognition of target behavior in the factory scene.
[0012] In step 2), the FCM module is used to enhance the expressive power of features at different levels. This module divides the input features into a main branch and an auxiliary branch using a channel splitting strategy. The main branch is responsible for convolutional modeling, while the auxiliary branch is responsible for information preservation and modulation. Subsequently, the spatial attention generated by the auxiliary branch and the channel attention generated by the main branch are cross-coupled to obtain the enhanced output features. The calculation process is as follows:
[0013] X1, X2 = Split(X) (1)
[0014] F1=φ1(X1), F2=φ2(X2) (2)
[0015] M s =Spatial(F2), M c =Channel(F1) (3)
[0016] Y = M s ⊙F1+M c ⊙F2 (4)
[0017] Y out =Y + βX (5)
[0018] In the above formula, X represents the input feature; X1 and X2 represent the two sub-features after channel partitioning; φ1(X1) represents the main branch convolutional mapping function, outputting enhanced feature F1; φ2(X2) represents the auxiliary branch convolutional mapping function, outputting auxiliary feature F2; M s M represents the spatial attention mask generated by F2; c Y represents the channel attention weights generated by F1; ⊙ represents the Hadamard product; Y represents the fused feature after adding the two cross-modulation results; Y out β represents the final output characteristic; β represents the residual adjustment coefficient.
[0019] In step 2), the MSFE module is deployed in layer P3 of the backbone network. Layer P3 balances feature resolution and semantic information, and is a crucial layer for detecting small targets in factory scenarios. Therefore, this invention introduces the MSFE module in this layer to enhance the discriminability of shallow and mid-level features for small targets. This module extracts multi-scale features through two parallel convolutional branches with different receptive fields and adaptively fuses them using dynamically normalized weights and a spatial attention mechanism. Its calculation process is as follows:
[0020]
[0021] x1=Conv 1×1 (DWConv 3×3 (X)), x2=Conv 1×1 (DWConv 5×5(X)) (8)
[0022] F = w1·x1 + w2·x2 (9)
[0023] S=σ(Conv 5×5 (x1+x2)) (10)
[0024] H MSFE =Fuse(F⊙S)+(k1+k2·σ(a))X (11)
[0025] In the above formula, X represents the input feature; ψ(X) represents the branch weight generation function, which is used to generate the initial weights of the two branches based on the input feature. and w i ε represents the normalized dynamic weights; x1 and x2 represent the mapping results of two different convolutional branches to the input feature X, where x1 corresponds to the branch output of a 3×3 depthwise convolution followed by a 1×1 convolution, and x2 corresponds to the branch output of a 5×5 depthwise convolution followed by a 1×1 convolution; F represents the weighted fusion result of the two branches under the action of dynamic weights; S represents the spatial attention mask; σ represents the Sigmoid activation function; Fuse represents the fusion mapping function; a represents the learnable residual parameter; Y MSFE The output characteristics of the module are represented by k1 and k2, which represent the coefficients corresponding to the residual terms after bias scaling.
[0026] In step 2), the loss function optimization module employs the HPR positive sample reweighting mechanism. This mechanism uses the positive sample reweighting detection head Detect_HPR to attach parameters such as classification prior weights, regression prior weights, small target category set, reference area threshold, and gain upper limit. The loss calculation module reads these parameters during the training phase and then applies differentiated weighting to positive samples of preset small target categories and key categories, thereby achieving joint reweighting of the classification loss, bounding box regression loss, and distribution focus loss. The calculation process is as follows:
[0027]
[0028] In the above formula, c represents the target class of the current positive sample, C small A represents a predefined set of small target categories. gt A represents the area of the true bounding box of the positive sample. ref The reference area threshold is represented by ε, which is the minimum constant to prevent the denominator from being zero, and g is the minimum value. max This indicates the upper limit of the gain for size weights; w size This represents the size weight calculated based on the target size.
[0029] For the bounding box regression branch, introduce prior weights from the class regression. Construct the bounding box reweighting factor:
[0030]
[0031] In the above formula, W represents the prior weight of category c in the bounding box regression branch. box This represents the regression reweighting factor, which is determined by the prior weights of the class regression and the size weights, and an upper limit constraint is set to maintain training stability.
[0032] For the classification branch, a prior weight for category classification is introduced. Constructing classification reweighting factors:
[0033]
[0034] In the above formula, W represents the prior weight of category c in the classification branch. cls Let represent the classification reweighting factor; a and b are the preset weight coefficients for the classification branches, and the final total loss function is expressed as:
[0035]
[0036] In the above formula, This represents the regression loss after weighting by the bounding box. This represents the classification loss after weighting by classification weights. λ represents the distribution focus loss obtained under the guidance of the bounding box weights. box , λ cls and λ dfl L represents the weighting coefficients of regression loss, classification loss, and distribution focus loss in the total loss, respectively. total This represents the total loss ultimately used for backpropagation.
[0037] As a preferred embodiment of the FMH-YOLO11-based detection system described in this invention, the system includes an image acquisition module, an image enhancement module, a model design module, a loss function optimization module, a model training module, and an object detection module.
[0038] The image acquisition module is used to acquire operation video streams and extract image frames using high-definition cameras in the factory to form raw image data covering personnel operation behavior, equipment operating status and key operation areas.
[0039] The image enhancement module is used to perform enhancement operations such as copy and paste enhancement, stitching enhancement, translation enhancement, scaling enhancement, flip enhancement, and color perturbation on the acquired image to improve the robustness of the subsequent model to complex factory environments.
[0040] The model design module is based on the YOLO11 network, integrating different variants of FCM feature complementarity modules into the backbone network, and setting an MSFE module in the P3 layer to enhance the complementary expression ability of features at different levels and the representation ability of shallow and medium-level features for small targets. At the same time, a three-scale detection head structure using Detect_HPR is constructed to jointly detect and output features at the three scales of P3, P4 and P5, and to serve as the parameter carrier unit of the HPR positive sample reweighting mechanism, providing configuration parameters such as class prior weights, small target class set, reference area threshold and gain upper limit for the loss calculation module.
[0041] The loss function optimization module is used to execute the HPR positive sample reweighting logic. During the training phase, this module reads the relevant parameters preset in the Detect_HPR detection head, calculates the small target size weight and combines the category prior weights of the classification branch and regression branch, and performs differential reweighting on the classification loss, bounding box regression loss and distribution focus loss of positive samples to improve the model's detection accuracy for small target categories such as smoking and key categories.
[0042] The model training module is used to input the dataset into the optimized network model for iterative training until convergence, so as to obtain the final target detection weight model.
[0043] The target detection module is used to input the image to be detected into the trained model and output the category, bounding box coordinates and corresponding confidence information of the target in the image.
[0044] Compared with the prior art, the present invention has the following beneficial effects:
[0045] 1. By introducing a variant of the FCM feature complementarity mapping module into the YOLO11n backbone network, cross-enhancement and complementary fusion of features at different levels are achieved, thereby improving the expressive ability of target features in complex factory backgrounds.
[0046] 2. By setting the MSFE multi-scale feature enhancement module in the P3 layer of the backbone network, the perception ability of shallow and medium-level features for small targets such as smoking and occluded targets is enhanced, which helps to reduce the false negative rate of small targets.
[0047] 3. By introducing the HPR positive sample reweighting mechanism, the classification loss and regression loss are weighted differently, which enhances the model's learning ability for small target samples and key categories, thereby improving the model's Precision and mAP50 performance in the factory violation detection task. Attached Figure Description
[0048] Figure 1This is a flowchart of the safety compliance testing method for factory scenarios based on FMH-YOLO11 of the present invention.
[0049] Figure 2 This is a diagram of the overall network architecture of the FMH-YOLO11 of the present invention.
[0050] Figure 3 This is a schematic diagram of the heterogeneous structure of the FCM series modules of the present invention.
[0051] Figure 4 This is a structural diagram of the MSFE module of the present invention.
[0052] Figure 5 This is a schematic diagram of the dynamic weight calculation logic of the HPR loss function of the present invention.
[0053] Figure 6 This is a performance comparison chart of the model of this invention with YOLO11n and other mainstream object detection models.
[0054] Figure 7 The ablation experiment diagram of the model of this invention.
[0055] Figure 8 This is a training loss curve of the original YOLO11n model on the factory dataset.
[0056] Figure 9 The training loss curve of the FMH-YOLO11 model of this invention is shown in the figure.
[0057] Figure 10 A comparison chart of the PR curves of the YOLO11n and FMH-YOLO11 models.
[0058] Figure 11 A comparison chart of prediction results between the YOLO11n and FMH-YOLO11 models.
[0059] Figure 12 A comparison chart of prediction results between the YOLO11n and FMH-YOLO11 models. Detailed Implementation Plan
[0060] The present invention will now be described in detail with reference to the accompanying drawings and embodiments.
[0061] Example
[0062] See Figure 1 The safety compliance testing method for factory scenarios based on FMH-YOLO11 provided in this embodiment includes the following steps:
[0063] 1) Constructing the dataset
[0064] The experiment uses a dataset of daily violations in a factory, containing 12,140 training images covering various violations. The dataset is divided into six typical violations and protective status types: wearing a safety helmet, not wearing a safety helmet, smoking in violation of regulations, wearing a reflective vest, using a mobile phone, and falling. Some images in the dataset were taken in dimly lit scenes, increasing the complexity and diversity of the dataset. The training, validation, and test sets are divided in a 7:2:1 ratio.
[0065] 2) Based on the YOLO11n network, a shallow residual variant FCM_3_Res is set in the P2 layer of the backbone network, a shallow residual variant FCM_2_Res is set in the P3 layer, and an MSFE module is further set thereafter. Deep residual variants FCM_1_Res and FCM_Res are set in the P4 and P5 layers. The detection head adopts the Detect_HPR detection head, and the HPR positive sample reweighting mechanism is introduced in the loss calculation stage, thereby constructing the FMH-YOLO11 network model.
[0066] 3) Use the dataset constructed in step 1) to train and optimize the FMH-YOLO11 network model. After 500 rounds of iterative training, it converges to obtain the final FMH-YOLO11 network model.
[0067] 4) Input the test set into the trained model to obtain evaluation metrics such as precision and recall.
[0068] 5) Input the image of the violation to be detected into the trained network model, and output the category, location and bounding box information of the violation in the image.
[0069] The experimental environment for this embodiment is as follows: Operating system: Windows 10; CPU: Intel(R) Core(TM) i7-9700 CPU@3.00GHz; GPU: NVIDIA GeForce RTX 2080; VRAM: 8GB; RAM: 16GB; CUDA version: 11.8; Algorithm integration framework: PyTorch 2.0; Programming language: Python 3.9.
[0070] The hyperparameters in this embodiment are set as follows: input image size is 640×640; batch size is 16; initial learning rate is 0.001; learning rate scheduling adopts cosine annealing strategy; weight decay is 0.0012.
[0071] The following description, in conjunction with the accompanying drawings, further illustrates this embodiment:
[0072] like Figure 1As shown, this invention proposes a complete workflow for detecting violations in factory settings based on FMH-YOLO11. The workflow begins with acquiring images of violations within the factory, proceeds through dataset construction and partitioning, model optimization and improvement, training optimization, and finally, violation detection, clearly presenting the entire process from data acquisition to practical application.
[0073] like Figure 2 As shown, the network model of this invention consists of three parts: a backbone network, a neck network, and a detection head. The backbone network is based on the C3k2 module, with FCM_3_Res, FCM_2_Res, FCM_1_Res, and FCM_Res feature complementarity mapping modules sequentially connected in series at layers P2, P3, P4, and P5 to perform layered enhancement of features at different depths. MSFE is further added after the FCM_2_Res module in layer P3 to strengthen the expressive ability of shallow and mid-level features for small targets. The neck network employs a top-down and bottom-up multi-scale feature fusion structure to fuse and propagate the multi-layer features output from the backbone network. The detection head uses the Detect_HPR detection head to jointly detect and output features at three scales: P3, P4, and P5. The Detect_HPR detection head is not only used to complete multi-scale target detection, but also to carry parameters such as class prior weights, small target class set, reference area threshold, and gain upper limit required by the HPR positive sample reweighting mechanism. These parameters are then passed to the loss calculation module to achieve differentiated reweighting of classification loss, bounding box regression loss, and distribution focus loss during the training phase.
[0074] like Figure 3As shown, in this embodiment, the FCM series modules are respectively set in layers P2, P3, P4, and P5 of the backbone network. Layer P2 uses FCM_3_Res, layer P3 uses FCM_2_Res, layer P4 uses FCM_1_Res, and layer P5 uses FCM_Res. The basic process is as follows: the input feature X is divided into a main branch X1 and an auxiliary branch X2 along the channels; the main branch is convolved to obtain the enhanced feature F, and the auxiliary branch is convolved to obtain the auxiliary feature F2; spatial attention is then generated from the auxiliary branch feature F2 to spatially modulate the enhanced feature F1 of the main branch; channel attention is generated from the enhanced feature F1 of the main branch to channel modulate the auxiliary branch feature F2; finally, the two cross-modulation results are added and fused, and the enhanced feature is output using a residual strategy. In the shallow stages, FCM_3_Res and FCM_2_Res employ a channel partitioning method where the main branch occupies 3 / 4 and the auxiliary branch occupies 1 / 4. They use 1×1 convolution mapping and 3×3 followed by 1×1 convolution mapping, respectively, and employ weak residual output with a coefficient of 0.2. In the deep stages, FCM_1_Res and FCM_Res also employ a channel partitioning method where the main branch occupies 1 / 4 and the auxiliary branch occupies 3 / 4. The main branch of FCM_1_Res uses two layers of 3×3 convolution followed by 1×1 convolution mapping, while FCM_Res adds an additional 1×1 convolution layer after fusion. Both are output through outer residual encapsulation. Through this design, the FCM series modules achieve hierarchical feature enhancement that is more detail-oriented in the shallow layers and more semantic-oriented in the deep layers.
[0075] Figure 4 As shown, in this embodiment, the MSFE module is located in the P3 layer of the backbone network to enhance the expressive power of shallow and medium-depth features for small and fine-grained targets. This module simultaneously feeds the input feature X into two parallel convolutional branches. One branch uses a 3×3 depthwise convolution followed by a 1×1 convolution to obtain feature X1, used to extract local detail information; the other branch uses a 5×5 depthwise convolution followed by a 1×1 convolution to obtain feature X2, used to extract contextual information within a larger receptive field. These are then normalized to obtain dynamic weights w1 and w2, which are then weighted and fused together. After weighted fusion, X1 and X2 are added to generate a spatial attention mask, spatially modulating the fused features, and then integrated through a 1×1 fusion convolution. Finally, the output of the main branch is added to (0.2 + 0.15·σ(a))X to obtain the enhanced feature, where a is a learnable parameter with an initial value of 0. With the above structure, the MSFE module can simultaneously fuse local detail information and contextual semantic information with low additional overhead, thereby improving the P3 layer's ability to detect small targets.
[0076] like Figure 5As shown, this invention employs a Detect_HPR detection head in the detection head section, and presets parameters such as classification prior weights, regression prior weights, small target category set, reference area threshold, and gain upper limit within it. During the training phase, the loss calculation module reads these parameters and executes the HPR positive sample reweighting mechanism. In this embodiment, the small target category set is C. small ={5}, Reference area threshold A ref Set to 1024, corresponding to a 32×32 pixel area, with a gain cap g. max Let the weights be 1.3. The classification prior weights are set to [1.0, 1.1, 1.0, 1.0, 1.0, 1.2], and the regression prior weights are set to [1.0, 1.2, 1.0, 1.0, 1.0, 1.3], where the classification prior weight for the smoking category is 1.2, and the regression prior weight is 1.3. The total loss weight coefficient is set to λ. box =7.5, λ cls =0.5, λ dfl =1.5. The remaining process is as follows: First, determine whether a positive sample belongs to the preset small target augmentation object based on the positive sample category and the ground truth box area; if the condition is met, calculate the size weight based on the ratio of the reference area to the ground truth box area; otherwise, keep the default weight unchanged; then generate classification weights and regression weights respectively, where the classification weights adopt a relatively gentle gain method, and the regression weights adopt a stronger gain and set an upper limit constraint; finally, combine the weighted classification loss, bounding box regression loss and distribution focus loss to form the total loss and use it to update the model parameters.
[0077] like Figure 6 The diagram shows the performance comparison results between the proposed FMH-YOLO11 model and existing mainstream YOLO series models. Precision, recall, and mAP50 are the core evaluation metrics for measuring the model's detection accuracy. It can be seen that the FMH-YOLO11 model's precision, recall, and mAP50 values are generally superior to the corresponding values of the basic YOLO11n model and other comparative models. This indicates that the proposed FMH-YOLO11 model outperforms the YOLO11n baseline model and some comparative models in terms of overall recognition accuracy.
[0078] like Figure 7 As shown, the ablation experiments were conducted using YOLO11n as the baseline model, progressively incorporating layered FCM, MSFE, and HPR mechanisms. Comparison of evaluation metrics at different indexes reveals that the overall detection performance of the model improved with the gradual introduction of each improved module. The model incorporating all improved modules ultimately achieved superior results, with the highest performance in accuracy and mAP50.
[0079] like Figure 8 and Figure 9As shown, the training loss of the two models, YOLO11n and FMH-YOLO11, is displayed. It can be seen that after 500 training rounds, both models have reached convergence.
[0080] like Figure 10 The figure shows a comparison of the Performance Index (PR) curves of the baseline model YOLO11n and the proposed FMH-YOLO11 model. The area enclosed by the PR curve and the horizontal and vertical axes represents the average accuracy of the model. As can be seen from the figure, the overall area enclosed by the PR curve of the FMH-YOLO11 model is larger than that of the corresponding area of the YOLO11n model. Furthermore, for the extremely difficult-to-detect tiny target 'smoking' in factory scenarios, the corresponding curve area increases from 0.571 to 0.629, indicating that the proposed FMH-YOLO11 model exhibits better detection performance on tiny illegal targets.
[0081] like Figure 11 and Figure 12 The image shows a comparison of the prediction results of the YOLO11n and FMH-YOLO11 models under various complex industrial scenarios, including not wearing a safety helmet, smoking illegally, wearing a reflective vest, using a mobile phone, and falls. The left image shows the prediction results of the YOLO11n model, and the right image shows the prediction results of the FMH-YOLO11 model. Figure 11 and Figure 12 It can be seen that the FMH-YOLO11 model can reduce the missed detection of relevant targets in some complex scenarios and give a high detection confidence.
[0082] Through the detailed description of the above figures, the innovation and advantages of the FMH-YOLO11-based safety compliance testing method for factory scenarios of the present invention are clearly demonstrated.
Claims
1. A method for safety compliance testing in factory settings based on FMH-YOLO11, characterized in that, Includes the following steps: 1) Collect image data containing personnel violations and protective status using on-site monitoring equipment in the factory. Filter, clean, and manually annotate the collected images to obtain target category labels and bounding box annotation information. Divide the annotated data into training set, validation set, and test set according to a preset ratio. Perform data augmentation processing on the training set images. 2) Based on YOLO11n, corresponding variants of the Feature Complementary Mapping (FCM) module are set after the C3k2 modules in layers P2, P3, P4, and P5 of the backbone network, and a Multi-Scale Feature Enhancement (MSFE) module is set in layer P3 of the backbone network. At the same time, a positive sample reweighting detection head Detect_HPR (Detect_Hard-class Positive Reweighting) is designed at the detection head, and a positive sample reweighting mechanism HPR (Hard-class Positive Reweighting) is designed in the loss calculation stage. 3) Input the training set into the improved network for iterative training until the model converges to obtain the object detection model; 4) Input the validation set or test set into the trained model to obtain the three core evaluation metrics: precision, recall, and mAP50. 5) Input the factory scene image to be detected into the trained FMH-YOLO11 model, and output the target category, bounding box coordinates and confidence score to realize the automatic detection and recognition of target protection status and illegal behavior in the factory scene.
2. The method as described in claim 1, characterized in that, The FCM module divides the input features into main branch features and auxiliary branch features through a channel splitting strategy. The main branch is responsible for convolution modeling, and the auxiliary branch is responsible for information preservation and modulation. Subsequently, spatial attention is generated by the auxiliary branch to spatially modulate the features of the main branch, and channel attention is generated by the main branch to channel modulate the features of the auxiliary branch. Finally, the two cross-modulation results are fused, and different residual strategies are used to output enhanced features according to different level variants. The calculation process is as follows: X1, X2 = Split(X) (1) F1=φ1(X1), F2=φ2(X2) (2) M s =Spatial(F2),M c =Channel(F1) (3) Y=M s ⊙F1+M c ⊙F2 (4) AND out =Y+βX (5) In the above formula, X represents the input feature; X1 and X2 represent the two sub-features after channel partitioning; φ1(X1) represents the main branch convolutional mapping function, outputting enhanced feature F1; φ2(X2) represents the auxiliary branch convolutional mapping function, outputting auxiliary feature F2; M s This represents the spatial attention mask generated by F2; M c Y represents the channel attention weights generated by F1; ⊙ represents the Hadamard product; Y represents the fused feature after adding the two cross-modulation results; Y out β represents the final output characteristic; β represents the residual adjustment coefficient.
3. The method as described in claim 1, characterized in that, The MSFE module is located in the P3 layer of the backbone network. The MSFE module uses two parallel convolutional branches with different receptive fields to extract multi-scale features, and adaptively fuses the extracted features using dynamic normalized weights and spatial attention mechanisms. Its output calculation process is as follows: x1=Conv 1×1 (DWConv 3×3 (X)),x2=Conv 1×1 (DWConv 5×5 (X)) (8) F = w1·x1 + w2·x2 (9) S=σ(Corv 5×5 (x1+x2)) (10) Y MSFE =Fuse(F⊙S)+(k1+k2·σ(a))X (11) In the above formula, X represents the input feature; ψ(X) represents the branch weight generation function, used to generate the initial weights for the two branches based on the input features. and w i ε represents the normalized dynamic weights; ε represents the minimum constant to prevent the denominator from being zero; x1 and x2 represent the mapping results of two different convolutional branches to the input feature X, where x1 corresponds to the branch output of a 3×3 depthwise convolution followed by a 1×1 convolution, and x2 corresponds to the branch output of a 5×5 depthwise convolution followed by a 1×1 convolution; F represents the weighted fusion result of the two branches under the action of dynamic weights; S represents the spatial attention mask; σ represents the Sigmoid activation function; Fuse represents the fusion mapping function; a represents the learnable residual parameter; Y MSFE The output characteristics of the module are represented by k1 and k2, which represent the coefficients of the residual terms after bias scaling.
4. The method as described in claim 1, characterized in that, In the loss calculation stage, a positive sample reweighting mechanism of HPR is adopted. The mechanism uses the Detect_HPR detection head to attach classification prior weights, regression prior weights, small target category set, reference area threshold and gain upper limit parameters. After the loss calculation module reads the parameters in the training stage, it performs differential reweighting on the positive samples of the preset small target category and key category. In the above formula, c represents the target class of the current positive sample, C small A represents a predefined set of small target categories. gi A represents the area of the true bounding box of the positive sample. ref The reference area threshold is represented by ε, which is the minimum constant to prevent the denominator from being zero, and g is the minimum value. max Indicates the upper limit of gain for size weights; w size This represents the size weight calculated based on the target size. For the bounding box regression branch, introduce prior weights from the class regression. Construct the bounding box reweighting factor: In the above formula, W represents the prior weight of category c in the bounding box regression branch. box This represents the regression reweighting factor, which is determined by the prior weights of the class regression and the size weights, and an upper limit constraint is set to maintain training stability. For the classification branch, a prior weight for category classification is introduced. Constructing classification reweighting factors: In the above formula, W represents the prior weight of category c in the classification branch. cls Let represent the classification reweighting factor; a and b are the preset weight coefficients for the classification branches, and the final total loss function is expressed as: In the above formula, This represents the regression loss after weighting by the bounding box. This represents the classification loss after weighting by classification weights. λ represents the distribution focus loss obtained under the guidance of the bounding box weights. box , λ cls and λ dfl L represents the weighting coefficients of regression loss, classification loss, and distribution focus loss in the total loss, respectively. total This represents the total loss ultimately used for backpropagation.
5. A factory scenario safety compliance testing system based on FMH-YOLO11 as described in any one of claims 1 to 4, characterized in that, It includes an image acquisition module, an image enhancement module, a model design module, a loss function optimization module, a model training module, and an object detection module; The module connections are as follows: the output of the image acquisition module is connected to the input of the image enhancement module; the outputs of the image enhancement module, model design module, and loss function optimization module are all connected to the input of the model training module; and the output of the model training module is connected to the input of the object detection module. The image acquisition module is used to collect video streams using monitoring equipment deployed in factory workshops, material handling areas, entrances and exits, and key locations, and extract image frames as raw data to cover personnel work status, equipment operating status, and areas where violations occur. The image enhancement module is used to perform data enhancement processing on the original image. The data enhancement processing includes copy and paste enhancement, splicing enhancement, flip enhancement, translation enhancement, scaling enhancement, color perturbation and angle perturbation, so as to improve the generalization ability of the model in complex lighting, occlusion, cluttered background and other factory scene. The model design module is used to introduce a complementary feature mapping module (FCM) at different levels of the backbone network based on the YOLO11 network, and to propose a multi-scale feature enhancement module (MSFE) at the P3 layer to improve the feature extraction capability for fine-grained illegal targets in complex backgrounds. The loss function optimization module is used to propose an HPR positive sample reweighting mechanism. By calculating the small target size weight and combining it with the category prior weight, the classification loss, bounding box regression loss and distribution focus loss of positive samples are reweighted in a differentiated manner to improve the detection accuracy of preset small target categories and key categories. The model training module is used to input the labeled factory scene training set into the improved FMH-YOLO11 network for training until the model converges and the target detection weight model is obtained. The target detection module is used to input the image of the factory scene to be detected or the real-time monitoring screen into the trained target detection weight model, and output the target category, bounding box coordinates, target confidence and corresponding detection results.