Image segmentation method and device based on artificial intelligence, equipment and medium
Through the method of training the first MRI brain image set and updating the model parameters, the problem of manual labeling is solved in medical image segmentation, the improvement of model detection performance and cost reduction are achieved, and the auxiliary diagnosis and treatment effect of digital medical care is improved.
Patent Information
- Application Number
- CN202411716627.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-26
- Publication Date
- 2025-03-18
- Estimated Expiration
- 2044-11-26
AI Technical Summary
In the prior art, the accuracy requirements of medical image segmentation tasks are extremely high, resulting in the manual labeling process taking time, low efficiency and high cost. How to reduce the use of manual labeling and improve the model detection performance during the training model has become an urgent problem.
By obtaining the first MRI brain image set, the preset first model is trained, and then the parameters of its training in the last N iterations are averaged to obtain the second model parameters and update the second model. Use the updated second model to perform image segmentation, classification prediction and clustering of target MRI brain images to achieve image segmentation.
It realizes the use of manual labeling during the training model, improves model detection performance, reduces the high cost and low efficiency problems caused by manual labeling, and improves the application effect of digital medical care in auxiliary diagnosis and treatment.
Smart Images

Figure CN119648713A_ABST
Abstract
Description
Technical Field
[0001] The present application is applicable to the field of digital medical technology, and in particular relates to an image segmentation method, device, equipment and medium based on artificial intelligence. Background Art
[0002] With the development of digital medical technology, the use of advanced instruments to collect corresponding human body images to assist doctors in diagnosis has become an integral part of the medical process. Among them, medical image segmentation is an important part of the digital processing of medical images. The current deep neural network technology is often used in image processing to achieve image segmentation. Medical images refer to internal tissues obtained in a non-invasive manner for medical treatment or medical research, such as images of the stomach, abdomen, heart, knees, and brain, such as computed tomography (CT) imaging, magnetic resonance imaging (MRI), ultrasound (US) imaging, X-ray imaging, electroencephalogram, and optical photography. Images generated by medical instruments. In the medical process, MRI images of the brain are often used to detect whether there are lesions in the brain. They can diagnose low-grade astrocytoma, ganglion, arteriovenous malformation and other diseases in the brain with a high accuracy rate. The labels of MRI images used for deep neural network training need to be manually labeled by experts. Due to the extremely high accuracy requirements of medical image segmentation tasks, the labeling process takes a long time, is inefficient, and has high costs. Therefore, how to reduce the use of manual annotation in the process of model training and reduce the impact of high cost and low efficiency caused by manual annotation while improving model detection performance has become an urgent problem to be solved. Summary of the invention
[0003] In view of this, the embodiments of the present application provide an artificial intelligence-based image segmentation method, device, equipment and medium to solve the problem of how to reduce the use of manual annotation in the model training process, and reduce the impact of problems such as high cost and low efficiency caused by manual annotation while improving model detection performance.
[0004] In a first aspect, an embodiment of the present application provides an image segmentation method based on artificial intelligence, the image segmentation method comprising: Acquire a first MRI brain image set and a target MRI brain image to be segmented, and use the first MRI brain image set to train a preset first model to obtain a trained first model, wherein the first MRI brain image set includes at least one first MRI brain image and a preset segmentation category matrix corresponding to each first MRI brain image at each pixel position; Obtaining first model parameters of the trained first model during the last N iterations of training, averaging the first model parameters during the N iterations of training to obtain second model parameters corresponding to the first model parameters, and using the second model parameters to update a preset second model to obtain an updated second model, wherein the first model has the same structure as the second model, and N is an integer greater than zero; Using the updated second model to segment the target MRI brain image to obtain M sub-images, and performing classification prediction on each sub-image to obtain a target classification category of the corresponding sub-image, where M is an integer greater than zero; The sub-images with adjacent pixel positions and the same target classification category in the target MRI brain image are clustered to obtain clustering results of all sub-images, and the target MRI brain image is segmented based on the clustering results to obtain corresponding segmentation results.
[0005] In a second aspect, an embodiment of the present application provides an image segmentation method based on artificial intelligence, wherein the image segmentation device comprises: A first model training module is used to obtain a first MRI brain image set and a target MRI brain image to be segmented, and use the first MRI brain image set to train a preset first model to obtain a trained first model, wherein the first MRI brain image set includes at least one first MRI brain image and a preset segmentation category matrix corresponding to each first MRI brain image at each pixel position; A second model updating module is used to obtain first model parameters of the trained first model during the last N iterations of training, average the first model parameters during the N iterations of training to obtain second model parameters corresponding to the first model parameters, and use the second model parameters to update a preset second model to obtain an updated second model, wherein the first model has the same structure as the second model, and N is an integer greater than zero; A classification prediction module, configured to use the updated second model to segment the target MRI brain image to obtain M sub-images, and perform classification prediction on each sub-image to obtain a target classification category of the corresponding sub-image, where M is an integer greater than zero; The image segmentation module is used to cluster sub-images with adjacent pixel positions and the same target classification category in the target MRI brain image to obtain clustering results of all sub-images, and segment the target MRI brain image based on the clustering results to obtain corresponding segmentation results.
[0006] In a third aspect, an embodiment of the present application provides a computer device, comprising a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein the processor implements the image segmentation method as described in the first aspect when executing the computer program.
[0007] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the image segmentation method as described in the first aspect is implemented.
[0008] Compared with the prior art, the embodiments of the present application have the following beneficial effects: the present application obtains a first MRI brain image set and a target MRI brain image to be segmented, uses the first MRI brain image set to train a preset first model to obtain a trained first model, obtains first model parameters of the trained first model during the last N iterations of training, averages the first model parameters during the N iterations of training to obtain second model parameters corresponding to the first model parameters, uses the second model parameters to update the preset second model to obtain an updated second model, uses the updated second model to segment the target MRI brain image to obtain M sub-images, and performs classification prediction on each sub-image to obtain a target classification category of the corresponding sub-image, clusters sub-images with adjacent pixel positions and the same target classification category in the target MRI brain image to obtain clustering results of all sub-images, segments the target MRI brain image based on the clustering results to obtain corresponding segmentation results, implements an image training model using less annotations, updates the model for image segmentation by means of parameter optimization, and then implements model training and uses it for MRI brain image segmentation, reduces the impact of problems such as high cost and low efficiency caused by manual annotation, and helps to improve the application effect of digital medicine in auxiliary diagnosis and treatment. BRIEF DESCRIPTION OF THE DRAWINGS
[0009] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0010] Figure 1 This is a schematic diagram of an application environment of an image segmentation method based on artificial intelligence provided in Example 1 of the present application; Figure 2 It is a flowchart of an image segmentation method based on artificial intelligence provided in Example 2 of the present application; Figure 3It is a flowchart of an image segmentation method based on artificial intelligence provided in Example 3 of the present application; Figure 4 It is a structural schematic diagram of an image segmentation method based on artificial intelligence provided in Embodiment 4 of the present application; Figure 5 It is a structural diagram of a computer device provided in Example 5 of the present application. DETAILED DESCRIPTION
[0011] In the following description, specific details such as specific system structures, technologies, etc. are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present application. However, it should be clear to those skilled in the art that the present application may also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to prevent unnecessary details from obstructing the description of the present application.
[0012] It should be understood that when used in the present specification and the appended claims, the term "comprising" indicates the presence of described features, wholes, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or combinations thereof.
[0013] It should also be understood that the term “and / or” used in the specification and appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes these combinations.
[0014] As used in the specification and appended claims of this application, the term "if" can be interpreted as "when" or "uponce" or "in response to determining" or "in response to detecting", depending on the context. Similarly, the phrase "if it is determined" or "if [described condition or event] is detected" can be interpreted as meaning "uponce it is determined" or "in response to determining" or "uponce [described condition or event] is detected" or "in response to detecting [described condition or event]", depending on the context.
[0015] In addition, in the description of the present application specification and the appended claims, the terms "first", "second", "third", etc. are only used to distinguish the descriptions and cannot be understood as indicating or implying relative importance.
[0016] References to "one embodiment" or "some embodiments" etc. described in the specification of this application mean that one or more embodiments of the present application include specific features, structures or characteristics described in conjunction with the embodiment. Therefore, the statements "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. that appear in different places in this specification do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways. The terms "including", "comprising", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized in other ways.
[0017] The embodiments of the present application can acquire and process relevant data based on artificial intelligence technology. Artificial Intelligence (AI) is the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results.
[0018] AI basic technologies generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing technology, operation / interaction systems, mechatronics, etc. AI software technologies mainly include computer vision technology, robotics technology, biometrics technology, speech processing technology, natural language processing technology, and machine learning / deep learning.
[0019] It should be understood that the size of the serial numbers of the steps in the following embodiments does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.
[0020] In order to illustrate the technical solution of the present application, a specific embodiment is provided below for illustration.
[0021] The first embodiment of the present application provides an image segmentation method based on artificial intelligence, which can be applied in the following aspects: Figure 1 In the application environment, the client communicates with the server. The client includes but is not limited to PDAs, desktop computers, laptops, ultra-mobile personal computers (UMPCs), netbooks, cloud computing devices, personal digital assistants (PDAs), and other computer devices. The server can be implemented with an independent server or a server cluster consisting of multiple servers.
[0022] See also Figure 2, is a flow chart of an image segmentation method based on artificial intelligence provided in the second embodiment of the present application, wherein the image segmentation method based on artificial intelligence is applied to Figure 1 The server in the server, the computer device corresponding to the server connects to the corresponding database to obtain the MRI brain image and other data stored in the database.
[0023] The computer device corresponding to the server of the present application can also be connected to the corresponding client, which is operated by the user, and the user can provide the target MRI brain image to be segmented to the server through the client. For example, the server, the client, the database, etc. are connected to form a medical system, in which the server and the database are the background of the medical system, and the client is an application running on the doctor's computer, so that the doctor can send the MRI brain image to be segmented to the background, and the server performs segmentation processing and other operations.
[0024] like Figure 2 As shown, the image segmentation method may include the following steps: Step S201, obtaining a first MRI brain image set and a target MRI brain image to be segmented, and using the first MRI brain image set to train a preset first model to obtain a trained first model.
[0025] In the present application, the first MRI brain image set includes at least one first MRI brain image and a preset segmentation category matrix corresponding to each first MRI brain image at each pixel position, that is, for any MRI brain image, each pixel point corresponds to a segmentation category. If the entire image is expressed in matrix form, the element is the pixel point, then the value of the category corresponding to the pixel point can be used as the element value of the element corresponding to the pixel point.
[0026] For example, a left and right area is defined for an MRI brain image, the left area is the lesion class, and the right area is the non-lesion class. So far, the segmentation category corresponding to all the pixels in the left area is the lesion class, and the segmentation category corresponding to all the pixels in the right area is the non-lesion class. In this regard, if the lesion class is assigned a value of 1 and the non-lesion class is assigned a value of 0, the number of pixel rows and pixel columns of the MRI brain image constitute the number of matrix rows and columns, where the element corresponding to the pixel value of the lesion class is 1, and the element corresponding to the pixel value of the non-lesion class is 0.
[0027] The first MRI brain image set includes MRI brain images and corresponding segmentation category matrices, that is, MRI brain images are used as training samples, and the segmentation category matrix is used as the annotation result of the training samples. The preset first model is a segmentation model, that is, a model that can segment images. The input of the model is the MRI brain image, and the output is the segmentation result. The above-mentioned training samples are input into the first model, the segmentation result is output, and the loss is calculated for the segmentation result and the annotation result, and then the parameters of the first model are adjusted until the loss meets the conditions or the number of iterations meets the conditions, and the trained first model can be obtained.
[0028] The above training process is a supervised training process. Although labeled training samples are used, since the first model is not the final model but a lightweight model, a large number of samples are not required. However, the final model parameters have a certain ability to segment MRI brain images.
[0029] Step S202, obtain the first model parameters of the trained first model during the last N iterative trainings, average the first model parameters during the N iterative trainings to obtain second model parameters corresponding to the first model parameters, and use the second model parameters to update the preset second model to obtain an updated second model.
[0030] In the present application, the first model parameters represent the set of all parameters supporting the operation of all models in the first model. The first model has undergone multiple iterative calculations during the training process, and the first model parameters corresponding to the last N iterative trainings are recorded, where N is an integer greater than zero.
[0031] The first model parameters corresponding to N iterative trainings are averaged to obtain an averaged result, wherein, for any target parameter in the first model parameters, the target parameters during N iterative trainings are averaged to obtain the target parameter average result, and all target parameters are traversed to obtain a target parameter average result set. Since the first model and the second model have the same structure, the target parameter average result forms the second model parameter. For example, for the convolutional layer parameters of the encoder in the first model, the values of the convolutional layer parameters in the last three iterative trainings are 0.1, 0.11, and 0.105, respectively, and the average is 0.105, which can be used as the convolutional layer parameters of the encoder in the second model, i.e., the second model parameters.
[0032] In the present application, each target parameter in the first model parameters corresponds to a parameter label, and accordingly, the parameter label of each target parameter in the second model parameters is the same as the parameter label of the corresponding target parameter when averaging. Since the structures of the first model and the second model are the same, accordingly, the position of the corresponding target parameter in the second model is determined based on the parameter label, and the second model parameters are used to perform a step of updating the parameters to obtain an updated second model.
[0033] Optionally, obtaining first model parameters of the trained first model during the last N iterations of training, averaging the first model parameters during the N iterations of training, and obtaining second model parameters corresponding to the first model parameters includes: Obtain the first model parameters of the trained first model at the last iteration of training; Based on the exponential moving average mechanism, the first model parameters during the last iteration of training are processed to obtain the second model parameters.
[0034] Among them, after the first model is trained, the model parameters of the trained first model can be directly obtained, and the model parameters are the first model parameters corresponding to the last iterative training. The exponential sliding average mechanism is used to process each target parameter in the first model parameters respectively, and the corresponding processed parameters are obtained to form the second model parameters. The exponential sliding average mechanism only needs the model parameters after the last iterative training, and there is no need to save the model parameters of the previous N iterative trainings, which reduces the memory usage.
[0035] Step S203, using the updated second model to segment the target MRI brain image to obtain M sub-images, and performing classification prediction on each sub-image to obtain the target classification category of the corresponding sub-image.
[0036] In the present application, since the structure of the second model is the same as that of the first model, the input of the second model is also MRI brain image, and the output is the segmentation result of the MRI brain image, wherein the model's segmentation of MRI brain image can be divided into image segmentation, classification, clustering, segmentation and other steps.
[0037] Image segmentation and classification is to convert MRI brain images into multiple smaller processing areas to accurately determine the classification category within the area. The number M of sub-images after image segmentation can be set according to needs. M is an integer greater than zero. The larger M is, the slower the corresponding processing speed, but the more accurate the result is. The smaller M is, the slower the corresponding processing speed is, but the accuracy of the result will be lower than when M is larger.
[0038] Image segmentation can use a sliding window of preset length and width, sliding in the horizontal direction of the image with a preset length as the step length, and sliding in the vertical direction of the image with a preset width as the step length. Since the input images are of the same size, the length, width and step length of the sliding window can be determined based on the total length and width of the image, as well as the number of sub-images obtained by segmentation, so that the sub-images will not overlap and all pixels of the image are involved in the segmentation.
[0039] The result of classification prediction is the classification category. For example, for a sub-image, its classification result is predicted to be lesion or non-lesion. If it is a lesion, the sub-image can be classified as the lesion class. If it is not a lesion, the sub-image can be classified as the non-lesion class. So far, each sub-image has its corresponding target classification category.
[0040] Step S204, clustering the sub-images with adjacent pixel positions and the same target classification category in the target MRI brain image to obtain clustering results of all sub-images, and segmenting the target MRI brain image based on the clustering results to obtain corresponding segmentation results.
[0041] In the present application, for any sub-image, its adjacent sub-image is first obtained, and adjacent means that the pixel positions are adjacent. If the adjacent sub-image has the same target classification category as the sub-image, it is determined that the two are a cluster.
[0042] The clustering results of all sub-images include at least one cluster. If there are multiple clusters, the target classification categories corresponding to two non-adjacent clusters may also be the same, but this situation is two clusters. The area formed by the sub-images under each cluster is a segmentation area, so that the target MRI brain image is segmented into various segmentation areas, and the target classification category corresponding to each segmentation area is the segmentation category.
[0043] For example, if the target classification category only includes lesions and non-lesions, then one cluster corresponds to the target classification category of lesions, forming a lesion segmentation area, and one cluster corresponds to the target classification category of non-lesions, forming a non-lesion segmentation area. The lesion segmentation area is the lesion class, and the non-lesion segmentation area is the non-lesion class.
[0044] The embodiment of the present application obtains a first MRI brain image set and a target MRI brain image to be segmented, uses the first MRI brain image set to train a preset first model to obtain a trained first model, obtains first model parameters of the trained first model during the last N iterations of training, averages the first model parameters during the N iterations of training to obtain second model parameters corresponding to the first model parameters, uses the second model parameters to update the preset second model to obtain an updated second model, uses the updated second model to segment the target MRI brain image to obtain M sub-images, and performs classification prediction on each sub-image to obtain a target classification category of the corresponding sub-image, clusters sub-images with adjacent pixel positions and the same target classification category in the target MRI brain image to obtain clustering results of all sub-images, segments the target MRI brain image based on the clustering results to obtain corresponding segmentation results, and implements an image training model with less annotations, updates the model for image segmentation by means of parameter optimization, and then implements model training and uses it for MRI brain image segmentation, reducing the impact of problems such as high cost and low efficiency caused by manual annotation, and helps to improve the application effect of digital medicine in auxiliary diagnosis and treatment.
[0045] See also Figure 3 , is a flowchart of an image segmentation method based on artificial intelligence provided in Example 3 of the present application, such as Figure 3 As shown, the image segmentation method based on artificial intelligence may include the following steps: Step S301, obtaining a first MRI brain image set and a target MRI brain image to be segmented, and using the first MRI brain image set to train a preset first model to obtain a trained first model.
[0046] Step S302, obtain the first model parameters of the trained first model during the last N iterative trainings, average the first model parameters during the N iterative trainings to obtain second model parameters corresponding to the first model parameters, and use the second model parameters to update the preset second model to obtain an updated second model.
[0047] Among them, the contents of step S301 to step S302 are the same as part of the contents of the above-mentioned steps S201 to step S202. Please refer to the description of steps S201 to step S202, and will not be repeated here.
[0048] Step S303, obtain a second MRI brain image set, perform image transformation on all the first MRI brain images and all the second MRI brain images to obtain first transformed images corresponding to the first MRI brain images and second transformed images corresponding to the second MRI brain images, perform image transformation on all the second MRI brain images to obtain corresponding third transformed images.
[0049] In the present application, the second MRI brain image set includes at least one second MRI brain image without annotation results, that is, subsequent training does not need to be supervised by the annotation results, reducing the need for annotation.
[0050] Before using all MRI brain images for training, due to the lack of supervision, in order to facilitate the formation of self-supervision logic, all brain images need to be transformed to avoid the situation where the same images appear in subsequent processing and the model cannot converge.
[0051] Optionally, performing image transformation on all the first MRI brain images and all the second MRI brain images to obtain first transformed images corresponding to the first MRI brain images and second transformed images corresponding to the second MRI brain images, and performing image transformation on all the second MRI brain images to obtain corresponding third transformed images include: Performing image transformation on all first MRI brain images using preset first transformation data to obtain first transformed images corresponding to the first MRI brain images; Performing image transformation on all second MRI brain images using the first transformation data to obtain second transformed images corresponding to the second MRI brain images; The preset second transformation data is used to perform image transformation on all the second MRI brain images to obtain corresponding third transformation images, wherein the change directions of the first transformation data and the second transformation data are opposite.
[0052] Among them, when performing image transformation on the MRI brain image, the first MRI brain image and the second MRI brain image are transformed respectively using the same transformation method, and the second MRI brain image is transformed using another transformation method. Since the first MRI brain image has a corresponding real label (i.e., the segmentation category matrix), there is no need to perform a second image transformation on the first MRI brain image.
[0053] The second transformation data changes in the opposite direction to the first change data. It can be understood that if the first change data enhances the image, the second change data weakens the image; if the first change data weakens the image, the second change data enhances the image, wherein weakening may refer to increasing noise, blurring the image, etc., and enhancing may refer to increasing contrast, brightness, etc., to achieve image sharpening.
[0054] Optionally, the preset first transformation data is Gaussian noise data, the preset second transformation data is style enhancement data, image transformation is performed on all first MRI brain images and all second MRI brain images to obtain first transformed images corresponding to the first MRI brain images and second transformed images corresponding to the second MRI brain images, and image transformation is performed on all second MRI brain images to obtain corresponding third transformed images, including: Adding Gaussian noise data to all first MRI brain images respectively to obtain first transformed images corresponding to the first MRI brain images; adding Gaussian noise data to all second MRI brain images respectively to obtain second transformed images corresponding to the second MRI brain images; The style enhancement data is used to perform image transformation on all the second MRI brain images to obtain corresponding third transformed images.
[0055] Among them, the first transformation data is Gaussian noise data, that is, the first transformation data weakens the image, and the second transformation data is style enhancement data, that is, the second transformation data enhances the image. Therefore, in subsequent use, the first transformation data is used to predict the image input model after image enhancement, and the prediction result is obtained as a pseudo label of the image for calculating the loss.
[0056] Step S304: for any first MRI brain image, use the updated second model to predict the classification category at each pixel position in the first transformed image corresponding to the first MRI brain image, and obtain a corresponding first predicted category matrix.
[0057] In the present application, the first model and the second model have the same structure and the same input data format, and the output is the classification result for each pixel position to form a prediction category matrix.
[0058] Step S305: For any second MRI brain image, use the updated second model to predict the classification category at each pixel position in the second transformed image corresponding to the second MRI brain image to obtain the corresponding second predicted category matrix; use the trained first model to predict the classification category at each pixel position in the third transformed image corresponding to the second MRI brain image to obtain the corresponding third predicted category matrix.
[0059] In the present application, the second MRI brain image corresponds to a second change image and a third change image respectively. The second model predicts the second change image to obtain a corresponding prediction category matrix, and the first model predicts the third change image to obtain a corresponding prediction category matrix.
[0060] Optionally, the trained first model is used to predict the classification category at each pixel position in the third transformed image corresponding to the second MRI brain image, and the corresponding third predicted category matrix is obtained, including: Using the trained first model, predict the classification category at each pixel position in the third transformed image corresponding to the second MRI brain image, and determine the probability of the corresponding pixel position being determined as each preset category; For any pixel position, the preset category corresponding to the pixel position with the maximum probability is determined as the predicted category of the pixel position, and all pixel positions are traversed to obtain a third predicted category matrix corresponding to the third transformed image of the second MRI brain image.
[0061] Among them, since the training degree of the first model is relatively high and the third transformed image is an enhanced image, in this case, using the first model to predict the third transformed image can obtain a relatively accurate prediction result. When predicting, if there are K categories, for each pixel in the image, the prediction result of a pixel is the probability of the pixel being in the K categories. Therefore, the category with the highest probability is taken as the final prediction category, and each pixel is traversed to obtain the prediction category matrix.
[0062] Step S306: The segmentation category matrix and the third prediction category matrix are used as true labeling results, the first prediction category matrix and the second prediction category matrix are used as predicted labeling results, and the total loss is calculated according to the true labeling results and the predicted labeling results.
[0063] In the present application, the third prediction category matrix predicted by using the trained first model to predict the third transformed image can be used as a pseudo label of the second MRI brain image, that is, the true annotation result of the second MRI brain image.
[0064] The first predicted category matrix and the second category matrix predicted by the updated second model are used as the predicted labeling results, and the total loss is calculated with the actual labeling results.
[0065] Optionally, the segmentation category matrix and the third prediction category matrix are used as true labeling results, the first prediction category matrix and the second prediction category matrix are used as predicted labeling results, and the total loss is calculated according to the true labeling results and the predicted labeling results, including: For any first MRI brain image, according to a first prediction labeling result of a first transformed image corresponding to the first MRI brain image and a segmentation category matrix, a first loss corresponding to the first MRI brain image is calculated; For any second MRI brain image, according to the second prediction labeling result and the third prediction labeling result corresponding to the second MRI brain image, calculate a second loss corresponding to the second MRI brain image; All first MRI brain images and all second MRI brain images are traversed, all first losses and all second losses are summed up, and the summed result is the total loss.
[0066] The first prediction labeling result and the segmentation category matrix calculate the first loss, the second prediction labeling result and the third prediction labeling result calculate the second loss, the first loss is the loss of the first MRI brain image, the second loss is the loss of the second MRI brain image, and the sum of the two is the total loss. Furthermore, a weighted sum can be used to obtain the total loss.
[0067] Step S307: according to the total loss, update the trained first model based on reverse gradient propagation to obtain an updated first model, use the updated first model as the trained first model, and return to execute the step of extracting the first model parameters of the trained first model until the updated second model is obtained as the trained second model when the iteration condition is met.
[0068] In the present application, reverse gradient propagation is used to update the trained first model based on the total loss, so as to execute step S202 to obtain an updated second model until the iteration is completed, at which time the corresponding updated second model is the trained second model.
[0069] Step S308, use the trained second model to segment the target MRI brain image to obtain M sub-images, and perform classification prediction on each sub-image to obtain the target classification category of the corresponding sub-image.
[0070] Step S309, clustering the sub-images with adjacent pixel positions and the same target classification category in the target MRI brain image to obtain clustering results of all sub-images, and segmenting the target MRI brain image based on the clustering results to obtain corresponding segmentation results.
[0071] Among them, the contents of step S308 to step S309 are the same as part of the contents of the above-mentioned steps S203 to step S204. Please refer to the description of steps S203 to step S204, and will not be repeated here.
[0072] The embodiment of the present application obtains a first MRI brain image set and a target MRI brain image to be segmented, uses the first MRI brain image set to train a preset first model to obtain a trained first model, obtains first model parameters of the trained first model during the last N iterations of training, averages the first model parameters during the N iterations of training to obtain second model parameters corresponding to the first model parameters, uses the second model parameters to update the preset second model to obtain an updated second model, uses the updated second model to segment the target MRI brain image to obtain M sub-images, and performs classification prediction on each sub-image to obtain a target classification category of the corresponding sub-image, clusters sub-images with adjacent pixel positions and the same target classification category in the target MRI brain image to obtain clustering results of all sub-images, segments the target MRI brain image based on the clustering results to obtain corresponding segmentation results, and implements an image training model with less annotations, updates the model for image segmentation by means of parameter optimization, and then implements model training and uses it for MRI brain image segmentation, reducing the impact of problems such as high cost and low efficiency caused by manual annotation, and helps to improve the application effect of digital medicine in auxiliary diagnosis and treatment.
[0073] Corresponding to the image segmentation method based on artificial intelligence in the above embodiment, Figure 4 The structure diagram of the image segmentation method based on artificial intelligence provided by the fourth embodiment of the present application is shown. The above-mentioned image segmentation device is applied to Figure 1 The server in the server, the computer device corresponding to the server connects to the corresponding database to obtain the MRI brain image and other data stored in the database.
[0074] The computer device corresponding to the server of the present application can also be connected to the corresponding client, which is operated by the user, and the user can provide the target MRI brain image to be segmented to the server through the client. For example, the server, the client, the database, etc. are connected to form a medical system, in which the server and the database are the background of the medical system, and the client is an application running on the doctor's computer, so that the doctor can send the MRI brain image to be segmented to the background, and the server performs segmentation processing and other operations.
[0075] For ease of explanation, only the parts related to the embodiments of the present application are shown.
[0076] See also Figure 4 , the image segmentation device comprises: A first model training module 41 is used to obtain a first MRI brain image set and a target MRI brain image to be segmented, and use the first MRI brain image set to train a preset first model to obtain a trained first model, wherein the first MRI brain image set includes at least one first MRI brain image and a preset segmentation category matrix corresponding to each first MRI brain image at each pixel position; A second model updating module 42 is used to obtain first model parameters of the trained first model during the last N iterations of training, average the first model parameters during the N iterations of training to obtain second model parameters corresponding to the first model parameters, and use the second model parameters to update the preset second model to obtain an updated second model, wherein the first model and the second model have the same structure, and N is an integer greater than zero; The classification prediction module 43 is used to segment the target MRI brain image using the updated second model to obtain M sub-images, and to perform classification prediction on each sub-image to obtain a target classification category of the corresponding sub-image, where M is an integer greater than zero; The image segmentation module 44 is used to cluster sub-images with adjacent pixel positions and the same target classification category in the target MRI brain image to obtain clustering results of all sub-images, and segment the target MRI brain image based on the clustering results to obtain corresponding segmentation results.
[0077] Optionally, the image segmentation device further includes: A brain image acquisition module, configured to acquire a second MRI brain image set after updating a preset second model using the second model parameters to obtain an updated second model, wherein the second MRI brain image set includes at least one second MRI brain image; An image transformation module is used to perform image transformation on all the first MRI brain images and all the second MRI brain images to obtain first transformed images corresponding to the first MRI brain images and second transformed images corresponding to the second MRI brain images, and perform image transformation on all the second MRI brain images to obtain corresponding third transformed images; A first prediction module is used to predict the classification category at each pixel position in the first transformed image corresponding to any first MRI brain image using the updated second model to obtain a corresponding first prediction category matrix; A second prediction module is used to predict the classification category at each pixel position in the second transformed image corresponding to the second MRI brain image using the updated second model for any second MRI brain image, and obtain a corresponding second prediction category matrix, and to predict the classification category at each pixel position in the third transformed image corresponding to the second MRI brain image using the trained first model, and obtain a corresponding third prediction category matrix; A loss calculation module, used to use the segmentation category matrix and the third prediction category matrix as true labeling results, use the first prediction category matrix and the second prediction category matrix as predicted labeling results, and calculate the total loss according to the true labeling results and the predicted labeling results; The second model training module is used to update the trained first model based on reverse gradient propagation according to the total loss to obtain an updated first model, use the updated first model as the trained first model, and return to execute the step of extracting the first model parameters of the trained first model until the updated second model is obtained as the trained second model when the iteration condition is met.
[0078] Optionally, the image transformation module includes: A first transformation unit, configured to perform image transformation on all first MRI brain images using preset first transformation data to obtain first transformed images corresponding to the first MRI brain images; A second transformation unit is used to perform image transformation on all second MRI brain images using the first transformation data to obtain second transformed images corresponding to the second MRI brain images; The third transformation unit is used to perform image transformation on all second MRI brain images using preset second transformation data to obtain corresponding third transformation images, wherein the change directions of the first transformation data and the second transformation data are opposite.
[0079] Optionally, the preset first transformation data is Gaussian noise data, the preset second transformation data is style enhancement data, and the image transformation module includes: A first transformation subunit is used to add Gaussian noise data to all first MRI brain images to obtain a first transformed image corresponding to the first MRI brain image; A second transformation subunit is used to add Gaussian noise data to all second MRI brain images to obtain second transformed images corresponding to the second MRI brain images; The third transformation subunit is used to perform image transformation on all the second MRI brain images using the style enhancement data to obtain corresponding third transformed images.
[0080] Optionally, the loss calculation module includes: A first loss calculation unit is used to calculate, for any first MRI brain image, a first loss corresponding to the first MRI brain image according to a first predicted labeling result of a first transformed image corresponding to the first MRI brain image and a segmentation category matrix; A second loss calculation unit is used to calculate, for any second MRI brain image, a second loss corresponding to the second MRI brain image according to a second prediction labeling result and a third prediction labeling result corresponding to the second MRI brain image; The total loss calculation unit is used to traverse all the first MRI brain images and all the second MRI brain images, sum all the first losses and all the second losses, and obtain the summed result as the total loss.
[0081] Optionally, the second prediction module includes: A probability prediction unit, used to predict the classification category at each pixel position in the third transformed image corresponding to the second MRI brain image using the trained first model, and determine the probability of the corresponding pixel position being determined as each preset category; The matrix determination unit is used to determine, for any pixel position, the preset category corresponding to the pixel position with the maximum probability as the predicted category of the pixel position, traverse all pixel positions, and obtain a third predicted category matrix corresponding to the third transformed image of the second MRI brain image.
[0082] Optionally, the second model updating module 42 includes: A parameter acquisition unit, used to acquire the first model parameters of the trained first model during the last iteration training; The parameter calculation unit is used to process the first model parameters at the last iteration training based on the exponential sliding average mechanism to obtain the second model parameters.
[0083] It should be noted that the information interaction, execution process and other contents between the above-mentioned modules are based on the same concept as the method embodiment of the present application. Their specific functions and technical effects can be found in the method embodiment part and will not be repeated here.
[0084] Figure 5 This is a schematic diagram of the structure of a computer device provided in Example 5 of this application. Figure 5 As shown, the computer device of this embodiment includes: at least one processor ( Figure 5 Only one is shown), a memory, and a computer program stored in the memory and executable on at least one processor, wherein when the processor executes the computer program, the steps in any of the above-mentioned embodiments of the image segmentation method based on artificial intelligence are implemented.
[0085] The computer device may include, but is not limited to, a processor and a memory. Those skilled in the art will appreciate that Figure 5 This is merely an example of a computer device and does not constitute a limitation on the computer device. The computer device may include more or fewer components than those shown in the figure, or a combination of certain components, or different components. For example, it may also include a network interface, a display screen, and an input device.
[0086] The processor may be a CPU, or other general-purpose processors, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc.
[0087] The memory includes a readable storage medium, an internal memory, etc., wherein the internal memory may be the memory of a computer device, and the internal memory provides an environment for the operation of the operating system and computer-readable instructions in the readable storage medium. The readable storage medium may be a hard disk of a computer device, and in other embodiments, it may also be an external storage device of the computer device, for example, a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. equipped on the computer device. Further, the memory may also include both an internal storage unit of the computer device and an external storage device. The memory is used to store an operating system, an application program, a boot loader (BootLoader), data, and other programs, such as the program code of a computer program, etc. The memory may also be used to temporarily store data that has been output or is to be output.
[0088] The technicians in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example. In practical applications, the above-mentioned function allocation can be completed by different functional units and modules as needed, that is, the internal structure of the device is divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiment can be integrated into a processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application. The specific working process of the units and modules in the above-mentioned device can refer to the corresponding process in the above-mentioned method embodiment, which will not be repeated here. If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present application implements all or part of the processes in the above-mentioned embodiment method, which can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a computer-readable storage medium. When the computer program is executed by the processor, the steps of the above-mentioned method embodiment can be implemented. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may at least include: any entity or device capable of carrying computer program code, recording medium, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal and software distribution medium. For example, a USB flash drive, a mobile hard disk, a magnetic disk or an optical disk. In some jurisdictions, according to legislation and patent practice, computer-readable media cannot be electric carrier signals and telecommunication signals.
[0089] The present application implements all or part of the processes in the above-mentioned embodiment method, and may also be completed through a computer program product. When the computer program product runs on a computer device, the computer device can implement the steps in the above-mentioned method embodiment when executing the computer program product.
[0090] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0091] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0092] In the embodiments provided in the present application, it should be understood that the disclosed devices / computer equipment and methods can be implemented in other ways. For example, the device / computer equipment embodiments described above are only schematic, for example, the division of modules or units is only a logical function division, and there may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0093] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0094] The above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application, and should all be included in the protection scope of the present application.
Claims
1. An image segmentation method based on artificial intelligence, characterized in that: The image segmentation method comprises: Acquire a first MRI brain image set and a target MRI brain image to be segmented, and use the first MRI brain image set to train a preset first model to obtain a trained first model, wherein the first MRI brain image set includes at least one first MRI brain image and a preset segmentation category matrix corresponding to each first MRI brain image at each pixel position; Obtaining first model parameters of the trained first model during the last N iterations of training, averaging the first model parameters during the N iterations of training to obtain second model parameters corresponding to the first model parameters, and using the second model parameters to update a preset second model to obtain an updated second model, wherein the first model has the same structure as the second model, and N is an integer greater than zero; Using the updated second model to segment the target MRI brain image to obtain M sub-images, and performing classification prediction on each sub-image to obtain a target classification category of the corresponding sub-image, where M is an integer greater than zero; The sub-images with adjacent pixel positions and the same target classification category in the target MRI brain image are clustered to obtain clustering results of all sub-images, and the target MRI brain image is segmented based on the clustering results to obtain corresponding segmentation results.
2. The image segmentation method according to claim 1, characterized in that: After the preset second model is updated using the second model parameters to obtain an updated second model, the method further includes: Acquire a second MRI brain image set, wherein the second MRI brain image set includes at least one second MRI brain image; Performing image transformation on all the first MRI brain images and all the second MRI brain images to obtain first transformed images corresponding to the first MRI brain images and second transformed images corresponding to the second MRI brain images, and performing image transformation on all the second MRI brain images to obtain corresponding third transformed images; For any first MRI brain image, use the updated second model to predict the classification category at each pixel position in the first transformed image corresponding to the first MRI brain image to obtain a corresponding first predicted category matrix; For any second MRI brain image, use the updated second model to predict the classification category at each pixel position in the second transformed image corresponding to the second MRI brain image to obtain a corresponding second predicted category matrix, and use the trained first model to predict the classification category at each pixel position in the third transformed image corresponding to the second MRI brain image to obtain a corresponding third predicted category matrix; Taking the segmentation category matrix and the third prediction category matrix as true labeling results, taking the first prediction category matrix and the second prediction category matrix as predicted labeling results, and calculating a total loss according to the true labeling results and the predicted labeling results; According to the total loss, the trained first model is updated based on reverse gradient propagation to obtain an updated first model, the updated first model is used as the trained first model, and the step of extracting the first model parameters of the trained first model is returned to execute until the updated second model is obtained as the trained second model when the iteration condition is met.
3. The image segmentation method according to claim 2, characterized in that: Performing image transformation on all first MRI brain images and all second MRI brain images to obtain first transformed images corresponding to the first MRI brain images and second transformed images corresponding to the second MRI brain images, and performing image transformation on all second MRI brain images to obtain corresponding third transformed images include: Performing image transformation on all first MRI brain images using preset first transformation data to obtain first transformed images corresponding to the first MRI brain images; Performing image transformation on all second MRI brain images using the first transformation data to obtain second transformation images corresponding to the second MRI brain images; All second MRI brain images are transformed using preset second transformation data to obtain corresponding third transformation images, wherein the change directions of the first transformation data and the second transformation data are opposite.
4. The image segmentation method according to claim 3, characterized in that: The preset first transformation data is Gaussian noise data, the preset second transformation data is style enhancement data, image transformation is performed on all first MRI brain images and all second MRI brain images to obtain first transformed images corresponding to the first MRI brain images and second transformed images corresponding to the second MRI brain images, and image transformation is performed on all second MRI brain images to obtain corresponding third transformed images, including: adding the Gaussian noise data to all first MRI brain images respectively to obtain first transformed images corresponding to the first MRI brain images; adding the Gaussian noise data to all the second MRI brain images respectively to obtain second transformed images corresponding to the second MRI brain images; The style enhancement data is used to perform image transformation on all second MRI brain images to obtain corresponding third transformed images.
5. The image segmentation method according to claim 2, characterized in that: Taking the segmentation category matrix and the third prediction category matrix as true labeling results, taking the first prediction category matrix and the second prediction category matrix as predicted labeling results, and calculating the total loss according to the true labeling results and the predicted labeling results includes: For any first MRI brain image, according to a first predicted labeling result of a first transformed image corresponding to the first MRI brain image and a segmentation category matrix, a first loss corresponding to the first MRI brain image is calculated; For any second MRI brain image, according to the second prediction labeling result and the third prediction labeling result corresponding to the second MRI brain image, calculate a second loss corresponding to the second MRI brain image; All first MRI brain images and all second MRI brain images are traversed, all first losses and all second losses are summed up, and the summed result is the total loss.
6. The image segmentation method according to claim 2, characterized in that: The trained first model is used to predict the classification category at each pixel position in the third transformed image corresponding to the second MRI brain image, and the corresponding third prediction category matrix is obtained, including: Using the trained first model, predict the classification category at each pixel position in the third transformed image corresponding to the second MRI brain image, and determine the probability of the corresponding pixel position being determined as each preset category; For any pixel position, determine the preset category corresponding to the pixel position with the maximum probability as the predicted category of the pixel position, traverse all pixel positions, and obtain a third predicted category matrix corresponding to the third transformed image of the second MRI brain image.
7. The image segmentation method according to any one of claims 1 to 6, characterized in that: Obtaining first model parameters of the trained first model during the last N iterations of training, and averaging the first model parameters during the N iterations of training to obtain second model parameters corresponding to the first model parameters includes: Obtaining first model parameters of the trained first model during the last iteration of training; Based on the exponential moving average mechanism, the first model parameters during the last iterative training are processed to obtain second model parameters.
8. An image segmentation device based on artificial intelligence, characterized in that: The image segmentation device comprises: A first model training module is used to obtain a first MRI brain image set and a target MRI brain image to be segmented, and use the first MRI brain image set to train a preset first model to obtain a trained first model, wherein the first MRI brain image set includes at least one first MRI brain image and a preset segmentation category matrix corresponding to each first MRI brain image at each pixel position; A second model updating module is used to obtain first model parameters of the trained first model during the last N iterations of training, average the first model parameters during the N iterations of training to obtain second model parameters corresponding to the first model parameters, and use the second model parameters to update a preset second model to obtain an updated second model, wherein the first model has the same structure as the second model, and N is an integer greater than zero; A classification prediction module, configured to use the updated second model to segment the target MRI brain image to obtain M sub-images, and perform classification prediction on each sub-image to obtain a target classification category of the corresponding sub-image, where M is an integer greater than zero; The image segmentation module is used to cluster sub-images with adjacent pixel positions and the same target classification category in the target MRI brain image to obtain clustering results of all sub-images, and segment the target MRI brain image based on the clustering results to obtain corresponding segmentation results.
9. A computer device, characterized in that: The computer device includes a processor, a memory, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the image segmentation method according to any one of claims 1 to 7 is implemented.
10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the image segmentation method according to any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Brain tumor image segmentation method based on depth learning and weight space integration
CN109242860A
Heart image processing method and device based on image segmentation, equipment and medium
CN113850826A
Image segmentation method, training method of image segmentation model, related device and electronic equipment
CN114049344A
Image segmentation method, image segmentation device, electronic equipment and storage medium
CN116740075A