A two-stage human behavior recognition method based on classroom intensive scenes

By designing a two-stage human behavior recognition method in dense classroom scenes, using multi-scale feature extraction and tracking technology, combined with the 3D behavioral feature extraction module, and optimizing the loss function, the problem of low recognition accuracy in traditional methods is solved and more efficient is achieved. behavior recognition.

CN118379798BActive Publication Date: 2024-09-24WUHAN TEXTILE UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410695162.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-05-30
Publication Date
2024-09-24
Estimated Expiration
2044-05-30

AI Technical Summary

Technical Problem

In dense scenes, traditional personnel behavior recognition methods have high false alarm rates, low accuracy, low body movement image recognition accuracy, insufficient accuracy in correlating seat numbers with student information, vague definitions of negative actions, and low real-time processing efficiency. Problem, it is difficult to accurately identify human behavior.

Method used

A two-stage human behavior recognition method based on dense classroom scenes is designed, including a human detection network and a behavior recognition network. Through multi-scale feature extraction and fusion technology, combined with human tracking and 3D behavioral feature extraction modules, the loss function is optimized to improve recognition. accuracy.

Benefits of technology

It improves the recognition accuracy and efficiency of human behavior in dense classroom scenes, simplifies the complexity of the problem, enhances the detection ability of human location and behavioral characteristics, effectively coordinates the relationship between detection and recognition tasks, and reduces the risk of over-fitting.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118379798B
    Figure CN118379798B
Patent Text Reader

Abstract

The present invention discloses a two-stage personnel behavior recognition method based on a classroom intensive scene, comprising the following steps: S1: collecting video data, manually screening out personnel image data and specific behavior fragments of the classroom intensive scene, and making a corresponding data set; S2: designing a personnel detection network based on the classroom intensive scene; S3: designing a personnel behavior recognition network based on the classroom intensive scene; S4: designing a loss function of the two-stage personnel behavior recognition network based on the classroom intensive scene; S5: training the personnel detection network and the personnel behavior recognition network; S6: deploying the trained personnel detection and behavior recognition models to recognize personnel behaviors in the classroom intensive scene in real time. The present invention monitors the real-time video stream of the classroom scene in real time by designing a personnel detection network, a personnel behavior recognition network and a loss function based on the classroom intensive scene, thereby improving the recognition accuracy of behaviors in intensive scenes.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer vision, and in particular to a two-stage personnel behavior recognition method based on a classroom intensive scene. Background Art

[0002] Effectively identifying human behavior in densely monitored scenarios has always been a challenging task. Traditional monitoring methods often rely on manual visual observation. However, in densely monitored scenarios, it is often difficult to keep an eye on each person, especially due to the coverage and technical limitations of monitoring equipment. Therefore, traditional methods often have difficulty in accurately observing specific behaviors.

[0003] In recent years, with the advancement of artificial intelligence technology, the use of surveillance video to identify human behavior has become a research hotspot. However, human behavior in dense scenes is usually very complex and difficult to accurately identify. Traditional algorithms may have problems with high false alarm rates and low accuracy, and often rely on thresholds to identify abnormal behavior. However, this method is easily affected by noise, resulting in an increased false alarm rate, and also requires monitoring personnel to invest a lot of effort in confirmation.

[0004] Chinese patent publication number CN117475466A discloses a method and system called "A real-time monitoring method and system for classroom student learning status". The method regularly takes a panoramic picture of the classroom within a preset time period, extracts the students' body movement images for recognition, and then associates them based on the seat information and student information, and finally sends the students' negative action images and related information to the monitoring terminal. However, this method has problems such as low accuracy in body movement image recognition, insufficient accuracy in associating seat numbers with student information, vague definition of negative actions, and low efficiency in real-time processing, and needs further improvement.

[0005] Therefore, in order to address the complexity of human behavior in dense scenes and the difficulty of detection due to occlusion, more effective methods need to be proposed to overcome the limitations of existing technologies. Summary of the invention

[0006] In view of the above defects or improvement needs of the prior art, the present invention provides a two-stage personnel behavior recognition method based on dense classroom scenes. By designing a personnel detection network, a personnel behavior recognition network and a loss function based on dense classroom scenes, the real-time video stream of the classroom scene is monitored in real time, thereby improving the recognition accuracy of behavior in dense scenes.

[0007] To achieve the above object, according to one aspect of the present invention, a two-stage personnel behavior recognition method based on a classroom intensive scenario is provided, the method comprising the following steps:

[0008] S1: Collect video data, manually filter out image data of people and specific behavior clips in classroom intensive scenes, and create corresponding data sets, which include person detection image data sets and behavior recognition video data sets;

