Bone marrow cell few-sample classification method and system and electronic equipment
By using a multi-scale multi-modal network model based on text multi-source generation and selection in the classification of bone marrow cells with few samples, combined with the histopathology pre-training model and the multi-source text generation and selection module, the inaccuracy and class description in the classification of bone marrow cells are solved. The problem of fine-grained demand dissatisfaction achieves higher classification accuracy and adaptability.
Patent Information
- Application Number
- CN202410739764.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-07
- Publication Date
- 2024-09-03
- Estimated Expiration
- 2044-06-07
AI Technical Summary
When the existing bone marrow cell few-sample classification method applies the CLIP model, it lacks precise text description and fine-grained feature design of the category, and the pre-training data is greatly different from the bone marrow cell data, resulting in poor classification results.
A multi-scale multi-modal few-sample classification network model based on text multi-source generation selection is adopted, combined with the histopathology pre-training model and the multi-source text generation selection module, to generate more discriminative category text descriptions, and use overall and detailed features Ensemble learning for classification.
It improves the accuracy of small-sample classification of bone marrow cells, adapts to the fine-grained characteristics of bone marrow cells, overcomes the problem of differences between pre-training data and bone marrow cell data, and improves classification performance.
Smart Images

Figure CN118587704A
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer vision technology, and in particular to a method, system and electronic equipment for classifying a small number of bone marrow cell samples. Background Art
[0002] In previous studies on bone marrow cell classification, large datasets were constructed for supervised training. However, labeling bone marrow cells requires enormous manpower and resources. One bone marrow smear generally has 200-300 single cell categories labeled, which requires an experienced doctor to work continuously for more than 4 hours to complete. In actual applications, it is not feasible to collect and label images for each hospital and construct a large dataset for separate training.
[0003] Since many deep learning models have a certain degree of generalization, they use a small amount of labeled data and apply various methods to classify models or data adjustments, that is, perform few-sample classification, which has good classification effects on various data sets. Therefore, in the application of bone marrow cell classification, consider an application scenario: annotate a part of the cell labels for the newly collected images, and construct a labeled few-sample dataset for classification. In this scenario, the few-sample classification task of bone marrow cells is studied to explore the application effect of few-sample classification of bone marrow cells.
[0004] After OpenAI released CLIP, large-scale basic models became a new research hotspot. CLIP uses billions of Internet image-text pairs to build a large multimodal model, aligns images and texts during training, and obtains rich visual language knowledge through contrastive learning. Therefore, it has better generalization performance and shows excellent few-sample classification capabilities on a variety of data sets. However, when applied to the few-sample classification of bone marrow cells, the classification effect is not good. The main problems are:
[0005] (1) Lack of precise text description of categories. In CLIP model training, the category text of natural images is matched with the images after training. In downstream tasks, input text such as "a picture of a dog" can be successfully matched to the image of a dog, thanks to the matching process of text and image in the pre-training stage. However, for categories that have not been pre-trained, such as bone marrow cells, directly using the category text cannot match the image. To this end, it is necessary to generate more general and discriminative text descriptions, such as "the color is blue-purple", "the cell nucleus is located in the center of the image", etc., to accurately match image features and improve model performance;
[0006] (2) The targeted design did not take into account the fine-grained characteristics of bone marrow cells. Bone marrow cell classification is a fine-grained classification task, and fine-grained requirements need to be considered during classification. When classifying a few samples, only the overall image features are focused on, and the image detail features are not paid attention to;
[0007] (3) The pre-training dataset is very different from the bone marrow cell dataset. The CLIP pre-training data is common natural images and does not contain bone marrow cell images. At the same time, natural images and bone marrow cell images are very different, so the good classification ability of the model cannot be inherited in practical applications. Summary of the invention
[0008] In view of this, embodiments of the present invention provide a method, system and electronic device for classifying a small number of bone marrow cell samples with high accuracy.
[0009] An aspect of an embodiment of the present invention provides a method for classifying a small number of bone marrow cells, comprising the following steps:
[0010] Obtain a bone marrow cell dataset and construct a few-sample training set and test set;
[0011] Establishing a multi-scale multi-modal few-sample classification network model based on multi-source text generation and selection; wherein the few-sample classification network model applies a tissue pathology pre-training model, and the few-sample classification network model is added with a multi-source text generation and selection module; the multi-source text generation and selection module is used to generate a category text description of the input network;
[0012] Training the few-sample classification network model according to the few-sample training set to obtain a trained bone marrow cell classification network model;
[0013] The tested bone marrow cell image is input into the bone marrow cell classification network model to obtain the predicted category of the bone marrow cell image, thereby realizing the classification of bone marrow cell images under the condition of few sample training.
[0014] Optionally, the few-sample classification network model includes a text feature extractor, an image feature extractor, and an image-text similarity score calculation module;
[0015] The text feature extractor is used to extract text features using a text-transformer model;
[0016] The image feature extractor is used to extract image features using the ViT-B16 model;
[0017] The image-text similarity score calculation module is used to obtain the text-image similarity score by using the feature point multiplication method;
[0018] The multi-source text generation selection module includes a classification branch of the original image scale and a classification branch of the subject image scale, wherein the subject image is obtained by positioning and segmenting the original image; the classification branch of the original image scale is used to extract the overall features of the image; and the classification branch of the subject image scale is used to extract the detailed features of the image.
[0019] Optionally, the category text description generated by the multi-source text generation selection module includes single text content generated by the GPT-3 large language model, text and image content generated by the GPT-4 large language model, and content supplemented by professional medical knowledge;
[0020] The multi-source text generation selection module adaptively selects text matching the image as the category text description of the input network through a selection function;
[0021] Wherein, the expression of the selection function is:
[0022]
[0023] Wherein, F represents the selection function; α and β represent proportional coefficients; C i Represents the normalized image features of each category; T j Represents each text feature; cos(T i ,T j ) represents the calculation of the cosine similarity between two different texts.
[0024] Optionally, the establishing of a multi-scale multi-modal few-sample classification network model based on text multi-source generation selection comprises the following steps:
[0025] The original image and the corresponding text are sent to the multimodal network for classification, and the prediction results are obtained from the global aspect of the cell image;
[0026] The original image is cut and enlarged to obtain a main image;
[0027] Sending the subject image and the corresponding text into the multimodal network for classification, and obtaining prediction results from the cell image details;
[0028] The classification branch of the original image scale is combined with the classification branch of the subject image scale, and the final classification result is obtained through ensemble learning in the case of few-sample classification.
[0029] Optionally, the whole image extracted by the classification branch of the original image scale is a cell original image, and the cell original image includes a complete cell nucleus, cytoplasm structure and surrounding background environment;
[0030] The main image extracted by the classification branch of the main image scale is the cell nucleus and part of its surrounding environment.
[0031] Optionally, the process of extracting the subject image through the classification branch of the subject image scale comprises the following steps:
[0032] The original image is sent to the image segmentation model SAM to segment the cell nucleus mask, the cell nucleus region in the cell nucleus mask is configured as white, assigned a value of 1, and the rest of the cell nucleus region is configured as black, assigned a value of 0;
[0033] Calculate the maximum connected area of the white area based on the pixels;
[0034] Calculate the rectangle covered by the maximum connected area according to the calculated maximum connected area to obtain a main body positioning frame;
[0035] The original image is cropped according to the coordinates of the subject positioning frame and enlarged to the same size as the original image to obtain a final subject image.
[0036] Optionally, the step of obtaining a bone marrow cell dataset and constructing a small sample training set and a test set comprises the following steps:
[0037] Collect some bone marrow cell images, and label each bone marrow cell, with the labeling category being the bone marrow cell fine-grained category;
[0038] Randomly divide into training set and test set in a ratio of 8:2;
[0039] Randomly select 1, 2, 4, 8, or 16 images of each category in the training set as a training data set for few-sample classification;
[0040] All image formats are unified to obtain the final few-sample training set and test set, and the image format includes image file type and picture size.
[0041] Another aspect of the present invention provides a system for classifying a small number of bone marrow cell samples, including:
[0042] The first module is used to obtain bone marrow cell datasets and construct a few-sample training set and test set;
[0043] The second module is used to establish a multi-scale multi-modal few-sample classification network model based on text multi-source generation selection; wherein the few-sample classification network model applies a tissue pathology pre-training model, and the few-sample classification network model is added with a multi-source text generation selection module; the multi-source text generation selection module is used to generate a category text description of the input network;
[0044] The third module is used to train the few-sample classification network model according to the few-sample training set to obtain a trained bone marrow cell classification network model;
[0045] The fourth module is used to input the tested bone marrow cell image into the bone marrow cell classification network model to obtain the predicted category of the bone marrow cell image and realize the bone marrow cell image classification under the condition of few sample training.
[0046] Another aspect of an embodiment of the present invention further provides an electronic device, including a processor and a memory;
[0047] The memory is used to store programs;
[0048] The processor executes the program to implement the method described above.
[0049] Another aspect of the embodiments of the present invention further provides a computer-readable storage medium, wherein the storage medium stores a program, and the program is executed by a processor to implement the method described above.
[0050] The embodiment of the present invention also discloses a computer program product or a computer program, which includes a computer instruction stored in a computer-readable storage medium. A processor of a computer device can read the computer instruction from the computer-readable storage medium, and the processor executes the computer instruction, so that the computer device executes the above method.
[0051] The embodiment of the present invention obtains a bone marrow cell data set, constructs a few-sample training set and a test set to establish a multi-scale multi-modal few-sample classification network model based on text multi-source generation and selection; wherein the few-sample classification network model applies a tissue pathology pre-training model, and the few-sample classification network model is added with a multi-source text generation and selection module; the multi-source text generation and selection module is used to generate a category text description of the input network; the few-sample classification network model is trained according to the few-sample training set to obtain a trained bone marrow cell classification network model; the tested bone marrow cell image is input into the bone marrow cell classification network model to obtain the predicted category of the bone marrow cell image, and the bone marrow cell image classification is realized under the few-sample training condition. The present invention selects a histopathology pre-training model for bone marrow cell classification, and designs a text multi-source generation and selection module to standardize the semantic description of each category of bone marrow cells, thereby improving the accuracy of few-sample classification of bone marrow cells. BRIEF DESCRIPTION OF THE DRAWINGS
[0052] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0053] Figure 1An overall step flow chart provided for an embodiment of the present invention;
[0054] Figure 2 A schematic diagram of an implementation environment provided for an embodiment of the present invention;
[0055] Figure 3 An implementation flowchart for a specific scenario provided by an embodiment of the present invention;
[0056] Figure 4 A structural diagram of a multi-scale multi-modal few-sample classification network model based on text multi-source generation selection provided by an embodiment of the present invention;
[0057] Figure 5 A structural diagram of a multi-source text generation and selection module in a few-sample classification network model provided in an embodiment of the present invention;
[0058] Figure 6 A schematic diagram of the structure of a system provided by an embodiment of the present invention;
[0059] Figure 7 A schematic diagram of the structure of a computer device provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0060] In order to make the purpose, technical solutions and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the embodiments of the present invention. They are only examples of devices and methods consistent with some aspects of the embodiments of the present invention as detailed in the attached claims.
[0061] It is understood that the terms "first", "second", etc. used in the present invention may be used herein to describe various concepts, but unless otherwise specified, these concepts are not limited by these terms. These terms are only used to distinguish one concept from another. For example, without departing from the scope of the embodiments of the present invention, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information. Depending on the context, the words "if" and "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining".
[0062] The terms "at least one", "multiple", "each", "any", etc. used in the present invention, at least one includes one, two or more, multiple includes two or more, each refers to each of the corresponding multiple, and any refers to any one of the multiple.
[0063] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which the present invention belongs. The terms used herein are only for the purpose of describing the embodiments of the present invention and are not intended to limit the present invention.
[0064] The method for classifying a small number of bone marrow cells provided in an embodiment of the present invention relates to the field of computer vision technology. The method for classifying a small number of bone marrow cells provided in an embodiment of the present invention can be applied to a terminal, can be applied to a server, or can be software running in a terminal or a server. In some embodiments, the terminal can be a smart phone, a tablet computer, a laptop computer, a desktop computer, a smart speaker, a smart watch, and a car terminal, etc., but is not limited to this; the server side can be configured as an independent physical server, or a server cluster or distributed system composed of multiple physical servers, and can also be configured to provide cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms and other basic cloud computing services. The cloud server, the server can also be a node server in a blockchain network; the software can be an application that implements the method for classifying a small number of bone marrow cells, etc., but is not limited to the above forms.
[0065] The present invention can be used in many general or special computer system environments or configurations. For example: personal computers, server computers, handheld or portable devices, tablet devices, multiprocessor systems, microprocessor-based systems, set-top boxes, programmable consumer electronic devices, network PCs, minicomputers, mainframe computers, distributed computing environments including any of the above systems or devices, etc. The present invention can be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. The present invention can also be practiced in distributed computing environments, in which tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules can be located in local and remote computer storage media including storage devices.
[0066] In view of the problems existing in the related existing technologies, the present invention provides a method for classifying bone marrow cells with a small number of samples. The method selects a tissue pathology pre-training model for bone marrow cell classification to improve the overall classification accuracy. A text multi-source generation and selection module is designed to standardize the semantic description of each category of bone marrow cells. The multi-scale idea is applied to combine the overall image and the main image for classification, focusing on the overall features and fine-grained features, thereby improving the accuracy of bone marrow cell classification with a small number of samples.
[0067] Specifically, Figure 1 As shown, a method for classifying a small number of bone marrow cells of the present invention comprises the following steps:
[0068] S100, obtain the bone marrow cell dataset and construct a few-sample training set and test set;
[0069] S200, establishing a multi-scale multi-modal few-sample classification network model based on text multi-source generation selection; wherein the few-sample classification network model applies a tissue pathology pre-training model, and the few-sample classification network model is additionally provided with a multi-source text generation selection module; the multi-source text generation selection module is used to generate a category text description of the input network;
[0070] S300, training the few-sample classification network model according to the few-sample training set to obtain a trained bone marrow cell classification network model;
[0071] S400, inputting the tested bone marrow cell image into the bone marrow cell classification network model to obtain the predicted category of the bone marrow cell image, thereby realizing the classification of the bone marrow cell image under the condition of few-sample training.
[0072] Optionally, the few-sample classification network model includes a text feature extractor, an image feature extractor, and an image-text similarity score calculation module;
[0073] The text feature extractor is used to extract text features using a text-transformer model;
[0074] The image feature extractor is used to extract image features using the ViT-B16 model;
[0075] The image-text similarity score calculation module is used to obtain the text-image similarity score by using the feature point multiplication method;
[0076] The multi-source text generation selection module includes a classification branch of the original image scale and a classification branch of the subject image scale, wherein the subject image is obtained by positioning and segmenting the original image; the classification branch of the original image scale is used to extract the overall features of the image; and the classification branch of the subject image scale is used to extract the detailed features of the image.
[0077] Optionally, the category text description generated by the multi-source text generation selection module includes single text content generated by the GPT-3 large language model, text and image content generated by the GPT-4 large language model, and content supplemented by professional medical knowledge;
[0078] The multi-source text generation selection module adaptively selects text matching the image as the category text description of the input network through a selection function;
[0079] Wherein, the expression of the selection function is:
[0080]
[0081] Wherein, F represents the selection function; α and β represent proportional coefficients; C i Represents the normalized image features of each category; T j Represents each text feature; cos(T i ,T j ) represents the calculation of the cosine similarity between two different texts.
[0082] Optionally, the establishing of a multi-scale multi-modal few-sample classification network model based on text multi-source generation selection comprises the following steps:
[0083] The original image and the corresponding text are sent to the multimodal network for classification, and the prediction results are obtained from the global aspect of the cell image;
[0084] The original image is cut and enlarged to obtain a main image;
[0085] Sending the subject image and the corresponding text into the multimodal network for classification, and obtaining prediction results from the cell image details;
[0086] The classification branch of the original image scale is combined with the classification branch of the subject image scale, and the final classification result is obtained through ensemble learning in the case of few-sample classification.
[0087] Optionally, the whole image extracted by the classification branch of the original image scale is a cell original image, and the cell original image includes a complete cell nucleus, cytoplasm structure and surrounding background environment;
[0088] The main image extracted by the classification branch of the main image scale is the cell nucleus and part of its surrounding environment.
[0089] Optionally, the process of extracting the subject image through the classification branch of the subject image scale comprises the following steps:
[0090] The original image is sent to the image segmentation model SAM to segment the cell nucleus mask, the cell nucleus region in the cell nucleus mask is configured as white, assigned a value of 1, and the rest of the cell nucleus region is configured as black, assigned a value of 0;
[0091] Calculate the maximum connected area of the white area based on the pixels;
[0092] Calculate the rectangle covered by the maximum connected area according to the calculated maximum connected area to obtain a main body positioning frame;
[0093] The original image is cropped according to the coordinates of the subject positioning frame and enlarged to the same size as the original image to obtain a final subject image.
[0094] Optionally, the step of obtaining a bone marrow cell dataset and constructing a small sample training set and a test set comprises the following steps:
[0095] Collect some bone marrow cell images, and label each bone marrow cell, with the labeling category being the bone marrow cell fine-grained category;
[0096] Randomly divide into training set and test set in a ratio of 8:2;
[0097] Randomly select 1, 2, 4, 8, or 16 images of each category in the training set as a training data set for few-sample classification;
[0098] All image formats are unified to obtain the final few-sample training set and test set, and the image format includes image file type and picture size.
[0099] The following describes the specific implementation process of the present invention in detail by taking a specific application scenario as an example:
[0100] like Figure 2 As shown, the training environment of the bone marrow cell few-sample classification method provided by the embodiment of the present invention can be applied to Figure 2 In the application environment shown in 202, a labeled bone marrow cell few sample image is input into a computer device 201, and the computer device 201 first processes the data set to obtain a processed few sample data set. Then the computer device 201 trains the multi-scale multi-modal few sample classification network model based on text multi-source generation selection through the training set to obtain a trained multi-scale multi-modal few sample classification network based on text multi-source generation selection, and inputs the random bone marrow cell image of the test set into the multi-scale multi-modal few sample classification network based on text multi-source generation selection trained in the computer device 201 to obtain the cell category prediction result corresponding to the bone marrow cell image, and realize cell classification; wherein, the computer device in 202 can be a terminal or a server, and the terminal can be but not limited to various personal computers, laptops, smart phones, tablet computers and portable wearable devices. The server can be implemented with an independent server or a server cluster composed of multiple servers.
[0101] In one embodiment, Figure 3 As shown, a method for classifying a small number of bone marrow cells is provided, comprising the following steps:
[0102] S201: Obtain a data set and process the data set.
[0103] Optionally, step S201 specifically includes:
[0104] S2011. Collect and annotate datasets.
[0105] According to the clinical test standards, this example collected bone marrow smears stained with Wright stain from some newly diagnosed leukemia patients and bone marrow transplant donors in the hospital. All smears were collected from the subjects when they underwent disease examinations in the hospital and were included in the hospital database. The subjects were not specially recruited for collection. All data have been desensitized, do not contain the identity information of the subjects, and no patient tracking is performed.
[0106] It should be noted that in various specific embodiments of the present invention, when it comes to the need to perform relevant processing based on data related to user identity or characteristics such as user information, user behavior data, user historical data, and user location information, the user's permission or consent will be obtained first, and the collection, use, and processing of these data will comply with relevant laws, regulations, and standards. In addition, when the embodiment of the present invention needs to obtain the user's sensitive personal information, it will obtain the user's separate permission or consent through a pop-up window or jump to a confirmation page, and after clearly obtaining the user's separate permission or consent, it will obtain the necessary user-related data for the normal operation of the embodiment of the present invention.
[0107] In order to construct a fine-grained classification dataset of bone marrow cells, this embodiment crops a single cell from the original image and labels each cropped bone marrow cell by category. Based on the diagnostic criteria for acute leukemia and the development and evolution of bone marrow cells, and referring to the actual number of cells collected, this embodiment finally constructed a bone marrow cell dataset of 19 categories, with a total of 22,201 cell images.
[0108] S2012. Preprocess the data set to obtain a preprocessed few-sample data set.
[0109] Preprocessing of the data set: Unify the image format of all bone marrow cells in the data set. The image format includes the image file type and the image size. The image type is jpg file and the unified image size is 224×224.
[0110] The dataset is randomly divided into a total training set and a test set in a ratio of 8:2. In the overall training set, 1, 2, 4, 8, and 16 images of each category are randomly selected as the training dataset for few-sample classification.
[0111] S202. Establish a multi-scale multi-modal few-sample classification network model based on text multi-source generation selection.
[0112] like Figure 4As shown in the figure, the multi-scale multi-modal few-shot classification network model based on text multi-source generation selection is built on the basis of the multi-modal large model CLIP.
[0113] The CLIP model consists of three parts: text feature extractor, image feature extractor, and image-text similarity score calculation. The text feature extractor uses text-transformer to extract text features; the image feature extractor uses ViT-B16 to extract image features; and the feature point multiplication method is used to obtain the text and image similarity scores.
[0114] Use the pre-trained model Quilt-Net trained on histopathology images and text, freeze the text feature extractor and image feature extractor, and only train the network's classifier.
[0115] The few-sample classification network model of this embodiment first adds a text multi-source generation and selection module to generate a more extensive and accurate text description, such as Figure 5 As shown, the structure includes two parts: multi-source text generation and text sorting selection.
[0116] When generating text, three approaches are selected: GPT-3 single text generation, professional medical knowledge supplementation, and GPT-4 text and image generation to generate a wide range of category text descriptions.
[0117] The questions input to GPT-3 are mainly divided into general description and specific description. In the general description, we hope that GPT-3 can give a complete description of a certain type of cells. In the specific description, we focus on the detailed description and hope that GPT-3 can give a description of the specific color, size, and texture characteristics of a certain type of cells. In professional medicine, we collect descriptions of various types of cells from some medical examination atlas books. In the input questions of GPT-4, we input cell images in the data set, and assume that GPT-4 is a professional microscopic pathologist, and hope that it can give a visual description.
[0118] In the text sorting selection part, the text and image are sorted according to their similarity and the best matching text is adaptively selected.
[0119] First, the image features and text features are multiplied in pairs to obtain the corresponding image and text features. Then, according to the category of the image features, the features of images of the same category are added to obtain the corresponding total category image and text features. Subsequently, the elements in the matrix are normalized by column, and the original elements are converted into the proportion they occupy in the 19 categories. At this time, the normalized image and text features of all texts corresponding to each category of images are obtained for subsequent sorting and selection.
[0120] Submodule optimization is used to select the final set. The score function during selection is shown below, which also promotes the selection of more discriminative and differentiated text sets.
[0121]
[0122] In addition, the few-sample classification network model of this embodiment also applies the multi-scale idea. The branches of the original image and the subject image at two scales focus on both the global features and the fine-grained features of the cells. The specific process is as follows:
[0123] The original image and the corresponding text are sent to the multimodal network for classification, and the prediction results are obtained from the global aspect of the cell image;
[0124] The original image was cropped and enlarged to obtain the main image, which mainly includes the cell nucleus and its surroundings;
[0125] The subject image and the corresponding text are fed into a multimodal network for classification, and prediction results are obtained from the details of the cell image;
[0126] The overall image classification branch is combined with the main image classification branch, and the final classification result is obtained through ensemble learning in the case of few-sample classification.
[0127] Among them, the whole image is the original image of the cell, including the complete cell nucleus and cytoplasm structure, and also contains a lot of surrounding background environment; the main image is the cell nucleus and a small part of its surroundings, which comes from the original image after being cropped and enlarged. There is only the cell nucleus in the image, and the aggregation of chromatin inside the cell nucleus can be observed. It contains more detailed information and is not affected by the surrounding environment. The specific acquisition process is as follows:
[0128] The original image is sent to the image segmentation model SAM, and the segmentation model segments the cell nucleus mask. The cell nucleus area in the cell nucleus mask is white and assigned a value of 1, and the rest is black and assigned a value of 0;
[0129] The cell nucleus in the central area is the largest area, so the maximum connected area of the white area is calculated based on the pixels;
[0130] Calculate the rectangle covered by the calculated maximum connected area to obtain the main body positioning frame;
[0131] The original image is cropped according to the coordinates of the subject positioning frame and enlarged to the same size as the original image to obtain the final subject image.
[0132] S203: Using the bone marrow cell few-sample data set, the few-sample classification network model is trained to obtain a trained few-sample classification network model.
[0133] The specific steps of training the few-sample classification network model in this embodiment are as follows:
[0134] (1) Network initialization: Import the Quit-Net pre-training parameters and randomly initialize the parameters of the remaining network structures;
[0135] (2) Setting network parameters: The learning rate is set to 0.01, the number of samples in each batch in training is 32, a total of 50 epochs are trained, the Adam optimizer is used, the momentum is set to 0.9, and the weight decay coefficient is 1e-3. In the linear prediction of the CLIP model, the sklearn linear classifier is used, and multiple experiments are performed to select the C parameter value in the function, and the best performance on the test set is recorded.
[0136] (3) Load the few-sample training dataset into the network.
[0137] (4) Preprocessing the training images: Preprocess the images in the bone marrow cell few-sample dataset by performing online data enhancement on the images through three methods: random vertical flipping, random rotation, and color perturbation.
[0138] (5) Training the model: Figure 3 The few-shot classification network shown is iteratively trained as follows:
[0139] Input image is I total , the selected text T total , at this time I total , T total The input data to be sent to the network is obtained through the text feature extractor. The image features are obtained by the image feature extractor Calculate the feature similarity score G of text features and image features total , the calculation formula is shown below.
[0140]
[0141] The feature similarity score G total The data is sent to the classifier for classification into 19 categories. The classifier learns the weight for each class. After the training is completed, the classifier gives the category prediction probability P total , the category prediction probability and the true image label y are used to calculate the loss function. The loss function calculation formula is shown below.
[0142] L total =CE(P total ,y)
[0143] The main input image is the original image I total The main part image I obtained after segmentation and processing local , the selected text T local , the text features are obtained through the text feature extractor The image features are obtained by the image feature extractor Calculate the feature similarity score G of text features and image features local , the calculation formula is as follows.
[0144]
[0145] The feature similarity score G local The classifier is sent to the classifier for classification into 19 categories. The classifier is set in the same way as the overall part, and the category prediction probability P is obtained. local , the category prediction probability and the true image label y calculate the loss function. The loss function calculation formula is as follows, CE is the cross entropy loss.
[0146] L local =CE(P local ,y)
[0147] The total loss function is shown below, where α and β are hyperparameters of different branches.
[0148] L=αL total +βL local =αCE(P total ,y)+βCE(P local ,y) (4-5)
[0149] S204, inputting the bone marrow cell images of the test set into the trained multi-scale multi-modal few-sample classification network model based on text multi-source generation selection to obtain the predicted category of the bone marrow cell images, thereby realizing the classification of the bone marrow cell images.
[0150] The bone marrow cell image of the test set is input, and after feature extraction and calculation, the predicted probability distribution P of the two branches is obtained respectively. total , P local , the total predicted probability P is P total , P local The sum of the two categories is then used to select the position with the largest category prediction probability P as the final predicted category of the test image.
[0151] This embodiment is tested on a test bone marrow cell dataset. The trained few-sample classification network model is used to predict the category of random bone marrow cell images, and then the classification effect of the few-sample classification network is quantitatively measured by the accuracy of the category prediction. The accuracy rate calculates the proportion of the number of correctly predicted images in all the test bone marrow cell images, which can explicitly show the prediction effect of the network on the target bone marrow cell image.
[0152] In the experiment, a consistent pre-trained model and feature extractor were used to randomly select the few-sample data set 10 times, and the average results on the test set were recorded. The experimental results are shown in Table 1, which is used to describe the accuracy of bone marrow cell few-sample classification.
[0153] Table 1
[0154] Model 1shot 2shot 4shot 8shot 16shot CLIP Linear Mapping 18.570 24.663 30.126 35.049 42.963 The few-sample classification network model in this embodiment 25.458 29.586 35.049 38.214 43.085
[0155] It can be seen from Table 1 that the performance of this embodiment is better than that of CLIP linear mapping. By comparing the experimental results, it is found that the network proposed in the present invention can improve the accuracy of few-sample classification. When the sample size is smaller, such as 1 shot, the improvement effect is best. When the amount of data increases, the improvement of the model accuracy is limited.
[0156] like Figure 6 As shown, this embodiment provides a bone marrow cell few-sample classification system, which includes a data set acquisition unit 601, a model building unit 602, a model training unit 603 and a classification prediction unit 604. The specific functions of each unit are as follows:
[0157] A data set acquisition unit 601 is used to acquire and process a data set, wherein the data set includes a small sample training data set and a test data set;
[0158] A model building unit 602 is used to build a multi-scale multi-modal few-sample classification network model based on text multi-source generation and selection. The few-sample classification network model is based on the CLIP network, applies a tissue pathology pre-training model, adds a text multi-source generation and selection module, and includes classification branches at two scales: original image and subject image.
[0159] A model training unit 603 is used to train the few-sample classification network model using the bone marrow cell few-sample data set to obtain a trained few-sample classification network model;
[0160] The classification prediction unit 604 is used to input the bone marrow cell images in the test set into the trained bone marrow cell few-sample classification network model to obtain the predicted category of the bone marrow cell image and implement bone marrow cell image classification.
[0161] It can be understood that the contents of the above method embodiments are all applicable to the present system embodiments, the functions specifically implemented by the present system embodiments are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those achieved by the above method embodiments.
[0162] This embodiment provides a computer device, which may be a computer, such as Figure 7As shown, it comprises a processor 702, a memory, an input device 703, a display device 704 and a network interface 705 connected via a system bus 701. The processor is used to provide computing and control capabilities. The memory comprises a non-volatile storage medium 706 and an internal memory 707. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory 707 provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. When the processor 702 executes the computer program stored in the memory, the above-mentioned bone marrow cell classification method is implemented.
[0163] It can be understood that the contents of the above method embodiments are all applicable to the present device embodiments, the functions specifically implemented by the present device embodiments are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those achieved by the above method embodiments.
[0164] An embodiment of the present invention further provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, the above-mentioned method for classifying a small number of bone marrow cells is implemented.
[0165] It can be understood that the contents of the above method embodiments are all applicable to the present storage medium embodiments, the functions specifically implemented by the present storage medium embodiments are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those achieved by the above method embodiments.
[0166] The memory, as a non-transient computer-readable storage medium, can be used to store non-transient software programs and non-transient computer executable programs. In addition, the memory may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some embodiments, the memory may optionally include a memory remotely disposed relative to the processor, and these remote memories may be connected to the processor via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0167] In some selectable embodiments, the function / operation mentioned in the block diagram may not occur in the order mentioned in the operation diagram. For example, depending on the function / operation involved, the two boxes shown in succession can actually be executed substantially simultaneously or the boxes can sometimes be executed in reverse order. In addition, the embodiment presented and described in the flow chart of the present invention is provided by way of example, for the purpose of providing a more comprehensive understanding of technology. The disclosed method is not limited to the operation and logic flow presented herein. Selectable embodiments are expected, wherein the order of various operations is changed and the sub-operation of a part for which is described as a larger operation is performed independently.
[0168] In addition, although the present invention is described in the context of functional modules, it should be understood that, unless otherwise specified, one or more of the functions and / or features described may be integrated into a single physical device and / or software module, or one or more functions and / or features may be implemented in separate physical devices or software modules. It is also understood that a detailed discussion of the actual implementation of each module is unnecessary for understanding the present invention. More specifically, in view of the properties, functions, and internal relationships of the various functional modules in the device disclosed herein, the actual implementation of the module will be understood within the conventional skills of the engineer. Therefore, those skilled in the art can implement the present invention set forth in the claims without excessive experimentation using ordinary techniques. It is also understood that the specific concepts disclosed are merely illustrative and are not intended to limit the scope of the present invention, which is determined by the full scope of the appended claims and their equivalents.
[0169] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc., which can store program codes.
[0170] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as an ordered list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by an instruction execution system, device or apparatus (such as a computer-based system, a system including a processor, or other system that can fetch instructions from an instruction execution system, device or apparatus and execute instructions), or in conjunction with such instruction execution systems, devices or apparatuses. For the purposes of this specification, "computer-readable medium" can be any device that can contain, store, communicate, propagate or transmit a program for use by an instruction execution system, device or apparatus, or in conjunction with such instruction execution systems, devices or apparatuses.
[0171] More specific examples of computer-readable media (a non-exhaustive list) include the following: an electrical connection with one or more wires (electronic device), a portable computer disk case (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable and programmable read-only memory (EPROM or flash memory), an optical fiber device, and a portable compact disk read-only memory (CDROM). In addition, the computer-readable medium may even be a paper or other suitable medium on which the program is printed, since the program may be obtained electronically, for example, by optically scanning the paper or other medium, followed by editing, deciphering or, if necessary, processing in another suitable manner, and then stored in a computer memory.
[0172] It should be understood that the various parts of the present invention can be implemented by hardware, software, firmware or a combination thereof. In the above-mentioned embodiments, a plurality of steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented by hardware, as in another embodiment, it can be implemented by any one of the following technologies known in the art or their combination: a discrete logic circuit having a logic gate circuit for implementing a logic function for a data signal, a dedicated integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.
[0173] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "examples", "specific examples", or "some examples" means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner.
[0174] Although the embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the claims and their equivalents.
[0175] The above is a specific description of the preferred implementation of the present invention, but the present invention is not limited to the described embodiments. Those skilled in the art may make various equivalent modifications or substitutions without violating the spirit of the present invention. These equivalent modifications or substitutions are all included in the scope defined by the claims of the present invention.
Claims
1. A method for classifying a small number of bone marrow cells, characterized in that: The following steps are involved: Obtain a bone marrow cell dataset and construct a few-sample training set and test set; Establishing a multi-scale multi-modal few-sample classification network model based on multi-source text generation and selection; wherein the few-sample classification network model applies a tissue pathology pre-training model, and the few-sample classification network model is added with a multi-source text generation and selection module; the multi-source text generation and selection module is used to generate a category text description of the input network; Training the few-sample classification network model according to the few-sample training set to obtain a trained bone marrow cell classification network model; The tested bone marrow cell image is input into the bone marrow cell classification network model to obtain the predicted category of the bone marrow cell image, thereby realizing the classification of bone marrow cell images under the condition of few sample training.
2. A method for classifying a small number of bone marrow cells according to claim 1, characterized in that: The few-sample classification network model includes a text feature extractor, an image feature extractor, and an image-text similarity score calculation module; The text feature extractor is used to extract text features using a text-transformer model; The image feature extractor is used to extract image features using the ViT-B16 model; The image-text similarity score calculation module is used to obtain the text-image similarity score by using the feature point multiplication method; The multi-source text generation and selection module includes a classification branch of the original image scale and a classification branch of the subject image scale, wherein the subject image is obtained by positioning and segmenting the original image; the classification branch of the original image scale is used to extract the overall features of the image; The subject image scale classification branch is used to extract detail features of the image.
3. A method for classifying a small number of bone marrow cells according to claim 1, characterized in that: The category text description generated by the multi-source text generation selection module includes single text content generated by the GPT-3 large language model, text and image content generated by the GPT-4 large language model, and content supplemented by professional medical knowledge; The multi-source text generation selection module adaptively selects text matching the image as the category text description of the input network through a selection function; Wherein, the expression of the selection function is: Wherein, F represents the selection function; α and β represent proportional coefficients; C i Normalized image features representing each category; T j Represents each text feature; cos(T i ,T j ) represents the calculation of the cosine similarity between two different texts.
4. A method for classifying a small number of bone marrow cells according to claim 1, characterized in that: The method of establishing a multi-scale multi-modal few-sample classification network model based on text multi-source generation selection includes the following steps: The original image and the corresponding text are sent to the multimodal network for classification, and the prediction results are obtained from the global aspect of the cell image; The original image is cut and enlarged to obtain a main image; Sending the subject image and the corresponding text into the multimodal network for classification, and obtaining prediction results from the cell image details; The classification branch of the original image scale is combined with the classification branch of the subject image scale, and the final classification result is obtained through ensemble learning in the case of few-sample classification.
5. A method for classifying a small number of bone marrow cells according to claim 4, characterized in that: The whole image extracted by the classification branch of the original image scale is the original cell image, and the original cell image includes a complete cell nucleus, cytoplasm structure and surrounding background environment; The main image extracted by the classification branch of the main image scale is the cell nucleus and part of its surrounding environment.
6. A method for classifying a small number of bone marrow cells according to claim 5, characterized in that: The process of extracting the subject image through the classification branch of the subject image scale includes the following steps: The original image is sent to the image segmentation model SAM to segment the cell nucleus mask, the cell nucleus region in the cell nucleus mask is configured as white, assigned a value of 1, and the rest of the cell nucleus region is configured as black, assigned a value of 0; Calculate the maximum connected area of the white area based on the pixels; Calculate the rectangle covered by the maximum connected area according to the calculated maximum connected area to obtain a main body positioning frame; The original image is cropped according to the coordinates of the subject positioning frame and enlarged to the same size as the original image to obtain a final subject image.
7. A method for classifying a small number of bone marrow cells according to any one of claims 1 to 6, characterized in that: The method of obtaining a bone marrow cell dataset and constructing a small sample training set and a test set includes the following steps: Collect some bone marrow cell images, and label each bone marrow cell, with the labeling category being the bone marrow cell fine-grained category; Randomly divide into training set and test set in a ratio of 8:2; Randomly select 1, 2, 4, 8, or 16 images of each category in the training set as a training data set for few-sample classification; All image formats are unified to obtain the final few-sample training set and test set, and the image format includes image file type and picture size.
8. A bone marrow cell small sample classification system, characterized in that: include: The first module is used to obtain bone marrow cell datasets and construct a few-sample training set and test set; The second module is used to establish a multi-scale multi-modal few-sample classification network model based on text multi-source generation selection; wherein the few-sample classification network model applies a tissue pathology pre-training model, and the few-sample classification network model is added with a multi-source text generation selection module; the multi-source text generation selection module is used to generate a category text description of the input network; The third module is used to train the few-sample classification network model according to the few-sample training set to obtain a trained bone marrow cell classification network model; The fourth module is used to input the tested bone marrow cell image into the bone marrow cell classification network model to obtain the predicted category of the bone marrow cell image and realize the bone marrow cell image classification under the condition of few sample training.
9. An electronic device, characterized in that: including a processor and a memory; The memory is used to store programs; The processor executes the program to implement the method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: The storage medium stores a program, and the program is executed by a processor to implement the method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Bone marrow cell fine granularity classification method and system, computer equipment and storage medium
CN114580510A
Cell cluster classification and identification method and device, electronic equipment and storage medium
CN117173697A
System and method for TCR sequence identification and / or classification
WO2024018467A1
Cited By
Low-resource biomedical image classification method based on double-branch visual semantic collaboration
CN122435354A
