A multi-class anomaly detection method and system for complex industrial workshop scenarios

By constructing the CNSD-YOLO detection model, the comprehensive monitoring problem of detecting multiple types of abnormal behavior in industrial workshops was solved, achieving high-precision and robust real-time detection, and adapting to multiple types of abnormal targets in complex industrial scenarios.

CN122391977APending Publication Date: 2026-07-14LONGYAN UNIV

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
LONGYAN UNIV
Filing Date
2026-03-27
Publication Date
2026-07-14

AI Technical Summary

Technical Problem

Existing technologies for detecting abnormal behavior in industrial workshops lack the ability to comprehensively monitor multiple types of abnormal behavior, and their positioning accuracy is poor when dealing with small targets and occlusion, making them difficult to adapt to complex industrial scenarios.

Method used

We construct a lightweight YOLO detection model that integrates multi-scale feature enhancement, adaptive receptive field selection, high-level semantic feature injection, dynamic label allocation, and improved bounding box regression, including the CNSD-YOLO detection model. Through data augmentation, backbone network, feature fusion, and detection head design, we achieve high-precision, robust, and real-time detection of multi-class abnormal targets.

Benefits of technology

It achieves high-precision detection of multiple types of abnormal targets in complex industrial workshops, with high robustness and real-time performance. It can effectively handle small targets and occlusion situations and has cross-scene generalization capabilities.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122391977A_ABST
    Figure CN122391977A_ABST
Patent Text Reader

Abstract

The application discloses a kind of multi-class abnormality detection method and system for complex industrial workshop scene, it is related to target detection technical field, method includes: by gathering and carrying out enhancement construction training set including whether smoking flame, whether wearing safety helmet, whether wearing mask category monitoring video data;Multi-scale feature extraction and adaptive receptive field selection are realized based on the CNSD-YOLO model of topological reconstruction, multi-scale enhanced feature map is generated by using bidirectional feature pyramid fusion high-level semantic feature;Detection head introduces DynamicATSS dynamic allocation positive and negative samples, combined with improved NWD loss optimization bounding box regression, joint classification probability and regression result output high-precision abnormal target positioning and class identification result;Real-time detection and alarm are realized by being deployed in edge terminal.The application realizes the real-time detection of complex industrial workshop abnormal behavior by multi-scale feature enhancement, adaptive receptive field selection, high-level semantic feature fusion and dynamic label allocation improved bounding box regression detection model.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of target detection technology, specifically to a multi-category anomaly detection method and system for complex industrial workshop scenarios. Background Technology

[0002] With the deepening development of informatization and intelligentization, the industrial manufacturing industry is gradually moving towards a new stage of high-quality, high-efficiency, and safe production. In supporting the rapid development of the economy and society, production safety issues in industrial workshops are becoming increasingly prominent. In reality, safety hazards such as workers not wearing safety helmets or dust masks as required, smoking in violation of regulations in work areas, and open flames at the operating site occur frequently. These violations may lead to fires, explosions, or casualties, causing huge losses to enterprises and society.

[0003] Currently, deep learning-based target detection technology has been applied in the field of industrial safety, especially the YOLO series algorithms, which are favored for their balance between speed and accuracy. However, existing technologies for detecting abnormal behavior in industrial workshops still face significant challenges:

[0004] On the one hand, existing detection models are mostly optimized for a single specific behavior (such as detecting only safety helmets or only flames), lacking the comprehensive monitoring capability for multiple types of abnormal behaviors in the workshop (such as simultaneously detecting smoking, fire, and improper clothing), resulting in insufficient model generalization ability.

[0005] On the other hand, industrial workshops present complex environments with variable lighting conditions and targets of vastly different sizes (from tiny cigarette butts and flames to larger personnel-worn equipment). Existing technologies often suffer from missed or false detections when dealing with extremely small targets (such as distant cigarette butts) or targets with occlusion or overlap, resulting in poor localization accuracy. Traditional IoU-based loss functions are overly sensitive to positional deviations when dealing with small targets, further limiting detection performance.

[0006] Therefore, there is an urgent need for a high-precision abnormal behavior detection method that can adapt to complex industrial scenarios and effectively solve problems involving multiple categories, small targets, multiple scales, and occlusion. Summary of the Invention

[0007] To address the aforementioned issues, this invention proposes a multi-category anomaly detection method and system for complex industrial workshop scenarios. By constructing a lightweight YOLO detection model that integrates multi-scale feature enhancement, adaptive receptive field selection, high-level semantic feature injection, dynamic label allocation, and improved bounding box regression, it achieves high-precision, robust, and real-time detection and localization of multiple categories of abnormal targets in complex industrial workshops, such as smoking, flames, not wearing safety helmets, and not wearing masks.

[0008] On the one hand, a multi-category anomaly detection method for complex industrial workshop scenarios includes:

[0009] S1. Collect multi-category surveillance video data in the industrial workshop, establish a dataset including categories such as smoking, flames, whether or not a safety helmet is worn, and whether or not a mask is worn, and perform augmentation processing on the dataset to obtain augmented training data;

[0010] S2: Construct a CNSD-YOLO detection model based on topology reconstruction. The CNSD-YOLO detection model is based on the YOLOv8 architecture and includes a backbone network, a feature fusion network, and a detection head connected in sequence.

[0011] The sequentially connected backbone network includes an input convolutional layer, various levels of C3_ConvNeXTv2 units, and SKAttention units. The sequentially connected backbone network receives the enhanced training data, performs initial feature extraction through the input convolutional layer to obtain shallow feature maps, and then performs feature enhancement through various levels of C3_ConvNeXTv2 units to output multi-scale feature maps. The multi-scale feature maps are then subjected to adaptive receptive field selection by the SKAttention unit to obtain enhanced high-level semantic features.

[0012] The feature fusion network fuses enhanced high-level semantic features with a bidirectional feature pyramid structure to obtain a multi-scale enhanced feature map.

[0013] The detection head includes a classification branch and a regression branch. The detection head takes a multi-scale enhanced feature map as input and uses the DynamicATSS dynamic label allocation strategy to assign positive samples, corresponding categories, and coordinate labels to the ground truth bounding boxes for each training data. Then, the classification branch outputs the category prediction probability based on the category and coordinate labels of the ground truth bounding boxes. The regression branch uses an improved NWD loss to optimize the bounding box parameters on the positive samples allocated by DynamicATSS. Finally, the category prediction probability and the optimized bounding box parameters are jointly decoded to generate the category label and bounding box coordinates of the abnormal target.

[0014] S3 utilizes the enhanced training data to perform end-to-end optimization training on the constructed CNSD-YOLO detection model. The optimized and trained model is then deployed on an industrial edge computing terminal to perform inference on real-time video streams. When abnormal behavior is detected, an alarm is triggered.

[0015] Furthermore, the C3_ConvNeXtv2 unit defines a cross-scale feature aggregation function. Feature enhancement is performed using the following formula:

[0016] ;

[0017] ;

[0018] in, Input feature map; The aggregated output feature map; and For two parallel The convolutional dimensionality reduction branch compresses the number of channels to half each; express One ConvNeXtv2 bottleneck module is connected in series; For channel splicing; for Convolution restores the concatenated result to the number of output channels; This represents the effect of a single bottleneck module on input features. Residual mapping; for Depthwise separable convolution; For layer normalization function; For point-by-point linear dimensionality increase; The activation function for the Gaussian error linear unit; This is the global response normalization function; This is a point-by-point linear dimensionality reduction.

[0019] Furthermore, the SKAttention unit performs adaptive receptive field selection, specifically through a dynamic process of splitting, fusing, and selecting, to perform channel-level adaptive scale selection on multi-scale feature maps, including:

[0020] Four branch feature maps with different receptive fields are generated through a splitting operation. Then, the feature maps of each branch are summed and integrated element-wise through a fusion operation. Global average pooling is used to count the response intensity of each channel. A compact channel description vector is generated through linear transformation. Finally, through a selection operation, the attention weights of different convolutional kernel branches are adaptively calculated based on the channel description vectors through independent linear mapping and Softmax normalization of each branch. The attention weights are weighted and summed with the corresponding branch feature maps to complete the adaptive receptive field selection and obtain enhanced high-level semantic features.

[0021] Furthermore, the attention weights for different convolutional kernel branches are adaptively calculated, and the attention weights are summed with the corresponding branch feature maps using the following formula:

[0022] ;

[0023] ;

[0024] in, Let C be the input feature map, where C is the number of channels, H is the height of the input image, and W is the width of the input image. The output feature map after scale selection; For the first Convolution, normalization, and activation mapping for each branch; , representing the kernel size of the four branches; Represents a compact channel description vector; For the first Independent fully connected layer weights for each branch; Indicates the first The branch in the Attention weights on each channel; Multiplication is broadcast channel by channel.

[0025] Furthermore, the improved NWD loss calculation formula is as follows:

[0026] ;

[0027] ;

[0028] in, , , and Represents the x-coordinate, y-coordinate, width, and height of the prediction box; , , and Represents the x-coordinate, y-coordinate, width, and height of the actual bounding box; For regression loss; Represents the normalized Wasserstein distance similarity; It is the numerical stability constant; This is the normalized scaling parameter; This is the intersection-union ratio (IoU) between the predicted bounding box and the ground truth bounding box. The Euclidean distance between the center points of the two frames; The length of the diagonal of the smallest bounding rectangle; This is a penalty for aspect ratio consistency. The value is a constant term.