[0009] S2: Design a personnel detection network based on a dense classroom scene. The personnel detection network consists of the first stage, the second stage, and the third stage, including multiple feature extraction modules, a multi-scale feature extraction module, a multi-scale feature fusion module, and a series of convolution, upsampling, downsampling, and feature splicing operations. The personnel detection network is used to detect people in the classroom scene and output the person detection box and confidence.

[0010] S3: Design a person behavior recognition network based on a classroom intensive scenario, wherein the person behavior recognition network is used to receive the person detection frame and confidence output by the person detection network and perform behavior classification on the corresponding person in the video;

[0011] S4: Design and optimize the loss function of a two-stage person behavior recognition network based on a classroom intensive scenario, wherein the two-stage person behavior recognition network includes a person detection network and a person behavior recognition network;

[0012] S5: using the loss function and the prepared data set to train the designed personnel detection network and personnel behavior recognition network to obtain trained personnel detection and behavior recognition models;

[0013] S6: Deploy trained personnel detection and behavior recognition models to identify personnel behaviors in dense classroom scenarios in real time.

[0014] As an embodiment of the present application, step S1 specifically includes the following steps:

[0015] S11: Collect video data captured by surveillance cameras at different angles in the classroom;

[0016] S12: Divide the video data into segments, each lasting 11 seconds, and manually screen each video to select adjacent segments with large behavior changes as the behavior recognition video dataset, and renumber each video;

[0017] S13: Extract the behavior recognition video dataset into images, extract 11 frames per second, and use these images as the person detection image dataset. At the same time, frame the positions of the people in the images as annotation information.

[0018] S14: Based on the annotation of the person detection image dataset, a corresponding label is added to the person behavior in each image; at the same time, the behavior category labels in the previous and next frame images are associated with different persons, and the person ID and the corresponding behavior in the corresponding frame in each video are recorded as the annotation of the behavior recognition video dataset;

[0019] S15: Divide the labeled data set into training set, validation set and test set in a ratio of 7:2:1.

[0020] As an embodiment of the present application, the personnel detection network based on the classroom intensive scene in step S2 specifically includes:

[0021] S21: In the first stage, firstly, video data of size H×W×3 is input, and the video data is converted into a feature map of size 160×160×128 through feature extraction module 1, and then after a 3×3 convolution operation, the size of the feature map is halved and the depth is doubled, becoming a feature map of size 80×80×256;

[0022] S22: Next, after the multi-scale feature extraction module 1, the features of different scales are analyzed and weighted, while maintaining the depth and width of the model, the network's ability to extract subtle features in complex visual tasks is improved. After the multi-scale feature extraction module 1, the multi-scale feature extraction module 2, and the multi-scale feature extraction module 3 are stacked and convolved, the network obtains a feature map with a size of 20×20×512;

[0023] S23: Subsequently, in the second stage of the network, the feature map with a size of 20×20×512 passes through the multi-scale feature fusion module 1 and the multi-scale feature fusion module 2 to fuse features of different scales. Secondly, the size of the feature map is adjusted by upsampling to keep it consistent with the feature size output by the multi-scale feature extraction module 2 in the first stage. After feature splicing, this set of feature maps with a size of 40×40×512 is fused. Then, after passing through the multi-scale feature extraction module 3, the features of different scales are fused. The size of the feature map is adjusted to 80×80×512 by upsampling again to keep it consistent with the height and width of the 80×80×256 feature map output by the multi-scale feature extraction module 1 in the first stage. After feature splicing, this set of feature maps is fused to obtain a feature map with a size of 80×80×768.

[0024] S24: Subsequently, the feature map with a size of 80×80×768 is converted into a feature map of 80×80×256 through feature extraction module 2. Next, the size of the feature map is adjusted to 40×40×256 through downsampling, keeping the height and width consistent with the 40×40×512 feature map output in the multi-scale feature fusion module 3 in stage 2. After feature splicing, this set of feature maps is fused to obtain a feature map with a size of 40×40×768. After feature extraction module 3, it is converted into a feature map of 40×40×512. Next, the size of the feature map is adjusted through downsampling, keeping the feature size consistent with the feature size output in the multi-scale feature fusion module 2 in stage 2. After feature splicing, this set of 20×20×512 feature maps is fused. Finally, after feature extraction module 4, the network has acquired the ability to extract feature information of three scales: large, medium and small.

[0025] S25: Finally, in the third stage of the network, the detection head outputs the person detection box and confidence, which are sent to the person behavior recognition network based on the classroom intensive scene to further identify the specific behavior of the person.

