Cross-domain small sample learning expression recognition method and system based on joint distribution metric

By employing two-stage transfer learning and deep joint distribution covariance matrix, the problems of data distribution differences and noise interference in cross-domain academic expression recognition are solved, achieving high-precision academic expression recognition.

CN123182277APending Publication Date: 2026-11-27XI AN JIAOTONG UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611295133.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-08-25
Publication Date
2026-11-27

AI Technical Summary

Technical Problem

Existing facial expression recognition models suffer from problems in academic scenarios, such as large differences in data distribution, noise introduced by changes in lighting and head posture, and difficulty in using traditional measurement methods to characterize high-order nonlinear dependencies, leading to class confusion.

Method used

A cross-domain few-sample academic expression recognition method based on joint distribution metric is adopted. Through two-stage transfer learning, lightweight dual-domain fusion attention module and deep joint distribution covariance matrix, the feature space and channel dimensions are synergistically enhanced and high-order nonlinear dependency is measured.

Benefits of technology

Under cross-domain small sample conditions, it significantly improves the recognition accuracy and robustness of academic facial expressions, effectively suppresses noise interference, and accurately captures subtle facial expression differences.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123182277A_ABST
    Figure CN123182277A_ABST
Patent Text Reader

Abstract

The application discloses a cross-domain small sample learning expression recognition method and system based on joint distribution measurement, and belongs to the field of computer vision and intelligent education. The method obtains source domain basic expression images and a small amount of labeled learning expression images of a target domain, obtains expression features with cross-domain generalization ability through two-stage transfer learning, cooperatively enhances key expression regions and suppresses noise in the spatial and channel dimensions by using a light dual-domain fusion attention module, models high-order nonlinear dependency between support set and query set features by using a deep joint distribution covariance module, and outputs learning expression categories according to joint distribution measurement results. The application improves the generalization ability and classification precision of classroom learning expression recognition under the condition of a small amount of labeled samples.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of computer vision and facial expression recognition, and relates to a cross-domain few-sample academic facial expression recognition method and system based on joint distribution metric. Background Technology

[0002] Facial expressions are categorized into seven basic types: anger, surprise, disgust, fear, happiness, sadness, and neutrality. Facial expressions convey a wide range of signals and emotions. Analyzing students' academic expressions in classroom settings using artificial intelligence technology can help improve teaching quality. Academic expressions refer to expressions related to academic achievement, including expressions generated during teaching and learning activities, reflecting students' level of focus and understanding of knowledge. Through academic expression recognition, teachers can be provided with suggestions for improving teaching content or methods, thus increasing the efficiency of teaching quality assessment.

[0003] When existing facial expression recognition models are applied in academic scenarios, they typically employ a method of pre-training on publicly available basic facial expression datasets and then fine-tuning or extracting features directly on target academic facial expression datasets. These methods rely on data distributions that are relatively close between the source and target domains, using simple distance metrics (such as Euclidean distance or cosine distance) to compare the similarity between features of different samples, thereby completing the classification task.

[0004] However, in practical applications, existing technologies still have the following problems: publicly available academic expression datasets are scarce and small in scale; the basic expression categories in the source domain are limited and their distributions differ from those in the target domain, making the model prone to overfitting; changes in lighting, head posture, and local occlusion in the classroom environment can introduce feature noise, resulting in insufficient focus on key areas; existing few-sample methods mostly use marginal distribution measures such as Euclidean distance or cosine distance, which are difficult to characterize the high-order nonlinear dependencies between the support set and the query set, and are prone to class confusion in academic expression recognition scenarios where the differences between classes are small. Summary of the Invention

[0005] The purpose of this invention is to provide a cross-domain small-sample academic expression recognition method and system based on joint distribution metric, so as to solve the problem that existing technologies are difficult to characterize the high-order nonlinear dependency relationship between the support set and the query set, and are prone to class confusion in academic expression recognition scenarios with small inter-class differences.

[0006] To achieve the above objectives, the present invention adopts the following technical solution: In a first aspect, the present invention provides a cross-domain small-sample academic expression recognition method based on joint distribution metric, comprising: Obtain source domain basic facial expression images and target domain academic facial expression images, wherein the target domain academic facial expression images are small sample images; An academic expression recognition model is constructed and trained using a two-stage transfer learning strategy. Through the academic expression recognition model, the features of the source domain basic expression image and the target domain academic expression image are enhanced in both spatial and channel dimensions to obtain the enhanced feature map. The enhanced feature map is transformed into a deep joint distribution covariance matrix, which is used to measure the high-order nonlinear dependency relationship between the features of the support set and the query set. Based on the measurement results of the deep joint distribution covariance matrix, the recognition category of academic expression is output.

