Laboratory personnel nonstandard behavior identification method and system based on improved YOLOv7
By improving YOLOv7's laboratory irregular behavior detection method and optimizing the network structure and loss function, the problem of low detection accuracy and slow speed in university laboratories has been solved, efficient and reliable irregular behavior identification has been achieved, and safety risks have been reduced.
Patent Information
- Application Number
- CN202410492232.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Priority Date
- 2024-02-23
- Filing Date
- 2024-04-23
- Publication Date
- 2024-08-23
AI Technical Summary
Existing laboratory personnel behavior detection technology has problems of low detection accuracy and slow speed in university laboratory scenarios, resulting in frequent missed and misjudgments, inability to effectively identify irregular behaviors, and increased safety risks.
Based on the improved YOLOv7 laboratory irregular behavior detection method, by optimizing the design of the backbone network convolution network, the head network bounding box loss function, and adding an attention module to the neck network, a laboratory irregular behavior detection network model was constructed to improve Detection accuracy and speed.
It achieves efficient and reliable identification of laboratory personnel's irregular behavior in laboratory scenarios, improves detection accuracy and actual recognition effects, reduces the amount and complexity of model parameters, and is suitable for safety monitoring in complex scenarios.
Smart Images

Figure CN118537786A
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of laboratory behavior detection, and in particular to a method and system for identifying irregular behaviors of laboratory personnel based on improved YOLOv7. Background Art
[0002] In recent years, laboratories, as important places for universities to carry out teaching and scientific research tasks, have many potential safety hazards due to the large number of equipment types and the different levels of operators, especially in various chemical, biological, electrical and mechanical laboratories, which are prone to safety accidents caused by irregular behavior of personnel. In the past decade, more than 10,000 safety accidents of various types have occurred in laboratories of universities across the country, with nearly 100 deaths and injuries. The newly issued "Safety Standards for Laboratories in Higher Education Institutions" also clearly stated that university laboratories should establish and improve a safety classification and management system, and experimental personnel should sign a safety responsibility letter or commitment letter when using laboratories, and risk assessment should be carried out before using important hazardous sources; in addition, according to Heinrich's theoretical model, about 85% to 90% of safety accidents are caused by irregular behavior of people; this shows that the importance of laboratory safety accident prevention and control is not trivial.
[0003] With the development of deep learning technology, image detection technology has gradually been applied to personnel behavior detection, and to a certain extent, it can detect irregular behaviors of personnel. There are two main forms of current detection technology: one-stage detection algorithm and two-stage detection algorithm. Among them, computational models such as region-based convolutional neural network (R-CNN), Fast R-CNN, and Faster R-CNN belong to two-stage detection algorithms. Although such models have good detection accuracy, the training cycle required for the model to achieve the expected detection function is long, resulting in a slow detection speed. Other computational models such as SSD and YOLO series belong to one-stage detection algorithms; compared with the two-stage detection algorithm, although the training time of such computational models is reduced and the detection speed is improved, the detection accuracy is reduced, and it cannot well meet the recognition needs of irregular behaviors of laboratory personnel, and the application reliability is insufficient.
[0004] In university laboratory scenarios, there are many people, high mobility and easy to gather, and the behavior of people is easily obscured. When traditional models are used to detect the behavior of laboratory personnel, there are generally problems of low detection accuracy and slow speed, and it is easy to miss or misjudge. Therefore, in order to reduce the safety hazards brought by irregular behavior of personnel to the laboratory, a high-quality and intelligent recognition method is urgently needed to effectively detect irregular behavior of laboratory personnel.
[0005] The information disclosed in the background technology section of the present invention is only intended to deepen the understanding of the general background technology of the present invention, and should not be regarded as acknowledging or suggesting in any form that the information constitutes the prior art known to those skilled in the art. Summary of the invention
[0006] To solve the above problems, the present invention provides a method for identifying irregular behaviors of laboratory personnel based on improved YOLOv7, which can overcome the problems of poor detection timeliness and accuracy in the prior art, and efficiently realize reliable identification of irregular behaviors of laboratory personnel; a laboratory irregular behavior detection network model is established based on laboratory personnel behavior sample image training; by optimizing the design of the backbone network convolution network and the head network bounding box loss function, an attention module is added to the neck network, and a laboratory irregular behavior detection network model based on improved YOLOv7 is constructed; preferably, in one embodiment, the method includes:
[0007] Step S10: Establishing a laboratory irregular behavior detection network model based on improved YOLOv7 based on laboratory personnel behavior sample image training;
[0008] The process of establishing the laboratory irregular behavior detection network model includes the following operations:
[0009] Step S100: After obtaining sample images of laboratory personnel behavior as required, automatically preprocess and annotate them to form an experimental sample data set, including a training sample set, a verification sample set, and a test sample set;
[0010] Step S200: Based on the improved YOLOv7, the backbone network convolution network is optimized and designed, the head network bounding box loss function is optimized and designed, and an attention module is added to the neck network to construct a laboratory irregular behavior detection network model whose recognition performance and bounding box compatibility are adapted to the laboratory personnel behavior recognition requirements;
[0011] Step S300: using the training sample set in the experimental sample data set to train the laboratory irregular behavior detection network model until the set training conditions are met, and using the verification sample set to verify;
[0012] Step S20: respectively obtaining real-time behavior image data of people in the laboratory environment to be detected;
[0013] Step S30: inputting the real-time behavior image data into the laboratory irregular behavior detection network model based on improved YOLOv7 for recognition;
[0014] Step S40: Analyze and identify the category and confidence level of the irregular behavior of the personnel in the real-time behavior image data. If the confidence level reaches the set requirement, output a prompt signal according to the category of the irregular behavior.
[0015] In an optional embodiment, in step S200, when constructing a network model for detecting laboratory irregularities, a deformable convolutional network is used to replace traditional convolution in the backbone network part, an offset is added based on the standard convolution kernel, different convolution kernel structures are obtained according to different offset data, and the sampling result of the input feature map is calculated based on the convolution operation.
[0016] Furthermore, in one embodiment, in step S200, when constructing a laboratory irregular behavior detection network model, a CBAM_E attention module is added after the neck network input feature layer; one-dimensional convolution is used to replace the original MLP network, and the improved channel attention module is connected in parallel with the original spatial attention module.
[0017] In one embodiment, in step S200, when constructing a laboratory irregular behavior detection network model, the prediction head network is optimized and designed by using the α-SioU function to replace the CIoU function as the bounding box loss function in the prediction head network part, so as to process the feature maps extracted from the backbone network and the neck part.
[0018] In a preferred embodiment, in the process of processing the feature maps extracted from the backbone network and the neck part, the SIoU loss function is used as the basic loss function, the penalty index is redefined taking into account the impact of the camera angle factor on the detection result, and all the prediction results are combined into a target box to obtain the final predicted target.
[0019] Specifically, in an optional embodiment, the α-SIoU loss function used is as follows:
[0020]
[0021] Among them, α is a hyperparameter; IoU represents the overlap rate of the predicted box and the true box; Δ is the distance loss representing the error in the position and scale of the predicted box compared to the true value; Ω is the shape loss representing the shape difference between the predicted box and the true box.
[0022] Furthermore, in a preferred embodiment, the method further comprises:
[0023] Step S400: Conduct an ablation experiment on the constructed laboratory irregular behavior detection network model, and compare and analyze the detection effects of different optimized designs through multi-level evaluation indicators; the evaluation indicators include: accuracy, recall rate, weighted harmonic mean, average precision, number of frames processed per second, model parameter quantity, model calculation quantity and model weight indicator.
[0024] Optionally, in one embodiment, in step S20, real-time video data of the laboratory environment is captured and frame-processed to obtain real-time behavior image data of people in the laboratory environment.
[0025] In one embodiment, in step S100, a public data set is used to comprehensively search for public data content to obtain laboratory personnel behavior images as laboratory personnel behavior sample images; the public data content includes original image data and video frame processing data.
[0026] Furthermore, in one embodiment, in step S100, multi-level preprocessing operations are performed on the sample images of laboratory personnel behavior, including random changes in brightness and contrast, rotation and translation, and addition of Gaussian noise operations.
[0027] Based on other aspects of the method described in any one or more of the above embodiments, the present invention further provides a storage medium storing program codes that can implement the method described in any one or more of the above embodiments.
[0028] On the other hand, based on the application aspects of the method described in any one or more of the above embodiments, the present invention also provides a laboratory personnel irregular behavior recognition system based on improved YOLOv7, which executes the method as described in any one or more of the above embodiments.
[0029] Compared with the closest prior art, the present invention also has the following beneficial effects:
[0030] The present invention provides a method and system for identifying irregular behavior of laboratory personnel based on improved YOLOv7. A laboratory irregular behavior detection network model based on improved YOLOv7 is established based on laboratory personnel behavior sample image training; the laboratory personnel behavior sample images are first preprocessed and annotated as an experimental sample data set, and image feature enhancement is achieved through preprocessing operations before the sample data is annotated, so that the samples are effectively expanded on the basis of ensuring the quality of the sample images, thereby forming a comprehensive and reliable sample data foundation;
[0031] When constructing a laboratory irregular behavior detection network model based on improved YOLOv7, the backbone network convolutional network is optimized to effectively enhance the detection network model's ability to capture target features and reduce the model complexity; the head network bounding box loss function is optimized to take into account the impact of angle factors on the bounding box regression accuracy of the detection network model and improve the model convergence speed; and an attention module is added to the neck network to enhance the detection network model's ability to extract important target features, suppress useless features, and improve the detection rate in complex laboratory scenarios; based on this, the real-time behavior image data of personnel in the laboratory environment to be detected is obtained and input into the established laboratory irregular behavior detection network model for identification, and a prompt signal is output according to the category and confidence of the identified irregular behavior; compared with the existing algorithm, it has higher detection accuracy and better actual recognition effect, and the number and complexity of model parameters are reduced, which has great practical application potential in laboratory scenarios.
[0032] Other features and advantages of the present invention will be described in the following description, and partly become apparent from the description, or understood by practicing the present invention. The purpose and other advantages of the present invention can be realized and obtained by the structures particularly pointed out in the description, claims and drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] The accompanying drawings are used to provide a further understanding of the present invention and constitute a part of the specification. Together with the embodiments of the present invention, they are used to explain the present invention and do not constitute a limitation of the present invention. In the accompanying drawings:
[0034] Figure 1 It is a flowchart of a method for identifying irregular behavior of laboratory personnel based on improved YOLOv7 provided by an embodiment of the present invention;
[0035] Figure 2 It is a flow chart of constructing a laboratory irregular behavior detection network model in a laboratory personnel irregular behavior recognition method based on improved YOLOv7 provided in an embodiment of the present invention;
[0036] Figure 3 It is a schematic diagram of the structure of a laboratory irregular behavior detection network model in a laboratory personnel irregular behavior identification method based on improved YOLOv7 provided in an embodiment of the present invention;
[0037] Figure 4 It is a schematic diagram of the convolution kernel processing principle of the deformable convolution in the laboratory personnel irregular behavior recognition method based on the improved YOLOv7 provided in an embodiment of the present invention;
[0038] Figure 5It is a schematic diagram of a feature graph processing flow of deformable convolution in a method for identifying irregular behaviors of laboratory personnel based on improved YOLOv7 provided in an embodiment of the present invention;
[0039] Figure 6 It is a schematic diagram of the operation process of deformable convolution in the method for identifying irregular behavior of laboratory personnel based on improved YOLOv7 provided in an embodiment of the present invention;
[0040] Figure 7 Schematic diagram of the network structure involving the CBAM attention module provided in an embodiment of the present invention;
[0041] Figure 8 Schematic diagram of the structure of the channel attention module in the CBAM attention module provided in an embodiment of the present invention;
[0042] Fig. 9 Schematic diagram of the structure of the spatial attention module in the CBAM attention module provided in an embodiment of the present invention;
[0043] Fig.10 It is a schematic diagram of the processing process of the improved CBAM_E attention module in the method for identifying irregular behavior of laboratory personnel based on improved YOLOv7 provided in an embodiment of the present invention;
[0044] Fig.11 This is an example diagram of comparative verification data of an ablation experiment conducted on a method for identifying irregular behavior of laboratory personnel based on improved YOLOv7 in an embodiment of the present invention;
[0045] Fig.12 It is a schematic diagram of the comparison of the average accuracy of the laboratory personnel irregular behavior recognition method based on the improved YOLOv7 provided by the embodiment of the present invention and other recognition algorithms;
[0046] Fig.13 (I) Fig.13 (II) Fig.13 (III) are comparative displays of the original images from three shooting angles, the conventional YOLOv7 detection images, and the improved YOLOv7 recognition algorithm detection images;
[0047] Fig.14 It is a structural diagram of a laboratory personnel irregular behavior recognition system based on improved YOLOv7 provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0048] The following will describe the implementation methods of the present invention in detail in conjunction with the accompanying drawings and embodiments, so that the implementers of the present invention can fully understand how the present invention applies technical means to solve technical problems and achieve the implementation process of technical effects and implement the present invention specifically according to the above implementation process. It should be noted that as long as there is no conflict, the various embodiments and various features of the embodiments in the present invention can be combined with each other, and the technical solutions formed are all within the protection scope of the present invention.
[0049] Although the flowcharts describe the operations as sequential processes, many of the operations may be performed in parallel, concurrently, or simultaneously. The order of the operations may be rearranged. A process may be terminated when its operations are completed, but may also have additional steps not included in the accompanying drawings. A process may correspond to a method, function, procedure, subroutine, subprogram, etc.
[0050] Computer devices include user devices and network devices. Among them, user devices or clients include but are not limited to computers, smart phones, PDAs (Personal Digital Assistants), etc.; network devices include but are not limited to a single network server, a server group consisting of multiple network servers, or a cloud based on cloud computing consisting of a large number of computers or network servers. Computer devices can be run alone to implement the present invention, or they can be connected to the network and implement the present invention through interactive operations with other computer devices in the network. The network where the computer device is located includes but is not limited to the Internet, wide area network, metropolitan area network, local area network, VPN network, etc.
[0051] The terms used herein are only for describing specific embodiments and are not intended to limit exemplary embodiments. Unless the context clearly indicates otherwise, the singular forms "one", "one" and "item" used herein are also intended to include plural numbers. It should also be understood that the terms "include" and / or "comprise" used herein specify the existence of stated features, integers, steps, operations, units and / or components, without excluding the existence or addition of one or more other features, integers, steps, operations, units, components and / or combinations thereof.
[0052] As an important place for universities to carry out teaching and scientific research tasks, laboratories have many safety hazards due to the large number of equipment types and the different levels of operators. In particular, various chemical, biological, electrical and mechanical laboratories are prone to safety accidents due to irregular behavior of personnel. In the past decade, more than 10,000 safety accidents of various types have occurred in laboratories of universities across the country, causing nearly 100 deaths and injuries. In February 2023, the Ministry of Education clearly stated in the "Safety Standards for Laboratories in Higher Education Institutions": University laboratories must establish and improve a safety classification and management system, and experimental personnel must sign a safety responsibility letter or commitment letter when using laboratories, and risk assessments must be carried out before using important hazardous sources.
[0053] With the research of deep learning technology, image detection technology has been widely used in personnel behavior detection, which can effectively detect irregular personnel behavior. There are two main forms of target detection technology: one-stage detection algorithm and two-stage detection algorithm. Region-based convolutional neural network (R-CNN), Fast R-CNN, Faster R-CNN, etc. are two-stage detection algorithms. This type of model has good detection accuracy, but the training cycle is long and the detection speed is slow. SSD, YOLO series, etc. are all one-stage detection algorithms. Compared with the two-stage detection algorithm, although the training time of this type of model is significantly reduced and the detection speed is significantly improved, the detection accuracy is reduced.
[0054] In university laboratories, there are many people, high mobility and easy gathering, and the behavior of people is easily obscured. According to Heinrich's theoretical model, about 85% to 90% of safety accidents are caused by people's irregular behavior; when traditional models are used to detect the behavior of laboratory personnel, there are generally problems of low detection accuracy and slow speed, and it is easy to miss or misjudge. Therefore, in order to reduce the safety hazards brought by irregular behavior of personnel to the laboratory, a low-cost and intelligent identification method is urgently needed to effectively detect irregular behavior of laboratory personnel.
[0055] In order to solve the above-mentioned technical defects, the present invention provides a method and system for identifying irregular behaviors of laboratory personnel based on improved YOLOv7. According to the corresponding characteristics of laboratory scenes and personnel behaviors, the detection accuracy is improved on the basis of reducing the amount and complexity of model parameters from aspects such as convolution method, attention mechanism, and loss function, so as to achieve the purpose of real-time monitoring of the behavior of laboratory personnel. Compared with traditional recognition model algorithms, the method for identifying irregular behaviors of laboratory personnel in an embodiment of the present invention has higher detection accuracy, faster convergence speed and better actual recognition effect, and the amount and complexity of model parameters are reduced.
[0056] Next, the detailed process of the method of the embodiment of the present invention is described in detail based on the accompanying drawings. The steps shown in the flowchart of the accompanying drawings can be executed in a computer system including a set of computer executable instructions. Although the logical order of each step is shown in the flowchart, in some cases, the steps shown or described can be executed in a different order than here.
[0057] Embodiment 1
[0058] Figure 1 The flowchart of the method for identifying irregular behavior of laboratory personnel based on improved YOLOv7 provided in the first embodiment of the present invention is shown, referring to Figure 1 It can be seen that the method includes the following steps.
[0059] Step S10: Establishing a laboratory irregular behavior detection network model based on improved YOLOv7 based on laboratory personnel behavior sample image training;
[0060] The process of establishing the laboratory irregular behavior detection network model includes the following operations:
[0061] Step S100: After obtaining sample images of laboratory personnel behavior as required, automatically preprocess and annotate them to form an experimental sample data set, including a training sample set, a verification sample set, and a test sample set;
[0062] Step S200: Based on the improved YOLOv7, the backbone network convolution network is optimized and designed, the head network bounding box loss function is optimized and designed, and an attention module is added to the neck network to construct a laboratory irregular behavior detection network model whose recognition performance and bounding box compatibility are adapted to the laboratory personnel behavior recognition requirements;
[0063] Step S300: Use the training sample set in the experimental sample data set to train the laboratory irregular behavior detection network model until the set training conditions are met, and use the verification sample set for verification, such as Figure 2 As shown;
[0064] Step S20: For laboratories with testing needs, real-time behavior image data of personnel in the laboratory environment are obtained respectively;
[0065] Step S30: inputting the real-time behavior image data into the laboratory irregular behavior detection network model based on improved YOLOv7 for identification;
[0066] Step S40: Analyze and identify the category and confidence level of the irregular behavior of the personnel in the real-time behavior image data. If the confidence level reaches the set requirement, output a prompt signal according to the category of the irregular behavior.
[0067] The above-mentioned embodiment of the present invention is based on the improved YOLOv7 to identify the irregular behavior of laboratory personnel. The detection network model is optimized and transformed from the aspects of convolution method, attention mechanism, loss function, etc., so as to improve the detection accuracy on the basis of reducing the number and complexity of model parameters, so as to achieve the purpose of real-time monitoring of the behavior of laboratory personnel.
[0068] Preferably, in one embodiment, in step S100, a public data set is used to comprehensively search the public data content to obtain images of irregular behaviors of laboratory personnel as sample images of laboratory personnel behaviors; the public data content includes original image data and video frame processing data.
[0069] In actual application, images of improper behavior of laboratory personnel are obtained by searching public data; in an optional embodiment, image and video samples of a set scale are selected from the public data sets "HMDB51" and "Hollywood2", for example, 350 video samples are selected for frame processing, and a total of 5,000 images are obtained.
[0070] Specifically, the HMDB51 dataset was released by Brown University in the United States in 2011, including 51 types of actions and a total of 6,849 videos, most of which come from movies, public databases and online video libraries; the Hollywood2 database was released by the IRISA Research Institute in 2009, including 12 action categories and 10 scenes, a total of 3,669 samples, and comes from 69 Hollywood movies; optionally, the embodiment of the present invention uses Python technology to perform frame processing on some video clips in the two datasets to obtain 5,000 photos, with a total of 14,396 labels, including 1,427 phone calls, 1,368 smoking behaviors, 1,208 eating behaviors, and 997 mobile phone playing behaviors.
[0071] Furthermore, in one embodiment, in step S100, multi-level preprocessing operations are performed on the sample images of the laboratory personnel behavior, including random changes in brightness and contrast, rotation and translation, and addition of Gaussian noise operations. The sample image enhancement processing is achieved through preprocessing operations, and different sample images are obtained on the basis of ensuring image quality, and stable sample expansion is achieved, providing a high-quality sample data foundation for establishing a laboratory personnel irregular behavior detection network based on improved YOLOv7. In actual application, in one embodiment, the OpenCV library is used to perform random changes in brightness and contrast, rotation and translation, and addition of Gaussian noise on the picture to obtain the irregular behavior image of the personnel required before annotation.
[0072] In addition, in an optional embodiment, matching annotation categories are set according to the types of irregular behaviors in different laboratories, and then the pre-processed sample images of laboratory personnel behaviors are annotated using image annotation tools according to the annotation categories, and training sample sets, verification sample sets, and test sample sets are divided to form an experimental sample data set. In actual application, the LabelImg image annotation tool can be used to annotate the pre-processed sample image data, and the corresponding labels are marked according to the annotation categories and the corresponding .xml files are generated to obtain the experimental sample data set; based on this, the experimental sample data set is divided into data, and all images and annotated labels are divided into training sets, verification sets, and test sets in a ratio of 8:1:1.
[0073] In actual application, five types of labels are added according to the annotation categories, and the five types of labels are: "person", "calling", "smoking", "eating and drinking" and "playing phone". The distribution of each label sample in the above experimental sample data set example of the present invention is shown in the following table:
[0074] Table 1. Number of labels for each category in the experimental dataset
[0075]
[0076] Furthermore, based on the improved YOLOv7, the backbone network convolution network is optimized and designed, the head network bounding box loss function is optimized and designed, and an attention module is added to the neck network to construct a laboratory irregular behavior detection network model whose recognition performance and bounding box compatibility are adapted to the laboratory personnel behavior recognition requirements; the structure diagram of the laboratory irregular behavior detection network model based on the improved YOLOv7 in the embodiment of the present invention is as follows Figure 3 shown.
[0077] The embodiment of the present invention constructs a laboratory personnel irregular behavior detection network based on improved YOLOv7 through step S200; the YOLOv7 algorithm involved in the present invention is the latest generation of YOLO series algorithms proposed by Alexey Bochkovskiy's team in July 2022 on the basis of the YOLOv5 algorithm to optimize the speed and accuracy of the model; the laboratory personnel irregular behavior detection network based on improved YOLOv7 is mainly composed of 4 parts: input, backbone network, neck and prediction head.
[0078] The input part mainly reduces or enlarges the input image to a fixed size to meet the input size standard set by the backbone network;
[0079] The backbone network usually includes three parts: CBS convolution module, E-ELAN (Extended-ELAN) module and MPConv module; CBS convolution module is proposed on the basis of Batch Normalization (BN), and uses the statistical information between different batches of data to further improve the generalization performance of the model; E-ELAN module is a module used to improve the feature representation ability in deep neural networks, enhancing the model's attention and modeling ability for long sequences, and only needs to perform calculations locally, reducing the amount of calculations and memory consumption, and has advantages in both time and space consumption and computing power; MPConv module adds MaxPool layer to form upper and lower branches, and uses Concat operation to fuse the extracted features to improve the generalization ability of the network;
[0080] The neck part adopts the SPPCSPC structure. According to the pixel information in the input Feature Map, the category, position, size and other information of the target are calculated through convolution operation, and feature extraction is performed;
[0081] The prediction head processes the feature maps extracted from the backbone network and the neck part, and then combines all the prediction results into a target box to obtain the final predicted target.
[0082] In a preferred embodiment, in step S200, when constructing a laboratory irregular behavior detection network model, the present invention designs a YOLOv7 algorithm backbone network part to use a deformable convolutional network (DCN) to replace the traditional convolution, adds an offset based on the standard convolution kernel, and obtains different convolution kernel structures according to different offset data, based on which the convolution operation is used to calculate the sampling result of the input feature map.
[0083] As a preferred solution of the present invention, a deformable convolutional network is used to replace the traditional convolution in the backbone network, which specifically includes the following steps:
[0084] 1) Deformable convolution is to add an offset to each point on the standard convolution kernel, and obtain different convolution kernel structures according to different offset data, such as Figure 4 As shown in the figure, the structure of the deformable convolution is mainly divided into two parts: generating the displacement in the X and Y directions based on the input feature map, and obtaining the output feature map through the deformable convolution based on the feature map and the displacement; the process of the deformable convolution is as follows Figure 5 shown.
[0085] In the backbone network, a deformable convolutional network is used to replace the traditional convolution for operation, which includes the following steps.
[0086] In the 3×3 convolution kernel, a set of pixels are first sampled from the input feature map, and the convolution operation is used to perform the following calculations on the sampled results to obtain the result after the convolution operation:
[0087]
[0088] Where: y represents the output feature map; p0 is the center position of the convolution kernel window; p n is the enumeration value of the relative position around p0 with a distance of no more than 1 pixel; R is the relative position coordinate matrix, R = {(-1,-1), (-1,0), ..., (0,1), (1,1)}; x(p0+p n ) means taking the pixel at each position; w(p n ) represents the weight corresponding to each pixel position.
[0089] 2) Since deformable convolution modifies the sampling result, thereby indirectly changing the shape of the convolution kernel, Δp can be used n For p on the input feature map n To expand:
[0090]
[0091] Where: Δp n is the offset matrix, n=1,2,…,N.
[0092] Since the deformable convolution network only fine-tunes the position of the convolution kernel in the 3×3 convolution kernel to make it easier to adapt to the deformation and deformation of the target, this can improve the performance and accuracy of the model without affecting the calculation amount and speed of the model. Therefore, the embodiment of the present invention replaces the 3×3 convolution network module in the backbone network with a deformable convolution network; taking the MPConv module as an example, the deformable convolution process is as follows Figure 6 shown.
[0093] The above-mentioned embodiment of the present invention utilizes a deformable convolutional network to replace the traditional convolution, thereby enhancing the model's ability to capture target features and reducing the complexity of the model; in view of the situation in laboratory scenarios where there are a large number of people, intensive traffic, and insufficient feature extraction of the target area, the detection network model of the embodiment of the present invention can achieve efficient and accurate behavioral feature capture.
[0094] On the other hand, considering that there are dense crowds of people in the laboratory scene and people are easily obscured, it is necessary to improve and strengthen the model to perform discriminative weighted learning of image features; therefore, in a preferred embodiment, in step S200, when constructing a laboratory irregular behavior detection network model, a CBAM_E attention module is added after the two input feature layers of the neck network, the global maximum pooling operation in the channel attention module is removed, and the original MLP network is replaced by a one-dimensional convolution. Based on this, the improved channel attention module is connected in parallel with the original spatial attention module, and the final output feature layer of the CBAM_E attention module is obtained by processing.
[0095] The CBAM attention module is divided into two parts: the channel attention module (CAM) and the spatial attention module (SAM). The network structure of the CBAM attention module is as follows: Figure 7 As shown;
[0096] The channel attention module performs global maximum pooling and mean pooling on the input feature layer (C×H×W) to obtain two C×1×1 feature layers; then they are sent to a two-layer neural network (MultilayerPerceptron, MLP) to perform element-wise addition on the output feature results; then after the Sigmoid function activation operation, the final weight value of each channel is obtained; finally, the obtained weight value is multiplied by the original input feature layer to obtain a new feature. The structure diagram of the channel attention module is shown in the figure. Figure 8 shown.
[0097] For an input feature F, the feature F′ obtained after the channel attention mechanism is:
[0098]
[0099] Where F′ represents the feature map output by the channel attention mechanism.
[0100] The spatial attention module focuses on the location information of the target. First, the feature layer output by the channel attention module is globally max-pooled and average-pooled to obtain two feature layers of size 1×H×W, which are concatenated. Then, a 7×7 convolution operation and a Sigmoid function activation operation are performed to obtain the weight value. Finally, the weight value is multiplied by the input feature layer to obtain the final feature. The structure diagram of the spatial attention module is shown in Fig. 9 shown.
[0101] For the output feature F′ of the channel attention mechanism, the feature F″ obtained after the spatial attention mechanism is:
[0102]
[0103] Where F” represents the feature matrix output by the spatial attention mechanism.
[0104] Based on this, the embodiment of the present invention adds a CBAM_E attention module after the two input feature layers of the neck network. The improvement made by the CBAM_E attention module in terms of operation compared with the CBAM attention module is reflected in the following operations:
[0105] 1) Remove the global maximum pooling operation in the channel attention module (CAM) and replace the original MLP network with one-dimensional convolution;
[0106] 2) The improved channel attention module is connected in parallel with the original spatial attention module (SAM) to reduce the mutual influence between the two modules. The final output feature layer of the improved CBAM_E attention module is as follows:
[0107]
[0108] Where: F2 represents the final output feature layer; F represents the input feature matrix; Ms is the spatial compression weight matrix; Mc is the channel compression weight matrix; The matrix elements are multiplied in sequence; the improved CBAM_E attention module is as follows Fig.10 shown.
[0109] In the above embodiment, by adding a CBAM_E attention module after the two input feature layers of the neck network, the model's ability to extract important features of the target is enhanced, useless features are suppressed, and the detection rate in complex laboratory scenes is improved; it can specifically overcome the problem that the behavior of people is difficult to detect after being obscured in laboratory scenes, and further ensure the comprehensiveness and reliability of the detection of irregular behaviors of laboratory personnel.
[0110] Furthermore, in one embodiment, in step S200, when constructing a laboratory irregular behavior detection network model, the α-SioU function is used in the prediction head network part to replace the CIoU function as the bounding box loss function to optimize the design of the prediction head network, which is used to process the feature maps extracted from the backbone network and the neck part.
[0111] In the process of processing the feature maps extracted from the backbone network and the neck part, the SIoU loss function is used as the basic loss function, and the penalty index is redefined taking into account the impact of the camera angle factor on the detection result. All the prediction results are combined into a target box to obtain the final predicted target.
[0112] The bounding box loss in the original YOLOv7 is calculated using CIoU, which takes into account the aspect ratio of the box and effectively distinguishes the relative position relationship when two boxes belong to a containment relationship. However, since the consistency of measuring the aspect ratio reflects the difference in the aspect ratio of the box, it does not consider the mismatch between the real box and the predicted box, which can easily lead to slow model convergence and poor results. During the training process, the predicted box is prone to deviations, resulting in a worse model, which hinders the model from effectively optimizing similarity.
[0113] In the embodiment of the present invention, taking into account the influence of camera angle factors on target detection in the laboratory and the optimization of the weighted method of bounding box regression accuracy, the α-SIoU function is used in the prediction head part of the detection network to replace the original CIoU function as the bounding box loss function to realize the bounding box loss calculation, and the SIoU loss function is used as the basic loss function; the SIoU loss function is used as the basic loss function, which mainly involves four parts: angle loss, distance loss, shape loss and IoU loss, and its calculation formula is:
[0114] I SIoU =1-IoU+(Δ+Ω) / 2,
[0115] Where IoU represents the overlap rate between the predicted box and the real box; Δ is the distance loss, and Ω is the shape loss, which represents the shape difference between the predicted box and the real box.
[0116] Taking into account the impact of camera angle factors on detection, the penalty index is redefined, and the α-SIoU loss function calculation formula is:
[0117]
[0118] Where: α is a hyperparameter; IoU represents the overlap rate between the predicted box and the true box; Δ is the distance loss, which represents the error in position and scale compared to the true value predicted box, which is affected by the angle loss (angle loss represents the error in rotation angle between the true box and the predicted box); Ω is the shape loss, which represents the shape difference between the predicted box and the true box. Selecting a suitable α can improve the performance of the detector. This weighting method not only provides great flexibility for achieving regression accuracy of different bounding boxes, but also does not increase the parameters.
[0119] In the embodiment of the present invention, the bounding box loss function CIoU is replaced with α-SIoU to more accurately measure the bounding box overlap. In the laboratory personnel behavior recognition scenario, it can overcome the influence of camera angle factors on target detection, solve the weighted optimization problem of bounding box regression accuracy, and improve the convergence speed and detection accuracy of the detection network model.
[0120] Based on this, the training sample set in the experimental sample data set is used to train the constructed laboratory irregular behavior detection network model until the set training conditions are met, and the verification sample set is used for verification; the training set image data in the experimental sample data set is used as input, and input into the improved YOLOv7 algorithm laboratory irregular behavior detection network model for training, and the trained irregular behavior detection network model is obtained as the laboratory personnel abnormal behavior detection model, and the verification set is used for verification, and the test set is used for testing. In actual application, in an optional embodiment, the stochastic gradient descent method is used for model training, the initial learning rate is set to 0.001, the input image size is 640×640 pixels, the batch-size is set to 16, and the epoch is set to 300.
[0121] Furthermore, the embodiment of the present invention combines validation set data selected from a public data set to evaluate the effectiveness of the improved algorithm. The validation results show that compared with other traditional target recognition methods, the detection speed and accuracy of the improved algorithm are significantly improved, and the test results are the best, which fully demonstrates the effectiveness of the algorithm enhancement proposed in the present invention.
[0122] In a preferred embodiment, step S400 is also included: conducting an ablation experiment on the constructed laboratory irregular behavior detection network model, and comparing and analyzing the detection effects of different optimized designs through multi-level evaluation indicators; the evaluation indicators include: accuracy, recall rate, weighted harmonic mean, average precision, number of frames processed per second, model parameter quantity, model calculation amount and model weight.
[0123] In actual application, an ablation experiment is carried out on the improved YOLOv7 algorithm detection network model, and the detection effects of different improvement points are compared and analyzed through multiple evaluation indicators; specifically, in order to verify the actual effect of the present invention on the detection of abnormal behavior of laboratory personnel, ablation experiments and comparative tests are carried out according to the following settings for comparative analysis.
[0124] The experimental environment is Ubuntu 18.04 operating system, the CPU is i9-12900K, the graphics card is NVIDIA GeForce RTX4090, the video memory is 24GB, the Pytorch 1.13.1 framework is used to run the code, the CUDA version is 11.7.64, and the integrated development environment is Pycharm 2023.2.1.
[0125] The training environment is the same as the test environment. The accuracy P (Precision), recall R (Recall), weighted harmonic mean F1, mean average precision mAP (Mean Average Precision), frames per second FPS (Frames PerSecond), model parameters Par (Parameters), model calculation Fs (FLOPs) and model weight W (Weights) are used as the main evaluation indicators. The calculation formulas are shown in Equations (5)-(10).
[0126]
[0127]
[0128]
[0129]
[0130]
[0131]
[0132] Wherein, TP (True Positive) represents the number of correctly detected target frames, FP (False Positive) represents the number of incorrectly detected target frames, FN (False Negative) represents the number of correctly detected target frames that have not been detected, AP is the area enclosed by the PR (Precision-Recall) curve and the coordinate axis, and its value range is (0,1), N is the number of detected categories, and there are 3 categories in the algorithm of the embodiment of the present invention, that is, N=3, AP i is the AP value corresponding to the three types of detection targets, n is the number of processed images, and T is the time consumed.
[0133] In actual application, in the ablation experiment, the laboratory personnel irregular behavior detection network model based on the improved YOLOv7 algorithm of the present invention (improved YOLOv7 algorithm) has three improved parts. In order to analyze the impact of each improved part on the model and verify whether each improved part is effective, seven groups of different improved methods can be designed to compare and analyze with the original model. All experiments are trained under the same constructed data set, the same environment and parameters. The results are shown in Table 2 below; "√" represents the application of the improved method, and "×" represents the non-application of the improved method:
[0134] Table 2 Ablation experiment results
[0135]
[0136]
[0137] From the analysis of the experimental data in Table 2, we can see that Improvement 1 uses the deformable convolutional network to enhance the model's ability to capture target shape features. Compared with the original YOLOv7 model, the number and complexity of the model parameters are reduced by 23.81% and 24.67% respectively, and the accuracy, recall rate, F1 value and mAP@0.5 are all improved, indicating that the deformable convolutional network has better feature extraction capabilities.
[0138] Improvement 2 adopts the method of adding a CBAM_E attention module in the neck network to make the model pay more attention to the important features of the target. Compared with the original model, the accuracy, recall rate, F1 value, and mAP@0.5 value are all improved, the attention mechanism is optimized, and the number of model parameters and complexity are reduced.
[0139] Improvement 3 uses α-SIoU instead of CIoU in the bounding box loss function, considers the angle factor and the optimization problem of the bounding box regression accuracy weighted method, recalculates the prediction head loss function, and reduces the number and complexity of model parameters. However, due to the recalculation of the model bounding box, more factors are considered compared to the original model, so the accuracy, recall rate and F1 value are all reduced.
[0140] Improvement 4 combines the deformable convolutional network and CBAM_E attention module on the basis of improvement 1. On the basis of effectively reducing the number and complexity of model parameters, it further improves the model's ability to extract important target features and suppress non-essential features. Compared with improvement 1, the accuracy is improved by 1.15%, the recall rate is improved by 2.96%, the F1 value is improved by 0.0210, the mAP@0.5 value is improved by 0.15%, the model parameters are reduced by 16.40%, and the model complexity is reduced by 11.71%.
[0141] Improvement 5 combines deformable convolutional networks and α-SIoU on the basis of improvement 1, and considers the impact of changing the loss function calculation method on the lightweight structure of the model. Compared with improvement 1, the accuracy is reduced by 3.03%, the recall rate is increased by 2.85%, the F1 value is reduced by 0.0148, the mAP@0.5 value is reduced by 1.11%, the number of model parameters is reduced by 24.10%, and the model complexity is reduced by 16.25%.
[0142] Improvement 6 combines α-SIoU on the basis of Improvement 1 to verify whether changing the calculation of the loss function will conflict with the attention mechanism, thereby having a negative impact on the model. The final experimental results show that compared with Improvement 2, the accuracy is improved by 0.93%, the recall rate is improved by 0.68%, the F1 value is improved by 0.0050, the mAP@0.5 value is improved by 1.02%, the model parameters are reduced by 19.52%, and the model complexity is reduced by 19.63%.
[0143] Improvement 7 combines the three methods to verify the effectiveness of the three improved methods. Compared with the previous model, the accuracy, recall rate, F1 value and mAP@0.5 value of Improvement 7 are the best, and the model parameter quantity and complexity are the lowest; compared with the original YOLOv7 algorithm, the accuracy of the final improved algorithm is improved by 2.92%, the recall rate is improved by 4.14%, the F1 value is improved by 0.0356, the mAP@0.5 value is improved by 3.60%, the number of model parameters is reduced by 47.83%, the model complexity is reduced by 38.99%, and the model detection accuracy is significantly improved.
[0144] Under the same experimental conditions, the present invention conducts a comparative verification of the convergence of the algorithm loss function in the ablation experiment. The comparison is as follows: Fig.11 As shown in the figure, as the number of iterations increases, the loss functions of the original algorithm and the seven improved methods are all in a convergence state. Among them, the loss function of the original algorithm remains at around 0.0308, the loss function of improved 3 remains at around 0.0251, the loss function of improved 5 remains at around 0.0247, and the loss function of improved 7 remains at around 0.239.
[0145] Compared with the original model, the loss function of the improved algorithm converges faster and has a smaller loss value; therefore, experiments have proved that the improved method of the present invention has a significant effect on optimizing the model loss function and improving the overall performance of the model.
[0146] Furthermore, in an optional embodiment, the method also includes step S500: using other target recognition methods for training and detection, using the evaluation indicators described in step S400 to compare the performance of the laboratory personnel irregular behavior detection network model based on the improved YOLOv7 with other target recognition methods, and evaluating the effectiveness of the laboratory personnel irregular behavior detection network model based on the improved YOLOv7.
[0147] Specifically, in order to further verify the feasibility of the detection network model algorithm of the present invention, the improved algorithm of the present invention is compared with other mainstream target recognition methods, including Faster R-CNN, SSD, YOLOv5m, YOLOX, YOLOv7-tiny and YOLOv7, and the above algorithms are compared in eight aspects, including accuracy, recall, weighted harmonic mean, average precision, FPS, model parameter quantity, model complexity and weight size. The results are shown in Table 3.
[0148] Table 3 Comparative experimental results
[0149]
[0150] Analysis of the experimental data in Table 3 shows that under the same data set and experimental environment, the improved detection network model algorithm (improved YOLOv7 algorithm) of the present invention has obvious advantages over the current mainstream traditional target recognition method; among them, the improved YOLOv7 algorithm and Faster Compared with the R-CNN algorithm, SSD algorithm, YOLOv5m and YOLOX, the accuracy rates are improved by 23.33%, 29.47%, 13.83% and 10.87% respectively, the recall rates are improved by 25.21%, 27.03%, 17.48% and 16.30% respectively, the mAP@0.5 is improved by 29.35%, 32.54%, 19.29% and 12.25% respectively, the model parameters are reduced by 67.85%, 61.90%, 12.30% and 55.33% respectively, and the model complexity is reduced by 78.82%, 66.10%, -30.69% and 21.10% respectively. Among them, the model complexity of YOLOv5m is lower, but other indicators are far inferior to the improved algorithms.
[0151] Compared with the original YOLOv7 algorithm, the improved YOLOv7 algorithm has improved all indicators, and the model parameter quantity and complexity have been greatly reduced, down 47.83% and 38.99% respectively, and the model weight has been reduced by 26.33%; the YOLOv7-tiny algorithm optimizes the network structure, greatly reduces the parameter quantity and complexity, and the model is more lightweight and suitable for edge deployment, but the detection accuracy is far less than the invented improved algorithm; after comprehensive comparison of different algorithms, it is shown that the changes made by the improved algorithm of the present invention are the best, which proves the effectiveness of the improved method of the present invention; the comparison of the average precision mAP@0.5 values of each recognition method is shown in the figure Fig.12 As shown in the figure, a mark is made every 10 points. It can be seen intuitively that the improved YOLOv7 algorithm of the present invention reaches convergence at about 100 epochs, and its mAP@0.5 value is the highest among all algorithms, reaching 92.04%; the detection effects of each target recognition method are as follows Fig.13 As shown, it can be seen from the detection categories and confidence levels that the improved YOLOv7 algorithm of the present invention has the best detection effect.
[0152] Based on this, real-time behavior image data of personnel in the laboratory environment to be detected is obtained; then the real-time behavior image data is input into a laboratory irregular behavior detection network model constructed based on the improved YOLOv7 technology to identify the category and confidence of the irregular behavior of personnel in the real-time behavior image data. If the confidence meets the set requirements, a prompt signal is output according to the category of the irregular behavior.
[0153] Among them, by shooting real-time video data of the laboratory environment, the real-time video data is frame-processed to obtain real-time behavior image data of people in the laboratory environment, and then the obtained image data is used as the object to carry out intelligent recognition processing using the trained laboratory irregular behavior detection network model.
[0154] In actual application, after the recognition is completed, the category and confidence of the irregular behavior of the personnel in the real-time behavior image data are obtained, that is, the probability of the personnel having a certain irregular behavior is judged, so that relevant processing operations such as reminders and warnings can be made during background processing.
[0155] The method for identifying irregular behaviors of laboratory personnel based on improved YOLOv7 provided by the embodiment of the present invention aims at the problem that there are many people and intensive traffic in the laboratory scene, and the feature extraction of the target area is insufficient. The deformable convolution network is used to replace the traditional convolution, so as to enhance the model's ability to capture target features and reduce the model complexity. In view of the problem that the behavior of personnel is difficult to detect after being blocked in the laboratory scene, the present invention adds a CBAM_E attention module to the two effective input feature layers of the neck network, enhances the model's ability to extract important features of the target, suppresses useless features, and improves the detection rate in the complex laboratory scene. In view of the influence of camera angle factors on target detection and weighted optimization of bounding box regression accuracy in the laboratory scene, the present invention replaces the bounding box loss function CIoU with α-SIoU, more accurately measures the bounding box overlap, and improves the model convergence speed and detection accuracy. Compared with other traditional target recognition methods, the detection speed and accuracy of the improved algorithm are significantly improved. In addition, the method for identifying irregular behaviors of laboratory personnel based on improved YOLOv7 provided by the embodiment of the present invention is suitable for laboratory scenes of different types in different fields, has a wide range of applications, and has good practicality.
[0156] For the above-mentioned method embodiments, for the sake of simplicity, they are all described as a series of action combinations, but those skilled in the art should know that the present invention is not limited by the order of the actions described, because according to the present invention, some steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present invention.
[0157] It should be pointed out that in other embodiments of the present invention, the method can also obtain a new method for identifying irregular behaviors of laboratory personnel based on improved YOLOv7 by combining one or several of the above embodiments, so as to achieve accurate detection and management of the behaviors of laboratory personnel.
[0158] It should be noted that, based on the method in any one or more of the above embodiments of the present invention, the present invention also provides a storage medium, on which is stored a program code that can implement the method as described in any one or more of the embodiments, and when the code is executed by the operating system, it can implement the above-mentioned recognition of irregular behaviors of laboratory personnel based on the improved YOLOv7.
[0159] Embodiment 2:
[0160] The method is described in detail in the embodiments disclosed in the present invention. The method of the present invention can be implemented by various forms of devices or systems. Therefore, based on other aspects of the method described in any one or more embodiments, the present invention also provides a laboratory personnel irregular behavior recognition system based on improved YOLOv7, which is used to execute the laboratory personnel irregular behavior recognition method based on improved YOLOv7 described in any one or more embodiments. Specific embodiments are given below for detailed description.
[0161] Specifically, Fig.14 FIG. 4 is a schematic diagram showing a structure of a laboratory personnel irregular behavior recognition system based on improved YOLOv7 provided in an embodiment of the present invention. Fig.14 As shown, the system includes:
[0162] A detection model building module, which is configured to build a laboratory irregular behavior detection network model based on improved YOLOv7 based on laboratory personnel behavior sample image training;
[0163] A test data acquisition module, which is configured to respectively acquire real-time behavior image data of personnel in the test laboratory environment;
[0164] A behavior recognition module, configured to input the real-time behavior image data into the laboratory irregular behavior detection network model based on improved YOLOv7 for recognition;
[0165] A real-time prompt module is configured to analyze and identify the category and confidence level of the irregular behavior of the personnel in the real-time behavior image data, and output a prompt signal according to the category of the irregular behavior if the confidence level reaches the set requirement;
[0166] The detection model building module includes:
[0167] A sample data preparation unit is configured to automatically pre-process and annotate sample images of laboratory personnel behaviors as required to form an experimental sample data set, including a training sample set, a verification sample set, and a test sample set;
[0168] The model network construction unit is configured to optimize the design of the backbone network convolution network based on the improved YOLOv7, optimize the design of the head network bounding box loss function, and add an attention module to the neck network to build a laboratory irregular behavior detection network model with recognition performance and bounding box compatibility that is adapted to the laboratory personnel behavior recognition needs;
[0169] The model training unit is configured to use the training sample set in the experimental sample data set to train the laboratory irregular behavior detection network model until the set training conditions are met, and use the verification sample set for verification.
[0170] In an optional embodiment, when the model network construction unit constructs a laboratory irregular behavior detection network model, a deformable convolutional network is designed to replace the traditional convolution in the backbone network part, an offset is added based on the standard convolution kernel, different convolution kernel structures are obtained according to different offset data, and the sampling results of the input feature map are calculated based on the convolution operation.
[0171] Furthermore, in one embodiment, when the model network construction unit constructs the laboratory irregular behavior detection network model, a CBAM_E attention module is added after the neck network input feature layer; one-dimensional convolution is used to replace the original MLP network, and the improved channel attention module is connected in parallel with the original spatial attention module.
[0172] In one embodiment, when the model network construction unit constructs the laboratory irregular behavior detection network model, the prediction head network is optimized and designed by using the α-SioU function to replace the CIoU function as the bounding box loss function in the prediction head network part, so as to process the feature maps extracted from the backbone network and the neck part.
[0173] In a preferred embodiment, in the process of processing the feature maps extracted from the backbone network and the neck part by the model network construction unit, the SIoU loss function is used as the basic loss function, the penalty index is redefined taking into account the impact of the camera angle factor on the detection result, and all the prediction results are combined into a target box to obtain the final predicted target.
[0174] Specifically, in an optional embodiment, the α-SIoU loss function used is as follows:
[0175]
[0176] Among them, α is a hyperparameter; IoU represents the overlap rate of the predicted box and the true box; Δ is the distance loss representing the error in the position and scale of the predicted box compared to the true value; Ω is the shape loss representing the shape difference between the predicted box and the true box.
[0177] Furthermore, in a preferred embodiment, the system further comprises:
[0178] The model verification module is configured to carry out ablation experiments on the constructed laboratory irregular behavior detection network model, and compare and analyze the detection effects of different optimized designs through multi-level evaluation indicators; the evaluation indicators include: accuracy, recall rate, weighted harmonic mean, average precision, number of frames processed per second, model parameter quantity, model calculation quantity and model weight indicator.
[0179] Optionally, in one embodiment, the test data acquisition module is configured to acquire real-time behavior image data of people in the laboratory environment by shooting real-time video data of the laboratory environment and performing frame processing on the real-time video data.
[0180] In one embodiment, the sample data preparation unit is configured to use a public data set to comprehensively search public data content to obtain laboratory personnel behavior images as laboratory personnel behavior sample images; the public data content includes original image data and video frame processing data.
[0181] Furthermore, in one embodiment, the sample data preparation unit performs multi-level preprocessing operations on the sample images of laboratory personnel behavior, including random changes in brightness and contrast, rotation and translation, and addition of Gaussian noise operations.
[0182] In the laboratory personnel irregular behavior recognition system based on improved YOLOv7 provided by the embodiment of the present invention, each module or unit structure can be operated independently or in combination according to the actual data processing and model algorithm improvement requirements to achieve corresponding technical effects.
[0183] It should be understood that the embodiments disclosed in the present invention are not limited to the specific structures, processing steps or materials disclosed herein, but should be extended to equivalent substitutions of these features understood by ordinary technicians in the relevant field. It should also be understood that the terms used herein are only used for the purpose of describing specific embodiments and are not meant to be limiting.
[0184] The "one embodiment" mentioned in the specification means that a particular feature, structure or characteristic described in conjunction with the embodiment is included in at least one embodiment of the present invention. Therefore, the phrase "one embodiment" appearing in various places throughout the specification does not necessarily refer to the same embodiment.
[0185] Although the embodiments disclosed in the present invention are as above, the above contents are only embodiments adopted for facilitating the understanding of the present invention and are not intended to limit the present invention. Any technician in the technical field to which the present invention belongs can make any modifications and changes in the form and details of the implementation without departing from the spirit and scope disclosed in the present invention, but the patent protection scope of the present invention shall still be subject to the scope defined in the attached claims.
Claims
1. A method for identifying irregular behavior of laboratory personnel based on improved YOLOv7, characterized in that: The method comprises: Step S10: Establishing a laboratory irregular behavior detection network model based on improved YOLOv7 based on laboratory personnel behavior sample image training; The process of establishing the laboratory irregular behavior detection network model includes the following operations: Step S100: After obtaining sample images of laboratory personnel behavior as required, automatically preprocess and annotate them to form an experimental sample data set, including a training sample set, a verification sample set, and a test sample set; Step S200: Based on the improved YOLOv7, the backbone network convolution network is optimized and designed, the head network bounding box loss function is optimized and designed, and an attention module is added to the neck network to construct a laboratory irregular behavior detection network model whose recognition performance and bounding box compatibility are adapted to the laboratory personnel behavior recognition requirements; Step S300: using the training sample set in the experimental sample data set to train the laboratory irregular behavior detection network model until the set training conditions are met, and using the verification sample set to verify; Step S20: respectively obtaining real-time behavior image data of people in the laboratory environment to be detected; Step S30: inputting the real-time behavior image data into the laboratory irregular behavior detection network model based on improved YOLOv7 for recognition; Step S40: Analyze and identify the category and confidence level of the irregular behavior of the personnel in the real-time behavior image data. If the confidence level reaches the set requirement, output a prompt signal according to the category of the irregular behavior.
2. The method according to claim 1, characterized in that: In step S200, when constructing a network model for detecting irregular laboratory behavior, the backbone network is designed to use a deformable convolutional network to replace the traditional convolution, an offset is added based on the standard convolution kernel, different convolution kernel structures are obtained according to different offset data, and the sampling results of the input feature map are calculated based on the convolution operation.
3. The method according to claim 1, characterized in that In step S200, when constructing the laboratory irregular behavior detection network model, a CBAM_E attention module is added after the neck network input feature layer; The original MLP network is replaced by one-dimensional convolution, and the improved channel attention module is connected in parallel with the original spatial attention module.
4. The method according to claim 1, characterized in that: In step S200, when constructing a laboratory irregular behavior detection network model, the prediction head network is optimized and designed by using the α-SioU function to replace the CIoU function as the bounding box loss function in the prediction head network part, so as to process the feature maps extracted from the backbone network and the neck part.
5. The method according to claim 1 or 4, characterized in that: In the process of processing the feature maps extracted from the backbone network and the neck part, the SIoU loss function is used as the basic loss function, and the penalty index is redefined taking into account the impact of the camera angle factor on the detection result. All prediction results are combined into a target box to obtain the final predicted target.
6. The method according to claim 1 or 5, characterized in that: The α-SIoU loss function used is as follows: Among them, α is a hyperparameter; IoU represents the overlap rate of the predicted box and the true box; Δ is the distance loss representing the error in the position and scale of the predicted box compared to the true value; Ω is the shape loss representing the shape difference between the predicted box and the true box.
7. The method according to claim 1, characterized in that The method further comprises: Step S400: Conduct an ablation experiment on the constructed laboratory irregular behavior detection network model, and compare and analyze the detection effects of different optimized designs through multi-level evaluation indicators; the evaluation indicators include: accuracy, recall rate, weighted harmonic mean, average precision, number of frames processed per second, model parameter quantity, model calculation quantity and model weight indicator.
8. The method according to claim 1, characterized in that In step S20, real-time video data of the laboratory environment is captured and frame-processed to obtain real-time behavior image data of people in the laboratory environment.
9. The method according to claim 1, characterized in that: In step S100, the public data set is used to comprehensively search the public data content to obtain laboratory personnel behavior images as laboratory personnel behavior sample images; the public data content includes original image data and video frame processing data.
10. The method according to claim 1, characterized in that In step S100, multi-level preprocessing operations are performed on the sample images of laboratory personnel behavior, including random changes in brightness and contrast, rotation and translation, and addition of Gaussian noise operations.
Citation Information
Cited By
Real face room person unsafe behavior monitoring system and method based on edge end and cloud end cooperation
CN121838270A