[0026] As an embodiment of the present application, the personnel behavior recognition network in step S3 specifically includes:

[0027] S31: First, the person behavior recognition network receives the person detection frame and confidence output by the person detection network, and then uses the person tracking module to track the person by using the association information between the upper and lower frames, and assigns a unique ID and trajectory information to each person;

[0028] S32: Next, the image video frames corresponding to the tracked personnel ID and trajectory information are passed to the subsequent 3D behavior feature extraction module through two branches to extract key behavior features from the trajectory of each person;

[0029] S33: Finally, the features of the two branches are fused and sent to the behavior classifier for behavior classification and recognition.

[0030] As an embodiment of the present application, the two branch specific steps in step S32 include:

[0031] S321: First, the personnel behavior recognition network receives T-frame H×W×3 video data with personnel ID and trajectory information. In the first branch, the video data passes through 3D behavior feature extraction module 1, 3D behavior feature extraction module 2, and 3D behavior feature extraction module 3 in sequence, and is converted into a 14×14×4C×2 feature map with C number of behavior categories, and static feature information is extracted, wherein the static feature information includes environmental background and personnel behavior;

[0032] S322: Secondly, in another branch, the T-frame H×W×3 video data with personnel ID and trajectory information is sequentially passed through 3D behavior feature extraction module 4, 3D behavior feature extraction module 5, and 3D behavior feature extraction module 6 to convert it into a feature map of 14×14×4C / 8×15 with C number of behavior categories to extract dynamic feature information of personnel behavior.

[0033] As an embodiment of the present application, the loss function in step S4 is The calculation formula is as follows:

[0034]

[0035] in, represents the loss function of the personnel detection network, which is used to evaluate the accuracy of personnel detection. represents the loss function of the personnel behavior recognition network, which is used to evaluate the accuracy of personnel identification. is a learnable hyperparameter that balances the relationship between the two tasks and guides the update of model parameters during training.

[0036] As an embodiment of the present application, the personnel detection network loss function The calculation formula is as follows:

[0037]

[0038] in, is the number of targets detected, It is The intersection-over-union ratio between the predicted bounding box and the actual bounding box of the target person is used to measure the degree of overlap between the predicted bounding box and the true bounding box. The model is The prediction confidence of each target person, is a hyperparameter used to adjust the loss weight for undetected objects.

[0039] As an embodiment of the present application, the human behavior recognition network loss function The calculation formula is as follows:

[0040]

[0041] in, is the number of targets detected, is the number of behavior categories, is a mapping function, which means that when samples belong to the category 1 if yes, 0 otherwise. Indicates when samples belong to the category The probability of is the regularization parameter, which is used to control the weight of the regularization term. Used to penalize the size of model parameters, where is the number of model parameters, Represents the model parameters.

[0042] As an embodiment of the present application, step S5 specifically includes:

[0043] S51: Model training: Use the training sets in the image dataset and video dataset to simultaneously train the personnel detection network and personnel behavior recognition network based on classroom dense scenes. Through the designed loss function, the back propagation algorithm is used to update the parameters to accurately detect people in dense scenes and identify their behaviors. During the training process, the shared parameters of the two networks are optimized to ensure that they can promote each other and improve the overall performance, thereby obtaining the initial personnel detection and behavior recognition model;

[0044] S52: Model verification and tuning: Use the verification set to verify the initial person detection and behavior recognition model obtained through training, evaluate its performance on unseen data, and tune the model parameters based on the verification results to improve the generalization ability of the model and further optimize the person detection and behavior recognition model;

[0045] S53: Model testing: Use the test set to test the trained and verified model, evaluate its performance in real scenarios, and check whether the model can accurately identify the behavior of people in intensive classroom scenarios. If the model does not perform well on the test set, return to the model verification and tuning stage for further tuning until the expected performance level is achieved.

[0046] The beneficial effects of the present invention are:

[0047] (1) The present invention adopts a two-stage recognition method, namely, designing independent personnel detection networks and personnel behavior recognition stages, which can more accurately analyze personnel behavior in dense classroom scenarios. This phased processing method helps to simplify the complexity of the problem, and each stage can focus on its core task, thereby improving the overall recognition accuracy and efficiency.

[0048] (2) The personnel detection network designed in the present invention adopts multi-scale feature extraction and fusion technology, which enables the network to capture features at different levels from coarse to fine, enhancing the model's ability to detect personnel in dense classroom scenes. The multi-stage feature processing flow ensures that the network can effectively extract personnel locations and related features from a large amount of complex visual information, which is crucial for accurately identifying individuals in dense classroom scenes.

