Bone marrow cell recognition system based on multi-modal enhancement
Through the multi-modal enhanced bone marrow cell identification system, the accuracy of the bone marrow cell identification system is improved by using coarse and fine-grained text information and improved model technology, and the problem of cell type imbalance and complex image recognition is solved.
Patent Information
- Application Number
- CN202410815254.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-24
- Publication Date
- 2024-10-29
- Estimated Expiration
- 2044-06-24
AI Technical Summary
The existing bone marrow cell identification system has low accuracy when faced with cell type imbalance and complex cell image recognition, and cannot effectively solve the problem of small cell types and difficult to identify complex images.
A bone marrow cell identification system based on multi-modal enhancement is used to perform cell image segmentation and classification through coarse-grained and fine-grained text information prompts, combined with the improved SAM model and PMC-CLIP model, and cross-entropy loss is used for model optimization to improve the model. recognition accuracy.
It significantly improves the recognition accuracy of types with small number of cells and complex cell images, enhances the recognition ability of the model, and solves the problem of unbalanced cell types and difficulty in identifying complex images.
Smart Images

Figure CN118865373A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of intelligent identification of bone marrow cells, and in particular to a bone marrow cell identification system based on multimodal enhancement. Background Art
[0002] Bone marrow cell morphology examination plays an indispensable role in the diagnosis, disease assessment and treatment plan of blood diseases. This examination process includes several key steps, from the collection of bone marrow samples to the preparation of bone marrow smears, microscopic observation after staining, and finally to cell counting and final report diagnosis. Among them, microscopic observation is a crucial link. Doctors need to carefully examine the cell morphology, structure, staining characteristics, karyotype and other indicators to ensure accurate identification of disease type, judgment of disease progression, and design of the best treatment strategy.
[0003] However, the traditional microscopic observation method has some shortcomings, such as being time-consuming, cumbersome, and requiring high doctor experience. Therefore, it is of great significance to research and develop an automated bone marrow cell recognition system. Such a system can greatly reduce the workload of doctors and improve the efficiency and accuracy of diagnosis. By combining advanced image processing technology, deep learning, and artificial intelligence algorithms, bone marrow cells can be automatically identified and classified, providing doctors with timely auxiliary judgment and decision support, thereby bringing significant improvements to the diagnosis and treatment of patients. This article will bring new solutions to this problem through the latest deep learning technology.
[0004] With the rapid advancement of computing hardware, the accumulation of large-scale data, and the widespread application of large models, the fusion of traditional bone marrow cell detection and large models has great potential. In the bone marrow cell recognition system based on deep learning, there are usually two methods: one is to perform cell segmentation first and then classification; the other is to perform cell segmentation and classification at the same time, that is, an end-to-end target detection method. However, at present, neither of these two methods takes into account the problem of cell type imbalance and the low accuracy in the face of complex cell images. As a result, the system has a low accuracy rate when identifying fewer cell types, and a low recognition rate for complex cell images. Summary of the invention
[0005] The purpose of the present invention is to overcome the shortcomings of the prior art and provide a bone marrow cell recognition system based on multimodal enhancement. Through coarse-grained + fine-grained text information prompts, the recognition accuracy of types with a small number of cells and complex cell images can be effectively improved, the problems of unbalanced cell types and difficult to distinguish complex images can be solved, and the recognition accuracy of the model can be improved.
[0006] To achieve the above-mentioned purpose, the technical solution provided by the present invention is: a bone marrow cell recognition system based on multimodal enhancement, comprising:
[0007] The cell image segmentation module is an improved SAM model for segmenting bone marrow cell microscope image data. This module combines the SAM model and the Adapter block, and realizes feature extraction and adjustment of image data by embedding the ViT block of the SAM model into the Adapter block. This module freezes other parameters of the SAM model and only updates the Adapter block. At the same time, segmentation hints and Mask processing are added to improve the segmentation accuracy and robustness of the model for bone marrow cell microscope image data, thereby obtaining an embedded representation of the segmented cell image.
[0008] The label text transformation module is used to convert traditional label text into coarse-grained and fine-grained text feature representations. Its operation is as follows: first, the coarse-grained text information is constructed using a text generator. The text generator is a program for generating text, which can generate corresponding text according to the given content. The label text is segmented and semantically analyzed to extract coarse-grained semantic information to form a coarse-grained text feature set. Then, fine-grained text information is constructed using natural language processing or manual processing. The fine-grained text information describes the cell image in detail according to the characteristics of the cell image to form a fine-grained text feature set. Then, the coarse-grained text information and the fine-grained text information are transmitted to the BERT text encoder, and the coarse-grained text information and the fine-grained text information are mapped to a low-dimensional semantic space, thereby converting them into coarse-grained text features and fine-grained text features.
[0009] The multimodal alignment module uses an improved PMC-CLIP model to realize image-text alignment of the coarse-grained and fine-grained text features output by the label text transformation module. The improved PMC-CLIP model adds coarse-grained and fine-grained text features on the basis of the PMC-CLIP model. The cross-entropy loss is calculated and normalized through the coarse-grained text features and fine-grained text features of the cell respectively. The cross-entropy loss is used to back-propagate the loss to guide the model to utilize the fine-grained text information and coarse-grained text information. Finally, the classification result is output through the classification head.
[0010] Furthermore, the cell image segmentation module reads a microscope image from the bone marrow cell microscope image data, and then performs the following process: first, the original image is randomly cropped into small blocks of 32*32, and then segmentation points and segmentation lines are obtained on the image according to the segmentation prompts, and the SAM model is used to segment the cells and the background image, and then the parameters of the Adapter block are adjusted, the loss function is optimized, and the noise points and incomplete cells are removed. The contours with large areas left are the cell contours, and all the segmented cell images of the microscope image are composed of a segmented cell image data set; all microscope images are generated according to the above process to obtain a segmented bone marrow cell data set.
[0011] Furthermore, the improved SAM model includes an image encoder, a prompt encoder, a Mask encoder, a mask decoder and an Adapter block; the image encoder refers to a process of convolving and rearranging the input microscope image by 3×3, and then inputting the rearrangement result and the position embedding into the Transformer block to generate an image embedding, and finally adding the image embedding to the result output by the Mask encoder after convolution to form a new image embedding, and then using the box segmentation prompt and point segmentation prompt input by the user to input the prompt encoder to generate the prompt embedding, and then inputting the prompt embedding and the new image embedding into the mask decoder to generate a prediction; the Adapter block is composed of a high-order fully connected layer, a RELU activation function layer and a low-order fully connected layer. Since the Adapter block is added to each layer for parameter adjustment, the SAM model will better segment the image; the Mask encoder includes a convolution layer, a normalization layer and a GELU activation function layer, which are used to generate a mask embedding to provide more information for the image encoder; the prompt encoder includes a point prompt encoder and a box prompt encoder, and the point prompt encoder generates a point embedding by adding the point segmentation prompt provided by the user through coordinate normalization and pixel label encoding, and then The pixel labels are weighted and added to the box label embedding. The box hint encoder generates box embedding by rearranging and normalizing the box segmentation hints provided by the user, and finally weightedly adding them to the point label embedding. Then, the mask substring and confidence substring with initial values are spliced to predict the image. The spliced result passes through the self-attention layer and the normalization layer and then enters the mask decoder; the mask decoder includes a cross attention layer, a normalization layer, a multi-layer perceptron layer and a transposed convolution layer. The multi-layer perceptron layer consists of an input layer, a hidden layer and an output layer. The number of neural nodes in the hidden layer is 1024; the mask decoder performs the following operations: first, After the results of the prompt encoder and the image encoder pass through the cross-attention layer, they learn each other's features and are then standardized. Due to the different dimensions, the results of the prompt encoder need to go through a multi-layer perceptron layer, and then enter a cross-attention layer to learn each other's information. After that, the mask substring and confidence substring are taken out from the result of the prompt encoder, and then enter a three-layer multi-layer perceptron layer respectively. The result of the mask substring needs to be multiplied with the result of the transposed convolution of the image encoder, so that the confidence prediction and mask prediction are obtained, so as to perform the next back propagation to optimize the prediction result, and finally obtain the segmented image embedding.
[0012] Furthermore, the label text transformation module performs the following operations:
[0013] 1) Read the source image and corresponding label information from the bone marrow cell dataset;
[0014] 2) Generate detailed text description of cells based on the image content of the source image and professional cell description knowledge;
[0015] 3) Input the generated coarse-grained and fine-grained text information into the BERT text encoder, which includes text preprocessing and a Transformer encoder; the text preprocessing is to first tokenize the sentences, then substring the sentences and input them into the embedding layer to generate embeddings, and then add them to the position embedding and segment embedding and input them into the Transformer encoder after rearrangement, and finally rearrange and normalize them to obtain an output result of unified dimension, and finally obtain coarse-grained and fine-grained text feature representations; the Transformer encoder includes a normalization layer, a multi-head attention layer and a multi-layer perceptron layer, which are used to map text information into a low-dimensional semantic space.
[0016] Furthermore, the multimodal alignment module is an improved PMC-CLIP model, including a ViT image encoder, an image-text alignment module, an improved Loss function module and a back-propagation module, wherein:
[0017] The ViT image encoder generates a corresponding microscope image embedding by passing the input microscope image through the backbone network. The operation is as follows: first, the input microscope image is first subjected to image enhancement. Here, two strategies, random cropping and combined enhancement, are adopted. Random cropping refers to randomly selecting an area from the original image and cropping it to generate a new image. Combined enhancement refers to combining a variety of different enhancement methods to generate richer and more diverse image data. These enhancement methods include contrast enhancement, color enhancement, scale transformation, rotation and flipping, and noise addition. After batch division and projection transformation, it enters an image embedding layer for feature extraction. The extracted features and the position embedding with initial values are reorganized into a feature sequence. This feature sequence is then used as input and processed by a series of Transformer modules. Each Transformer module contains a normalization layer, a multi-head attention layer, and a multi-head perceptron layer, which are used to capture the global dependency between features and perform nonlinear transformation of features. After processing, an embedding representation corresponding to the input microscope image is generated for subsequent tasks.
[0018] The image-text alignment module uses coarse-grained text similarity embedding and fine-grained text similarity embedding to align with random image similarity embedding, and adds a scale factor to convert the dimensions of text features and image embeddings, so as to obtain text similarity embedding and image similarity embedding, and align them in a high-dimensional semantic space, with the goal of maximizing the semantic relevance between image and text, thereby obtaining an image-text pairing matrix. Finally, the obtained image-text pairing matrix is used for various cross-modal applications;
[0019] The improved Loss function module is used to calculate the Loss function of the image-text feature matrix. Due to the addition of coarse-grained text information, the Loss function needs to be improved, and the improvement is: total =L graph +λ((1-a)L coarse +aL fine ), where L total Represents the total loss, L coarse represents the coarse-grained text-image loss, L fine represents the fine-grained text-image loss, L graph represents the real image-prediction image loss, L graph , L coarse , L fine It is calculated using the cross entropy function, λ and a are hyperparameters;
[0020] The back propagation module is used to optimize the model and optimize the model structure according to the result of the Loss function. It calculates the gradient of the loss function and uses the gradient descent algorithm to update the model parameters in the direction of the gradient, so that the output of the model is closer to the true label, that is, the correct image-text pairing is closer, and the incorrect pairing is farther away. Finally, the classification result is obtained through the classification head.
[0021] Furthermore, the multimodal alignment module learns useful knowledge from the bone marrow cell dataset and coarse and fine-grained text features to train an improved PMC-CLIP model, including the following steps:
[0022] 1) Set the number of training times, initial learning rate and batch size, and start training;
[0023] 2) The images segmented by the improved SAM model are taken as the input image set, and the coarse-grained text features are taken as the input text feature set. A batch size image subset A is randomly selected from the image set, and the corresponding text feature subset B is selected from the text feature set corresponding to the image subset A. Subset A and subset B are aligned one by one in the high-dimensional semantic space, one as the horizontal axis and the other as the vertical axis;
[0024] 3) Calculate the cross entropy loss so that the difference between the corresponding image and text features is as small as possible, thereby achieving a better image-text alignment effect. At the same time, for the remaining image and text features, the calculated loss is as large as possible;
[0025] 4) Similar to the coarse-grained text, the same alignment and loss calculation steps are performed on the fine-grained text to ensure the semantic consistency and alignment between the image and the fine-grained text;
[0026] 5) The improved PMC-CLIP model calculates the loss Loss and back-propagates the updated weights, updates the weights and parameters of the model to minimize the loss function; where Loss is expressed as:
[0027]
[0028]
[0029] L coarse =-(L sup (v,l)+L sup (l,v)))
[0030] L fine =-(L sup (v,l)+L sup (l,v)))
[0031] L total =L graph +λ((1-a)L coarse +aL fine )
[0032] In the above formula, L total Represents the total loss, L graph represents the real image-prediction image loss, L ce represents the cross entropy loss, L sup Represents the loss of text features-image features, L coarse represents the coarse-grained text-image loss, L fine represents the fine-grained text-image loss; in L graph In the above example, N represents the total number of samples, y i Represents the label information x i One-hot encoding, C(x i ) represents the prediction result, through L graph To calculate the image loss; in L sup , L coarse , L fine , medium, L sup Represents the loss of text features-image features, L coarse represents the coarse-grained text-image loss, Lfine represents the fine-grained text-image loss, i is the index, m and n represent the embedded features, represents the transposed m embedding features of the ith index, represents the i-th index n embedding feature transpose; in L ce In, p i represents the predicted probability of the ith cell; in L sup In (m,n), P n (i) represents the positive sample set of the i-th batch, n represents the embedded features, A n (i) represents the negative sample set of the i-th batch, |P(i)| represents the total number of positive samples in the i-th batch, represents one of the samples in a positive sample set, represents one of the samples in a negative sample set, τ represents the temperature parameter in softmax, which will be trained during the training process. sup Can define L coarse and L fine ; in L coarse and L fine In the above example, l and v represent the text feature sample set and image feature sample set respectively, P l (i) represents the positive sample set of the i-th batch of text features, P v (i) represents the positive sample set of the i-th batch of image features, P(i) represents the positive sample set of the i-th batch, A l (i) represents the negative sample set of the i-th batch of text features, A v (i) represents the negative sample set of the i-th batch of image features, and |P l (i)|=|P v (i)|=|P(i)|; During the optimization process, the image features and text features belonging to the same category are placed in P l (i) and P v In (i), the out-of-class features are placed in A v (i) and A l (i) In; at the same time L coarse and L fine It will make the characteristics of samples of the same type closer and the characteristics of samples of different types farther apart; L total The λ in is a hyperparameter used for balanced alignment; a is used to control the contribution rate of coarse-grained text features and fine-grained text features, which is also a hyperparameter.
[0033] Compared with the prior art, the present invention has the following advantages and beneficial effects:
[0034] 1. The present invention generates a segmented bone marrow cell dataset based on the bone marrow cell microscope image data through a cell image segmentation module, and assists the model in acquiring more features about the bone marrow cells.
[0035] 2. The present invention uses a label text transformation module to enable the model to fully utilize text information to assist classification, add relevant information to the data set in disguise, increase the accuracy of model recognition, and solve the problem of unclear text description in the data set.
[0036] 3. The present invention improves the classification ability of the PMC-CLIP model for bone marrow cells by adding coarse-grained and fine-grained text features, so that the model uses the coarse-grained and fine-grained text features of cells and the cross-entropy loss of the segmented images to guide the model to capture more cell classification information, thereby improving the model recognition accuracy. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] Figure 1 It is a schematic diagram of the relationship between various modules of the system of the present invention.
[0038] Figure 2 It is a structural diagram of the cell image segmentation model.
[0039] Figure 3 It is a structural diagram of the label text transformation module.
[0040] Figure 4 It is a structural diagram of the multimodal alignment module. DETAILED DESCRIPTION
[0041] The present invention will be further described below in conjunction with specific embodiments.
[0042] This embodiment provides a bone marrow cell recognition system based on multimodal enhancement, which is a bone marrow cell recognition system developed using Python language and can be run on multiple platforms. The relationship between the modules of the system is as follows: Figure 1 As shown, it includes:
[0043] The cell image segmentation module is an improved SAM model for segmenting bone marrow cell microscope image data. The module combines the SAM model and the Adapter block, and realizes feature extraction and adjustment of image data by embedding the ViT (Vision Transformer) block of the SAM model into the Adapter block. The module freezes other parameters of the SAM model and only updates the Adapter block. At the same time, segmentation hints and Mask processing are added to improve the segmentation accuracy and robustness of the model for bone marrow cell microscope image data, thereby obtaining an embedded representation of the segmented cell image.
[0044] The label text transformation module is used to convert traditional label text into coarse-grained and fine-grained text feature representations. Its operation is as follows: first, the coarse-grained text information is constructed using a text generator. The text generator is a program that generates text and can generate corresponding text according to the given content. The label text is segmented and semantically analyzed to extract coarse-grained semantic information. Then, the fine-grained text information is constructed using natural language processing or manual processing. The fine-grained text information describes the cell image in detail according to the characteristics of the cell image. Then, the coarse-grained text information and the fine-grained text information are transmitted to the BERT text encoder, and the coarse-grained text information and the fine-grained text information are mapped to a low-dimensional semantic space, thereby converting them into coarse-grained text features and fine-grained text features.
[0045] The multimodal alignment module uses an improved PMC-CLIP model to realize image-text alignment of the coarse-grained and fine-grained text features output by the label text transformation module. The improved PMC-CLIP model adds coarse-grained and fine-grained text features on the basis of the PMC-CLIP model. The cross-entropy loss is calculated and normalized through the coarse-grained text features and fine-grained text features of the cell respectively. The cross-entropy loss is used to back-propagate the loss to guide the model to utilize the fine-grained text information and coarse-grained text information. Finally, the classification result is output through the classification head.
[0046] Specifically, Figure 2 As shown, the cell image segmentation module reads a microscope image from the bone marrow cell microscope image data, and then performs the following process: first, the original image is randomly cropped into small blocks of 32*32, and then segmentation points and segmentation lines are obtained on the image according to the segmentation prompts, and the SAM model is used to segment the cells and the background image, and then the parameters of the Adapter block are adjusted, the loss function is optimized, the noise points and incomplete cells are removed, and the contours with large areas left are the cell contours, and all the segmented cell images of the microscope image are composed of the segmented cell image data set; all microscope images are generated according to the above process to obtain the segmented bone marrow cell data set.
[0047] Specifically, the improved SAM model includes an image encoder, a prompt encoder, a Mask encoder, a mask decoder and an Adapter block; the image encoder refers to the input microscope image being subjected to 3×3 convolution and rearranged, and then the rearrangement result and the position embedding are input into the Transformer block to generate an image embedding, and finally the image embedding is convolved and added with the result output by the Mask encoder to form a new image embedding, and then the box segmentation prompt and point segmentation prompt input by the user are input into the prompt encoder to generate the prompt embedding, and then the prompt embedding and the new image embedding are input into the mask decoder to generate a prediction; the Adapter block is composed of a high-order fully connected layer, a RELU activation function layer and a low-order fully connected layer. Since the Adapter block is added to each layer for parameter adjustment, the SAM model will better segment the image; the Mask encoder includes a convolution layer, a normalization layer and a GELU activation function layer, which are used to generate a mask embedding to provide more information for the image encoder; the prompt encoder includes a point prompt encoder and a box prompt encoder, and the point prompt encoder generates a point embedding by adding the point segmentation prompt provided by the user through coordinate normalization and pixel label encoding, and then the image The pixel labels are weighted and added to the box label embedding. The box hint encoder generates box embedding by rearranging and normalizing the box segmentation hints provided by the user, and finally weightedly adding them to the point label embedding. Then, the mask substring and confidence substring with initial values are spliced to predict the image. The spliced result passes through the self-attention layer and the normalization layer and then enters the mask decoder; the mask decoder includes a cross attention layer, a normalization layer, a multi-layer perceptron layer and a transposed convolution layer. The multi-layer perceptron layer consists of an input layer, a hidden layer and an output layer. The number of neural nodes in the hidden layer is 1024; the mask decoder performs the following operations: first, After the results of the prompt encoder and the image encoder pass through the cross-attention layer, they learn each other's features and are then standardized. Due to the different dimensions, the results of the prompt encoder need to go through a multi-layer perceptron layer, and then enter a cross-attention layer to learn each other's information. After that, the mask substring and confidence substring are taken out from the result of the prompt encoder, and then enter a three-layer multi-layer perceptron layer respectively. The result of the mask substring needs to be multiplied with the result of the transposed convolution of the image encoder, so that the confidence prediction and mask prediction are obtained, so as to perform the next back propagation to optimize the prediction result, and finally obtain the segmented image embedding.
[0048] Specifically, Figure 3 As shown, the label text transformation module performs the following operations:
[0049] 1) Read the source image and corresponding label information from the bone marrow cell dataset;
[0050] 2) Generate detailed text description of cells based on the image content of the source image and professional cell description knowledge;
[0051] 3) Input the generated coarse-grained and fine-grained text information into the BERT text encoder, which includes text preprocessing and a Transformer encoder; the text preprocessing is to first tokenize the sentences, then substring the sentences and input them into the embedding layer to generate embeddings, and then add them to the position embedding and segment embedding and input them into the Transformer encoder after rearrangement, and finally rearrange and normalize them to obtain an output result of unified dimension, and finally obtain coarse-grained and fine-grained text feature representations; the Transformer encoder includes a normalization layer, a multi-head attention layer and a multi-layer perceptron layer, which are used to map text information into a low-dimensional semantic space.
[0052] Specifically, the multimodal alignment module is an improved PMC-CLIP model, including a ViT image encoder, an image-text alignment module, an improved Loss function module and a back-propagation module, wherein:
[0053] The ViT image encoder generates a corresponding microscope image embedding by passing the input microscope image through the backbone network. The operation is as follows: first, the input microscope image is first subjected to image enhancement. Here, two strategies, random cropping and combined enhancement, are adopted. Random cropping refers to randomly selecting an area from the original image and cropping it to generate a new image. Combined enhancement refers to combining a variety of different enhancement methods to generate richer and more diverse image data. These enhancement methods include contrast enhancement, color enhancement, scale transformation, rotation and flipping, and noise addition. After batch division and projection transformation, it enters an image embedding layer for feature extraction. The extracted features and the position embedding with initial values are reorganized into a feature sequence. This feature sequence is then used as input and processed by a series of Transformer modules. Each Transformer module contains a normalization layer, a multi-head attention layer, and a multi-head perceptron layer, which are used to capture the global dependency between features and perform nonlinear transformation of features. After processing, an embedding representation corresponding to the input microscope image is generated for subsequent tasks.
[0054] The image-text alignment module uses coarse-grained text similarity embedding and fine-grained text similarity embedding to align with random image similarity embedding, and adds a scale factor to convert the dimensions of text features and image embeddings, so as to obtain text similarity embedding and image similarity embedding, and align them in a high-dimensional semantic space, with the goal of maximizing the semantic relevance between image and text, thereby obtaining an image-text pairing matrix. Finally, the obtained image-text pairing matrix is used for various cross-modal applications;
[0055] The improved Loss function module is used to calculate the Loss function of the image-text feature matrix. Due to the addition of coarse-grained text information, the Loss function needs to be improved, and the improvement is: total =L graph +λ((1-a)L coarse +aL fine ), where L total Represents the total loss, L coarse represents the coarse-grained text-image loss, L fine represents the fine-grained text-image loss, L graph represents the real image-prediction image loss, L graph , L coarse , L fine It is calculated using the cross entropy function, λ and a are hyperparameters;
[0056] The back propagation module is used to optimize the model and optimize the model structure according to the result of the Loss function. It calculates the gradient of the loss function and uses the gradient descent algorithm to update the model parameters in the direction of the gradient, so that the output of the model is closer to the true label, that is, the correct image-text pairing is closer, and the incorrect pairing is farther away. Finally, the classification result is obtained through the classification head.
[0057] Specifically, Figure 4 As shown, the multimodal alignment module learns useful knowledge from the bone marrow cell dataset and coarse and fine-grained text features, and trains the improved PMC-CLIP model, including the following steps:
[0058] 1) Set the number of training times, initial learning rate and batch size, and start training;
[0059] 2) The images segmented by the improved SAM model are taken as the input image set, and the coarse-grained text features are taken as the input text feature set. A batch size image subset A is randomly selected from the image set, and the corresponding text feature subset B is selected from the text feature set corresponding to the image subset A. Subset A and subset B are aligned one by one in the high-dimensional semantic space, one as the horizontal axis and the other as the vertical axis;
[0060] 3) Calculate the cross entropy loss so that the difference between the corresponding image and text features is as small as possible, thereby achieving a better image-text alignment effect. At the same time, for the remaining image and text features, the calculated loss is as large as possible;
[0061] 4) Similar to the coarse-grained text, the same alignment and loss calculation steps are performed on the fine-grained text to ensure the semantic consistency and alignment between the image and the fine-grained text;
[0062] 5) The improved PMC-CLIP model calculates the loss Loss and back-propagates the updated weights, updates the weights and parameters of the model to minimize the loss function; where Loss is expressed as:
[0063]
[0064] L coarse =-(L sup (v,l)+L sup (l,v)))
[0065] L fine =-(L sup (v,l)+L sup (l,v)))
[0066] L total =L graph +λ((1-a)L coarse +aL fine )
[0067] In the above formula, L total Represents the total loss, L graph represents the real image-prediction image loss, L ce represents the cross entropy loss, L sup Represents the loss of text features-image features, L coarse represents the coarse-grained text-image loss, L fine represents the fine-grained text-image loss; in L graph In the above example, N represents the total number of samples, y i Represents the label information x i One-hot encoding, C(x i ) represents the prediction result, through L graph To calculate the image loss; in L sup , L coarse , L fine , medium, L sup Represents the loss of text features-image features, L coarse represents the coarse-grained text-image loss, L fine represents the fine-grained text-image loss, i is the index, m and n represent the embedded features, represents the transposed m embedding features of the ith index, represents the i-th index n embedding feature transpose; in L ce In, p i represents the predicted probability of the ith cell; in L sup In (m,n), P n (i) represents the positive sample set of the i-th batch, n represents the embedded features, A n (i) represents the negative sample set of the i-th batch, |P(i)| represents the total number of positive samples in the i-th batch, represents one of the samples in a positive sample set, represents one of the samples in a negative sample set, τ represents the temperature parameter in softmax, which will be trained during the training process. sup Can define L coarse and L fine ; in L coarse and L fine In the above example, l and v represent the text feature sample set and image feature sample set respectively, P l (i) represents the positive sample set of the i-th batch of text features, P v (i) represents the positive sample set of the i-th batch of image features, P(i) represents the positive sample set of the i-th batch, A l (i) represents the negative sample set of the i-th batch of text features, A v (i) represents the negative sample set of the i-th batch of image features, and |P l (i)|=|P v (i)|=|P(i)|; During the optimization process, the image features and text features belonging to the same category are placed in P l (i) and P v In (i), the out-of-class features are placed in A v (i) and A l (i) In; at the same time L coarse and L fine It will make the characteristics of samples of the same type closer and the characteristics of samples of different types farther apart; L total The λ in is a hyperparameter used for balanced alignment; a is used to control the contribution rate of coarse-grained text features and fine-grained text features, which is also a hyperparameter.
[0068] The above-described embodiments are only preferred embodiments of the present invention and are not intended to limit the scope of implementation of the present invention. Therefore, all changes made according to the shape and principle of the present invention should be included in the protection scope of the present invention.
Claims
1. A bone marrow cell recognition system based on multimodal enhancement, characterized in that: include: The cell image segmentation module is an improved SAM model for segmenting bone marrow cell microscope image data. This module combines the SAM model and the Adapter block, and realizes feature extraction and adjustment of image data by embedding the ViT block of the SAM model into the Adapter block. This module freezes other parameters of the SAM model and only updates the Adapter block. At the same time, segmentation hints and Mask processing are added to improve the segmentation accuracy and robustness of the model for bone marrow cell microscope image data, thereby obtaining an embedded representation of the segmented cell image. The label text transformation module is used to convert traditional label text into coarse-grained and fine-grained text feature representations. Its operation is as follows: first, the coarse-grained text information is constructed using a text generator. The text generator is a program for generating text, which can generate corresponding text according to the given content. The label text is segmented and semantically analyzed to extract coarse-grained semantic information to form a coarse-grained text feature set. Then, fine-grained text information is constructed using natural language processing or manual processing. The fine-grained text information describes the cell image in detail according to the characteristics of the cell image to form a fine-grained text feature set. Then, the coarse-grained text information and the fine-grained text information are transmitted to the BERT text encoder, and the coarse-grained text information and the fine-grained text information are mapped to a low-dimensional semantic space, thereby converting them into coarse-grained text features and fine-grained text features. The multimodal alignment module uses an improved PMC-CLIP model to realize image-text alignment of the coarse-grained and fine-grained text features output by the label text transformation module. The improved PMC-CLIP model adds coarse-grained and fine-grained text features on the basis of the PMC-CLIP model. The cross-entropy loss is calculated and normalized through the coarse-grained text features and fine-grained text features of the cell respectively. The cross-entropy loss is used to back-propagate the loss to guide the model to utilize the fine-grained text information and coarse-grained text information. Finally, the classification result is output through the classification head.
2. The bone marrow cell identification system based on multimodal enhancement according to claim 1, characterized in that: The cell image segmentation module reads a microscope image from the bone marrow cell microscope image data, and then performs the following process: first, randomly crop the original image into small blocks of 32*32, then obtain segmentation points and segmentation lines on the image according to the segmentation prompts, use the SAM model to segment the cells and the background image, then adjust the parameters of the Adapter block, optimize the loss function, remove noise points and incomplete cells, and the remaining large area contours are cell contours. All segmented cell images of the microscope image form a segmented cell image data set; all microscope images are generated according to the above process to obtain a segmented bone marrow cell data set.
3. The bone marrow cell identification system based on multimodal enhancement according to claim 2, characterized in that: The improved SAM model includes an image encoder, a prompt encoder, a Mask encoder, a mask decoder and an Adapter block; the image encoder refers to a process of convolving and rearranging the input microscope image by 3×3, and then inputting the rearrangement result and the position embedding into the Transformer block to generate an image embedding, and finally adding the image embedding to the result output by the Mask encoder after convolution to form a new image embedding, and then using the box segmentation prompt and point segmentation prompt input by the user to input the prompt encoder to generate the prompt embedding, and then inputting the prompt embedding and the new image embedding into the mask decoder to generate a prediction; the Adapter block is composed of a high-order fully connected layer, a RELU activation function layer and a low-order fully connected layer. Since the Adapter block is added to each layer for parameter adjustment, the SAM model will better segment the image; the Mask encoder includes a convolution layer, a normalization layer and a GELU activation function layer, which are used to generate a mask embedding to provide more information for the image encoder; the prompt encoder includes a point prompt encoder and a box prompt encoder. The point prompt encoder generates a point embedding by adding the point segmentation prompt provided by the user through coordinate normalization and pixel label encoding, and then the pixel label The box hint encoder generates box embedding by weighted rearrangement and normalization through the box segmentation hint provided by the user, and finally adds the box embedding to the point label embedding, and then splices the mask substring and confidence substring with initial value for image prediction, and then passes the spliced result through the self-attention layer and the normalization layer into the mask decoder; the mask decoder includes a cross attention layer, a normalization layer, a multi-layer perceptron layer and a transposed convolution layer, and the multi-layer perceptron layer is composed of an input layer, a hidden layer and an output layer, and the number of neural nodes in the hidden layer is 1024; the mask decoder performs the following operations: first, the hint is given After the result of the hint encoder and the result of the image encoder pass through the cross-attention layer, they learn each other's features and are then standardized. Due to the different dimensions, the result of the hint encoder needs to go through a multi-layer perceptron layer, and then enter a cross-attention layer to learn each other's information. After that, the mask substring and confidence substring are taken out from the result of the hint encoder, and then enter a three-layer multi-layer perceptron layer respectively. The result of the mask substring needs to be multiplied with the result of the transposed convolution of the image encoder, so that the confidence prediction and mask prediction are obtained, so as to perform the next back propagation to optimize the prediction result, and finally obtain the segmented image embedding.
4. The bone marrow cell identification system based on multimodal enhancement according to claim 3, characterized in that: The label text transformation module performs the following operations: 1) Read the source image and corresponding label information from the bone marrow cell dataset; 2) Generate detailed text description of cells based on the image content of the source image and professional cell description knowledge; 3) Inputting the generated coarse-grained and fine-grained text information into the BERT text encoder, which includes text preprocessing and a Transformer encoder; The text preprocessing is to first tokenize the sentences, then substring the sentences and input them into the embedding layer to generate embedding, and then add them with the position embedding and the segment embedding and input them into the Transformer encoder after rearrangement, and finally obtain the output result of unified dimension through rearrangement and normalization, and finally obtain the coarse and fine-grained text feature representation; the Transformer encoder includes a normalization layer, a multi-head attention layer and a multi-layer perceptron layer, which are used to map the text information into a low-dimensional semantic space.
5. The bone marrow cell identification system based on multimodal enhancement according to claim 4, characterized in that: The multimodal alignment module is an improved PMC-CLIP model, including a ViT image encoder, an image-text alignment module, an improved Loss function module and a back-propagation module, wherein: The ViT image encoder generates a corresponding microscope image embedding by passing the input microscope image through the backbone network. The operation is as follows: first, the input microscope image is first subjected to image enhancement. Here, two strategies, random cropping and combined enhancement, are adopted. Random cropping refers to randomly selecting an area from the original image and cropping it to generate a new image. Combined enhancement refers to combining a variety of different enhancement methods to generate richer and more diverse image data. These enhancement methods include contrast enhancement, color enhancement, scale transformation, rotation and flipping, and noise addition. After batch division and projection transformation, it enters an image embedding layer for feature extraction. The extracted features and the position embedding with initial values are reorganized into a feature sequence. This feature sequence is then used as input and processed by a series of Transformer modules. Each Transformer module contains a normalization layer, a multi-head attention layer, and a multi-head perceptron layer, which are used to capture the global dependency between features and perform nonlinear transformation of features. After processing, an embedding representation corresponding to the input microscope image is generated for subsequent tasks. The image-text alignment module uses coarse-grained text similarity embedding and fine-grained text similarity embedding to align with random image similarity embedding, and adds a scale factor to convert the dimensions of text features and image embeddings, so as to obtain text similarity embedding and image similarity embedding, and align them in a high-dimensional semantic space, with the goal of maximizing the semantic relevance between image and text, thereby obtaining an image-text pairing matrix. Finally, the obtained image-text pairing matrix is used for various cross-modal applications; The improved Loss function module is used to calculate the Loss function of the image-text feature matrix. Due to the addition of coarse-grained text information, the Loss function needs to be improved, and the improvement is: total =L graph +λ((1-a)L coarse +aL fine ), where L total Represents the total loss, L coarse represents the coarse-grained text-image loss, L fine represents the fine-grained text-image loss, L graph represents the real image-prediction image loss, L graph , L coarse , L fine It is calculated using the cross entropy function, λ and a are hyperparameters; The back propagation module is used to optimize the model and optimize the model structure according to the result of the Loss function. It calculates the gradient of the loss function and uses the gradient descent algorithm to update the model parameters in the direction of the gradient, so that the output of the model is closer to the true label, that is, the correct image-text pairing is closer, and the incorrect pairing is farther away. Finally, the classification result is obtained through the classification head.
6. The bone marrow cell identification system based on multimodal enhancement according to claim 5, characterized in that: The multimodal alignment module learns useful knowledge from the bone marrow cell dataset and coarse and fine-grained text features to train the improved PMC-CLIP model, including the following steps: 1) Set the number of training times, initial learning rate and batch size, and start training; 2) The images segmented by the improved SAM model are taken as the input image set, and the coarse-grained text features are taken as the input text feature set. A batch size image subset A is randomly selected from the image set, and the corresponding text feature subset B is selected from the text feature set corresponding to the image subset A. Subset A and subset B are aligned one by one in the high-dimensional semantic space, one as the horizontal axis and the other as the vertical axis; 3) Calculate the cross entropy loss so that the difference between the corresponding image and text features is as small as possible, thereby achieving a better image-text alignment effect. At the same time, for the remaining image and text features, the calculated loss is as large as possible; 4) Similar to the coarse-grained text, the same alignment and loss calculation steps are performed on the fine-grained text to ensure the semantic consistency and alignment between the image and the fine-grained text; 5) The improved PMC-CLIP model calculates the loss Loss and back-propagates the updated weights, updates the weights and parameters of the model to minimize the loss function; where Loss is expressed as: L coarse =-(L sup (v,l)+L sup (l,v))) L fine =-(L sup (v,l)+L sup (l,v))) L total =L graph +λ((1-a)L coarse +aL fine ) In the above formula, L total Represents the total loss, L graph represents the real image-prediction image loss, L ce represents the cross entropy loss, L sup Represents the loss of text features-image features, L coarse represents the coarse-grained text-image loss, L fine represents the fine-grained text-image loss; in L graph In the above example, N represents the total number of samples, y i Represents the label information x i One-hot encoding, C(x i ) represents the prediction result, through L graph To calculate the image loss; in L sup , L coarse , L fine , medium, L sup Represents the loss of text features-image features, L coarse represents the coarse-grained text-image loss, L fine represents the fine-grained text-image loss, i is the index, m and n represent the embedded features, represents the transposed m embedding features of the ith index, represents the i-th index n embedding feature transpose; in L ce In, p i represents the predicted probability of the ith cell; in L sup In (m,n), P n (i) represents the positive sample set of the i-th batch, n represents the embedded features, A n (i) represents the negative sample set of the i-th batch, |P(i)| represents the total number of positive samples in the i-th batch, represents one of the samples in a positive sample set, represents one of the samples in a negative sample set, τ represents the temperature parameter in softmax, which will be trained during the training process. sup Can define L coarse and L fine ; in L coarse and L fine In the above example, l and v represent the text feature sample set and image feature sample set respectively, P l (i) represents the positive sample set of the i-th batch of text features, P v (i) represents the positive sample set of the i-th batch of image features, P(i) represents the positive sample set of the i-th batch, A l (i) represents the negative sample set of the i-th batch of text features, A v (i) represents the negative sample set of the i-th batch of image features, and |P l (i)|=|P v (i)|=|P(i)|; During the optimization process, the image features and text features belonging to the same category are placed in P l (i) and P v In (i), the out-of-class features are placed in A v (i) and A l (i) In; at the same time L coarse and L fine It will make the characteristics of samples of the same type closer and the characteristics of samples of different types farther apart; L total The λ in is a hyperparameter used for balanced alignment; a is used to control the contribution rate of coarse-grained text features and fine-grained text features, which is also a hyperparameter.
Citation Information
Patent Citations
Image text retrieval method based on multi-level network
CN114357148A
Bone marrow cell image segmentation method, computer equipment and readable storage medium
CN115527031A
Bone marrow cell detection system based on improved Mask R-CNN
CN117649657A
Cited By
Universal medical image segmentation method based on multi-modal collaborative contrast enhancement
CN119832238A
CLIP-guided multi-modal fusion microscopic identification method
CN120014638A
Transform-based unsupervised cell segmentation method
CN120047460A
High-efficiency fine tuning method for large language model for fine-grained text classification
CN121413692A
Cell image classification method based on morphological semantic guidance
CN121937808A
