Blood smear image classification method and system based on knowledge distillation and graph neural network
By developing a blood smear image classification method based on knowledge distillation and graph neural networks, the problems of high computational cost and difficulty in processing time-series data are solved, and efficient and accurate blood smear image classification is achieved in resource-limited environments.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-29
- Publication Date
- 2026-04-07
AI Technical Summary
In existing technologies, graph neural networks and deep learning techniques are computationally expensive when processing blood smear images, making them difficult to deploy in resource-constrained environments. Furthermore, existing knowledge distillation models cannot effectively process time-series data, resulting in poor classification performance of blood smear images.
A blood smear image classification method based on knowledge distillation and graph neural networks is adopted. The training dataset is preprocessed to generate a training feature matrix. The feature distillation loss, classification loss and temporal consistency loss between the teacher model and the student model are used for iterative training to optimize the student model and ensure that it can classify efficiently in a resource-limited environment.
It achieves improved accuracy and stability of blood smear image classification while reducing computational costs, and can be deployed in different environments, adapting to irregular time series data and ensuring consistency in the time dimension.
Smart Images

Figure CN120472213B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of information technology, and in particular to a method, system, terminal, and computer-readable storage medium for classifying blood smear images based on knowledge distillation and graph neural networks. Background Technology
[0002] Acute myeloid leukemia (AML) is a disease that occurs in the blood and bone marrow, characterized by the rapid growth of abnormal cells that interfere with the function of normal blood cells. Currently, with the development of deep learning technology and the application of graph neural networks (GNNs), researchers are able to more accurately identify and classify blood smear images and related laboratory data for AML.
[0003] However, the current use of graph neural networks and deep learning techniques to process blood smear images is difficult to deploy in resource-constrained environments due to the high computational cost. In addition, most existing knowledge distillation models cannot process time-series data, resulting in poor performance in blood smear image classification tasks, which in turn affects the classification of blood smear images.
[0004] Therefore, existing technologies still need to be improved and developed. Summary of the Invention
[0005] The main objective of this invention is to provide a blood smear image classification method, system, terminal, and computer-readable storage medium based on knowledge distillation and graph neural networks. This aims to address the problems in existing technologies where graph neural networks and deep learning techniques are used to process blood smear images, but due to high computational costs, they are difficult to deploy in resource-constrained environments. Furthermore, most existing knowledge distillation models cannot handle time-series data, resulting in poor performance in blood smear image classification tasks, thus affecting the classification of blood smear images.
[0006] To achieve the above objectives, this invention provides a blood smear image classification method based on knowledge distillation and graph neural networks. The blood smear image classification method based on knowledge distillation and graph neural networks includes the following steps:
[0007] Obtain the training dataset, and preprocess the training blood smear images of the training samples in the training dataset to obtain the training feature matrix;
[0008] The training feature matrix is input into a pre-trained teacher model to output teacher features and teacher prediction results; the training feature matrix is input into a student model to output student features and student prediction results.
[0009] Calculate feature distillation loss based on the teacher features and the student features; calculate classification loss based on the student prediction results and the labels in the training samples; calculate temporal consistency loss based on the teacher prediction results and the student prediction results; generate student model loss based on the feature distillation loss, the classification loss, and the temporal consistency loss; and optimize the student model based on the student model loss.
[0010] The student model is iteratively trained. When the training reaches the preset requirements, the trained student model is output. When the blood smear image to be processed and the test period are obtained, the blood smear image to be processed and the test period are preprocessed and then input into the trained student model, and the classification result is output.
[0011] Optionally, the preprocessing of the training blood smear images of the training samples in the training dataset to obtain the training feature matrix specifically includes:
[0012] The testing period is obtained, and the training blood smear image and the testing period are input into the time alignment module for time alignment to obtain an image sequence.
[0013] The image sequence and the training blood smear image are input into the graph structure construction module to generate a training feature matrix, which includes a node feature matrix and an edge feature matrix.
[0014] Optionally, the step of inputting the training feature matrix into a pre-trained teacher model and outputting teacher features and teacher prediction results specifically includes:
[0015] The training feature matrix is input into the graph attention network of the pre-trained teacher model, and the features output by the second layer of the graph attention network are used as teacher features.
[0016] A time dimension is added to the features at each time point of the graph attention network output to obtain the corresponding final feature representation of the teacher. The final feature representation of the teacher is then input into the bidirectional gated recurrent unit of the pre-trained teacher model to generate positive and negative hidden states. Based on the positive and negative hidden states, the output layer, and the feedforward neural network, the teacher prediction result is generated.
[0017] Optionally, the step of inputting the training feature matrix into the student model and outputting student features and student prediction results specifically includes:
[0018] The training feature matrix is input into the graph convolutional network in the student model, and the output of the graph convolutional network is used as the student features.
[0019] A time dimension is added to the features at each time point output by the graph convolutional network to obtain the corresponding final feature representation of the student. The final feature representation of the student is then input into the gated recurrent unit of the student model to generate a hidden state. Based on the hidden state, the output layer, and the feedforward neural network, the student prediction result is generated.
[0020] Optionally, the step of calculating feature distillation loss based on the teacher features and the student features, calculating classification loss based on the student prediction results and the labels in the training samples, and calculating temporal consistency loss based on the teacher prediction results and the student prediction results specifically includes:
[0021] Based on the pre-constructed cross-layer projection matrix, the teacher features are mapped to the feature space of the student model to obtain the projected features;
[0022] The bulldozer distance is calculated based on the projection features and the student features, and the distillation loss of the features is obtained based on the bulldozer distance;
[0023] The cross-entropy loss is calculated based on the student prediction results and the labels in the training samples, and is used as the classification loss.
[0024] Based on the teacher prediction results and the student prediction results, dynamic time warping is used to calculate the distance between the trained teacher model and the student model, and the optimal path is found according to the dynamic time warping algorithm.
[0025] Based on the found optimal path, the cosine similarity loss is calculated and used as the temporal consistency loss.
[0026] Furthermore, to achieve the above objectives, the present invention also provides a blood smear image classification system based on knowledge distillation and graph neural networks, wherein the blood smear image classification system based on knowledge distillation and graph neural networks includes:
[0027] The preprocessing module is used to acquire the training dataset and preprocess the training blood smear images of the training samples in the training dataset to obtain the training feature matrix.
[0028] The model output module is used to input the training feature matrix into a pre-trained teacher model and output teacher features and teacher prediction results, and to input the training feature matrix into a student model and output student features and student prediction results.
[0029] The loss calculation module is used to calculate feature distillation loss based on the teacher features and the student features, calculate classification loss based on the student prediction results and the labels in the training samples, calculate temporal consistency loss based on the teacher prediction results and the student prediction results, generate student model loss based on the feature distillation loss, the classification loss and the temporal consistency loss, and optimize the student model based on the student model loss.
[0030] The application module is used to iteratively train the student model. When the training reaches the preset requirements, it outputs the trained student model. When the blood smear image to be processed and the test period are obtained, the blood smear image to be processed and the test period are preprocessed and then input into the trained student model, and the classification result is output.
[0031] Optionally, the preprocessing module includes:
[0032] An alignment unit is used to obtain the test period. The training blood smear image and the test period are input into the temporal alignment module for temporal alignment to obtain an image sequence.
[0033] The node construction unit is used to input the image sequence and the training blood smear image into the graph structure construction module to generate a training feature matrix, wherein the training feature matrix includes a node feature matrix and an edge feature matrix.
[0034] Optionally, the loss calculation module includes:
[0035] The feature distillation loss calculation unit is used to map the teacher features to the feature space of the student model according to the pre-constructed cross-layer projection matrix to obtain the projected features, calculate the bulldozer distance according to the projected features and the student features, and obtain the feature distillation loss according to the bulldozer distance.
[0036] The classification loss calculation unit is used to calculate the cross-entropy loss based on the student's prediction result and the labels in the training samples, and use it as the classification loss.
[0037] The temporal consistency loss calculation unit is used to calculate the distance between the trained teacher model and student model based on the teacher prediction results and the student prediction results using dynamic time warping, and to find the optimal path according to the dynamic time warping algorithm. Based on the found optimal path, the cosine similarity loss is calculated and used as the temporal consistency loss.
[0038] The student model loss calculation unit is used to generate a student model loss based on the feature distillation loss, the classification loss, and the temporal consistency loss, and to optimize the student model based on the student model loss.
[0039] Furthermore, to achieve the above objectives, the present invention also provides a terminal, wherein the terminal includes: a memory, a processor, and a blood smear image classification program based on knowledge distillation and graph neural networks stored in the memory and executable on the processor. When the blood smear image classification program based on knowledge distillation and graph neural networks is executed by the processor, it implements the steps of the blood smear image classification method based on knowledge distillation and graph neural networks as described above.
[0040] Furthermore, to achieve the above objectives, the present invention also provides a computer-readable storage medium, wherein the computer-readable storage medium stores a blood smear image classification program based on knowledge distillation and graph neural networks, and the blood smear image classification program based on knowledge distillation and graph neural networks, when executed by a processor, implements the steps of the blood smear image classification method based on knowledge distillation and graph neural networks as described above.
[0041] In this invention, a training dataset is acquired, and the training blood smear images of the training samples in the training dataset are preprocessed to obtain a training feature matrix. The training feature matrix is input into a pre-trained teacher model, which outputs teacher features and teacher prediction results. The training feature matrix is also input into a student model, which outputs student features and student prediction results. Feature distillation loss is calculated based on the teacher and student features. Classification loss is calculated based on the student prediction results and the labels in the training samples. Temporal consistency loss is calculated based on the teacher and student prediction results. Student model loss is generated based on the feature distillation loss, classification loss, and temporal consistency loss. The student model is optimized based on the student model loss. The student model is iteratively trained. When the training reaches a preset requirement, the trained student model is output. When a blood smear image to be processed and an examination period are acquired, the blood smear image to be processed and the examination period are preprocessed and input into the trained student model, and the classification result is output. This invention ensures similarity not only in surface features but also in deep spatial structure information by calculating feature distillation loss, thereby more accurately capturing the inherent distribution characteristics of the data and improving the performance of the student model. Simultaneously, it introduces temporal consistency loss, which effectively handles irregular time-series data and guarantees consistency and continuity over time. Furthermore, this invention trains the corresponding model through knowledge distillation, enabling the resulting student model to be deployed in a wider range of environments without incurring high computational costs, and to achieve stable processing in different environments. Attached Figure Description
[0042] Figure 1 This is a flowchart of a preferred embodiment of the blood smear image classification method based on knowledge distillation and graph neural networks of the present invention;
[0043] Figure 2 This is a schematic diagram of the training process in the blood smear image classification method based on knowledge distillation and graph neural networks of the present invention;
[0044] Figure 3 This is a structural diagram of a preferred embodiment of the blood smear image classification system based on knowledge distillation and graph neural networks of the present invention;
[0045] Figure 4 This is a structural diagram of a preferred embodiment of the terminal of the present invention. Detailed Implementation
[0046] To make the objectives, technical solutions, and advantages of this invention clearer and more explicit, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
[0047] Acute myeloid leukemia (AML) is a disease that occurs in the blood and bone marrow, characterized by the rapid growth of abnormal cells that interfere with the function of normal blood cells. Currently, with the development of deep learning technology and the application of graph neural networks (GNNs), researchers can more accurately identify and classify blood smear images and related laboratory data for AML. However, current methods using graph neural networks and deep learning to process blood smear images have limitations in handling temporal data. In the clinical context of AML, the data for each case often exhibits temporal continuity, requiring the model to not only understand static image information but also capture trends changing over time. Current methods often fail to fully consider these dynamic characteristics. For example, traditional logit distillation methods suffer from temporal continuity loss due to single-time-step feature alignment issues in medical time-series data. Furthermore, existing knowledge distillation models suffer from incomplete knowledge transfer and weak adaptability. Throughout the knowledge distillation process, the teacher model's knowledge should include not only the probability distribution of the final output but also the feature representations of the intermediate layers. However, existing knowledge distillation models typically lack a GRU module, which prevents the teacher model from transferring time-series features to the student model. Consequently, the student model's knowledge is not comprehensive enough, making it difficult to fully absorb and apply the knowledge to practical tasks. Finally, due to the limitations of existing graph neural network applications, current GCN / GAT schemes primarily handle static graph data and lack the ability to model dynamic time-series graphs.
[0048] To address one or more of the above-mentioned problems, this invention obtains a training dataset, preprocesses the training blood smear images of the training samples in the training dataset to obtain a training feature matrix; inputs the training feature matrix into a pre-trained teacher model to output teacher features and teacher prediction results; inputs the training feature matrix into a student model to output student features and student prediction results; calculates feature distillation loss based on the teacher features and student features; calculates classification loss based on the student prediction results and the labels in the training samples; calculates temporal consistency loss based on the teacher prediction results and student prediction results; generates student model loss based on the feature distillation loss, classification loss, and temporal consistency loss; optimizes the student model based on the student model loss; iteratively trains the student model, and when the training reaches a preset requirement, outputs the trained student model; when a blood smear image to be processed and an examination period are obtained, the blood smear image to be processed and the examination period are preprocessed and input into the trained student model to output classification results.
[0049] The preferred embodiment of the blood smear image classification method based on knowledge distillation and graph neural networks of the present invention, such as... Figure 1 As shown, the blood smear image classification method based on knowledge distillation and graph neural networks includes the following steps:
[0050] Step S10: Obtain the training dataset, and preprocess the training blood smear images of the training samples in the training dataset to obtain the training feature matrix.
[0051] Specifically, in this invention, the training dataset is a set containing training blood smear images and corresponding labels. In this invention, both the training and actual inference processes require preprocessing of the corresponding blood smear images.
[0052] Further, the preprocessing of the training blood smear images of the training samples in the training dataset to obtain the training feature matrix specifically includes:
[0053] The testing period is obtained, and the training blood smear image and the testing period are input into the time alignment module for time alignment to obtain an image sequence.
[0054] The image sequence and the training blood smear image are input into the graph structure construction module to generate a training feature matrix, which includes a node feature matrix and an edge feature matrix.
[0055] Specifically, in this invention, the preprocessing is performed through two modules: a sequence alignment module and a graph structure construction module.
[0056] The temporal alignment module employs Dynamic Time Warping (DTW) to address the mismatch between the sampling frequency of blood smear images and the laboratory testing cycle. DTW finds the optimal alignment path between two time series by nonlinearly stretching or compressing the time axis, maximizing their similarity. This ensures that even with inconsistent sampling intervals for blood smear images, image features can accurately correspond to the relevant laboratory test results, improving the accuracy of data analysis. The graph structure construction module transforms cells in blood smear images into nodes in a graph and defines edge weights according to specific rules. Each blood cell node vi is characterized by morphological parameters, staining intensity, and spatial coordinates, capturing the cell's key attributes. The edge weight calculation first determines the connections between nodes based on the Delaunay triangulation method, a geometric partitioning method that maximizes the minimum angle of generated triangles, helping to avoid elongated triangles. Furthermore, the edge weights are further adjusted based on cell type similarity to enhance the representation of relationships between cells of the same type, thereby better reflecting the structural characteristics and interactions within the blood cell population and providing a foundation for subsequent analysis.
[0057] Furthermore, in the temporal alignment module, the input data is a blood smear image sequence I = {I1, I2, ..., I...} N}, where I i This is the i-th image, and the testing period is T = {T1, T2, ..., T}. M}, where T j This is the j-th testing period; the subsequent processing steps are: calculate the distance matrix, and calculate I for each image. i The distance d between each inspection cycle ij That is, to construct an N×M distance matrix D, where D ij =d(I i T j Applying the DTW algorithm, the cumulative distance D cum (i, j) = d(I i T j )+min(D cum (i-1, j), D cum (i, j-1), D cum Given (i-1, j-1), find the optimal path P from (1, 1) to (N, M) that minimizes the cumulative distance. The boundary condition is D. cum (0, 0) = 0, and other boundary values are initialized to infinity; finally, backtracking is used to obtain the optimal path, starting from (N, M), and backtracking to (1, 1) based on the minimum cumulative distance to obtain the optimal path. k is the path length; the aligned image sequence is rearranged into A = {A1, A2, ..., A...} according to the optimal path P.N}, so that it is aligned with the test period sequence T.
[0058] After the temporal alignment module completes its processing, the resulting rearranged image sequence A is input into the graph structure construction module. Each image A... i P contains location information of several blood cells i ={P i1 P i2 ..., P iK}, where P ij Is the j-th blood cell in image A i The position coordinates of each blood cell. The processing procedure of the graph structure construction module is as follows: extract the nodes and assign the position P of each blood cell. ij Consider it as a node v in the graph k Therefore, the node set V = {V1, V2, ..., V} n}, where n is the total number of blood cells in all images. Edges between nodes are generated using the Delaunay triangulation algorithm. The result of Delaunay triangulation is a planar graph G = (V, E), where each edge (v...)... i v j For any two adjacent triangles in E, the circumcircle of each triangle must not contain any other vertices, thus maximizing the minimum angle and avoiding elongated triangles. Given a set of nodes V, Delaunay triangulation generates an edge set E = {(V...} i V j )|W ij}. Among them, W ij For edge (v) i v j The weight of W ij =||V i -V j ||2; Finally, the training feature matrix is obtained, which includes the node feature matrix. The edge feature matrix D is obtained, and the node feature matrix H is the feature of all nodes. The edge feature matrix D contains the feature corresponding to each edge.
[0059] Step S20: Input the training feature matrix into the pre-trained teacher model and output the teacher features and teacher prediction results. Input the training feature matrix into the student model and output the student features and student prediction results.
[0060] Specifically, this invention addresses the issues of high cost and low coverage of traditional detection methods in the field of AML diagnosis. It proposes a blood smear image classification method based on knowledge distillation and graph neural networks, which reduces model complexity and parameter count while ensuring model performance. The lightweight model can run in resource-constrained environments, reducing hardware requirements and costs while improving system flexibility and deployability. The specific method for achieving this is the corresponding knowledge distillation approach.
[0061] It should be noted that, as Figure 2 As shown, in this invention, the teacher model consists of GAT (Graph Attention Network) and BiGRU (Bidirectional Gated Recurrent Unit), followed by an intermediate layer, an output layer, and an FNN (Feed-Forward Network); the student model consists of GCN (Graph Convolutional Network) and GRU (Gated Recurrent Unit), followed by an intermediate layer, an output layer, and an FNN; and in this invention, the intermediate layer, output layer, and FNN are shared by both the teacher and student models.
[0062] In this invention, the teacher-student architecture is a two-stream distillation architecture. In the construction of the teacher model, Gaussian Attraction (GAT) is used to extract local features from blood smear images. GAT enhances the interaction between nodes through a self-attention mechanism, helping to capture richer spatial relationships. Then, BiGRU is used to process the extracted feature sequences to capture dynamic changes and higher-order spatial dependencies in the long-term time dimension. The student model uses Gaussian Convolutional Networks (GCN) instead of GAT, considering that GCN is more computationally efficient and better suited to lightweight requirements. The student model also integrates GRU to process temporal information, ensuring consistency with the teacher model. When training the student model, the corresponding distillation algorithm employs a dynamic weight distillation mechanism and designs an adaptive temperature coefficient regulator based on case severity, implementing differentiated knowledge transfer techniques at the feature layer or output layer.
[0063] Furthermore, the step of inputting the training feature matrix into a pre-trained teacher model and outputting teacher features and teacher prediction results also includes:
[0064] Obtain the first training dataset, preprocess the training blood smear images in the first training dataset, and obtain the current training feature matrix;
[0065] The current training feature matrix is input into the teacher model, and the current teacher prediction result is output.
[0066] Calculate the teacher classification loss based on the current teacher prediction result and the labels in the first training dataset, and optimize the teacher model based on the teacher classification loss;
[0067] The teacher model is trained iteratively. When the training reaches the first preset requirement, the corresponding teacher model is output as the pre-trained teacher model.
[0068] In this invention, before training the student model, the teacher model is trained first. After training the teacher model using a first training dataset, the parameters of the teacher model are fixed, and then the student model is trained using the teacher model. The first training dataset used in training the teacher model can be the same dataset, consisting of blood smear images and their corresponding labels. During teacher model training, the teacher model's GAT is initialized using He, and the BiGRU uses orthogonal initialization; AdamW is used as the optimizer with a learning rate of 1e-4 and weight decay of 1e-5; the teacher model focuses only on classification loss (main loss), calculating the loss using the model output and labels to optimize parameters. In the forward propagation process of the teacher model, the input graph structure data is fed to the GAT layer, the second-layer output of the GAT serves as a feature distillation source, and is passed to the BiGRU to process temporal features. Gradient clipping (with a threshold set to 5.0) is used to update parameters layer by layer, followed by backpropagation.
[0069] In one embodiment of the present invention, the teacher model pre-training is performed for 50 epochs with a batch size of 32. Its performance is judged by evaluation metrics, including accuracy, precision, recall, F1 score, ROC curve, and AUC value. The first preset requirement is a user-preset requirement, which can be to achieve the required number of training iterations or the desired training effect.
[0070] For the teacher model, Gaussian Attention Array (GAT) is applied to extract local features from blood smear images. GAT enhances the interaction between nodes through a self-attention mechanism, allowing each node to dynamically adjust its weights based on the importance of its neighbors, thus more effectively capturing complex spatial relationships. Subsequently, BiGRU is used to process the feature sequences extracted by GAT. BiGRU can not only capture dynamic changes in the time dimension but also identify higher-order spatial dependencies. Forward and backward GRUs process the forward and backward directions of the time series data respectively, enabling the model to consider both past and future contextual information, providing richer background support for the current moment.
[0071] Furthermore, the step of inputting the training feature matrix into a pre-trained teacher model and outputting teacher features and teacher prediction results specifically includes:
[0072] The training feature matrix is input into the graph attention network of the pre-trained teacher model, and the features output by the second layer of the graph attention network are used as teacher features.
[0073] A time dimension is added to the features at each time point of the graph attention network output to obtain the corresponding final feature representation of the teacher. The final feature representation of the teacher is then input into the bidirectional gated recurrent unit of the pre-trained teacher model to generate positive and negative hidden states. Based on the positive and negative hidden states, the output layer, and the feedforward neural network, the teacher prediction result is generated.
[0074] Furthermore, during the training of the student model, after obtaining the training feature matrix, the training feature matrix is input into the pre-trained teacher model to output teacher features and teacher prediction results, which specifically includes: GAT extraction of local features and BiGRU processing of feature sequences.
[0075] GAT is a graph neural network (GNN) based method that enhances the interaction between nodes through a self-attention mechanism. Each node dynamically adjusts its weights based on the importance of its neighbors, thus more effectively capturing complex spatial relationships. The input graph structure is G = (V, E), where V is the set of nodes and E is the set of edges. Each node v... i ∈V has an eigenvector For each pair of nodes (v) i v j Attention coefficient e ij =LeakyReLU(a T [Wh i ||Wh j ]), where W is a shared linear transformation matrix used to transform node features; a is a learnable attention vector; || denotes vector concatenation operation. Then for each node v i Normalize the attention coefficients of neighboring nodes Where N(i) represents node v i The set of neighboring nodes. Next, update the node features h' based on the normalized attention coefficients. i =σ(∑ j∈N(i) α ij Wh j ), where σ is the activation function. To improve model stability, a multi-head attention mechanism is used in the model. Each head K These are all results calculated using independent attention mechanisms.
[0076] A Bidirectional Gated Recurrent Unit (BiGRU) is a bidirectional recurrent neural network (RNN) that can simultaneously consider the forward and backward directions of time series data, allowing the model to utilize both past and future contextual information. The feature sequence after the previous GAT processing step is H. (2) ={h′1,h′2,……,h′ N}, where h′ i This is the feature vector of the i-th node. The forward GRU processes the forward portion of the feature sequence. This represents the hidden state of the forward GRU at time t. The backward GRU processes the backward portion of the feature sequence. This represents the hidden state of the reverse GRU at time t. Finally, the positive and negative hidden states are merged. [.;.] represents a vector concatenation operation.
[0077] In this invention, the input to the teacher model is a preprocessed graph structure G = (V, E), i.e., a training feature matrix, where V is a set of nodes, i.e., a node feature matrix, and each node v i Corresponding to a feature vector F represents the feature dimension. E represents the edge set, or edge feature set, which indicates the connection relationships between nodes, expressed by a feature matrix. In this invention, the input GAT is the node feature matrix, where N represents the number of nodes. The feature matrix D of the edges is then processed through a GAT layer, which generates a new feature representation for each node. F1 is the output feature dimension of the first GAT layer, and the resulting feature representation is then input into the second GAT layer; after the second GAT layer, each node generates the final feature representation. F2 is the output feature dimension of the second-layer GAT, H (2) The shape is (N, F2). Each GAT is followed by a BiGRU, but before inputting into the BiGRU, the GAT output needs to be converted into a format suitable for sequence processing. That is, the time dimension T is added to the features at each time point of the graph attention network output. Then the data input to the BiGRU has a shape of (T, N, F2), and the feature sequence can be represented as follows. It can also be represented as H (2) ={h′1,h′2,……,h′ N Then, in BiGRU, the forward GRU processes the sequence data sequentially from the first time step to the last time step, generating forward hidden states; the backward GRU processes the sequence data sequentially from the first time step to the last time step, generating backward hidden states; BiGRU concatenates the forward and backward hidden states together to obtain the final output. 2W is the output dimension of BiGRU.
[0078] Therefore, in this invention, the training feature matrix processing procedure, such as... Figure 2 As shown, the data at the three time points are input into GAT respectively, and the output of the second layer of GAT processing at each time point is used as the corresponding teacher feature. Then, the output of each GAT is added to the time dimension and input into BiGRU. At the same time, the output of the previous time point BiGRU is combined in each BiGRU. Finally, the result is input into the output layer, and then the final teacher prediction result is output through FNN.
[0079] The Middle Layer, located between the input and output layers, learns features such as different cell types, nuclear morphology, and intercellular relationships in blood smears through linear transformations and non-linear activation functions. This helps to filter out valuable features for AML diagnosis, remove unnecessary details, and improve the model's diagnostic accuracy while reducing computational burden. Furthermore, Dropout regularization in the Middle Layer prevents overfitting and improves the model's generalization ability. The Output Layer, located before the FFN, is added to reduce dimensionality through linear transformations, considering that the output features of the teacher and student models may have high dimensionality, while the FFN requires lower-dimensional inputs. The Output Layer also facilitates a smooth transition from the teacher to the student model, mitigating the performance gap between them and making it easier for the student model to mimic the behavior of the teacher model. FNN, or Feedforward Neural Network, serves two main purposes: First, the last layer of the FFN acts as a classifier. Since the final output of this model is the classification result of a blood smear image (a three-class classification), the last layer of the FFN maps the features onto a three-dimensional vector. Second, the FFN can increase the model's non-linearity through multiple fully connected layers and activation functions, thereby better capturing complex patterns in the data.
[0080] Furthermore, the step of inputting the training feature matrix into the student model and outputting student features and student prediction results specifically includes:
[0081] The training feature matrix is input into the graph convolutional network in the student model, and the output of the graph convolutional network is used as the student features.
[0082] A time dimension is added to the features at each time point output by the graph convolutional network to obtain the corresponding final feature representation of the student. The final feature representation of the student is then input into the gated recurrent unit of the student model to generate a hidden state. Based on the hidden state, the output layer, and the feedforward neural network, the student prediction result is generated.
[0083] Furthermore, in this invention, the student model mainly includes GCN and GRU processing procedures, and the GCN in the student model is a simplified version of GCN. The simplified GCN design is a lightweight graph convolutional neural network architecture that reduces computational complexity and the number of parameters. To further reduce computational requirements, the adjacency matrix update frequency of the student model is set to one-third that of the teacher model. This helps reduce unnecessary computational overhead while maintaining the ability to learn important spatial relationships. In addition, the temporal distillation unit in the student model uses the hidden states of the GRU to apply sliding window correlation constraints to the teacher model. This allows the student model to gradually approximate the performance of the teacher model during the learning process. Especially in the processing of time series data, the sliding window approach can better capture the dynamic patterns within the sequence, achieving effective knowledge transfer. In this way, the teacher model and the student model work together, ensuring both performance and efficient resource utilization.
[0084] The simplified version of the GCN graph convolution operation can be represented as: in It is an adjacency matrix with self-loops added. H is the corresponding degree matrix, H is the input feature matrix, i.e. the training feature matrix, and W is the learnable weight matrix.
[0085] GRU processes the feature sequence and performs temporal distillation. Specifically, the feature sequence after GCN processing is Z = {z1, z2, ..., z...} N}, which is the output of the graph convolutional network, where z i h is the feature vector of the i-th node. Processing it using a forward GRU, we obtain h. t =GRU(h t-1 , z t ), h t This represents the hidden state of the GRU at time t; then, a sliding window approach is used to calculate the correlation between the hidden states of the student model and the teacher model. Where S teacher,t;t+w S represents the hidden state of the teacher model within the time window [t, t+w]. student,t;t+w This represents the hidden state of the student model within the time window [t, t+w]. T is the temperature parameter used to smooth the softmax output. w is the size of the sliding window.
[0086] In this invention, the input to the GCN is the node feature matrix. and the characteristic matrix of the normalized edges This involves training the feature matrix. After passing through one layer of GCN, each node generates a new feature representation. E1 is the output feature dimension of the first layer of GCN. After passing through GCN, each node generates the final feature representation. Z (n) Shape (N, E) n E n This is the output feature dimension of the nth layer of the GCN (n is chosen as 2-3 layers depending on the situation). Before inputting into the GRU, the output Z of the GCN is... (n) Convert the data to a format suitable for sequence processing, i.e., add a time dimension T, so that the data input to the GRU has the shape (T, N, E). n GRU processes the sequence data sequentially from the first time step to the last time step, generating hidden states. v is the output dimension of GRU.
[0087] Therefore, in this invention, the processing procedure for the training feature matrix of the student model is as follows: Figure 2 As shown, the data at the three time points are input into the GCN, and then the output of each GCN is added to the time dimension and input into the GRU. At the same time, the output of the GRU at the previous time point is combined in each GRU. Finally, the result is input into the output layer, and then the final teacher prediction result is output through the FNN.
[0088] Furthermore, this invention incorporates dynamic temperature control. "Temperature" is an inherent hyperparameter in knowledge distillation, used to control the smoothness of the teacher model's output. By adjusting the temperature, the "softness" or "hardness" of the knowledge learned by the student model from the teacher model can be influenced.
[0089] To adapt to cases of varying severity, a dynamic temperature adjustment mechanism, also known as dynamic weighted distillation, was employed. Specifically, a temperature coefficient τ = σ(MLP(Criticality Index)) was set, where MLP is a multilayer perceptron network used to dynamically adjust the temperature value based on the criticality index of the blood smear image. Higher temperatures result in smoother soft labels, while lower temperatures cause soft labels to approach hard labels, i.e., sharpen. This mechanism helps provide more precise guidance in critical situations, enhancing the model's adaptability and personalized service capabilities, while also improving the learning effectiveness of student models.
[0090] In dynamic temperature regulation, a pre-defined urgency index x is input from the user, and a multilayer perceptron (MLP) is used to calculate the temperature coefficient: τ = σ(MLP(x)), where σ is the activation function. Additionally, a softmax operation is performed on the output of the teacher model, and the temperature coefficient is applied. Higher temperatures make soft labels smoother, while lower temperatures make them closer to hard labels. Specifically, when the temperature T is higher, the probability distribution of the softmax output becomes smoother, and the differences between different categories decrease, making it easier for the student model to learn the teacher model's "soft labels." When the temperature T = 1, the softmax output is the same as the standard case, i.e., hard labels. When the temperature T is lower, the probability distribution of the softmax output becomes sharper, approaching hard labels.
[0091] Step S30: Calculate the feature distillation loss based on the teacher features and the student features; calculate the classification loss based on the student prediction results and the labels in the training samples; calculate the temporal consistency loss based on the teacher prediction results and the student prediction results; generate the student model loss based on the feature distillation loss, the classification loss, and the temporal consistency loss; and optimize the student model based on the student model loss.
[0092] Specifically, in this invention, when training the student model, the parameters of the student model's GCN are initialized using transfer learning to inherit some weights from the teacher model's GAT. The GRU is randomly initialized, the optimizer is SGD, the momentum is set to 0.9, the learning rate is 3e-4, and the update frequency is 1 / 3 of that of the teacher model. The forward propagation process involves inputting graph structure data to the GCN layer and then passing it to the GRU to process temporal features. Furthermore, Cross Entropy Loss is used as the primary loss function, i.e., classification loss; DTW is used to align the output sequences of the teacher and student models, and the cosine similarity loss after dynamic normalization is calculated as the temporal consistency loss; feature distillation loss applies MSE (mean squared error) loss between the second-layer output of GAT and the final output of GCN. The student model simultaneously considers classification loss, feature distillation loss, and temporal consistency loss. The student model loss L is set... student = 0.6 classification loss + 0.3 feature distillation loss + 0.1 temporal consistency loss.
[0093] Further, the step of calculating feature distillation loss based on the teacher features and the student features, calculating classification loss based on the student prediction results and the labels in the training samples, and calculating temporal consistency loss based on the teacher prediction results and the student prediction results specifically includes:
[0094] Based on the pre-constructed cross-layer projection matrix, the teacher features are mapped to the feature space of the student model to obtain the projected features;
[0095] The bulldozer distance is calculated based on the projection features and the student features, and the distillation loss of the features is obtained based on the bulldozer distance;
[0096] The cross-entropy loss is calculated based on the student prediction results and the labels in the training samples, and is used as the classification loss.
[0097] Based on the teacher prediction results and the student prediction results, dynamic time warping is used to calculate the distance between the trained teacher model and the student model, and the optimal path is found according to the dynamic time warping algorithm.
[0098] Based on the found optimal path, the cosine similarity loss is calculated and used as the temporal consistency loss.
[0099] Specifically, the step of calculating the feature distillation loss based on the teacher characteristics and the student characteristics includes:
[0100] Based on the pre-constructed cross-layer projection matrix, the teacher features are mapped to the feature space of the student model to obtain the projected features;
[0101] The bulldozer distance is calculated based on the projection features and the student features, and the feature distillation loss is obtained based on the bulldozer distance.
[0102] In this invention, the feature distillation process occurs between the second-layer output of the GAT and the final output of the GCN. By establishing a cross-layer projection matrix, the high-level features extracted by the GAT can be mapped to the feature space of the GCN. The goal is to minimize the Wasserstein distance, also known as the bulldozer distance, between these two feature representations, which is an effective method for measuring the difference in probability distributions. This not only preserves the spatial relationships of the original features but also allows the student model to learn more refined structural information, thereby improving its generalization ability.
[0103] Specifically, this means first obtaining the second-layer output H of the teacher model. (2) The final output Z of the student model is then used, and a linear transformation matrix P is used to map the features of the teacher model to the feature space H of the student model. P =H (2) P, and then the Wasserstein distance is used to measure the difference L between the two feature distributions. distill =W c (H p ,Z), where W c It is the Wasserstein distance, defined as Where ∏(μ,v) is the set of all joint probability distributions from μ to v, and c(x,y) is the cost function, usually expressed as the Euclidean distance.
[0104] Furthermore, the calculation of the temporal consistency loss based on the teacher's prediction results and the student's prediction results specifically includes:
[0105] Based on the teacher prediction results and the student prediction results, dynamic time warping is used to calculate the distance between the trained teacher model and the student model, and the optimal path is found according to the dynamic time warping algorithm.
[0106] Based on the found optimal path, the cosine similarity loss is calculated and used as the temporal consistency loss.
[0107] In this invention, to ensure the consistency of time series data, a sequence alignment loss function based on DTW is designed. This loss function aims to minimize the difference between the time series outputs of the teacher model and the student model, even if their sampling frequencies or rates are not synchronized. This method is particularly suitable for processing complex and irregular time series data such as blood smear images because it allows for non-linear alignment, ensuring accurate matching in the time dimension.
[0108] The temporal consistency loss module is used after the teacher and student models have generated their respective outputs. The preprocessed input data is then forward-propagated through the teacher model to obtain its output, i.e., the teacher's prediction result S. teacher The same input data is passed through the student model for forward propagation to obtain the output S of the student model. student Dynamic Time Warping (DTW) is used to calculate the distance L between the outputs of the teacher model and the student model. DTW =DTW(S teacher S student The optimal path is then found using the DTW algorithm to minimize the cumulative distance, i.e., to minimize the difference between the time series outputs of the teacher and student models. Finally, the normalized cosine similarity loss is calculated as the temporal consistency loss.
[0109] The specific steps are as follows: Define a cost matrix D, Where D[i][j] represents the distance between the i-th point in the teacher model's output sequence and the j-th point in the student model's output sequence. Then, dynamic programming is used to fill the cost matrix, and the cumulative distance C[i][j] = D[i][j] + min(C[i-1][j], C[i][j]-1], C[i-1][j-1]) is calculated to obtain the path L with the minimum cumulative distance. DTW=C[n][m], which is the optimal alignment path. Where n and m are the lengths of the output sequences of the teacher model and the student model, respectively.
[0110] Step S40: Iteratively train the student model. When the training reaches the preset requirements, output the trained student model. When the blood smear image to be processed and the test period are obtained, the blood smear image to be processed and the test period are preprocessed and then input into the trained student model, and the classification result is output.
[0111] Specifically, in this invention, when the student model is iteratively trained to the desired condition, the trained student model is output. The desired condition is set by the user and includes reaching the required number of training iterations or the required model accuracy.
[0112] When the blood smear image to be processed and the test period are obtained, the blood smear image to be processed and the test period are preprocessed and then input into the trained student model to output the classification result. The classification result includes three types: low, medium and high, which represent the corresponding blood smear image conditions. The corresponding result is given to the processing personnel, who then further process the blood smear image based on the classification result.
[0113] This invention captures time-series dependencies while processing graph-structured data, which is particularly useful for datasets with temporal and spatial dimensions. It constructs a more comprehensive feature representation, thereby improving classification performance. Compared to simple feature mapping, the proposed GAT+BiGRU teacher model not only considers node-level features but also strengthens the connections between important nodes through an attention mechanism, providing richer contextual information for the student model to learn. GAT can assign different weights to each node, allowing the model to adjust its focus according to specific application scenarios. Meanwhile, BiGRU helps the model better understand patterns in long sequences, which is crucial for learning long-term dependencies. Using GCN as part of the student model significantly reduces computational overhead while maintaining a certain level of accuracy, making this invention applicable not only to static graphs but also extend to dynamic graph scenarios, increasing the model's versatility and flexibility.
[0114] This invention acquires a training dataset, preprocesses the training blood smear images of the training samples in the training dataset to obtain a training feature matrix; inputs the training feature matrix into a pre-trained teacher model to output teacher features and teacher prediction results; inputs the training feature matrix into a student model to output student features and student prediction results; calculates feature distillation loss based on the teacher and student features, calculates classification loss based on the student prediction results and the labels in the training samples, calculates temporal consistency loss based on the teacher and student prediction results, generates student model loss based on the feature distillation loss, classification loss, and temporal consistency loss, optimizes the student model based on the student model loss; iteratively trains the student model, and when the training reaches a preset requirement, outputs the trained student model; when a blood smear image to be processed and an examination period are obtained, the blood smear image to be processed and the examination period are preprocessed and input into the trained student model to output classification results. This invention ensures similarity not only in surface features but also in deep spatial structure information by calculating feature distillation loss, thereby more accurately capturing the inherent distribution characteristics of the data and improving the performance of the student model. Simultaneously, it introduces temporal consistency loss, which effectively handles irregular time-series data and guarantees consistency and continuity over time. Furthermore, this invention trains the corresponding model through knowledge distillation, enabling the resulting student model to be deployed in a wider range of environments without incurring high computational costs, and to achieve stable processing in different environments.
[0115] Furthermore, such as Figure 3 As shown, based on the above-mentioned blood smear image classification method based on knowledge distillation and graph neural networks, the present invention also provides a blood smear image classification system based on knowledge distillation and graph neural networks, wherein the blood smear image classification system based on knowledge distillation and graph neural networks includes:
[0116] Preprocessing module 31 is used to acquire the training dataset and preprocess the training blood smear images of the training samples in the training dataset to obtain the training feature matrix.
[0117] The model output module 32 is used to input the training feature matrix into a pre-trained teacher model and output teacher features and teacher prediction results, and to input the training feature matrix into a student model and output student features and student prediction results.
[0118] The loss calculation module 33 is used to calculate feature distillation loss based on the teacher features and the student features, calculate classification loss based on the student prediction results and the labels in the training samples, calculate temporal consistency loss based on the teacher prediction results and the student prediction results, generate student model loss based on the feature distillation loss, the classification loss and the temporal consistency loss, and optimize the student model based on the student model loss.
[0119] Application module 34 is used to iteratively train the student model. When the training reaches the preset requirements, the trained student model is output. When the blood smear image to be processed and the test period are obtained, the blood smear image to be processed and the test period are preprocessed and then input into the trained student model, and the classification result is output.
[0120] The preprocessing module includes:
[0121] An alignment unit is used to obtain the test period. The training blood smear image and the test period are input into the temporal alignment module for temporal alignment to obtain an image sequence.
[0122] The node construction unit is used to input the image sequence and the training blood smear image into the graph structure construction module to generate a training feature matrix, wherein the training feature matrix includes a node feature matrix and an edge feature matrix.
[0123] The model output module includes a teacher prediction submodule and a student prediction submodule.
[0124] The teacher prediction submodule includes:
[0125] The teacher feature output unit is used to input the training feature matrix into the graph attention network of the pre-trained teacher model, and use the features output by the second layer of the graph attention network as teacher features.
[0126] The teacher prediction result generation unit is used to add a time dimension to the features of each time point output by the graph attention network to obtain the corresponding final feature representation of the teacher, and input the final feature representation of the teacher into the bidirectional gated recurrent unit of the pre-trained teacher model to generate positive and negative hidden states. Based on the positive and negative hidden states, the output layer and the feedforward neural network, the teacher prediction result is generated.
[0127] The student prediction submodule includes:
[0128] The student feature output unit is used to input the training feature matrix into the graph convolutional network in the student model and output the graph convolutional network as student features.
[0129] The student prediction result generation unit is used to add a time dimension to the features at each time point of the output of the graph convolutional network to obtain the corresponding final feature representation of the student, and input the final feature representation of the student into the gated recurrent unit of the student model to generate hidden states. Based on the hidden states, the output layer and the feedforward neural network, the student prediction result is generated.
[0130] The loss calculation module includes:
[0131] The feature distillation loss calculation unit is used to map the teacher features to the feature space of the student model according to the pre-constructed cross-layer projection matrix to obtain the projected features, calculate the bulldozer distance according to the projected features and the student features, and obtain the feature distillation loss according to the bulldozer distance.
[0132] The classification loss calculation unit is used to calculate the cross-entropy loss based on the student's prediction result and the labels in the training samples, and use it as the classification loss.
[0133] The temporal consistency loss calculation unit is used to calculate the distance between the trained teacher model and student model based on the teacher prediction results and the student prediction results using dynamic time warping, and to find the optimal path according to the dynamic time warping algorithm. Based on the found optimal path, the cosine similarity loss is calculated and used as the temporal consistency loss.
[0134] The student model loss calculation unit is used to generate a student model loss based on the feature distillation loss, the classification loss, and the temporal consistency loss, and to optimize the student model based on the student model loss.
[0135] Furthermore, such as Figure 4 As shown, based on the above-mentioned blood smear image classification method and system based on knowledge distillation and graph neural networks, the present invention also provides a terminal, which includes a processor 10, a memory 20 and a display 30. Figure 4 Only some of the terminal components are shown; however, it should be understood that it is not required to implement all of the components shown, and more or fewer components may be implemented instead.
[0136] In some embodiments, the memory 20 may be an internal storage unit of the terminal, such as a hard disk or memory. In other embodiments, the memory 20 may be an external storage device of the terminal, such as a plug-in hard disk, smart media card (SMC), secure digital card (SD), flash card, etc. Further, the memory 20 may include both internal and external storage devices. The memory 20 is used to store application software and various types of data installed on the terminal, such as the program code installed on the terminal. The memory 20 can also be used to temporarily store data that has been output or will be output. In one embodiment, the memory 20 stores a blood smear image classification program 40 based on knowledge distillation and graph neural networks. This blood smear image classification program 40 based on knowledge distillation and graph neural networks can be executed by the processor 10, thereby implementing the blood smear image classification method based on knowledge distillation and graph neural networks in this invention.
[0137] In some embodiments, the processor 10 may be a central processing unit (CPU), a microprocessor, or other data processing chip, used to run program code stored in the memory 20 or process data, such as executing the blood smear image classification method based on knowledge distillation and graph neural networks.
[0138] In some embodiments, the display 30 may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, or an OLED (Organic Light-Emitting Diode) touchscreen. The display 30 is used to display information on the terminal and to display a visual user interface.
[0139] In one embodiment, when the processor 10 executes the blood smear image classification program 40 based on knowledge distillation and graph neural networks in the memory 20, the steps of the above-mentioned blood smear image classification method based on knowledge distillation and graph neural networks are implemented.
[0140] The present invention also provides a computer-readable storage medium, wherein the computer-readable storage medium stores a blood smear image classification program based on knowledge distillation and graph neural networks, and the blood smear image classification program based on knowledge distillation and graph neural networks, when executed by a processor, implements the steps of the blood smear image classification method based on knowledge distillation and graph neural networks as described above.
[0141] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or terminal that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or terminal. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or terminal that includes that element.
[0142] Of course, those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware (such as a processor, controller, etc.). The program can be stored in a computer-readable storage medium, and when executed, it can include the processes described in the above method embodiments. The computer-readable storage medium can be a memory, magnetic disk, optical disk, etc.
[0143] It should be understood that the application of the present invention is not limited to the examples above. Those skilled in the art can make improvements or modifications based on the above description, and all such improvements and modifications should fall within the protection scope of the appended claims.
Claims
1. A blood smear image classification method based on knowledge distillation and graph neural networks, characterized in that, The blood smear image classification method based on knowledge distillation and graph neural networks includes: Obtain the training dataset, and preprocess the training blood smear images of the training samples in the training dataset to obtain the training feature matrix; The training feature matrix is input into a pre-trained teacher model to output teacher features and teacher prediction results; the training feature matrix is input into a student model to output student features and student prediction results. Calculate feature distillation loss based on the teacher features and the student features; calculate classification loss based on the student prediction results and the labels in the training samples; calculate temporal consistency loss based on the teacher prediction results and the student prediction results; generate student model loss based on the feature distillation loss, the classification loss, and the temporal consistency loss; and optimize the student model based on the student model loss. The student model is iteratively trained. When the training reaches the preset requirements, the trained student model is output. When the blood smear image to be processed and the test period are obtained, the blood smear image to be processed and the test period are preprocessed and then input into the trained student model, and the classification result is output. The preprocessing of the training blood smear images of the training samples in the training dataset to obtain the training feature matrix specifically includes: The testing period is obtained, and the training blood smear image and the testing period are input into the time alignment module for time alignment to obtain an image sequence. The image sequence and the training blood smear image are input into the graph structure construction module to generate a training feature matrix, wherein the training feature matrix includes a node feature matrix and an edge feature matrix; The step of inputting the training feature matrix into a pre-trained teacher model and outputting teacher features and teacher prediction results specifically includes: The training feature matrix is input into the graph attention network of the pre-trained teacher model, and the features output by the second layer of the graph attention network are used as teacher features. A time dimension is added to the features at each time point of the graph attention network output to obtain the corresponding final feature representation of the teacher. The final feature representation of the teacher is then input into the bidirectional gated recurrent unit of the pre-trained teacher model to generate positive and negative hidden states. Based on the positive and negative hidden states, the output layer, and the feedforward neural network, the teacher prediction result is generated. The steps of calculating feature distillation loss based on the teacher and student features, calculating classification loss based on the student prediction results and the labels in the training samples, and calculating temporal consistency loss based on the teacher and student prediction results specifically include: Based on the pre-constructed cross-layer projection matrix, the teacher features are mapped to the feature space of the student model to obtain the projected features; The bulldozer distance is calculated based on the projection features and the student features, and the feature distillation loss is obtained based on the bulldozer distance. The cross-entropy loss is calculated based on the student prediction results and the labels in the training samples, and is used as the classification loss. Based on the teacher prediction results and the student prediction results, dynamic time warping is used to calculate the distance between the trained teacher model and the student model, and the optimal path is found according to the dynamic time warping algorithm. Based on the found optimal path, the cosine similarity loss is calculated and used as the temporal consistency loss.
2. The blood smear image classification method based on knowledge distillation and graph neural networks according to claim 1, characterized in that, The step of inputting the training feature matrix into the student model and outputting student features and student prediction results specifically includes: The training feature matrix is input into the graph convolutional network in the student model, and the output of the graph convolutional network is used as the student features. A time dimension is added to the features at each time point output by the graph convolutional network to obtain the corresponding final feature representation of the student. The final feature representation of the student is then input into the gated recurrent unit of the student model to generate a hidden state. Based on the hidden state, the output layer, and the feedforward neural network, the student prediction result is generated.
3. A blood smear image classification system based on knowledge distillation and graph neural networks, characterized in that, The blood smear image classification system based on knowledge distillation and graph neural networks is used to implement the blood smear image classification method based on knowledge distillation and graph neural networks as described in any one of claims 1-2. The blood smear image classification system based on knowledge distillation and graph neural networks includes: The preprocessing module is used to acquire the training dataset and preprocess the training blood smear images of the training samples in the training dataset to obtain the training feature matrix. The model output module is used to input the training feature matrix into a pre-trained teacher model and output teacher features and teacher prediction results, and to input the training feature matrix into a student model and output student features and student prediction results. The loss calculation module is used to calculate feature distillation loss based on the teacher features and the student features, calculate classification loss based on the student prediction results and the labels in the training samples, calculate temporal consistency loss based on the teacher prediction results and the student prediction results, generate student model loss based on the feature distillation loss, the classification loss and the temporal consistency loss, and optimize the student model based on the student model loss. The application module is used to iteratively train the student model. When the training reaches the preset requirements, it outputs the trained student model. When the blood smear image to be processed and the test period are obtained, the blood smear image to be processed and the test period are preprocessed and then input into the trained student model, and the classification result is output.
4. The blood smear image classification system based on knowledge distillation and graph neural networks according to claim 3, characterized in that, The preprocessing module includes: An alignment unit is used to obtain the test period. The training blood smear image and the test period are input into the temporal alignment module for temporal alignment to obtain an image sequence. The node construction unit is used to input the image sequence and the training blood smear image into the graph structure construction module to generate a training feature matrix, wherein the training feature matrix includes a node feature matrix and an edge feature matrix.
5. The blood smear image classification system based on knowledge distillation and graph neural networks according to claim 3, characterized in that, The loss calculation module includes: The feature distillation loss calculation unit is used to map the teacher features to the feature space of the student model according to the pre-constructed cross-layer projection matrix to obtain the projected features, calculate the bulldozer distance according to the projected features and the student features, and obtain the feature distillation loss according to the bulldozer distance. The classification loss calculation unit is used to calculate the cross-entropy loss based on the student's prediction result and the labels in the training samples, and use it as the classification loss. The temporal consistency loss calculation unit is used to calculate the distance between the trained teacher model and student model based on the teacher prediction results and the student prediction results using dynamic time warping, and to find the optimal path according to the dynamic time warping algorithm. Based on the found optimal path, the cosine similarity loss is calculated and used as the temporal consistency loss. The student model loss calculation unit is used to generate a student model loss based on the feature distillation loss, the classification loss, and the temporal consistency loss, and to optimize the student model based on the student model loss.
6. A terminal, characterized in that, The terminal includes: a memory, a processor, and a blood smear image classification program based on knowledge distillation and graph neural networks stored in the memory and executable on the processor. When the blood smear image classification program based on knowledge distillation and graph neural networks is executed by the processor, it implements the steps of the blood smear image classification method based on knowledge distillation and graph neural networks as described in any one of claims 1-2.
7. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a blood smear image classification program based on knowledge distillation and graph neural networks, which, when executed by a processor, implements the steps of the blood smear image classification method based on knowledge distillation and graph neural networks as described in any one of claims 1-2.
Citation Information
Patent Citations
Flood forecasting method based on distributed adaptive graph attention network
CN116702959A
Knowledge distillation based neural network training method, device, and storage medium
WO2023212997A1