[0049] (3) The human behavior recognition model designed by the present invention adopts a combination of human tracking and 3D behavior feature extraction modules, which can accurately track and identify individual behaviors in a dynamic environment. This design effectively links spatiotemporal information, which is particularly important for understanding continuous actions and complex behavior patterns.

[0050] (4) The present invention designs and optimizes the loss function, which can effectively coordinate the relationship between the detection and recognition tasks while ensuring their respective accuracy, thereby optimizing the overall network performance. The design of this loss function, especially the addition of hyperparameters to adjust the importance of tasks, helps to automatically balance the learning progress of each task during the training process. At the same time, a regularization term is introduced to reduce the risk of overfitting. BRIEF DESCRIPTION OF THE DRAWINGS

[0051] Figure 1 A flowchart of a two-stage personnel behavior recognition method based on a classroom intensive scenario provided in an embodiment of the present invention;

[0052] Figure 2 A personnel detection network structure diagram of a two-stage personnel behavior recognition method based on a classroom intensive scenario provided in an embodiment of the present invention;

[0053] Figure 3 This is a personnel behavior recognition network structure diagram of a two-stage personnel behavior recognition method based on a classroom intensive scenario provided in an embodiment of the present invention. DETAILED DESCRIPTION

[0054] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0055] It should be noted that all directional indications (such as up, down, left, right, front, back, etc.) in the embodiments of the present invention are only used to explain the relative position relationship, movement status, etc. between the components under a certain specific posture (as shown in the accompanying drawings). If the specific posture changes, the directional indication will also change accordingly.

[0056] In the present invention, unless otherwise clearly specified and limited, the terms "connection", "fixation", etc. should be understood in a broad sense. For example, "fixation" can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection or an indirect connection through an intermediate medium, it can be the internal connection of two elements or the interaction relationship between two elements, unless otherwise clearly defined. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.

[0057] In addition, if there are descriptions involving "first", "second", etc. in the embodiments of the present invention, the descriptions of "first", "second", etc. are only used for descriptive purposes and cannot be understood as indicating or implying their relative importance or implicitly indicating the number of technical features indicated. Therefore, the features defined as "first" and "second" may explicitly or implicitly include at least one of the features. In addition, the meaning of "and / or" appearing in the full text includes three parallel schemes. Taking "A and / or B" as an example, it includes scheme A, or scheme B, or a scheme that satisfies both A and B. In addition, the technical solutions between the various embodiments can be combined with each other, but it must be based on the ability of ordinary technicians in the field to implement. When the combination of technical solutions is contradictory or cannot be implemented, it should be deemed that such a combination of technical solutions does not exist and is not within the scope of protection required by the present invention.

[0058] Reference Figure 1-Figure 3 The first aspect of the present invention provides a two-stage personnel behavior recognition method based on a classroom intensive scene, the method comprising the following steps:

[0059] S1: Collect video data, manually filter out image data of people and specific behavior clips in classroom intensive scenes, and create corresponding data sets, which include person detection image data sets and behavior recognition video data sets;

[0060] S2: Design a personnel detection network based on a dense classroom scene. The personnel detection network consists of the first stage, the second stage, and the third stage, including multiple feature extraction modules, a multi-scale feature extraction module, a multi-scale feature fusion module, and a series of convolution, upsampling, downsampling, and feature splicing operations. The personnel detection network is used to detect people in the classroom scene and output the person detection box and confidence.

[0061] S3: Design a person behavior recognition network based on a classroom intensive scenario, wherein the person behavior recognition network is used to receive the person detection frame and confidence output by the person detection network and perform behavior classification on the corresponding person in the video;

[0062] S4: Design and optimize the loss function of a two-stage person behavior recognition network based on a classroom intensive scenario, wherein the two-stage person behavior recognition network includes a person detection network and a person behavior recognition network;

[0063] S5: using the loss function and the prepared data set to train the designed personnel detection network and personnel behavior recognition network to obtain trained personnel detection and behavior recognition models;

[0064] S6: Deploy trained personnel detection and behavior recognition models to identify personnel behaviors in dense classroom scenarios in real time.

[0065] Specifically, the present invention adopts a two-stage recognition method, that is, designing independent personnel detection networks and personnel behavior recognition stages, which can more accurately analyze personnel behavior in intensive classroom scenarios. This phased processing method helps to simplify the complexity of the problem, and each stage can focus on its core task, thereby improving the overall recognition accuracy and efficiency.

[0066] As an embodiment of the present application, step S1 specifically includes the following steps:

[0067] S11: Collect video data captured by surveillance cameras at different angles in the classroom;