[0029] Furthermore, the DynamicATSS dynamic label allocation strategy assigns positive samples to the ground truth bounding boxes corresponding to each training data point specifically as follows: based on the ground truth bounding boxes corresponding to each training data point, the closest center distance is selected... A dynamic alignment index is constructed by fusing candidate anchor points with the intersection-union ratio (IU) and classification confidence scores using a power-weighted fusion. The sum of the mean and standard deviation of this index for the candidate set is used as an adaptive threshold. Candidates that exceed the threshold and whose centers fall within the ground truth bounding boxes are selected as positive samples. The classification labels of positive samples are soft-weighted using the IU of the predicted and ground truth bounding boxes. The dynamic alignment index is calculated using the following formula:

[0030] ;

[0031] in, Candidate anchor boxes; True bounding box; This is a dynamic alignment metric. The intersection-union ratio of the two frames; The model's classification confidence of the anchor point in the category to which the ground truth bounding box belongs; This is used to make IoU dominate the scoring with a higher power.

[0032] On the other hand, a multi-category anomaly detection system for complex industrial workshop scenarios includes:

[0033] The data augmentation module is used to collect multi-category surveillance video data in industrial workshops, establish datasets including categories such as smoking, flames, whether or not safety helmets are worn, and whether or not masks are worn, and perform augmentation processing on the datasets to obtain augmented training data;

[0034] The model building module is used to build a CNSD-YOLO detection model based on topology reconstruction. The CNSD-YOLO detection model is based on the YOLOv8 architecture and includes a backbone network, a feature fusion network and a detection head connected in sequence.

[0035] The sequentially connected backbone network includes an input convolutional layer, various levels of C3_ConvNeXTv2 units, and SKAttention units. The sequentially connected backbone network receives the enhanced training data, performs initial feature extraction through the input convolutional layer to obtain shallow feature maps, and then performs feature enhancement through various levels of C3_ConvNeXTv2 units to output multi-scale feature maps. The multi-scale feature maps are then subjected to adaptive receptive field selection by the SKAttention unit to obtain enhanced high-level semantic features.

[0036] The feature fusion network fuses enhanced high-level semantic features with a bidirectional feature pyramid structure to obtain a multi-scale enhanced feature map.

[0037] The detection head includes a classification branch and a regression branch. The detection head takes a multi-scale enhanced feature map as input and uses the DynamicATSS dynamic label allocation strategy to assign positive samples, corresponding categories, and coordinate labels to the ground truth bounding boxes for each training data. Then, the classification branch outputs the category prediction probability based on the category and coordinate labels of the ground truth bounding boxes. The regression branch uses an improved NWD loss to optimize the bounding box parameters on the positive samples allocated by DynamicATSS. Finally, the category prediction probability and the optimized bounding box parameters are jointly decoded to generate the category label and bounding box coordinates of the abnormal target.

[0038] The detection module is used to perform end-to-end optimization training on the constructed CNSD-YOLO detection model using enhanced training data. The optimized and trained model is then deployed on an industrial edge computing terminal to perform inference on the real-time video stream. When abnormal behavior is detected, an alarm is triggered.

[0039] The present invention adopts the above technical solution and has the following beneficial effects:

[0040] (1) This invention achieves high robustness in detecting distant, small-sized and partially occluded abnormal targets in industrial workshops by constructing a backbone network structure that combines multi-scale feature enhancement and adaptive receptive field selection.

[0041] (2) This invention introduces an improved bounding box regression loss that integrates center distance, width and height difference and circumscribed rectangle geometric constraints, and combines a label allocation strategy with dynamic thresholds to achieve high-precision localization of abnormal target bounding boxes and high consistency of category prediction results.

[0042] (3) This invention achieves real-time inference capability and cross-scenario generalization capability for edge computing terminals by using a lightweight topology reconstruction design based on the YOLOv8 architecture, including efficient feature reuse structure, semantically enhanced bidirectional feature fusion and low-overhead attention mechanism. Attached Figure Description

[0043] Figure 1 This is a flowchart of a multi-category anomaly detection method for complex industrial workshop scenarios according to an embodiment of the present invention;

[0044] Figure 2 This is a diagram showing the overall network structure of the abnormal behavior detection framework according to an embodiment of the present invention.

[0045] Figure 3 This is a schematic diagram of the attention mechanism module in an embodiment of the present invention;

[0046] Figure 4 Examples of various target samples constructed according to embodiments of the present invention;

[0047] Figure 5 This is a performance comparison table of ablation experiments according to embodiments of the present invention;

[0048] Figure 6 This is a diagram of a multi-category anomaly detection system for complex industrial workshop scenarios according to an embodiment of the present invention. Detailed Implementation

[0049] The present invention will be further described in detail below with reference to the embodiments and accompanying drawings, but the embodiments of the present invention are not limited thereto.

[0050] like Figure 1 As shown, the present invention provides a multi-category anomaly detection method for complex industrial workshop scenarios, comprising:

[0051] S1. Collect multi-category surveillance video data in the industrial workshop, establish a dataset including categories such as smoking, flames, whether or not a safety helmet is worn, and whether or not a mask is worn, and perform augmentation processing on the dataset to obtain augmented training data.

[0052] Specifically, in this embodiment, a multi-source heterogeneous industrial abnormal behavior feature space is constructed, and multi-category surveillance video data from industrial workshops are collected to establish an IWSB-6 dataset including categories such as smoking, flames, wearing / not wearing a safety helmet, and wearing / not wearing a mask. The data is then augmented to simulate changes in lighting and motion blur in the industrial environment.

[0053] S2, Construct a CNSD-YOLO detection model based on topology reconstruction. The CNSD-YOLO detection model is based on the YOLOv8 architecture and includes a backbone network, a feature fusion network, and a detection head connected in sequence.

[0054] The sequentially connected backbone network includes an input convolutional layer, various levels of C3_ConvNeXTv2 units, and SKAttention units. The sequentially connected backbone network receives the enhanced training data. After input, the data is processed by the input convolutional layer to extract initial features and obtain a shallow feature map. The shallow feature map is then enhanced by various levels of C3_ConvNeXTv2 units to output a multi-scale feature map. The multi-scale feature map is then processed by the SKAttention unit to perform adaptive receptive field selection, resulting in enhanced high-level semantic features.

[0055] The feature fusion network is used to fuse enhanced high-level semantic features through a bidirectional feature pyramid structure to obtain a multi-scale enhanced feature map;

[0056] The detection head includes a classification branch and a regression branch. The detection head takes multi-scale enhanced feature maps as input and uses the DynamicATSS dynamic label allocation strategy to assign positive samples, corresponding class and coordinate labels to the ground truth bounding boxes corresponding to each training data. Then, the classification branch outputs the class prediction probability based on the class and coordinate labels corresponding to the ground truth bounding boxes. The regression branch uses an improved NWD loss to optimize the bounding box parameters on the positive samples allocated by DynamicATSS. Finally, the class prediction probability and the optimized bounding box parameters are jointly decoded to generate the class label and high-precision bounding box coordinates of the abnormal target.

[0057] Specifically, the C3_ConvNeXtv2 unit defines a cross-scale feature aggregation function. Feature enhancement is performed using the following formula:

[0058] ;

[0059] ;

[0060] in, Input feature map; The aggregated output feature map; and For two parallel The convolutional dimensionality reduction branch compresses the number of channels to half each; express One ConvNeXtv2 bottleneck module is connected in series; For channel splicing; for Convolution restores the concatenated result to the number of output channels; This represents the effect of a single bottleneck module on input features. Residual mapping; for Depthwise separable convolution; For layer normalization function; For point-by-point linear dimensionality increase; The activation function for the Gaussian error linear unit; This is the global response normalization function; This is a point-by-point linear dimensionality reduction.

[0061] Specifically, the SKAttention unit performs adaptive receptive field selection by performing channel-level adaptive scale selection on multi-scale feature maps through a dynamic process of splitting, fusing, and selecting. This includes:

[0062] Four branch feature maps with different receptive fields are generated through a splitting operation. Then, the feature maps of each branch are summed and integrated element-wise through a fusion operation. Global average pooling is used to count the response intensity of each channel. A compact channel description vector is generated through linear transformation. Finally, through a selection operation, the attention weights of different convolutional kernel branches are adaptively calculated based on the channel description vectors through independent linear mapping and Softmax normalization of each branch. The attention weights are weighted and summed with the corresponding branch feature maps to complete the adaptive receptive field selection and obtain enhanced high-level semantic features.

[0063] Specifically, the attention weights for different convolutional kernel branches are adaptively calculated, and the attention weights are summed with the corresponding branch feature maps using the following formula:

[0064] ;

[0065] ;

[0066] in, Let C be the input feature map, where C is the number of channels, H is the height of the input image, and W is the width of the input image. The output feature map after scale selection; For the first Convolution, normalization, and activation mapping for each branch; , representing the kernel size of the four branches; Represents a compact channel description vector; For the first Independent fully connected layer weights for each branch; Indicates the first The branch in the Attention weights on each channel; Multiplication is broadcast channel by channel.

[0067] Specifically, the improved NWD loss calculation formula is as follows:

[0068] ;

[0069] ;

[0070] in, , , and Represents the x-coordinate, y-coordinate, width, and height of the prediction box; , , and Represents the x-coordinate, y-coordinate, width, and height of the actual bounding box; For regression loss; Represents the normalized Wasserstein distance similarity; It is the numerical stability constant; This is the normalized scaling parameter; This is the intersection-union ratio (IoU) between the predicted bounding box and the ground truth bounding box. The Euclidean distance between the center points of the two frames; The length of the diagonal of the smallest bounding rectangle; This is a penalty for aspect ratio consistency. The value is a constant term;