[0007] Furthermore, the source domain basic facial expression images are derived from the RAF-DB dataset, which includes seven basic facial expressions: anger, disgust, fear, happiness, sadness, surprise, and neutral. The target domain academic facial expression images are derived from the self-constructed CAED dataset, which includes seven academic facial expressions: relaxation, happiness, frustration, confusion, fatigue, boredom, and focus. The MTCNN network was used to align the source domain basic facial expression images with the target domain academic facial expression images, and data augmentation preprocessing was performed using random image cropping, random horizontal flipping, random vertical flipping, and histogram equalization.

[0008] Furthermore, the lightweight dual-domain fusion attention module in the academic expression recognition model is used to collaboratively enhance the features of the source domain basic expression image and the target domain academic expression image in both spatial and channel dimensions. The lightweight dual-domain fusion attention module consists of a lightweight multi-semantic spatial attention submodule and a lightweight channel calibration attention submodule. The lightweight multi-semantic spatial attention submodule is used to integrate multi-semantic information and generate spatial attention maps in the horizontal and vertical directions, and multiply the spatial attention map with the original feature map to obtain a feature output weighted by multi-semantic spatial information. The lightweight channel calibration attention submodule is used to weight the feature output with multiple semantic spatial information. It generates query vector, key vector and value vector through average pooling and 1×1 depthwise split convolution. After single-head attention calculation, it performs spatial average pooling and channel weighting to obtain the feature output with the same size as the input to the lightweight dual-domain fusion attention module.

[0009] Furthermore, the specific processing procedure of the lightweight multi-semantic space attention submodule is as follows: The input feature map is decomposed along the height and width dimensions, and global average pooling is performed on each to obtain two sets of feature maps. Each set of feature maps is then decomposed into four groups, and the channels are grouped by four sets of depth 1D convolutions of different sizes to generate horizontal spatial attention maps and vertical spatial attention maps, respectively. The horizontal spatial attention maps and vertical spatial attention maps are then multiplied with the original input feature map.

[0010] Furthermore, the feature map enhanced by the lightweight dual-domain fusion attention module is transformed into a deep joint distribution covariance matrix through the deep joint distribution covariance module in the academic expression recognition model. The specific processing procedure of the deep joint distribution covariance module is as follows: The input feature map is reduced in dimensionality by 1×1 convolution; the Brownian distance covariance is calculated on the reduced feature map to transform it into the depth joint distribution covariance matrix; the depth joint distribution covariance matrix is ​​vectorized to obtain the feature vector.

[0011] Furthermore, the calculation of the Brownian distance covariance includes: For the input feature map X, calculate the squared Euclidean distance matrix. ; The formula is:

[0012] in Let I represent the Hadamard product, where I is the identity matrix. Defined as ; For the Euclidean distance square matrix Taking the square root yields the Euclidean distance matrix. : ; The Euclidean distance matrix Subtracting its row mean and column mean, and adding the overall mean, yields the depth joint distribution covariance matrix A: , where 1 is a matrix in which all elements are 1. d represents the number of channels after dimensionality reduction.

[0013] Furthermore, the two-stage transfer learning strategy is specifically as follows: In the first stage, batch pre-training is performed on the basic facial expression images in the source domain, and supervised learning is performed using standard cross-entropy loss. In the second stage, a scenario-based training paradigm is used to perform self-distillation fine-tuning on the basic facial expression images in the source domain. The model trained in the first stage is used as the teacher network, and a student network with the same structure is used for knowledge distillation to jointly optimize the cross-entropy loss and KL divergence loss.

[0014] Secondly, this invention provides a cross-domain small-sample academic expression recognition system based on joint distribution metrics, comprising: The data acquisition module is used to acquire source domain basic facial expression images and target domain academic facial expression images, wherein the target domain academic facial expression images are small sample images; The feature enhancement module is used to construct an academic expression recognition model. The academic expression recognition model is trained using a two-stage transfer learning strategy. Through the academic expression recognition model, the features of the source domain basic expression image and the target domain academic expression image are enhanced in both spatial and channel dimensions to obtain the enhanced feature map. The feature transformation module is used to transform the enhanced feature map into a deep joint distribution covariance matrix, which is used to measure the high-order nonlinear dependency relationship between the features of the support set and the query set. The output module is used to output the recognition category of academic expressions based on the measurement results of the deep joint distribution covariance matrix.

[0015] Thirdly, the present invention provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that the processor executes the computer program to implement the steps of the cross-domain small sample academic expression recognition method based on joint distribution metric.

[0016] Fourthly, the present invention provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps of the cross-domain small sample academic expression recognition method based on joint distribution metric.

