A classroom behavior recognition method based on two-stream convolutional neural network
By designing a dual-stream network model, combining spatial and temporal attention mechanisms to extract features, and using the TAG method and multi-layer perceptron for behavior optimization and classification, the problem of insufficient accuracy and real-time performance in classroom behavior recognition in the existing technology has been solved, achieving Provides more efficient classroom behavior identification and management support.
Patent Information
- Application Number
- CN202410549648.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-06
- Publication Date
- 2024-08-30
- Estimated Expiration
- 2044-05-06
AI Technical Summary
The existing classroom behavior recognition method based on dual-stream convolutional neural network has shortcomings in accuracy and real-time performance, and the calculation speed is slow, making it difficult to meet the needs of teaching evaluation and personalized learning.
A dual-stream network model is designed, including a data preprocessing module, a dual-stream convolutional neural network feature extraction module and a feature fusion module. It extracts spatial and temporal features in video data through the spatial attention network and the temporal attention network, and uses TAG The method generates an initial behavior proposal area, optimizes the behavior boundaries and features through boundary regression and feature redesign modules, and finally performs behavior classification through a multi-layer perceptron.
It improves the accuracy and real-time performance of classroom behavior recognition, reduces the false detection rate, provides more reliable technical support for teaching and classroom management, can more accurately identify and classify classroom behavior, and improves the efficiency of monitoring and analysis in the education field. .
Smart Images