[0071] Specifically, the DynamicATSS dynamic label allocation strategy assigns positive samples to the ground truth bounding boxes corresponding to each training data point as follows: based on the ground truth bounding boxes corresponding to each training data point, the closest center distance is selected as the frontmost positive sample. A dynamic alignment index is constructed by fusing candidate anchor points with the intersection-union ratio (IU) and classification confidence scores using a power-weighted fusion. The sum of the mean and standard deviation of this index for the candidate set is used as an adaptive threshold. Candidates that exceed the threshold and whose centers fall within the ground truth bounding boxes are selected as positive samples. The classification labels of positive samples are soft-weighted using the IU of the predicted and ground truth bounding boxes. The dynamic alignment index is calculated using the following formula:

[0072] ;

[0073] in, Candidate anchor boxes; True bounding box; This is a dynamic alignment metric. The intersection-union ratio of the two frames; The model's classification confidence of the anchor point in the category to which the ground truth bounding box belongs; This is used to make IoU dominate the scoring with a higher power.

[0074] Specifically, this embodiment is based on the YOLOv8 architecture, but its core information flow processing mechanism has been theoretically reconstructed as follows: A non-local context anisotropic aggregation mechanism (Backbone reconstruction) is implemented, constructing the C3_ConvNeXtv2 module in the backbone network. To address industrial background noise interference, a large kernel convolution and an inverted bottleneck structure are introduced. Unlike traditional local convolution, this module constructs a non-local feature topology through a large 7x7 receptive field, utilizes depthwise convolution to achieve anisotropic aggregation of spatial information, and combines it with global response normalization (GRN) to enhance the semantic strength of the target while suppressing the propagation of high-frequency background noise. An elastic receptive field dynamic resonance network (Neck reconstruction) integrates the SKAttention (Selective KernelAttention) mechanism in the feature fusion stage. To address the problem of multi-scale target coexistence, an energy resonance model of the neuron's receptive field is established. The network dynamically adjusts the effective receptive field (ERF) of neurons by adaptively calculating the resonance coefficients of different convolutional kernel branches based on the statistical entropy values ​​of the input features through three dynamic processes: "split," "fuse," and "select." This allows the network to automatically behave in a "microscope" mode when processing cigarette butts and in a "wide-angle" mode when processing people.

[0075] Furthermore, a probability decoupling metric based on Gaussian manifold distribution (Head / Loss reconstruction) introduces an improved NWD (Normalized Wasserstein Distance) loss function into the detection head. It abandons the traditional geometric bounding box regression paradigm, modeling the target object as a 2D Gaussian probability distribution. Similarity is measured by calculating the Wasserstein distance between the predicted and true distributions. This mechanism transforms discrete geometric position regression into a problem of approximating a continuously differentiable probability distribution, mathematically solving the singularity problem of vanishing IoU gradients for small targets. A quality-driven gradient potential balancing strategy (label assignment reconstruction) is employed: DynamicATSS (Dynamic Anchor-based LoopAssignment) is used. A dynamic threshold model based on statistical characteristics is established, calculating the mean and variance of the IoU between each Ground Truth and candidate anchor boxes, dynamically defining the decision boundary between positive and negative samples. This strategy achieves Pareto optimality for both classification and regression tasks on the loss function surface, eliminating gradient conflicts in multi-task learning.

[0076] S3 utilizes the enhanced training data to perform end-to-end optimization training on the constructed CNSD-YOLO detection model. The optimized and trained model is then deployed on an industrial edge computing terminal to perform inference on real-time video streams. When abnormal behavior is detected, an alarm is triggered.

[0077] Specifically, such as Figure 2 As shown, the abnormal behavior detection framework in this embodiment consists of a backbone network, a neck network, and a detection head. The backbone network is responsible for extracting multi-scale features, the neck network enhances semantic information through bidirectional feature fusion, and the detection head completes the localization and identification of multiple categories of abnormal targets, achieving high-precision real-time detection in complex industrial workshop scenarios. Figure 3 As shown, the attention mechanism module in this embodiment mainly includes three processes: splitting, fusion, and selection. This module extracts multi-scale features through different convolutional kernel branches, and adaptively adjusts the response intensity of each branch by combining global pooling and Softmax weight allocation, thereby achieving dynamic selection and feature enhancement of the effective receptive field of the target. Figure 4 As shown, the target samples constructed in this embodiment cover typical categories such as whether a safety helmet is not worn, smoking behavior, mask wearing status, and flames. They can effectively cover personnel violations and dangerous events in complex industrial workshop scenarios, providing diverse sample support for subsequent model training and anomaly detection.

[0078] Specifically, this invention provides an end-to-end intelligent monitoring process for abnormal behavior in industrial workshops. This process integrates data acquisition, real-time reasoning, and alarm response mechanisms, and can be applied in the following steps:

[0079] Input source selection and initialization: After system startup, two detection modes can be selected;

[0080] Video detection mode: Suitable for retrospective analysis of historical data. Users can directly import recorded surveillance video files.

[0081] Real-time video stream detection mode for cameras: Suitable for real-time monitoring. The system lists available cameras, and the user selects a specific camera source (such as workshop entrance, work area, etc.) to connect to.

[0082] Video stream acquisition and frame processing: The system continuously monitors the status of the input source. If a valid video stream or video file exists, the system will perform the "acquire real-time video stream" operation.

[0083] Detection mechanism: The system is configured with logic to determine whether a stream is running. If the video stream is interrupted or the file playback ends, the process terminates; if the stream is normal, it proceeds to the frame-level processing stage.

[0084] Frame extraction: The system acquires each frame of the video stream at a preset sampling rate (such as 25 frames per second or frame extraction as needed) as input data for subsequent algorithm models.

[0085] Anomaly detection (core of algorithm inference): Each acquired frame of image is input into the pre-trained CNSD-YOLO model for inference. The model performs feature extraction, multi-scale fusion, and target localization and classification on the current frame to determine whether there are preset abnormal behaviors in the image (e.g., Detect: [fire, cigarette, without_helmet, without_mask]).

[0086] Judgment logic: The system determines whether "abnormal behavior has been detected" based on the class confidence and bounding box information output by the model.

[0087] If not: The system will automatically ignore the current result and return to the video stream acquisition step to continue processing the next frame.

[0088] If so: trigger the exception response mechanism.

[0089] Anomaly Response and Closed Loop: When an abnormal behavior is detected, the system performs the following operations in sequence: Record anomaly information: Save the anomaly type (e.g., "open flame detected"), occurrence time, location coordinates, and corresponding on-site screenshots to the database or log file.

[0090] Initiate alarms: Notify administrators via sound and light alarms, pop-up notifications, or push messages.

[0091] After the alarm is triggered, the system automatically returns to the video stream acquisition step to maintain continuous monitoring.

[0092] Specifically, in this embodiment, during the model training and inference closed-loop process, the model is optimized end-to-end using the constructed loss function space, and the trained model is deployed on an industrial edge computing terminal to achieve inference and abnormal behavior alerts for real-time video streams. Experimental results show that the model has strong multi-scale and small target detection capabilities: through the SKAttention mechanism and the improved NWD loss function, the model's adaptability to targets with large scale differences in industrial scenarios is significantly improved, especially for small targets that are difficult to detect due to few pixels and weak features (such as distant cigarette butts and initial flames), which have extremely high localization accuracy. Rich feature extraction and good anti-interference: by utilizing the large convolutional kernel and advanced structure of the C3_ConvNeXtv2 module, the model's feature extraction capability under complex lighting and backgrounds is enhanced, effectively reducing the interference of environmental noise in industrial workshops. Synergistic enhancement and superior overall performance: the four modules (C3_ConvNeXtv2, SKAttention, NWDLoss, DynamicATSS) integrated in this invention show significant synergistic effects in ablation experiments. Compared to the baseline model, this not only solves the training instability problem but also achieves a significant 4.0% improvement in mAP@0.5 on a self-built dataset, achieving a better balance between precision and recall. It boasts strong generalization ability and high application value: this framework is not only applicable to specific safety helmet detection but also a general multi-class abnormal behavior detection solution, capable of meeting the practical needs of comprehensive safety monitoring in complex industrial workshops. Figure 5 As shown, the four modules (C3_ConvNeXtv2, SKAttention, NWD Loss, and DynamicATSS) exhibit a significant synergistic enhancement effect in the system. Compared with the baseline model, mAP@0.5 is improved by 4.0%, and the model training process is more stable without premature stopping, which fully verifies the practicality of the system in complex industrial scenarios.

[0093] like Figure 6 As shown, this embodiment also discloses a multi-category anomaly detection system for complex industrial workshop scenarios, including:

[0094] Data augmentation module 61 is used to collect multi-category monitoring video data in industrial workshops, establish datasets including categories such as smoking, flames, whether or not a safety helmet is worn, and whether or not a mask is worn, and perform augmentation processing on the datasets to obtain augmented training data;

[0095] The model building module 62 is used to build a CNSD-YOLO detection model based on topology reconstruction. The CNSD-YOLO detection model is based on the YOLOv8 architecture and includes a backbone network, a feature fusion network and a detection head connected in sequence.

[0096] The sequentially connected backbone network includes an input convolutional layer, various levels of C3_ConvNeXTv2 units, and SKAttention units. The sequentially connected backbone network receives the enhanced training data, performs initial feature extraction through the input convolutional layer to obtain shallow feature maps, and then performs feature enhancement through various levels of C3_ConvNeXTv2 units to output multi-scale feature maps. The multi-scale feature maps are then subjected to adaptive receptive field selection by the SKAttention unit to obtain enhanced high-level semantic features.