[0017] Compared with the prior art, the present invention has the following technical effects: This invention constructs an input foundation for cross-domain few-shot learning by acquiring basic facial expression images from the source domain and a small sample of academic facial expression images from the target domain. It can fully utilize general facial expression knowledge in large-scale source domain data to assist in the learning of the small sample target domain, thus alleviating the problem of scarce target domain samples.

[0018] By employing a two-stage transfer learning strategy to train the academic facial expression recognition model, the first stage learns general facial expression features, and the second stage fine-tunes the model through self-distillation. This effectively improves the model's cross-domain generalization and discrimination capabilities from the source domain to the target domain. A lightweight dual-domain fusion attention module is used to synergistically enhance image features in both spatial and channel dimensions. This allows for the spatial localization and enhancement of key facial expression regions, while simultaneously adaptively calibrating feature responses in the channel dimension. This effectively suppresses noise interference introduced by changes in lighting, head posture, and partial occlusion in the classroom environment.

[0019] By transforming the enhanced feature maps into a deep joint distribution covariance matrix for high-order nonlinear dependency measurement, richer and more accurate joint distribution information between the support set and query set features can be captured than marginal distribution. This fundamentally solves the problem of class confusion easily caused by traditional measures such as Euclidean distance or cosine distance in academic expressions with small inter-class differences, and significantly improves the ability to distinguish subtle expressions such as confusion and focus. Through the synergistic effect of the above technical features, high-precision and high-robust recognition of classroom academic expressions is finally achieved with a small number of labeled samples. Attached Figure Description

[0020] Figure 1 This is a schematic diagram of the training network for a cross-domain few-sample academic expression recognition model based on joint distribution metric, according to an embodiment of the present invention.

[0021] Figure 2 The figure shows the experimental results of the cross-domain small sample academic expression recognition model based on joint distribution metric according to an embodiment of the present invention.

[0022] Figure 3 This is a schematic diagram of a computer device in an embodiment of the present invention.

[0023] Figure 4 This is a flowchart of the present invention. Detailed Implementation

[0024] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.

[0025] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0026] The present invention will now be described in further detail with reference to the accompanying drawings: Example 1, see Figure 1 and Figure 4 In one embodiment of the present invention, a cross-domain small-sample academic expression recognition method based on joint distribution metric is provided. This method is used in classroom scenarios with only a small number of labeled academic expression samples to accurately identify students' academic expressions, thereby assisting in the assessment of teaching quality. This method combines two-stage transfer learning, a lightweight dual-domain fusion attention mechanism, and a deep joint distribution covariance metric, solving the problems of large cross-domain distribution differences, severe feature noise interference, and insufficient metric methods to capture subtle facial expression differences in existing technologies.

[0027] Specifically, the cross-domain small-sample academic expression recognition method based on joint distribution metric includes the following steps: S1: Obtain the source domain basic facial expression image and the target domain academic facial expression image, wherein the target domain academic facial expression image is a small sample image.

[0028] The source domain basic facial expression images refer to images collected from publicly available, large-scale basic facial expression datasets. These images contain basic human emotional expressions that are common to all people and independent of cultural background. The target domain academic expression images specifically refer to static images of students' facial expressions during the learning process, captured by surveillance cameras in the specific application scenario of the classroom. They are defined as "small sample images" because in actual educational scenarios, obtaining large-scale, high-quality, expert-annotated academic expression data is extremely difficult and costly. Therefore, typically only a few to a dozen labeled samples per class are available, which constitutes the premise of the cross-domain small sample learning problem. By jointly acquiring images from the source and target domains, this invention constructs a foundation for knowledge transfer from a data-rich domain to a data-scarce domain, enabling the model to utilize massive amounts of source domain knowledge to solve the core contradiction of insufficient target domain samples.

[0029] S2: Construct an academic expression recognition model and train the academic expression recognition model using a two-stage transfer learning strategy.

[0030] The constructed academic expression recognition model is a deep neural network model. Its structural design fully considers the characteristics of cross-domain small sample tasks, including a backbone network for feature extraction, an attention module for feature enhancement, and a covariance module for similarity measurement. Traditional single-stage training, whether directly applied after training in the source domain or fine-tuned with a small number of target domain samples, is difficult to effectively bridge the huge domain differences and is prone to overfitting.

[0031] This invention employs a two-stage transfer learning strategy, an innovative training paradigm. The first stage aims to allow the model to fully learn general visual features related to facial expressions, establishing a robust feature base. The second stage uses a more sophisticated "learning how to learn" scenario-based training paradigm, and through self-distillation technology, forces the model to adjust its decision boundaries while maintaining generality, making it more sensitive to subtle facial expression changes related to academic studies. This phased, focused training approach is the key guarantee that the model can achieve superior performance under cross-domain, small-sample conditions.