Figure CN118135496B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer vision, and in particular to a classroom behavior recognition method based on a dual-stream convolutional neural network. Background Art
[0002] In modern education, automated monitoring and analysis of students' behaviors in class is essential for teaching evaluation and personalized learning. Traditional behavior recognition methods are mainly based on manually designed feature extraction and classifiers, but these methods require a lot of manual participation and expertise, and have limited effectiveness for complex behavior recognition tasks.
[0003] In recent years, the rapid development of deep learning technology has brought new breakthroughs in behavior recognition. The two-stream convolutional neural network is a deep learning model that combines spatial and temporal streams. It can effectively capture the spatiotemporal features in video data and is therefore widely used in behavior recognition tasks.
[0004] However, the existing classroom behavior recognition methods based on two-stream convolutional neural networks still have some problems. For example, the accuracy is not high and the calculation speed is slow. Therefore, it is necessary to propose an improved method to improve the performance of classroom behavior recognition.
[0005] The Chinese patent invention with publication number CN111738177A discloses a method for identifying student classroom behavior based on posture information extraction, which uses known student classroom behavior images and the category labels corresponding to the classroom behavior images to establish a local feature recognition convolutional neural network to identify unknown student classroom behavior images. The student classroom behavior images are identified using posture information and local image information, which effectively reduces the interference of information in the image that is not related to the behavior, such as clothing color, human body size, etc. on the identification. Compared with the traditional image recognition method based on convolutional neural network, it can effectively improve the generalization accuracy of student classroom behavior recognition. Although this method has made some progress in the recognition of student classroom behavior, there are still some shortcomings in recognition accuracy and real-time performance. Summary of the invention
[0006] In view of the above defects or improvement needs of the prior art, the present invention provides a classroom behavior recognition method based on a two-stream convolutional neural network. By designing a two-stream network model, the spatial information, time series information and motion features in image and video data can be effectively extracted, thereby helping to distinguish different classroom behavior categories, and more accurately judge students' behavioral actions in the classroom, thereby improving the accuracy and real-time performance of classroom behavior recognition.
[0007] To achieve the above object, according to one aspect of the present invention, a classroom behavior recognition method based on a two-stream convolutional neural network is provided, and the method comprises the following steps:
[0008] S1: Design a two-stream network model suitable for classroom behavior recognition; the two-stream network model includes a data preprocessing module, a two-stream convolutional neural network feature extraction module, and a feature fusion module, including the following steps:
[0009] S11: Send the collected classroom videos to the data preprocessing module for data preprocessing;
[0010] S12: sending the preprocessed optical flow image and RGB image frame to a two-stream convolutional neural network module to extract features;
[0011] S13: sending the spatial features and temporal features extracted by the two-stream convolutional neural network module to the feature fusion module for feature fusion to obtain fused features;
[0012] S2: Use the designed two-stream network model to extract the fused features to generate behavior proposal information;
[0013] S3: The generated behavior proposal information is boundary optimized and the features are redesigned to generate behavior-level prediction results.
[0014] As an embodiment of the present application, the step S11 specifically includes the following steps:
[0015] S111: cutting the video into segments corresponding to different classroom behaviors, and extracting frames from each video segment into pictures to form an RGB image;
[0016] S112: For each pair of continuous image frames, use an optical flow algorithm to calculate the motion between adjacent frames, and save the calculated optical flow information into a grayscale image to form an optical flow image;
[0017] S113: The preprocessed optical flow image and RGB image are divided into a training set and a test set in a ratio of 7:3, and then sent to a two-stream convolutional neural network feature extraction module for feature extraction.
[0018] As an embodiment of the present application, the two-stream convolutional neural network feature extraction module in step S12 includes a spatial attention network and a temporal attention network, including the following steps:
[0019] S121: Input the video image of size 512x512, i.e., the preprocessed optical flow image and RGB image, into the spatial attention network and the temporal attention network respectively. First, the image passes through a convolutional layer of size 7x7 and stride 2 to convert the original image into a feature map of size 256x256, and then is normalized and nonlinearly transformed through BatchNormalization and ReLU activation function. Then, it is downsampled through the maximum pooling layer to halve the size of the feature map to 128x128;
[0020] S122: Then, after passing through a plurality of residual blocks, the residual blocks include convolution blocks and identity blocks. In each residual block, a 1x1 convolution kernel is first used for dimensionality reduction, and then a 3x3 convolution operation is performed, and then a 1x1 convolution kernel is used for dimensionality increase; a spatial attention mechanism and a temporal attention mechanism are added to the last four stages of the spatial attention network and the temporal attention network respectively;
[0021] S123: Perform global average pooling on 256 channels to obtain a vector of length 256, and perform nonlinear mapping through two fully connected layers. The obtained weight vector is multiplied by the original feature map to obtain a weighted feature map;
[0022] S124: The output weighted feature map passes through a global average pooling layer, and the values of each channel of the feature map are averaged to obtain spatial features and temporal features.
[0023] As an embodiment of the present application, step S2 specifically includes:
[0024] S21: using the TAG method to generate an initial behavior proposal region from the fused features to obtain a candidate behavior proposal region;
[0025] S22: Send the candidate behavior proposal area to the feature clustering module for feature clustering.
[0026] As an embodiment of the present application, step S3 specifically includes:
[0027] S31: Send the generated behavior proposal information to the boundary regression module to optimize the boundary of the behavior proposal;
[0028] S32: Send the optimized behavior proposal boundary to the feature redesign module to obtain proposal information with global context information;
[0029] S33: Send the proposal information with global context information to the classification and recognition module and output the behavior category.
[0030] As an embodiment of the present application, the step S31 specifically includes:
[0031] S311: Using a multilayer perceptron as a regression network, the multilayer perceptron includes multiple fully connected layers, each neuron is connected to all neurons in the previous layer, and nonlinear mapping is performed on the generated behavior proposal information;
[0032] S312: The behavior proposal is represented as input, and the coordinate regression offset is output; the regression offset calculation formula is as follows:
[0033]
[0034]
[0035] in, , are the start and end coordinates of the proposed behavior, respectively. , are the start and end coordinates of the real data corresponding to the behavior proposal, Indicates the offset of the starting coordinates, Indicates the offset of the end coordinates;
[0036] S313: Using unit-level coordinate regression that matches the unit-based feature extraction method of the two-stream convolutional neural network, directly using the offset of the starting coordinate as the regression result;
[0037] S314: assign a label to the behavior proposal, determine whether the behavior proposal contains the behavior, and determine the label by calculating the tIoU overlap value between the behavior proposal and the real data. If the maximum tIoU value exceeds 0.5, the behavior proposal is regarded as a positive sample, otherwise it is regarded as a negative sample.
[0038] S315: Perform iterative calculation using a multi-layer perceptron. In each round of iteration, the output result is used as the input of the next round, and the process is repeated multiple times to obtain the best boundary regression result.
[0039] S316: For each round of iteration, given the boundary data input value of the candidate proposal, a new boundary regression result is obtained through network calculation, and this process is repeated until a predetermined number of iterations is reached;
[0040] S317: The boundary regression result obtained after K iterations is the boundary coordinate value of the behavior proposal.
[0041] As an embodiment of the present application, step S32 specifically includes:
[0042] S321: For each action proposal, determine its start time and end time , calculate its duration ;
[0043] S322: Divide the range of the proposed behavior into starting intervals , conduct interval , End interval , for each interval , , , extract the corresponding feature sequence , , ;
[0044] S323: The feature sequence extracted above is , , Recombining to reconstruct behavioral proposal features .
[0045] As an embodiment of the present application, step S33 specifically includes:
[0046] S331: For multi-classification tasks, define an output layer with n+1 output nodes, where n represents the number of behavior categories in the dataset, and the additional node is used to represent the background category;
[0047] S332: Using a multilayer perceptron network structure as a classifier, the multilayer perceptron network includes an input layer, a plurality of hidden layers and an output layer, each hidden layer includes a plurality of neurons, and learning feature representation and classification decisions through forward propagation and back propagation algorithms;
[0048] S333: The multilayer perceptron network outputs n+1 probability values, which represent the probability that the sample belongs to each behavior category. These probability values are normalized by the softmax function to ensure that their sum is 1. The behavior category corresponding to the maximum value in the output probability value is used as the result of behavior classification.
[0049] As an embodiment of the present application, a multi-task loss function is used in step S333 To jointly train the boundary regression and behavior classification networks, the multi-task loss function The calculation formula is as follows:
[0050]
[0051] in, is the boundary regression loss function, is the behavior classification loss function, and It is used to balance the boundary regression loss function And the behavior classification loss function The weight parameter of
[0052] The boundary regression loss function The calculation formula is as follows:
[0053]
[0054] in, and are the starting and ending coordinates predicted by the model, is the sample size;
[0055] The behavior classification loss function The calculation formula is as follows:
[0056]
[0057] in, It is The true category label of the sample The probability of the categories, The model predicts The sample The probability of the categories, is the number of categories, is the sample size, It is The sample weights of each category, is the regulating factor.
[0058] The beneficial effects of the present invention are:
[0059] (1) The present invention can effectively extract spatial information, time series information and action features from image and video data by designing a dual-stream network model, and use the attention mechanism to strengthen and fuse the features extracted by the spatial and temporal stream networks, so as to more accurately identify and classify behaviors in the classroom. This method improves the accuracy of classroom behavior recognition and provides more reliable technical support for teaching and classroom management.
[0060] (2) The present invention generates the initial behavior proposal region through the TAG method and optimizes the boundary of the proposed behavior through the boundary regression module, which can more accurately locate the boundary of the behavior, reduce the false detection rate, and further improve the accuracy of classroom behavior recognition.
[0061] (3) The present invention improves the overall performance of classroom behavior recognition by mapping temporal behavior proposals to corresponding behavior predictions through the reconstruction and classification recognition module of behavior proposal features. This method can not only accurately classify behaviors, but also provide an efficient and intelligent solution for real-time monitoring and analysis in the field of education. BRIEF DESCRIPTION OF THE DRAWINGS
[0062] Figure 1 A technical solution flow chart of a classroom behavior recognition method based on a dual-stream convolutional neural network provided in an embodiment of the present invention;
[0063] Figure 2 This is a two-stream convolutional neural network feature extraction structure diagram of a classroom behavior recognition method based on a two-stream convolutional neural network provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0064] 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.
[0065] 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.
[0066] 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.
[0067] 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.
[0068] Reference Figure 1and Figure 2 In a first aspect, the present invention provides a classroom behavior recognition method based on a two-stream convolutional neural network, the method comprising the following steps:
[0069] S1: Design a two-stream network model suitable for classroom behavior recognition; the two-stream network model includes a data preprocessing module, a two-stream convolutional neural network feature extraction module, and a feature fusion module, including the following steps:
[0070] S11: Send the collected classroom videos to the data preprocessing module for data preprocessing;
[0071] S12: sending the preprocessed optical flow image and RGB image frame to a two-stream convolutional neural network module to extract features;
[0072] S13: sending the spatial features and temporal features extracted by the two-stream convolutional neural network module to the feature fusion module for feature fusion to obtain fused features;
[0073] S2: Use the designed two-stream network model to extract the fused features and generate behavior proposal information;
[0074] S3: The generated behavior proposal information is boundary optimized and the features are redesigned to generate behavior-level prediction results.
[0075] As an embodiment of the present application, the step S11 specifically includes the following steps:
[0076] S111: cutting the video into segments corresponding to different classroom behaviors, and extracting frames from each video segment into pictures to form an RGB image;
[0077] S112: For each pair of continuous image frames, use an optical flow algorithm to calculate the motion between adjacent frames, and save the calculated optical flow information into a grayscale image to form an optical flow image;
[0078] S113: The preprocessed optical flow image and RGB image are divided into a training set and a test set in a ratio of 7:3, and then sent to a two-stream convolutional neural network feature extraction module for feature extraction.
[0079] As an embodiment of the present application, the two-stream convolutional neural network feature extraction module in step S12 includes a spatial attention network and a temporal attention network, including the following steps:
[0080] S121: Input the 512x512 image, i.e., the RGB image and the optical flow image, into the spatial attention network and the temporal attention network respectively. First, the original image is converted into a feature map of size 256x256 through a convolution layer of size 7x7 and stride 2, and then normalized and nonlinearly transformed through BatchNormalization and ReLU activation function. Then, the feature map is downsampled through the maximum pooling layer to halve to 128x128.
[0081] S122: Then, multiple residual blocks are passed through, wherein the residual blocks include convolution blocks and identity blocks.
[0082] In each residual block, a 1x1 convolution kernel is first used to reduce the dimension, and then a 3x3 convolution operation is performed, and then a 1x1 convolution kernel is used to increase the dimension; in the last four stages of the spatial attention network and the temporal attention network, a spatial attention mechanism and a temporal attention mechanism are respectively added to achieve a better balance between performance and computational complexity; wherein, the number of times the same block of this type is repeated in each stage of the network is different, such a design can increase the depth and complexity of the network, and help improve the network's representation and learning capabilities for input data.
[0083] S123: Perform global average pooling on 256 channels to obtain a vector of length 256, and perform nonlinear mapping through two fully connected layers. The obtained weight vector is multiplied by the original feature map to obtain a weighted feature map, where the global average pooling layer and the fully connected layer perform global integration and nonlinear mapping on the features to generate the final output;
[0084] S124: The output weighted feature map passes through a global average pooling layer, and the values of each channel of the feature map are averaged to obtain spatial features and temporal features.
[0085] Specifically, in this application, the spatial attention network is generally used to capture spatial information in video processing. It can help the network focus on specific areas of the video frame to identify and extract key spatial features, which helps the network better understand the position, shape and structure of objects in the video. Through the spatial attention mechanism, the network can pay more attention to important spatial areas when processing videos, thereby improving the ability to locate and recognize objects.
[0086] The temporal attention network is mainly used to capture the temporal information in video sequences. It can identify the associations and timing patterns between different frames in a video sequence, so as to better understand the dynamic changes of the video. Through the temporal attention mechanism, the network can dynamically adjust the degree of attention to different frames in the video sequence, and better capture the motion, behavior and timing characteristics of the video.
[0087] This application introduces a two-stream convolutional neural network and uses the attention mechanism to strengthen the features extracted by the spatial and temporal stream networks and fuse them, which can more accurately identify and classify behaviors in the classroom. This method improves the accuracy of classroom behavior recognition and provides more reliable technical support for teaching and classroom management.
[0088] As an embodiment of the present application, step S2 specifically includes:
[0089] S21: using the TAG method to generate an initial behavior proposal region from the fused features to obtain a candidate behavior proposal region;
[0090] S22: Send the candidate behavior proposal regions to the feature clustering module for feature clustering, and aggregate similar behavior proposal regions together to form more stable and accurate behavior proposals.
[0091] Specifically, the clustering method may adopt K-means clustering, density clustering or other clustering algorithms. By adding the clustering module, the behavior proposal generation module can better process the extracted candidate behavior proposals, thereby improving the stability and accuracy of the classroom behavior recognition model.
[0092] As an embodiment of the present application, step S3 specifically includes:
[0093] S31: Send the behavior proposal information generated by the TAG method to the boundary regression module to optimize the boundary of the behavior proposal;
[0094] S32: Send the optimized behavior proposal boundary to the feature redesign module to obtain proposal information with global context information;
[0095] S33: Send the proposal information with global context information to the classification and recognition module and output the behavior category.
[0096] As an embodiment of the present application, the boundary regression module in step S31 is used to optimize the boundary of the behavior proposal, specifically including:
[0097] S311: Using a multilayer perceptron as a regression network, the multilayer perceptron includes multiple fully connected layers, each neuron is connected to all neurons in the previous layer, so that the generated behavior proposal information can be nonlinearly mapped, which is suitable for complex boundary regression tasks;
[0098] S312: The behavior proposal is represented as input, and the coordinate regression offset is output; the regression offset calculation formula is as follows:
[0099]
[0100]
[0101] in, , are the start and end coordinates of the proposed behavior, respectively. , are the start and end coordinates of the real data corresponding to the behavior proposal, Indicates the offset of the starting coordinates, Indicates the offset of the end coordinates;
[0102] S313: Adopt unit-level coordinate regression that matches the unit-based feature extraction method of the two-stream convolutional neural network. This method has low computational consumption and can handle boundary regression tasks more efficiently. It does not use coordinate parameterization, but directly uses the offset of the starting coordinate as the regression result. The coordinate regression of the behavior proposal is performed in the time domain and does not require parameterization of the boundary.
[0103] S314: assign a label to the behavior proposal, determine whether the behavior proposal contains the behavior, and determine the label by calculating the tIoU (temporal Intersection over Union) overlap value between the behavior proposal and the real data. If the maximum tIoU value exceeds 0.5, the behavior proposal is regarded as a positive sample, otherwise it is regarded as a negative sample.
[0104] S315: Perform iterative calculation using a multi-layer perceptron. In each round of iteration, the output result is used as the input of the next round, and the process is repeated multiple times to obtain a more accurate and optimal boundary regression result.
[0105] S316: For each round of iteration, given the boundary data input value of the candidate proposal, a new boundary regression result is obtained through network calculation, and this process is repeated until a predetermined number of iterations is reached;
[0106] S317: The boundary regression result obtained after K iterations is the boundary coordinate value of the behavior proposal. This process can make the boundary coordinates of the final output more accurate and adaptable to different behavior proposals.
[0107] Specifically, the present application generates the initial behavior proposal area through the TAG method, effectively extracts the area in the video that may contain classroom behavior, reduces the computational complexity of subsequent processing, and optimizes the boundary of the behavior proposal through the boundary regression module, which can more accurately locate the boundary of the behavior, reduce the false detection rate, and further improve the accuracy of classroom behavior recognition.
[0108] As an embodiment of the present application, the feature redesign module in step S32 reconstructs the behavior proposal feature to have context information and robustness, specifically including:
[0109] S321: For each action proposal, determine its start time and end time , calculate its duration ;
[0110] S322: Divide the range of the proposed behavior into starting intervals , conduct interval , End interval , for each interval , , , extract the corresponding feature sequence , , ;
[0111] S323: The feature sequence extracted above is , , Recombining to reconstruct behavioral proposal features .
[0112] As an embodiment of the present application, the classification recognition module in step S33 maps the temporal behavior proposal to the corresponding behavior category, thereby realizing the classification recognition of the behavior, which specifically includes:
[0113] S331: For multi-classification tasks, define an output layer with n+1 output nodes, where n represents the number of behavior categories in the dataset, and the additional node is used to represent the background category;
[0114] S332: Using a multi-layer perceptron network structure as a classifier, the multi-layer perceptron network generally includes an input layer, a plurality of hidden layers and an output layer, each hidden layer includes a plurality of neurons, and learns feature representation and classification decisions through forward propagation and back propagation algorithms;
[0115] S333: The multilayer perceptron network outputs n+1 probability values, which represent the probability that the sample belongs to each behavior category (including the background category). These probability values are normalized by the softmax function to ensure that their sum is 1. The behavior category corresponding to the maximum value in the output probability value is used as the result of behavior classification. Among them, classroom behavior categories can be specifically divided into: sleeping, listening, playing with mobile phones, raising hands to ask questions, leaving seats, reading, and writing.
[0116] Specifically, this application uses the reconstruction and classification recognition module of behavior proposal features to map the temporal behavior proposals to the corresponding behavior predictions, thereby improving the overall performance of classroom behavior recognition. This method can not only accurately classify behaviors, but also provide efficient and intelligent solutions for real-time monitoring and analysis in the field of education.
[0117] As an embodiment of the present application, in order to obtain better experimental results, a multi-task loss function is used in step S333 To jointly train the boundary regression and behavior classification networks, the multi-task loss function The calculation formula is as follows:
[0118]
[0119] in, is the boundary regression loss function, is the behavior classification loss function, and It is used to balance the boundary regression loss function And the behavior classification loss function The weight parameter of
[0120] The boundary regression loss function The calculation formula is as follows:
[0121]
[0122] in, and are the starting and ending coordinates predicted by the model, is the sample size;
[0123] The behavior classification loss function The calculation formula is as follows:
[0124]
[0125] in, It is The true category label of the sample The probability of the categories, The model predicts The sample The probability of the categories, is the number of categories, is the sample size, It is The sample weights of each category are used to solve the problem of category imbalance. It is a regulating factor used to adjust the degree of attention paid to easy-to-classify samples and difficult-to-classify samples.
[0126] In the scenario of classroom behavior recognition, the boundary regression loss function ensures that the model accurately captures the time periods of different behaviors, such as students raising their hands, sleeping, etc., which is crucial for determining the time periods of various behaviors in the classroom. The behavior classification loss function ensures that the model can accurately classify these captured behaviors into corresponding categories, such as asking questions, answering, listening, etc., which is crucial for understanding the nature and meaning of different behaviors in the classroom. By using these two loss functions together, the model can comprehensively consider the goals of behavior positioning and behavior classification, thereby improving the accuracy and precision of classroom behavior recognition and providing more reliable data support for teaching management and evaluation.
[0127] The present invention loads the designed two-stream convolutional neural network model, performs preprocessing and model inference on the classroom video data to be analyzed, and generates feature representations of optical flow images and RGB images respectively. Next, the features extracted by the spatial attention network and the temporal attention network are fused to obtain a comprehensive behavioral feature representation. Subsequently, the TAG method is used to generate the initial behavior proposal area, effectively extracting the area in the video that may contain classroom behavior, reducing the amount of calculation for subsequent processing, and optimizing the boundary of the proposed behavior through the boundary regression module to reduce the false detection rate and obtain accurate behavior areas. Finally, using the reconstruction of the behavior proposal feature and the behavior prediction module, the temporal behavior proposal is mapped to the corresponding behavior prediction, which enhances the model's ability to understand classroom behavior, completes the fine recognition of classroom behavior, and ultimately provides accurate recognition results for classroom behavior.
[0128] 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 classroom behavior recognition method based on a two-stream convolutional neural network, characterized in that: The method comprises the following steps: S1: Design a two-stream network model suitable for classroom behavior recognition; the two-stream network model includes a data preprocessing module, a two-stream convolutional neural network feature extraction module, and a feature fusion module, including the following steps: S11: Send the collected classroom videos to the data preprocessing module for data preprocessing; S12: sending the preprocessed optical flow image and RGB image frame to a two-stream convolutional neural network module to extract features; S13: sending the spatial features and temporal features extracted by the two-stream convolutional neural network module to the feature fusion module for feature fusion to obtain fused features; S2: Use the designed two-stream network model to extract the fused features and generate behavior proposal information; S3: Optimize the boundaries of the generated behavior proposal information, redesign the features, and generate behavior-level prediction results; The two-stream convolutional neural network feature extraction module in step S12 includes a spatial attention network and a temporal attention network. Sending the preprocessed optical flow image and RGB image frame to the two-stream convolutional neural network module for feature extraction includes the following steps: S121: The spatial attention network and the temporal attention network each include five network modules, and the networks from the first network module to the fifth network module are connected in sequence, and the preprocessed RGB image and the optical flow image are respectively input into the first module of the spatial attention network and the temporal attention network. In the first module, the image passes through a convolution layer with a size of 7x7 and a stride of 2, and the input image is converted into a feature map with a size of 256x256, and then normalized and nonlinearly converted by BatchNormalization and ReLU activation function, and then downsampled by the maximum pooling layer, and the feature map size is halved to 128x128 to obtain the output of the first module; S122: Then, the output of the first module is input to the second module, the second module to the fifth module are residual blocks, the residual blocks in the second module to the fifth module in the spatial attention network include sequentially connected convolution blocks, spatial attention mechanism modules and identity blocks, the residual blocks in the second module to the fifth module in the temporal attention network include sequentially connected convolution blocks, temporal attention mechanism modules and identity blocks, and the number of identity blocks contained in the residual blocks in the second module to the fifth module in the spatial attention network and the temporal attention network is 2, 3, 5, and 2, respectively, and the output of the fifth module is input to the global average pooling layer; S123: Then the global average pooling layer performs global average pooling on the 256 channels to obtain a vector of length 256, and performs nonlinear mapping through two fully connected layers. The obtained weight vector is multiplied by the original feature map to obtain a weighted feature map; S124: The output weighted feature map is passed through a global average pooling layer, and the values of each channel of the feature map are averaged to obtain spatial features and temporal features; The step S2 specifically includes: S21: using the TAG method to generate an initial behavior proposal region from the fused features to obtain a candidate behavior proposal region; S22: sending the candidate behavior proposal area to the feature clustering module for feature clustering to generate behavior proposal information; The step S3 specifically includes: S31: Send the generated behavior proposal information to the boundary regression module to optimize the boundary of the behavior proposal; S32: Send the optimized behavior proposal boundary to the feature redesign module to obtain proposal information with global context information; S33: Send the proposal information with global context information to the classification and recognition module, and output the behavior category; The step S31 specifically includes: S311: Using a multilayer perceptron as a regression network, the multilayer perceptron includes multiple fully connected layers, each neuron is connected to all neurons in the previous layer, and nonlinear mapping is performed on the generated behavior proposal information; S312: The behavior proposal information is represented as input, and the coordinate regression offset is output; the regression offset calculation formula is as follows: in, , are the start and end coordinates of the proposed behavior, respectively. , are the start and end coordinates of the real data corresponding to the behavior proposal, Indicates the offset of the starting coordinates, Indicates the offset of the end coordinates; S313: Using unit-level coordinate regression that matches the unit-based feature extraction method of the two-stream convolutional neural network, directly using the offset of the starting coordinate as the regression result; S314: assign a label to the behavior proposal, determine whether the behavior proposal contains the behavior, and determine the label by calculating the tIoU overlap value between the behavior proposal and the real data. If the maximum tIoU value exceeds 0.5, the behavior proposal is regarded as a positive sample, otherwise it is regarded as a negative sample. S315: Perform iterative calculation using a multi-layer perceptron. In each round of iteration, the output result is used as the input of the next round, and the process is repeated multiple times to obtain the best boundary regression result. S316: For each round of iteration, given the boundary data input value of the behavior proposal, a new boundary regression result is obtained through network calculation, and this process is repeated until a predetermined number of iterations is reached; S317: The boundary regression result obtained after K iterations is the boundary coordinate value of the behavior proposal; The step S32 specifically includes: S321: For each action proposal, determine its start time and end time , calculate its duration ; S322: Divide the range of the proposed behavior into starting intervals , conduct interval , End interval , for each interval , , , extract the corresponding feature sequence , , ; S323: The feature sequence extracted above is , , Recombining to reconstruct behavioral proposal features ; The step S33 specifically includes: S331: For multi-classification tasks, define an output layer with n+1 output nodes, where n represents the number of behavior categories in the dataset, and the additional node is used to represent the background category; S332: Using a multilayer perceptron network structure as a classifier, the multilayer perceptron network includes an input layer, a plurality of hidden layers and an output layer, each hidden layer includes a plurality of neurons, and learning feature representation and classification decisions through forward propagation and back propagation algorithms; S333: The multilayer perceptron network outputs n+1 probability values, which respectively represent the probability that the sample belongs to each behavior category. These probability values are normalized by the softmax function to ensure that their sum is 1. The behavior category corresponding to the maximum value in the output probability value is taken as the result of behavior classification. In step S333, a multi-task loss function is used. To jointly train the boundary regression and behavior classification networks, the multi-task loss function The calculation formula is as follows: in, is the boundary regression loss function, is the behavior classification loss function, and It is used to balance the boundary regression loss function And the behavior classification loss function The weight parameter of The boundary regression loss function The calculation formula is as follows: in, and are the starting and ending coordinates predicted by the model, is the sample size; The behavior classification loss function The calculation formula is as follows: in, It is The true category label of the sample The probability of the categories, The model predicts The sample The probability of the categories, is the number of categories, is the sample size, It is The sample weights of each category, is the regulating factor.
2. A classroom behavior recognition method based on a two-stream convolutional neural network as claimed in claim 1, characterized in that: The step S11 specifically includes the following steps: S111: cutting the video into segments corresponding to different classroom behaviors, and extracting frames from each video segment into pictures to form an RGB image; S112: For each pair of continuous image frames, use an optical flow algorithm to calculate the motion between adjacent frames, and save the calculated optical flow information into a grayscale image to form an optical flow image; S113: The preprocessed optical flow image and RGB image are divided into a training set and a test set in a ratio of 7:3, and then sent to a two-stream convolutional neural network feature extraction module for feature extraction.
Citation Information
Patent Citations
Student classroom behavior identification method based on attitude information extraction
CN111738177A