[0097] The feature fusion network fuses enhanced high-level semantic features with a bidirectional feature pyramid structure to obtain a multi-scale enhanced feature map.

[0098] The detection head includes a classification branch and a regression branch. The detection head takes a multi-scale enhanced feature map as input and uses the DynamicATSS dynamic label allocation strategy to assign positive samples, corresponding categories, and coordinate labels to the ground truth bounding boxes for each training data. Then, the classification branch outputs the category prediction probability based on the category and coordinate labels of the ground truth bounding boxes. The regression branch uses an improved NWD loss to optimize the bounding box parameters on the positive samples allocated by DynamicATSS. Finally, the category prediction probability and the optimized bounding box parameters are jointly decoded to generate the category label and bounding box coordinates of the abnormal target.

[0099] The detection module 63 is used to perform end-to-end optimization training on the constructed CNSD-YOLO detection model using the enhanced training data, deploy the optimized and trained model on the industrial edge computing terminal, perform inference on the real-time video stream, and trigger an alarm when abnormal behavior is detected.

[0100] A specific implementation of a multi-category anomaly detection system for complex industrial workshop scenarios is described in this embodiment, which is the same as the multi-category anomaly detection method for complex industrial workshop scenarios.

[0101] Although the invention has been specifically shown and described in conjunction with preferred embodiments, those skilled in the art should understand that various changes in form and detail may be made to the invention without departing from the spirit and scope of the invention as defined in the appended claims, all of which shall be within the scope of protection of the invention.

Claims

1. A multi-category anomaly detection method for complex industrial workshop scenarios, characterized in that, Includes the following steps: S1. Collect multi-category surveillance video data in the industrial workshop, establish a dataset including categories such as smoking, flames, whether or not a safety helmet is worn, and whether or not a mask is worn, and perform augmentation processing on the dataset to obtain augmented training data; S2: Construct a CNSD-YOLO detection model based on topology reconstruction. The CNSD-YOLO detection model is based on the YOLOv8 architecture and includes a backbone network, a feature fusion network, and a detection head connected in sequence. The sequentially connected backbone network includes an input convolutional layer, various levels of C3_ConvNeXTv2 units, and SKAttention units. The sequentially connected backbone network receives the enhanced training data, performs initial feature extraction through the input convolutional layer to obtain shallow feature maps, and then performs feature enhancement through various levels of C3_ConvNeXTv2 units to output multi-scale feature maps. The multi-scale feature maps are then subjected to adaptive receptive field selection by the SKAttention unit to obtain enhanced high-level semantic features. The feature fusion network fuses enhanced high-level semantic features with a bidirectional feature pyramid structure to obtain a multi-scale enhanced feature map. The detection head includes a classification branch and a regression branch. The detection head takes a multi-scale enhanced feature map as input and uses the DynamicATSS dynamic label allocation strategy to assign positive samples, corresponding categories, and coordinate labels to the ground truth bounding boxes for each training data. Then, the classification branch outputs the category prediction probability based on the category and coordinate labels of the ground truth bounding boxes. The regression branch uses an improved NWD loss to optimize the bounding box parameters on the positive samples allocated by DynamicATSS. Finally, the category prediction probability and the optimized bounding box parameters are jointly decoded to generate the category label and bounding box coordinates of the abnormal target. S3 utilizes the enhanced training data to perform end-to-end optimization training on the constructed CNSD-YOLO detection model. The optimized and trained model is then deployed on an industrial edge computing terminal to perform inference on real-time video streams. When abnormal behavior is detected, an alarm is triggered.

2. The multi-category anomaly detection method for complex industrial workshop scenarios according to claim 1, characterized in that, In S2, the C3_ConvNeXtv2 unit defines a cross-scale feature aggregation function. Feature enhancement is performed using the following formula: ; ; in, Input feature map; The aggregated output feature map; and For two parallel The convolutional dimensionality reduction branch compresses the number of channels to half each; express One ConvNeXtv2 bottleneck module is connected in series; For channel splicing; for Convolution restores the concatenated result to the number of output channels; This represents the effect of a single bottleneck module on input features. Residual mapping; for Depthwise separable convolution; For layer normalization function; For point-by-point linear dimensionality increase; The activation function for the Gaussian error linear unit; This is the global response normalization function; This is a point-by-point linear dimensionality reduction.

3. The multi-category anomaly detection method for complex industrial workshop scenarios according to claim 1, characterized in that, In S2, the SKAttention unit performs adaptive receptive field selection, specifically through a dynamic process of splitting, fusing, and selecting to perform channel-level adaptive scale selection on multi-scale feature maps, including: Four branch feature maps with different receptive fields are generated through a splitting operation. Then, the feature maps of each branch are summed and integrated element-wise through a fusion operation. Global average pooling is used to count the response intensity of each channel. A compact channel description vector is generated through linear transformation. Finally, through a selection operation, the attention weights of different convolutional kernel branches are adaptively calculated based on the channel description vectors through independent linear mapping and Softmax normalization of each branch. The attention weights are weighted and summed with the corresponding branch feature maps to complete the adaptive receptive field selection and obtain enhanced high-level semantic features.