[0032] S3: Using the academic expression recognition model, the features of the source domain basic expression image and the target domain academic expression image are enhanced in both spatial and channel dimensions to obtain the enhanced feature map.

[0033] While the feature maps extracted by the backbone network contain facial information globally, they also contain a large amount of interference information unrelated to facial expressions, such as changes in lighting, head pose, individual occlusions, and individual identity differences. Furthermore, the facial features and patterns responded to by different channels vary, meaning not all channels are equally important for academic facial expression recognition tasks. This step addresses these issues through synergy between spatial and channel dimensions. Spatial enhancement aims to generate a spatial attention map, assigning higher weights to regions in the image that convey key facial expression information, such as eyebrows, corners of the eyes, and corners of the mouth, while suppressing responses from background or occluded areas. Channel enhancement aims to automatically learn the importance of different feature channels, enhancing channels that are more effective in distinguishing expressions and suppressing irrelevant or redundant channels. More importantly, the term "synergy" implies that these two processes are not isolated; rather, the prior information obtained from spatial enhancement is effectively injected into and guides the channel enhancement process, thereby achieving feature refinement.

[0034] S4: The enhanced feature map is transformed into a deep joint distribution covariance matrix, which is used to measure the high-order nonlinear dependency between the features of the support set and the query set.

[0035] After feature enhancement, the model needs to compare the similarity between the query set samples to be identified and the support set samples with a small number of known labels. Existing technologies widely use Euclidean distance or cosine distance, which only calculate the numerical difference between two feature vectors in a single dimension. This is a first-order statistic based on marginal distribution and cannot characterize the interrelationships between different dimensions within two features. When faced with academic expressions with minimal visual differences, such as "relaxed" and "focused," or "frustrated" and "fatigued," first-order distance measures often fail to effectively distinguish them. This step transforms the conventional feature map into a deep joint distribution covariance matrix that can represent high-order nonlinear dependencies, thus changing the nature of the similarity measure. This covariance matrix not only contains the intensity information of each feature but also captures high-order relationships at the joint distribution level by calculating the covariance between feature channels, such as "when the features in the eyebrow region exhibit a certain pattern, the features in the corner of the mouth region often appear in another specific pattern." This measurement method is more sensitive to subtle differences in expression patterns, greatly improving the ability to distinguish easily confused expressions. The vectorized covariance matrix, as a compact and interactively rich embedded feature, is used for subsequent measurement and classification.

[0036] S5: Based on the measurement results of the deep joint distribution covariance matrix, output the recognition category of academic expression.

[0037] After obtaining a deep joint distribution covariance matrix that accurately represents the high-order dependencies between the query set samples and the samples of each support set category, the model processes the embedding information represented by this matrix through subsequent fully connected layers and a classifier. The fully connected layers are used to further learn the mapping between these high-order relationships and the final categories. Finally, the model uses a normalization function such as softmax to transform this high-order metric into a probability distribution of the query sample belonging to various academic expressions, and outputs the category with the highest probability as the final judgment of the student's academic expression state, such as relaxation, happiness, frustration, confusion, fatigue, boredom, or focus. At this point, the model completes the full mapping from raw image pixels to specific emotional semantic categories.

[0038] This invention presents a cross-domain, small-sample academic expression recognition method based on joint distribution metrics. Step S1 acquires cross-domain image data, laying the input foundation for knowledge transfer. Step S2 designs and executes a two-stage transfer learning strategy, systematically addressing the overfitting risk caused by cross-domain distribution differences and scarce samples, providing the model with strong initial parameters and decision boundaries for generalization. Building on this, step S3 employs a sophisticated, lightweight dual-domain fusion attention module that operates collaboratively in both spatial and channel dimensions, effectively suppressing various feature noises introduced by the complex classroom environment, allowing subsequent processing to focus on the core features truly relevant to the expression. This refined and enhanced feature provides high-quality input for solving the metric challenge. Next, step S4 introduces an innovative deep joint distribution covariance matrix, fundamentally reforming the similarity measurement mechanism between features, accurately capturing the high-order nonlinear dependencies between easily confused subtle academic expressions—the core reason for the invention's significant improvement in classification accuracy. Finally, step S5 outputs the final recognition result based on this high-order metric.

[0039] Example 2, see Figure 1 , Figure 1 This paper presents a network for a cross-domain few-sample academic expression recognition model based on joint distribution metrics. First, basic expression images from the source domain and a few samples of academic expression images from the target domain are acquired, and preprocessed for face detection, alignment, and data augmentation. Then, a two-stage transfer learning strategy is employed for model training: the first stage involves batch pre-training to learn general expression features, and the second stage involves self-distillation fine-tuning to improve discriminative ability. Subsequently, a lightweight dual-domain fusion attention network is used to collaboratively enhance the spatial and channel dimensions of the extracted features to suppress noise interference. Next, a deep joint distribution covariance module is used to model the high-order nonlinear dependencies between the support set and query set features, performing similarity measurement at the joint distribution level. Finally, academic expression recognition is completed based on the metric information, resulting in a trained few-sample academic expression recognition model.