[0068] S12: Divide the video data into segments, each lasting 11 seconds, and manually screen each video to select adjacent segments with large behavior changes as the behavior recognition video dataset, and renumber each video;

[0069] S13: Extract the behavior recognition video dataset into images, extract 11 frames per second, and use these images as the person detection image dataset. At the same time, frame the positions of the people in the images as annotation information.

[0070] S14: Based on the annotation of the person detection image dataset, a corresponding label is added to the person behavior in each image; at the same time, the behavior category labels in the previous and next frame images are associated with different persons, and the person ID and the corresponding behavior in the corresponding frame in each video are recorded as the annotation of the behavior recognition video dataset;

[0071] S15: Divide the labeled data set into training set, validation set and test set in a ratio of 7:2:1.

[0072] As an embodiment of the present application, the personnel detection network based on the classroom intensive scene in step S2 specifically includes:

[0073] S21: In the first stage, firstly, video data of size H×W×3 is input, and the video data is converted into a feature map of size 160×160×128 through feature extraction module 1, and then after a 3×3 convolution operation, the size of the feature map is halved and the depth is doubled, becoming a feature map of size 80×80×256;

[0074] S22: Next, after the multi-scale feature extraction module 1, the features of different scales are analyzed and weighted, while maintaining the depth and width of the model, the network's ability to extract subtle features in complex visual tasks is improved. After the multi-scale feature extraction module 1, the multi-scale feature extraction module 2, and the multi-scale feature extraction module 3 are stacked and convolved, the network obtains a feature map with a size of 20×20×512;

[0075] S23: Subsequently, in the second stage of the network, the feature map with a size of 20×20×512 passes through the multi-scale feature fusion module 1 and the multi-scale feature fusion module 2 to fuse features of different scales. Secondly, the size of the feature map is adjusted by upsampling to keep it consistent with the feature size output by the multi-scale feature extraction module 2 in the first stage. After feature splicing, this set of feature maps with a size of 40×40×512 is fused. Then, after passing through the multi-scale feature extraction module 3, the features of different scales are fused. The size of the feature map is adjusted to 80×80×512 by upsampling again to keep it consistent with the height and width of the 80×80×256 feature map output by the multi-scale feature extraction module 1 in the first stage. After feature splicing, this set of feature maps is fused to obtain a feature map with a size of 80×80×768.

[0076] S24: Subsequently, the feature map with a size of 80×80×768 is converted into a feature map of 80×80×256 through feature extraction module 2. Next, the size of the feature map is adjusted to 40×40×256 through downsampling, keeping the height and width consistent with the 40×40×512 feature map output in the multi-scale feature fusion module 3 in stage 2. After feature splicing, this set of feature maps is fused to obtain a feature map with a size of 40×40×768. After feature extraction module 3, it is converted into a feature map of 40×40×512. Next, the size of the feature map is adjusted through downsampling, keeping the feature size consistent with the feature size output in the multi-scale feature fusion module 2 in stage 2. After feature splicing, this set of 20×20×512 feature maps is fused. Finally, after feature extraction module 4, the network has acquired the ability to extract feature information of three scales: large, medium and small.

[0077] S25: Finally, in the third stage of the network, the detection head outputs the person detection box and confidence, which are sent to the person behavior recognition network based on the classroom intensive scene to further identify the specific behavior of the person.

[0078] Specifically, the personnel detection network designed in the present invention adopts multi-scale feature extraction and fusion technology, so that the network can capture features at different levels from coarse to fine, thereby enhancing the model's ability to detect personnel in dense classroom scenes. The multi-stage feature processing process ensures that the network can effectively extract personnel locations and related features from a large amount of complex visual information, which is crucial for accurately identifying individuals in dense classroom scenes.

[0079] As an embodiment of the present application, the personnel behavior recognition network in step S3 specifically includes:

[0080] S31: First, the person behavior recognition network receives the person detection frame and confidence output by the person detection network, and then uses the person tracking module to track the person by using the association information between the upper and lower frames, and assigns a unique ID and trajectory information to each person, ensuring that the behavior of each person can be accurately tracked and analyzed in subsequent modules;

[0081] S32: Next, the image and video frames corresponding to the tracked person ID and trajectory information are passed to the subsequent 3D behavior feature extraction module through two branches to extract key behavior features from the trajectory of each person, such as posture, action sequence, etc.;

[0082] S33: Finally, the features of the two branches are fused and sent to the behavior classifier for behavior classification and recognition.

[0083] As an embodiment of the present application, the two branch specific steps in step S32 include:

[0084] S321: First, the personnel behavior recognition network receives T frames H×W×3 video data with personnel ID and trajectory information. In the first branch, the video data passes through 3D behavior feature extraction module 1, 3D behavior feature extraction module 2, and 3D behavior feature extraction module 3 in sequence, and is converted into a 14×14×4C×2 feature map with C behavior categories, and static feature information is extracted at a lower frame rate. The static feature information includes environmental background and personnel behavior, thereby reducing computing resource consumption.

[0085] S322: Secondly, in another branch, the T-frame H×W×3 video data with personnel ID and trajectory information is sequentially passed through 3D behavior feature extraction module 4, 3D behavior feature extraction module 5, and 3D behavior feature extraction module 6 to convert it into a feature map of 14×14×4C / 8×15 with C number of behavior categories to extract dynamic feature information of personnel behavior.

[0086] Among them, the dynamic feature information includes: the temporal nature of behavior: including the movement of people, gestures, changes in facial expressions, etc., which are dynamic behaviors that develop and change over time; speed and direction: the speed and direction of movement of people or objects, which is crucial to understanding how to transition from one action to another; the dynamic nature of interaction: dynamic interactions between people or between people and objects, such as pushing, pulling, throwing, etc.

[0087] Specifically, the personnel behavior recognition model designed by the present invention adopts a combination of personnel tracking and 3D behavior feature extraction modules, which can accurately track and identify individual behaviors in a dynamic environment. This design effectively links spatiotemporal information, which is particularly important for understanding continuous actions and complex behavior patterns.

[0088] As an embodiment of the present application, the loss function in step S4 is The calculation formula is as follows:

[0089]

[0090] in, represents the loss function of the personnel detection network, which is used to evaluate the accuracy of personnel detection. represents the loss function of the personnel behavior recognition network, which is used to evaluate the accuracy of personnel identification. is a learnable hyperparameter that balances the relationship between the two tasks and guides the update of model parameters during training.

[0091] Specifically, the purpose of the loss function designed in the present invention is that, during the model training process, while ensuring the accuracy of the detection and recognition tasks, it can also effectively coordinate the relationship between the two and optimize the overall network performance. The model error can be calculated based on the difference between the model's prediction results and the true labels. Through the feedback of this error signal, the model can gradually adjust its parameters to continuously improve its performance in personnel detection and recognition tasks, effectively balance the importance of the two tasks, and help to automatically balance the learning progress of each task during the training process. At the same time, a regularization term is introduced to reduce the risk of overfitting, so that the model can achieve good performance in both aspects.

[0092] As an embodiment of the present application, the personnel detection network loss function The calculation formula is as follows:

[0093]

[0094] in, is the number of targets detected, It is The intersection-over-union ratio between the predicted bounding box and the actual bounding box of the target person is used to measure the degree of overlap between the predicted bounding box and the true bounding box. The model is The prediction confidence of each target person, is a hyperparameter used to adjust the loss weight for undetected objects.

[0095] As an embodiment of the present application, the human behavior recognition network loss function The calculation formula is as follows:

[0096]

[0097] in, is the number of targets detected, is the number of behavior categories, is a mapping function, which means that when samples belong to the category 1 if yes, 0 otherwise. Indicates when samples belong to the category The probability of is the regularization parameter, which is used to control the weight of the regularization term. Used to penalize the size of model parameters, where is the number of model parameters, Represents the model parameters.

[0098] As an embodiment of the present application, step S5 specifically includes:

[0099] S51: Model training: Use the training sets in the image dataset and video dataset to simultaneously train the personnel detection network and personnel behavior recognition network based on classroom dense scenes. Through the designed loss function, the back propagation algorithm is used to update the parameters to accurately detect people in dense scenes and identify their behaviors. During the training process, the shared parameters of the two networks are optimized to ensure that they can promote each other and improve the overall performance, thereby obtaining the initial personnel detection and behavior recognition model;

[0100] S52: Model verification and tuning: Use the verification set to verify the initial person detection and behavior recognition model obtained through training, evaluate its performance on unseen data, and tune the model parameters based on the verification results to improve the generalization ability of the model and further optimize the person detection and behavior recognition model;

[0101] S53: Model testing: Use the test set to test the trained and verified model, evaluate its performance in real scenarios, and check whether the model can accurately identify the behavior of people in intensive classroom scenarios. If the model does not perform well on the test set, return to the model verification and tuning stage for further tuning until the expected performance level is achieved.