4. The multi-category anomaly detection method for complex industrial workshop scenarios according to claim 3, characterized in that, The attention weights for different convolutional kernel branches are adaptively calculated, and then the attention weights are summed with the corresponding branch feature maps using the following formula: ; ; in, Let C be the input feature map, where C is the number of channels, H is the height of the input image, and W is the width of the input image. The output feature map after scale selection; For the first Convolution, normalization, and activation mapping for each branch; , representing the kernel size of the four branches; Represents a compact channel description vector; For the first Independent fully connected layer weights for each branch; Indicates the first The branch in the Attention weights on each channel; Multiplication is broadcast channel by channel.

5. The multi-category anomaly detection method for complex industrial workshop scenarios according to claim 1, characterized in that, In S2, the improved NWD loss calculation formula is as follows: ; ; in, , , and Represents the x-coordinate, y-coordinate, width, and height of the prediction box; , , and Represents the x-coordinate, y-coordinate, width, and height of the actual bounding box; For regression loss; Represents the normalized Wasserstein distance similarity; It is the numerical stability constant; This is the normalized scaling parameter; This is the intersection-union ratio (IU) between the predicted bounding box and the ground truth bounding box. The Euclidean distance between the center points of the two frames; The length of the diagonal of the smallest bounding rectangle; This is a penalty for aspect ratio consistency. The value is a constant term.

6. The multi-category anomaly detection method for complex industrial workshop scenarios according to claim 1, characterized in that, In S2, the DynamicATSS dynamic label allocation strategy assigns positive samples to the ground truth bounding boxes corresponding to each training data point. Specifically, based on the ground truth bounding boxes corresponding to each training data point, the closest center distance is selected as the positive sample. A dynamic alignment index is constructed by fusing candidate anchor points with the intersection-union ratio (IU) and classification confidence scores using a power-weighted fusion. The sum of the mean and standard deviation of this index for the candidate set is used as an adaptive threshold. Candidates that exceed the threshold and whose centers fall within the ground truth bounding boxes are selected as positive samples. The classification labels of positive samples are soft-weighted using the IU of the predicted and ground truth bounding boxes. The dynamic alignment index is calculated using the following formula: ; in, Candidate anchor boxes; True bounding box; This is a dynamic alignment metric. The intersection-union ratio of the two frames; The model's classification confidence of the anchor point in the category to which the ground truth bounding box belongs; This is used to make IoU dominate the scoring with a higher power.

7. A multi-category anomaly detection system for complex industrial workshop scenarios, characterized in that, include: The data augmentation module is used to collect multi-category surveillance video data in industrial workshops, establish datasets including categories such as smoking, flames, whether or not safety helmets are worn, and whether or not masks are worn, and perform augmentation processing on the datasets to obtain augmented training data; The model building module is used to build a CNSD-YOLO detection model based on topology reconstruction. The CNSD-YOLO detection model is based on the YOLOv8 architecture and includes a backbone network, a feature fusion network and a detection head connected in sequence. The sequentially connected backbone network includes an input convolutional layer, various levels of C3_ConvNeXTv2 units, and SKAttention units. The sequentially connected backbone network receives the enhanced training data, performs initial feature extraction through the input convolutional layer to obtain shallow feature maps, and then performs feature enhancement through various levels of C3_ConvNeXTv2 units to output multi-scale feature maps. The multi-scale feature maps are then subjected to adaptive receptive field selection by the SKAttention unit to obtain enhanced high-level semantic features. The feature fusion network fuses enhanced high-level semantic features with a bidirectional feature pyramid structure to obtain a multi-scale enhanced feature map. The detection head includes a classification branch and a regression branch. The detection head takes a multi-scale enhanced feature map as input and uses the DynamicATSS dynamic label allocation strategy to assign positive samples, corresponding categories, and coordinate labels to the ground truth bounding boxes for each training data. Then, the classification branch outputs the category prediction probability based on the category and coordinate labels of the ground truth bounding boxes. The regression branch uses an improved NWD loss to optimize the bounding box parameters on the positive samples allocated by DynamicATSS. Finally, the category prediction probability and the optimized bounding box parameters are jointly decoded to generate the category label and bounding box coordinates of the abnormal target. The detection module is used to perform end-to-end optimization training on the constructed CNSD-YOLO detection model using enhanced training data. The optimized and trained model is then deployed on an industrial edge computing terminal to perform inference on the real-time video stream. When abnormal behavior is detected, an alarm is triggered.