[0040] The specific steps are as follows: 1) Transfer learning was performed using a model pre-trained on a face recognition dataset. ResNet18 was used as the backbone network to extract the main facial expression features, and the output feature size was 256. 14 14.

[0041] 2) The Lightweight Dual-Domain Fusion Attention Module LDFA consists of Lightweight Multi-Semantic Spatial Attention (LMSA) and Lightweight Channel Calibration Attention (LCCA). LMSA integrates multi-semantic information and uses a progressive compression strategy to inject discriminative spatial prior information into the channel self-attention of LCCA. Specifically, LMSA first decomposes along the H and W dimensions and performs global average pooling to obtain two sets of features. Then, each of the two feature maps is decomposed into four groups, and the channels are grouped and processed through four groups of different sizes of deep 1D convolutions to generate spatial attention maps in both the horizontal and vertical directions. The feature size is 256 for each. 14 1. Finally, multiplying these two attention maps with the original feature map yields the feature output weighted by multi-semantic spatial information. 14 14; Subsequently, LCCA first performs average pooling on the output of LMSA to obtain the feature output 256. 2 2. Then, a 1×1 depthwise split convolution is used to generate a query vector, a key vector, and a value vector. Single-head attention is then used to calculate 8... 32 4. Then reshape the attention output back to 256. 2 2. Finally, perform average pooling and channel weighting along the space to obtain the output 256. 14 14. The input and output feature map sizes remain unchanged.

[0042] 3) In the two-stage training, the first stage performs batch pre-training on the source domain and uses standard cross-entropy loss for supervised learning, enabling the model to learn general facial expression feature representations; the second stage uses a contextual training paradigm for self-distillation fine-tuning on the source domain, using the model trained in the first stage as the teacher network and the student network with the same structure for knowledge distillation, jointly optimizing the cross-entropy loss and KL divergence loss to improve the model's cross-domain discrimination ability.

[0043] 4) The Deep Joint Distributed Covariance Module (DJDC) receives the feature map obtained from the attention module LDFA as input. First, it performs a 1×1 convolution to reduce the number of channels to half of the original. Then, it calculates the Brownian distance covariance to convert the feature map into a DJDC matrix as the embedded feature of the image. After vectorization, the covariance matrix DJDC is converted into a feature vector. The output dimension is d×d, where d is the number of channels after dimensionality reduction.

[0044] 5) The calculation of Brownian distance covariance generally involves three steps. For the input feature map X, the first step is to calculate the squared Euclidean distance matrix. Then on The square root yields the Euclidean distance matrix. ,at last Subtracting the row mean and column mean and adding the overall mean yields the DJDC matrix A. This calculation method effectively captures the non-linear relationships between features, improving the discriminative power of the features. After processing by the DJDC module, the feature map passes through dropout and fully connected layers, and is finally output through softmax to obtain the facial expression classification. The network is then optimized using the cross-entropy loss function.

[0045] The dataset is constructed as follows: The basic facial expression dataset consists of the RAF-DB dataset, containing 7 basic facial expression classes: anger, disgust, fear, happiness, sadness, surprise, and neutral. This serves as the source domain for cross-domain few-shot training. The academic facial expression dataset consists of a self-constructed dataset of academic facial expressions collected from offline classroom monitoring (CAED), containing 7 academic facial expression labels: relaxed, happy, frustrated, confused, tired, bored, and focused. This serves as the target domain for cross-domain few-shot training.

[0046] Get facial expression images; Face alignment was performed using the MTCNN network, followed by data augmentation operations, primarily employing random image cropping, random horizontal flipping, random vertical flipping, and histogram equalization. The resulting image representation is 224. 224 3, as input to the model.

[0047] The two-stage transfer learning strategy is as follows: In the first stage, batch pre-training is performed on the source domain, and supervised learning is carried out using standard cross-entropy loss, so that the model learns a general facial expression feature representation; In the second stage, self-distillation fine-tuning is carried out on the source domain using a contextual training paradigm, with the model trained in the first stage as the teacher network and the student network with the same structure as the teacher network for knowledge distillation, jointly optimizing the cross-entropy loss and KL divergence loss to improve the model's cross-domain discrimination ability.

[0048] The cross-domain few-sample academic expression recognition model based on joint distribution metric includes a two-stage transfer learning strategy, a lightweight dual-domain fusion attention module, and a deep joint distribution covariance module.