[0102] The present invention adopts a two-stage recognition method, namely, designing a personnel detection network and a personnel behavior recognition network, so as to more accurately analyze the personnel behavior in the dense classroom scene, and then trains the designed personnel detection network and personnel behavior recognition network. The loss function designed in the training process can effectively balance the importance of the two tasks, so that the model can achieve good performance in both aspects, and finally utilizes the trained personnel detection and behavior recognition models to recognize the personnel behavior in the dense classroom scene in real time, thereby improving the recognition accuracy of the behavior in the dense scene.

[0103] The above descriptions are only some preferred embodiments of the present disclosure and an explanation of the technical principles used. Those skilled in the art should understand that the scope of the invention involved in the embodiments of the present disclosure is not limited to the technical solutions formed by a specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above inventive concept. For example, the above features are replaced with (but not limited to) technical features with similar functions disclosed in the embodiments of the present disclosure.

Claims

1. A two-stage personnel behavior recognition method based on classroom intensive scenes, characterized in that: The method comprises the following steps: S1: Collect video data, manually filter out image data of people and specific behavior clips in classroom intensive scenes, and create corresponding data sets, which include person detection image data sets and behavior recognition video data sets; S2: Design a personnel detection network based on a dense classroom scene. The personnel detection network consists of the first stage, the second stage, and the third stage, including multiple feature extraction modules, a multi-scale feature extraction module, a multi-scale feature fusion module, and a series of convolution, upsampling, downsampling, and feature splicing operations. The personnel detection network is used to detect people in the classroom scene and output the person detection box and confidence. S3: Design a person behavior recognition network based on a classroom intensive scenario, wherein the person behavior recognition network is used to receive the person detection frame and confidence output by the person detection network and perform behavior classification on the corresponding person in the video; S4: Design and optimize the loss function of a two-stage person behavior recognition network based on a classroom intensive scenario, wherein the two-stage person behavior recognition network includes a person detection network and a person behavior recognition network; S5: using the loss function and the prepared data set to train the designed personnel detection network and personnel behavior recognition network to obtain trained personnel detection and behavior recognition models; S6: Deploy trained person detection and behavior recognition models to identify person behaviors in crowded classroom scenarios in real time; The loss function in step S4 The calculation formula is as follows: in, represents the loss function of the personnel detection network, which is used to evaluate the accuracy of personnel detection. represents the loss function of the personnel behavior recognition network, which is used to evaluate the accuracy of personnel identification. It is a learnable hyperparameter that balances the relationship between the two tasks and guides the update of model parameters during training; The person detection network loss function The calculation formula is as follows: in, is the number of targets detected, It is The intersection-over-union ratio between the predicted bounding box and the actual bounding box of the target person is used to measure the degree of overlap between the predicted bounding box and the true bounding box. The model is The prediction confidence of each target person, is a hyperparameter used to adjust the loss weight of undetected targets; The loss function of the human behavior recognition network The calculation formula is as follows: in, is the number of targets detected, is the number of behavior categories, is a mapping function, which means that when samples belong to the category 1 if yes, 0 otherwise. Indicates when samples belong to the category The probability of is the regularization parameter, which is used to control the weight of the regularization term. Used to penalize the size of model parameters, where is the number of model parameters, Represents the model parameters.

2. A two-stage personnel behavior recognition method based on a classroom intensive scenario as claimed in claim 1, characterized in that: The step S1 specifically includes the following steps: S11: Collect video data captured by surveillance cameras at different angles in the classroom; S12: Divide the video data into segments, each lasting 11 seconds, and manually screen each video to select adjacent segments with large behavior changes as the behavior recognition video dataset, and renumber each video; S13: Extract the behavior recognition video dataset into images, extract 11 frames per second, and use these images as the person detection image dataset. At the same time, frame the positions of the people in the images as annotation information. S14: Based on the annotation of the person detection image dataset, a corresponding label is added to the person behavior in each image; at the same time, the behavior category labels in the previous and next frame images are associated with different persons, and the person ID and the corresponding behavior in the corresponding frame in each video are recorded as the annotation of the behavior recognition video dataset; S15: Divide the labeled data set into training set, validation set and test set in a ratio of 7:2:

1.

