A fine-grained classroom behavior recognition method based on discrete semantic knowledge prior and reliability routing guidance
By constructing a behavioral prototype knowledge base and discrete semantic knowledge priors, combined with a reliable routing guidance method, the problem of visual features being easily destroyed in classroom scenarios is solved, achieving efficient fine-grained behavior recognition and improving recognition accuracy.
Patent Information
- Application Number
- CN202611423710.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-09-14
- Publication Date
- 2026-11-27
AI Technical Summary
In classroom settings, existing technologies suffer from weak visual evidence due to privacy restrictions, low-resolution acquisition, and frequent occlusion. Furthermore, the distribution of behavioral categories is long-tailed, and directly introducing external semantic knowledge can easily disrupt the visual feature space and introduce noise, thus affecting the performance of behavior recognition.
A behavioral prototype knowledge base is constructed, discrete semantic prior vectors are extracted through a multimodal large language model, semantic knowledge is injected into the orthogonal residual space of visual features using a reliable routing guidance method, and a lightweight semantic expert model is combined for posterior correction to optimize the recognition results.
It significantly improves the accuracy of classroom behavior recognition under weak visual evidence, protects the discriminative structure of the visual classifier, and reduces noise interference.
Smart Images

Figure CN123182297A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of computer vision and multimodal machine learning, and in particular to a fine-grained classroom behavior recognition method based on discrete semantic knowledge priors and reliable routing guidance. Background Technology
[0002] Fine-grained behavior recognition in classroom scenarios is a crucial capability in educational multimedia applications. However, factors such as privacy restrictions, low-resolution acquisition, and frequent occlusion weaken visual evidence, and the highly long-tailed distribution of behavior categories further complicate the task. Textual semantic cues provided by open-world base models (such as visual-language models or large language models) can serve as useful semantic priors. However, these global semantics in the open world are often noisy and frequently mismatched with individual samples, making direct multimodal fusion at the feature level unreliable. Existing multimodal fusion methods often force semantic features directly into the visual decision space in the early or mid-stages. When sample-level semantic mismatches exist, this approach easily transforms useful priors into structured noise, disrupting the original visual discrimination space. Summary of the Invention
[0003] The purpose of this invention is to address the shortcomings of the prior art by providing a fine-grained classroom behavior recognition method based on discrete semantic knowledge priors and reliable routing guidance, in order to solve the problem that directly introducing external semantics under weak visual evidence leads to the destruction of the visual feature space and the introduction of noise.
[0004] The technical solution of the present invention is as follows:
[0005] A fine-grained classroom behavior recognition method based on discrete semantic knowledge priors and reliable routing guidance includes the following steps:
[0006] Step 1: Construct a behavioral prototype knowledge base: Collect behavioral images from real classroom scenarios and preprocess them. Construct a representative sample subset for each behavioral category to define the standard attribute features of the behavior in a specific domain, thereby establishing a reference benchmark for subsequent semantic prior knowledge extraction.
[0007] Step 2: Execute explicit and structured modeling of domain knowledge: Use a multimodal large language model to extract fine-grained attribute descriptions of classroom behavior and convert them into discrete semantic prior vectors. By constructing the matching relationship between class anchors and sample attributes, extract the attribute mismatch level as an indicator to measure the reliability of knowledge matching guided by domain knowledge.
[0008] Step 3: Perform reliability-guided knowledge-driven posterior correction: During the inference phase, a lightweight semantic expert model is used to process structured discrete attributes, and the fusion ratio of visual posterior and semantic posterior is dynamically routed based on the knowledge matching reliability index obtained in Step 2, so as to output the final recognition result and achieve decision optimization under weak visual evidence.
[0009] Furthermore, step 1 includes:
[0010] On the training set, visual feature vectors for each training sample are extracted based on a visual feature extractor, where the training samples are collected behavioral images;
[0011] For each behavior category, the prototype feature vector of each behavior category is obtained based on the average of the visual feature vectors of all its corresponding training samples;
[0012] For each behavior category, the cosine similarity between the visual feature vector of each training sample and its prototype feature vector is calculated, and the top N training samples with the highest cosine similarity are selected to form a representative sample subset for each behavior category; where N is a preset value.
[0013] Specifically, the value of N ranges from 1 to 3.
[0014] Furthermore, the extraction of visual feature vectors for each training sample based on the visual feature extractor includes:
[0015] A fully connected classification layer is connected after the visual feature extractor, and the fully connected classification layer is fine-tuned with linear layers to match the behavior recognition task in the teaching scenario; wherein, the fully connected classification layer includes at least two fully connected layers, and the last fully connected layer is used to output the predicted probability of each behavior category;
[0016] The visual feature vector of the training samples is obtained from the output features of the penultimate fully connected layer in the fully connected classification layer after fine-tuning the linear layer.
[0017] Specifically, the visual feature extractor uses the ViT-B / 16 backbone network.
[0018] Furthermore, step 2 includes:
[0019] For each behavior category, a representative subset of samples is used to prompt the multimodal large language model to obtain discrete semantic prior vectors (i.e., discrete attribute vocabularies). The attribute dimension is set as follows: , Number of behavior categories;
[0020] Training samples for each behavior category ,based on Map it to a discrete attribute vector Among them, attribute dimensions For all training samples of the same behavior category, based on discrete attribute vectors Anchor points are obtained through majority voting. ;
[0021] Calculate the attribute mismatch count between the training samples and the reference class. And convert it into a reliability level. Where M is the maximum level set. This is an indicator function.
[0022] Specifically, the value of M ranges from 1 to 5.
[0023] Furthermore, when fine-tuning the linear layers of the fully connected classification layer, a knowledge-guided geometrically decoupled visual representation model is adopted. This involves projecting visual features into the principal discriminant space and an orthogonal semantic residual space during the training of the visual feature extractor using geometric decoupling techniques. Attribute-based cue features are then used for alignment supervision within the residual space, injecting domain behavioral knowledge without compromising visual classification performance. This step specifically includes:
[0024] Define the visual feature vector of each training sample as follows: ;
[0025] Discrete attribute vectors based on training samples Obtain text-like features ;
[0026] Obtain classification scores based on a contrastive classifier: ,in, It is a scaling factor, and The superscript T indicates the transpose operation; and the main classification probability distribution is obtained through the Softmax function: ;in, For all categories Category score The resulting score vector;
[0027] Based on total training loss Perform linear layer fine-tuning, where, For label smoothing cross-entropy loss, For attribute alignment loss, The weights for attribute alignment loss.
[0028] Furthermore, label smoothing cross-entropy loss Specifically:
[0029]
[0030] Where B is the batch size. For training samples The smoothed target (soft label) vector. T represents the transpose operation. The label smoothing coefficient. The smoothed target label (true label). For the number of behavior categories, It is a vector consisting entirely of 1s.
[0031] Furthermore, attribute alignment loss Specifically:
[0032]
[0033] in, For orthogonal residual characteristics, For training samples The Normalized discrete semantic prior attributes of each attribute (i.e., normalized attribute hint features). For training samples The Mask of each attribute, constant Used to avoid a denominator of 0; orthogonal residual characteristics ,in, For normalized visual feature vectors, For training samples Authentic Labels The corresponding normalized text features, constant Used to avoid a denominator of 0 This is the inner product symbol.
[0034] Furthermore, step 3 specifically includes:
[0035] Offline training of lightweight semantic expert models Used to convert discrete attribute vectors Mapping to semantic posterior ;
[0036] Predict class-conditional routing tables for each behavior category using cross-validation. ,in, Indicates behavior category In the Routing weights at each sample level;
[0037] Visual prediction results Query the current sample level Get route weight Based on routing weight The confidence level after fusion correction is calculated by performing correction in the logarithmic probability space. To output the final recognition result ;in, ,in, The normalized main classification probability distribution has a numerically stable term. Used to prevent taking 0.
[0038] The technical solution provided by this invention brings at least the following beneficial effects:
[0039] To address the drawback of direct multimodal fusion easily damaging visual classifiers, this invention proposes a reliable routing guidance method. By restricting text attribute alignment to the orthogonal residual subspace of visual features, semantic knowledge can be injected while preserving the discriminative geometry of the main category. This significantly improves the recognition performance of instructional behaviors. Attached Figure Description
[0040] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0041] Figure 1 This is a semantic structure diagram illustrating the method of the present invention.
[0042] Figure 2 This is a flowchart illustrating the overall process of discrete semantic knowledge prior extraction and route correction in the method of this invention.
[0043] Figure 3 This demonstrates the performance of this invention compared to other methods on a classroom dataset. Detailed Implementation
[0044] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be described in detail and completely below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of them. Generally, the components of the embodiments of the present invention described and shown in the accompanying drawings can be arranged and designed using different configurations. Therefore, the following detailed description of the embodiments of the present invention provided in the accompanying drawings is not intended to limit the scope of the claimed application, but merely represents selected embodiments of the present invention.
[0045] In fine-grained classroom behavior recognition scenarios, visual evidence is very weak due to factors such as privacy constraints, low-resolution acquisition, and frequent occlusion. At the same time, the behavior category distribution exhibits a highly long tail. Although the textual semantic prior knowledge obtained from open-world multimodal large models has potential supplementary value, it often suffers from problems such as noise, incompleteness, or incorrect matching at the sample level. This causes direct multimodal feature fusion to turn unreliable semantic signals into "structural noise," distorting the decision space of the visual classifier and ultimately impairing recognition performance.
[0046] To address the aforementioned technical problems, this invention proposes a fine-grained classroom behavior recognition method based on discrete semantic knowledge priors and reliable routing guidance, comprising the following steps:
[0047] Step 1: Build a behavior prototype knowledge base. On the training set, use ViT-B / 16 as a feature extractor to extract features and adapt it to the classroom behavior recognition task.
[0048] Specifically, the behavior categories in this embodiment include 32 categories: "Listening", "Reading", "Using phone", "Using pad", "Using computers", "Scratching head", "Writing", "Talking", "Standing", "Sleeping", "Teaching", "Yawning", "Walking", "Relaxing", "Analyzing", "Taking bottle", "Gathering up bag", "Drinking", "Taking photos", "Listening to music", "Discussing", "Setting equipment", "Taking bag", "Blackboard writing", "Blackboard wiping", "Taking off", "Student demonstration", "Eating", "Reviewing", "Hands up", "Speaking", and "Picking up computers". Using the ViT-B / 16 model, the average of the feature vectors of all training samples for each category is calculated to obtain the prototype feature vector representing that category. Then, the cosine similarity between the feature vector of each training sample in that category and its category prototype feature vector is calculated. Finally, based on the similarity scores, the top N samples with the highest cosine similarity scores for each category are selected, where N is set to 3 (N ranges from 1 to 3), thus forming a representative subset of samples for that category.
[0049] Step 2: Perform explicit and structured modeling of domain knowledge for each category. A set is formed by extracting a small number of representative training samples through step 1. , forming a global representative set ,like Figure 1 As shown in the diagram. Here, C represents the category set. The representative set-driven multimodal large language model Qwen2.5-VL is used as input, taking the representative samples obtained in the previous step. The prompt words are set to "describe the common attributes of these input images," and discrete semantic prior vectors are obtained. Among them, attribute dimension settings , Number of categories. Samples Mapped to discrete attribute vectors Class anchors are obtained by majority voting on training samples of each category. Calculate the number of attribute mismatches between the sample and the reference class. Transform it into a reliability level The maximum level in this embodiment The default value is 5 (the range is 1-5), where, This is an indicator function.
[0050] Step 3: Construct knowledge-guided, geometrically decoupled visual learning, such as... Figure 2 As shown. This stage uses CLIP-ViT-B / 16 trained on ImageNet1K as the visual backbone network. Samples are extracted using the visual encoder of CLIP-ViT-B / 16. visual features and corresponding text features This embodiment employs a CLIP-style contrastive classifier for primary classification. Specifically, it calculates the cosine similarity between normalized visual features and text-like features, and introduces a learnable scaling factor τ>0 to obtain a classification score. The contrastive classifier is defined as follows: The main classification probability distribution is obtained through the Softmax function. Using label-smoothed cross-entropy loss. Perform primary classification optimization; specifically, for the samples... Its smoothed target label is defined as The smoothed target is ,in The value range is from 0 to 1. The classification loss is determined by constructing orthogonal residual features to prevent auxiliary semantics from disrupting the main discriminant direction. Extracting attribute hint features using a text encoder And calculate the attribute alignment loss in the residual space. ,in Overall training objective .in In the experiment, it was set to 1 (the value range is 0 to 1).
[0051] Step 4: Reliability-guided knowledge-driven posterior correction. Train a lightweight semantic expert model offline. This method employs a lightweight MLP implementation to transform structured discrete attributes. Mapping to semantic posterior , Represent the probability distribution of K categories; and use cross-validation to predict the class-conditional routing table. Regarding the visual prediction results Query the current sample level Get route weight The route weights are corrected in the logarithmic probability space to calculate the fused, corrected confidence level. Output the final recognition result .
[0052] In this embodiment, during the model training phase, the default training duration is 15 epochs with a batch size of 64. The learning rate for visual parameters is set to 0.00001, and the learning rate for the cue learner is set to 0.0005. The dimension D of structural semantics is set to 5 by default, the maximum reliability level M is set to 5, and the weights of the auxiliary semantic alignment loss are... Set to 1. For the input resolution, the classroom scenario dataset uses 224x224.
[0053] Experimental testing showed that this method achieved the most significant performance improvement on the ARIC-CAP500 classroom dataset. Its experimental results achieved an accuracy of 68.25%, significantly outperforming some fine-grained classification methods, classroom behavior recognition methods, and CLIP-related methods introduced in recent years. Figure 3 The model achieves state-of-the-art performance relative to other models on the ARIC-CAP500 dataset. On the relatively simple classroom datasets SCB-Released-CAP500 and STBD-08-CAP500, the final accuracies are 64.49% and 88.40%, respectively. The results indicate that this method is most effective on the most challenging classroom datasets, and its gains primarily stem from selective, conservative posterior correction rather than unconditional semantic information injection.
[0054] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit it. Although the foregoing embodiments have described the present invention in detail, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the embodiments of the present invention.
[0055] The above descriptions are merely some embodiments of the present invention. Those skilled in the art can make various modifications and improvements without departing from the inventive concept of the present invention, and these all fall within the scope of protection of the present invention.
Claims
1. A fine-grained classroom behavior recognition method based on discrete semantic knowledge priors and reliable routing guidance, characterized in that, Includes the following steps: Step 1: Construct a behavioral prototype knowledge base: Collect behavioral images from real classroom scenarios and preprocess them to construct a representative sample subset for each behavioral category; Step 2: Execute explicit and structured modeling of domain knowledge: Use a multimodal large language model to extract fine-grained attribute descriptions of classroom behavior and convert them into discrete semantic prior vectors. By constructing the matching relationship between class anchors and sample attributes, extract the attribute mismatch level as an indicator to measure the reliability of knowledge matching guided by domain knowledge. Step 3: Perform reliability-guided knowledge-driven posterior correction: During the inference phase, a lightweight semantic expert model is used to process structured discrete attributes, and the fusion ratio of visual posterior and semantic posterior is dynamically routed based on the knowledge matching reliability index obtained in Step 2, and the final recognition result is output.
2. The fine-grained classroom behavior recognition method based on discrete semantic knowledge priors and reliable routing guidance as described in claim 1, characterized in that, Step 1 includes: On the training set, visual feature vectors for each training sample are extracted using a visual feature extractor, where the training samples are collected behavioral images. For each behavior category, the prototype feature vector of each behavior category is obtained based on the average of the visual feature vectors of all its corresponding training samples; For each behavior category, the cosine similarity between the visual feature vector of each training sample and its prototype feature vector is calculated, and the top N training samples with the highest cosine similarity are selected to form a representative sample subset for each behavior category; where N is a preset value.
3. The fine-grained classroom behavior recognition method based on discrete semantic knowledge priors and reliable routing guidance as described in claim 2, characterized in that, The value of N ranges from 1 to 3.
4. The fine-grained classroom behavior recognition method based on discrete semantic knowledge priors and reliable routing guidance as described in claim 2, characterized in that, The visual feature vector extracted for each training sample using a visual feature extractor includes: A fully connected classification layer is connected after the visual feature extractor, and the fully connected classification layer is fine-tuned with linear layers to match the behavior recognition task in the teaching scenario; wherein, the fully connected classification layer includes at least two fully connected layers, and the last fully connected layer is used to output the predicted probability of each behavior category; The visual feature vector of the training samples is obtained from the output features of the penultimate fully connected layer in the fully connected classification layer after fine-tuning the linear layer.
5. The fine-grained classroom behavior recognition method based on discrete semantic knowledge priors and reliable routing guidance as described in claim 1, characterized in that, The visual feature extractor uses the ViT-B / 16 backbone network.
6. The fine-grained classroom behavior recognition method based on discrete semantic knowledge priors and reliable routing guidance as described in claim 1, characterized in that, Step 2 includes: For each behavior category, a representative subset of samples is used to prompt the multimodal large language model to obtain discrete semantic prior vectors. The attribute dimension is set as follows: , Number of behavior categories; Training samples for each behavior category ,based on Map it to a discrete attribute vector Among them, attribute dimensions For all training samples of the same behavior category, based on discrete attribute vectors Anchor points are obtained through majority voting. ; Calculate the attribute mismatch count between the training samples and the reference class. and convert it into a reliability level. Where M is the maximum level set. This is an indicator function.
7. The fine-grained classroom behavior recognition method based on discrete semantic knowledge priors and reliable routing guidance as described in claim 4, characterized in that, When fine-tuning the fully connected classification layer using linear layers, a knowledge-guided geometrically decoupled visual representation model is employed, including: Define the visual feature vector of each training sample as follows: ; Discrete attribute vectors based on training samples Obtain text-like features ; Obtain classification scores based on a contrastive classifier: ,in, It is a scaling factor, and The superscript T indicates the transpose operation; and the main classification probability distribution is obtained through the Softmax function: ;in, For all categories Category score The resulting score vector; Based on total training loss Perform linear layer fine-tuning, where, For label smoothing cross-entropy loss, For attribute alignment loss, The weights for attribute alignment loss.
8. The fine-grained classroom behavior recognition method based on discrete semantic knowledge priors and reliable routing guidance as described in claim 7, characterized in that, Label smooth cross-entropy loss Specifically: Where B is the batch size. For training samples Smoothed target vector, T represents the transpose operation. The label smoothing coefficient. For the smoothed true label, For the number of behavior categories, It is a vector consisting entirely of 1s.
9. The fine-grained classroom behavior recognition method based on discrete semantic knowledge priors and reliable routing guidance as described in claim 7, characterized in that, Attribute alignment loss Specifically: in, For orthogonal residual characteristics, For training samples The Normalized discrete semantic prior attributes of each attribute For training samples The Mask of each attribute, constant Used to avoid a denominator of 0; orthogonal residual characteristics ,in, For normalized visual feature vectors, For training samples Authentic Labels The corresponding normalized text features, constant Used to avoid a denominator of 0 This is the inner product symbol.
10. The fine-grained classroom behavior recognition method based on discrete semantic knowledge priors and reliable routing guidance as described in claim 1, characterized in that, Step 3 specifically includes: Offline training of lightweight semantic expert models Used to convert discrete attribute vectors Mapping to semantic posterior ; Predict class-conditional routing tables for each behavior category using cross-validation. ,in, Indicates behavior category In the Routing weights at each sample level; Visual prediction results Query the current sample level Get route weight Based on routing weight The confidence level after fusion correction is calculated by performing correction in the logarithmic probability space. To output the final recognition result ;in, ,in, This is the normalized main classification probability distribution. For the preset numerical stability term .