[0049] The specific process of small-sample academic facial expression recognition is as follows: Transfer learning was performed using a model pre-trained on a face recognition dataset, with ResNet18 used as the backbone network to extract key facial expression features. The output feature size was 256. 14 14.

[0050] The Lightweight Dual-Domain Fusion Attention Module (LDFA) consists of Lightweight Multi-Semantic Spatial Attention (LMSA) and Lightweight Channel Calibration Attention (LCCA). LMSA integrates multi-semantic information and uses a progressive compression strategy to inject discriminative spatial prior information into the channel self-attention of LCCA. Specifically, LMSA first decomposes along the H and W dimensions and performs global average pooling on each, obtaining two sets of features. Then, each of the two feature maps is decomposed into four groups, and the channels are grouped and processed through four groups of 1D convolutions of different sizes, generating spatial attention maps in both the horizontal and vertical directions, with a feature size of 256. 14 1. Finally, multiplying these two attention maps with the original feature map yields the feature output weighted by multi-semantic spatial information. 256 14 14; Subsequently, LCCA first performs average pooling on the output of LMSA to obtain the feature output 256. 2 2. Then, a 1×1 depthwise splitting convolution is used to generate a query vector, a key vector, and a value vector. Single-head attention is then used to calculate 8... 32 4. Then reshape the attention output back to 256. 2 2. Finally, perform average pooling and channel weighting along the space to obtain the output 256. 14 14. The input and output feature map sizes remain unchanged.

[0051] The Deep Joint Distributed Covariance Module (DJDC) receives the feature map obtained from the attention module LDFA as input. First, it performs a 1×1 convolution to reduce the number of channels to half of the original. Then, it calculates the Brownian distance covariance to convert the feature map into a DJDC matrix as the embedded feature of the image. After vectorization, the covariance matrix DJDC is converted into a feature vector, and the output dimension is d×d, where d is the number of channels after dimensionality reduction.

[0052] The calculation of Brownian distance covariance generally involves three steps. For the input feature map X, the first step is to calculate the squared Euclidean distance matrix, as shown in the following formula:

[0053] in Represents the Hadama product. It is the identity matrix. Defined as:

[0054] Next to The square root yields the Euclidean distance matrix. :

[0055] at last Subtract the row mean, column mean, and add the overall mean to obtain the DJDC matrix A:

[0056] Here, 1 is a matrix. Each element of the matrix is ​​1; This calculation method can effectively capture the nonlinear relationships between features and improve the discriminative ability of features.

[0057] After processing by the DJDC module, the feature map goes through a dropout layer and a fully connected layer, and is finally output through softmax to obtain the facial expression classification. The network is then optimized using the cross-entropy loss function.

[0058] Example 3: To compare the effectiveness of the cross-domain small-sample academic expression recognition model based on joint distribution metric proposed in this invention, expression recognition experiments were conducted using the proposed model and a series of classic algorithms. The experimental datasets were derived from the seven basic expressions (as the source domain) of the internationally used public dataset RAF-DB for expression recognition research, the composite expressions (denoted as RAF_C as the target domain) of the public dataset RAF-DB, and the facial expression data from the public dataset The Spontaneous Facial Expression Database in Online Learning (OLSFED) as the target domain, containing five academic expressions (confused, distracted, happy, neutral, and tired). Furthermore, considering the specific nature of this research scenario, a private expression dataset for the classroom scenario (Classroom Academic EmotionDataset, abbreviated as CAED) was constructed, collected from offline classroom monitoring, containing seven academic expressions (relaxed, happy, frustrated, confused, tired, bored, and focused). To evaluate the performance of different algorithms, five classes were randomly selected from the target domain dataset. Five labeled samples were extracted from each class to form the support set (referred to as the N-way K-shot task). Simultaneously, 15 samples from each class were selected as the query set. The matching degree between the query samples and the support set was calculated using a trained network. The accuracy of sample classification on the query set was taken as the accuracy of the current task. The average accuracy of 1000 tasks was taken as the final accuracy. The average accuracy in the experimental results is the average obtained after training the model multiple times.

[0059] Experimental results are as follows Figure 2As shown in the figure, the cross-domain few-shot academic expression recognition model based on joint distribution metric proposed in this invention outperforms the compared few-shot expression recognition models on the RAF_C, OLSFED, and CAED datasets. The model achieves a maximum Top-1 classification accuracy of 0.6631 on the RAF_C dataset, 0.6878 on the OLSFED dataset, and 0.7256 on the CAED dataset. Comparative experiments on public and self-built datasets demonstrate that this model can learn general information from basic expressions in the source domain and transfer it to academic expressions in the target domain, achieving good recognition results even with only a small number of labeled samples in the target domain.