3. A two-stage personnel behavior recognition method based on a classroom intensive scenario as claimed in claim 1, characterized in that: The personnel detection network based on the classroom intensive scene in step S2 specifically includes: S21: In the first stage, firstly, video data of size H×W×3 is input, where H represents height and W represents width. The video data is converted into a feature map of size 160×160×128 by feature extraction module 1. Then, after a 3×3 convolution operation, the size of the feature map is halved and the depth is doubled, becoming a feature map of size 80×80×256. S22: Next, after the multi-scale feature extraction module 1, the features of different scales are analyzed and weighted, while maintaining the depth and width of the model, the network's ability to extract subtle features in complex visual tasks is improved. After the multi-scale feature extraction module 1, the multi-scale feature extraction module 2, and the multi-scale feature extraction module 3 are stacked and convolved, the network obtains a feature map with a size of 20×20×512; S23: Subsequently, in the second stage of the network, the feature map with a size of 20×20×512 passes through the multi-scale feature fusion module 1 and the multi-scale feature fusion module 2 to fuse features of different scales. Secondly, the size of the feature map is adjusted by upsampling to keep it consistent with the feature size output by the multi-scale feature extraction module 2 in the first stage. After feature splicing, this set of feature maps with a size of 40×40×512 is fused. Then, after passing through the multi-scale feature extraction module 3, the features of different scales are fused. The size of the feature map is adjusted to 80×80×512 by upsampling again to keep it consistent with the height and width of the 80×80×256 feature map output by the multi-scale feature extraction module 1 in the first stage. After feature splicing, this set of feature maps is fused to obtain a feature map with a size of 80×80×768. S24: Subsequently, the feature map with a size of 80×80×768 is converted into a feature map of 80×80×256 through feature extraction module 2. Next, the size of the feature map is adjusted to 40×40×256 through downsampling, keeping the height and width consistent with the 40×40×512 feature map output in the multi-scale feature fusion module 3 in stage 2. After feature splicing, this set of feature maps is fused to obtain a feature map with a size of 40×40×768. After feature extraction module 3, it is converted into a feature map of 40×40×512. Next, the size of the feature map is adjusted through downsampling, keeping the feature size consistent with the feature size output in the multi-scale feature fusion module 2 in stage 2. After feature splicing, this set of 20×20×512 feature maps is fused. Finally, after feature extraction module 4, the network has acquired the ability to extract feature information of three scales: large, medium and small. S25: Finally, in the third stage of the network, the detection head outputs the person detection box and confidence, which are sent to the person behavior recognition network based on the classroom intensive scene to further identify the specific behavior of the person.

4. A two-stage personnel behavior recognition method based on a classroom intensive scenario as claimed in claim 1, characterized in that: The personnel behavior recognition network in step S3 specifically includes: S31: First, the person behavior recognition network receives the person detection frame and confidence output by the person detection network, and then uses the person tracking module to track the person by using the association information between the upper and lower frames, and assigns a unique ID and trajectory information to each person; S32: Next, the image video frames corresponding to the tracked personnel ID and trajectory information are passed to the subsequent 3D behavior feature extraction module through two branches to extract key behavior features from the trajectory of each person; S33: Finally, the features of the two branches are fused and sent to the behavior classifier for behavior classification and recognition.

5. A two-stage personnel behavior recognition method based on a classroom intensive scenario as claimed in claim 4, characterized in that: The two branches in step S32 specifically include: S321: First, the personnel behavior recognition network receives T-frame H×W×3 video data with personnel ID and trajectory information. In the first branch, the video data passes through 3D behavior feature extraction module 1, 3D behavior feature extraction module 2, and 3D behavior feature extraction module 3 in sequence, and is converted into a 14×14×4C×2 feature map with C number of behavior categories, and static feature information is extracted, wherein the static feature information includes environmental background and personnel behavior; S322: Secondly, in another branch, the T-frame H×W×3 video data with personnel ID and trajectory information is sequentially passed through 3D behavior feature extraction module 4, 3D behavior feature extraction module 5, and 3D behavior feature extraction module 6 to convert it into a feature map of 14×14×4C / 8×15 with C number of behavior categories to extract dynamic feature information of personnel behavior.

6. A two-stage personnel behavior recognition method based on a classroom intensive scenario as claimed in claim 1, characterized in that: The step S5 specifically includes: S51: Model training: Use the training sets in the image dataset and video dataset to simultaneously train the personnel detection network and personnel behavior recognition network based on classroom dense scenes. Through the designed loss function, the back propagation algorithm is used to update the parameters to accurately detect people in dense scenes and identify their behaviors. During the training process, the shared parameters of the two networks are optimized to ensure that they can promote each other and improve the overall performance, thereby obtaining the initial personnel detection and behavior recognition model; S52: Model verification and tuning: Use the verification set to verify the initial person detection and behavior recognition model obtained through training, evaluate its performance on unseen data, and tune the model parameters based on the verification results to improve the generalization ability of the model and further optimize the person detection and behavior recognition model; S53: Model testing: Use the test set to test the trained and verified model, evaluate its performance in real scenarios, and check whether the model can accurately identify the behavior of people in intensive classroom scenarios. If the model does not perform well on the test set, return to the model verification and tuning stage for further tuning until the expected performance level is achieved.