[0060] In one embodiment of the present invention, a cross-domain few-sample academic expression recognition system based on joint distribution metric is also provided, which can be used to implement the cross-domain few-sample academic expression recognition method based on joint distribution metric described in the above embodiments. Specifically, the cross-domain few-sample academic expression recognition system based on joint distribution metric includes a data acquisition module, a feature enhancement module, a feature transformation module, and an output module.

[0061] The data acquisition module is used to acquire source domain basic facial expression images and target domain academic facial expression images, wherein the target domain academic facial expression images are small sample images. This module is the input unit of the entire system, responsible for reading images from local storage, network databases, or real-time monitoring streams, and may simultaneously perform preliminary decoding and format conversion operations. Its output is a standardized image data stream.

[0062] The feature enhancement module is used to construct an academic expression recognition model. This model is trained using a two-stage transfer learning strategy. Through this model, features of the source domain basic expression image and the target domain academic expression image are enhanced in both spatial and channel dimensions to obtain an enhanced feature map. This module is the core computing unit of the system, integrating a backbone network (such as ResNet18) and a lightweight dual-domain fusion attention module, LDFA. It is responsible for executing the two-stage training algorithm described in the previous embodiments and loading the pre-trained model parameters during the inference phase, performing deep feature extraction and refined enhancement processing on the input image.

[0063] The feature transformation module converts the enhanced feature maps into a deep joint distributed covariance matrix (DJDC), which is used to measure high-order nonlinear dependencies between features in the support set and query set. This module integrates the DJDC module, which performs operations such as 1×1 convolutional dimensionality reduction, Brownian distance covariance calculation, and vectorization, and is crucial for improving the system's discriminative power on easily confused categories.

[0064] The output module is used to output the recognition category of academic expression based on the measurement results of the deep joint distribution covariance matrix. This module contains a fully connected layer and a softmax classifier, which is responsible for mapping the high-order relation metric vector calculated by the system to the final academic expression category probability and outputting specific recognition results such as "focused" and "confused".

[0065] In another embodiment of the present invention, please refer to Figure 3 A computer device is provided, comprising a processor and a memory. The memory stores a computer program, which includes program instructions. The processor executes the program instructions stored in the computer storage medium. The processor may be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. It is the computing and control core of the terminal, suitable for implementing one or more instructions, specifically suitable for loading and executing one or more instructions from the computer storage medium to achieve a corresponding method flow or function. The processor described in this embodiment can be used for the operation of a cross-domain small-sample academic expression recognition method based on joint distribution metrics.

[0066] In another embodiment of the present invention, a storage medium is provided, specifically a computer-readable storage medium (Memory), which is a memory device in a computer device used to store programs and data. It is understood that the computer-readable storage medium here can include both the built-in storage medium in the computer device and extended storage media supported by the computer device. The computer-readable storage medium provides storage space that stores the terminal's operating system. Furthermore, the storage space also stores one or more instructions suitable for loading and execution by a processor. These instructions can be one or more computer programs (including program code). It should be noted that the computer-readable storage medium here can be high-speed RAM or non-volatile memory, such as at least one disk storage device. The processor can load and execute one or more instructions stored in the computer-readable storage medium to implement the corresponding steps of the cross-domain small-sample academic expression recognition method based on joint distribution metrics in the above embodiments.

[0067] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, systems, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0068] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0069] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0070] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0071] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and not to limit it. Although the present invention has been described in detail with reference to the above embodiments, those skilled in the art should understand that modifications or equivalent substitutions can still be made to the specific implementation of the present invention. Any modifications or equivalent substitutions that do not depart from the spirit and scope of the present invention should be covered within the scope of protection of the claims of the present invention.

Claims

1. A cross-domain small-sample academic expression recognition method based on joint distribution metric, characterized in that, include: Obtain source domain basic facial expression images and target domain academic facial expression images, wherein the target domain academic facial expression images are small sample images; An academic expression recognition model is constructed and trained using a two-stage transfer learning strategy. Through the academic expression recognition model, the features of the source domain basic expression image and the target domain academic expression image are enhanced in both spatial and channel dimensions to obtain the enhanced feature map. The enhanced feature map is transformed into a deep joint distribution covariance matrix, which is used to measure the high-order non-linear dependency relationship between the features of the support set and the query set. Based on the measurement results of the deep joint distribution covariance matrix, the recognition category of academic expression is output.

2. The cross-domain small-sample academic expression recognition method based on joint distribution metric according to claim 1, characterized in that, The source domain basic facial expression images are derived from the RAF-DB dataset, which includes seven basic facial expressions: anger, disgust, fear, happiness, sadness, surprise, and neutral. The target domain academic facial expression images are derived from the self-constructed CAED dataset, which includes seven academic facial expressions: relaxation, happiness, frustration, confusion, fatigue, boredom, and focus. The MTCNN network was used to align the source domain basic facial expression images with the target domain academic facial expression images, and data augmentation preprocessing was performed using random image cropping, random horizontal flipping, random vertical flipping, and histogram equalization.

3. The cross-domain small-sample academic expression recognition method based on joint distribution metric according to claim 1, characterized in that, The lightweight dual-domain fusion attention module in the academic expression recognition model is used to enhance the features of the source domain basic expression image and the target domain academic expression image in a coordinated manner in terms of spatial and channel dimensions. The lightweight dual-domain fusion attention module consists of a lightweight multi-semantic spatial attention submodule and a lightweight channel calibration attention submodule. The lightweight multi-semantic spatial attention submodule is used to integrate multi-semantic information and generate spatial attention maps in the horizontal and vertical directions, and multiply the spatial attention map with the original feature map to obtain a feature output weighted by multi-semantic spatial information. The lightweight channel calibration attention submodule is used to weight the feature output with multiple semantic spatial information. It generates query vector, key vector and value vector through average pooling and 1×1 depthwise split convolution. After single-head attention calculation, it performs spatial average pooling and channel weighting to obtain the feature output with the same size as the input to the lightweight dual-domain fusion attention module.

4. The cross-domain small-sample academic expression recognition method based on joint distribution metric according to claim 3, characterized in that, The specific processing procedure of the lightweight multi-semantic space attention submodule is as follows: The input feature map is decomposed along the height and width dimensions, and global average pooling is performed on each to obtain two sets of feature maps. Each set of feature maps is then decomposed into four groups, and the channels are grouped by four sets of depth 1D convolutions of different sizes to generate horizontal spatial attention maps and vertical spatial attention maps, respectively. The horizontal spatial attention maps and vertical spatial attention maps are then multiplied with the original input feature map.

5. The cross-domain small-sample academic expression recognition method based on joint distribution metric according to claim 1, characterized in that, The deep joint distribution covariance module in the academic expression recognition model transforms the feature map enhanced by the lightweight dual-domain fusion attention module into a deep joint distribution covariance matrix. The specific processing procedure of the deep joint distribution covariance module is as follows: The input feature map is reduced in dimensionality by 1×1 convolution; the Brownian distance covariance is calculated on the reduced feature map to transform it into the depth joint distribution covariance matrix; the depth joint distribution covariance matrix is ​​vectorized to obtain the feature vector.

6. The cross-domain small-sample academic expression recognition method based on joint distribution metric according to claim 5, characterized in that, The calculation of the Brownian distance covariance includes: For the input feature map X, calculate the squared Euclidean distance matrix. ; The formula is: in Let I represent the Hadamard product, where I is the identity matrix. Defined as ; For the Euclidean distance square matrix Taking the square root yields the Euclidean distance matrix. : ; The Euclidean distance matrix Subtracting its row mean and column mean, and adding the overall mean, yields the depth joint distribution covariance matrix A: , where 1 is a matrix in which all elements are 1. d represents the number of channels after dimensionality reduction.

7. The cross-domain small-sample academic expression recognition method based on joint distribution metric according to claim 1, characterized in that, The two-stage transfer learning strategy is as follows: In the first stage, batch pre-training is performed on the basic facial expression images in the source domain, and supervised learning is performed using standard cross-entropy loss. In the second stage, a scenario-based training paradigm is used to perform self-distillation fine-tuning on the basic facial expression images in the source domain. The model trained in the first stage is used as the teacher network, and a student network with the same structure is used for knowledge distillation to jointly optimize the cross-entropy loss and KL divergence loss.

8. A cross-domain small-sample academic expression recognition system based on joint distribution metric, characterized in that, include: The data acquisition module is used to acquire source domain basic facial expression images and target domain academic facial expression images, wherein the target domain academic facial expression images are small sample images; The feature enhancement module is used to construct an academic expression recognition model. The academic expression recognition model is trained using a two-stage transfer learning strategy. Through the academic expression recognition model, the features of the source domain basic expression image and the target domain academic expression image are enhanced in both spatial and channel dimensions to obtain the enhanced feature map. The feature transformation module is used to transform the enhanced feature map into a deep joint distribution covariance matrix, which is used to measure the high-order nonlinear dependency relationship between the features of the support set and the query set. The output module is used to output the recognition category of academic expressions based on the measurement results of the deep joint distribution covariance matrix.

9. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the steps of the cross-domain small sample academic expression recognition method based on joint distribution metric as described in any one of claims 1 to 7.

10. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by the processor, it implements the steps of the cross-domain small sample academic expression recognition method based on joint distribution metric as described in any one of claims 1 to 7.