Model training method, image processing method, device, equipment and storage medium
By training task sets and using adaptive learning deep learning models, the performance limitations of transfer learning models in brain tumor classification and lesion segmentation are addressed, achieving rapid convergence and wide applicability.
Patent Information
- Application Number
- CN202211658959.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-22
- Publication Date
- 2026-08-25
- Estimated Expiration
- 2042-12-22
AI Technical Summary
Existing transfer learning models cannot guarantee performance on new tasks such as brain tumor classification and lesion segmentation, and data labeling is time-consuming and costly, making it difficult to achieve accurate diagnosis and treatment.
By training a set of tasks including brain segmentation and brain classification, a deep learning model is used to update model parameters. Combined with backpropagation algorithm and learning rate adjustment, adaptive learning of the model is achieved.
It reduces the cost of brain data collection, achieves rapid convergence and good results in brain segmentation and classification tasks, and has a wide range of applications.
Smart Images

Figure CN116091863B_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the field of medical image processing technology, and in particular relates to a model training method, image processing method, device, equipment and storage medium. Background Technology
[0002] With the development of big data technology, the performance of deep learning models applied to medical image analysis is becoming increasingly high, their parameters are becoming more complex, and the amount of data required is also increasing. Therefore, transfer learning technology has emerged, which involves fine-tuning the parameters of a model trained on a large amount of data using small batches of data to adapt it to new tasks. However, this method still has limitations; the transferred model cannot guarantee performance on the new task, but can only guarantee good performance on the pre-trained data.
[0003] Currently in clinical practice, even experienced doctors find it difficult to diagnose certain types of brain tumors based on patient imaging information, posing significant challenges to accurate diagnosis and treatment. Therefore, the classification of brain tumors and subsequent lesion segmentation are crucial for precision treatment; however, data labeling is extremely time-consuming and costly, meaning that data processed by classification models cannot be used to train segmentation models, and vice versa. Summary of the Invention
[0004] This application aims to at least partially address one of the technical problems in the related art. To this end, one objective of this application is to provide a model training method, an image processing method, an apparatus, a device, and a storage medium.
[0005] To address the aforementioned technical problems, embodiments of this application provide the following technical solutions:
[0006] A model training method, comprising:
[0007] Obtain a training task set; wherein the training task set includes multiple training tasks, and each training task includes a brain segmentation task or a brain classification task;
[0008] The (N+1)th training task is input into the Nth model to be trained, and the Nth model parameters of the Nth model to be trained are updated based on the (N+1)th training task to obtain the (N+1)th updated parameters; where N is a positive integer;
[0009] Based on the (N+1)th update parameter and the Nth model parameter, the target model parameters are calculated.
[0010] Based on the target model parameters, the target model is obtained.
[0011] Optionally, the step of inputting the (N+1)th training task into the Nth model to be trained, and updating the Nth model parameters of the Nth model to be trained based on the (N+1)th training task to obtain the (N+1)th updated parameters, includes:
[0012] The training subtask of the (N+1)th training task is input into the Nth model to be trained, and the Nth model parameters of the Nth model to be trained are updated based on the training subtask of the (N+1)th training task to obtain the (N+1)th updated parameters and the (N+1)th updated model; wherein, the training task includes training subtasks and testing subtasks.
[0013] Optionally, the step of calculating the target model parameters based on the (N+1)th update parameter and the Nth model parameter includes:
[0014] Input the test subtask of the N+1th training task into the N+1th updated model and output the N+1th test result;
[0015] Based on the N+1th test result, the N+1th loss function is calculated;
[0016] Based on the (N+1)th loss function, the (N+1)th gradient value is calculated;
[0017] The Nth model parameter is calculated based on the (N+1)th gradient value to obtain the (N+1)th model parameter;
[0018] The target model parameters are calculated based on the (N+1)th model parameters.
[0019] Optionally, the step of calculating the Nth model parameter based on the (N+1)th gradient value to obtain the (N+1)th model parameter includes:
[0020] Obtain the (N+1)th learning rate;
[0021] The Nth model parameters are calculated based on the N+1th gradient value and the N+1th learning rate to obtain the N+1th model parameters.
[0022] Embodiments of this application also provide an image processing method, including the target model as described above, and further including:
[0023] Obtain a training image set; wherein the training image set includes multiple training images, and each training image includes a brain segmentation task or a brain classification task;
[0024] Obtain the Mth training image, resize the Mth training image to obtain the Mth training image, and input the Mth training image into the target model to obtain the Mth model parameters; where M is a positive integer;
[0025] Based on the Mth model parameters, the Mth detection gradient value is calculated, and based on the Mth detection gradient value, a set of detection gradient values is obtained.
[0026] The target detection gradient value is calculated based on the detection gradient value set, and the target size of the image to be processed is determined based on the target detection gradient value.
[0027] Optionally, calculating the Mth detection gradient value based on the Mth model parameters includes:
[0028] The detection sub-image of the Mth training image is input into the Mth size model, and the Mth detection result is output.
[0029] Based on the Mth detection result and the Mth model parameters, the Mth detection gradient value is calculated. Optionally, calculating the target detection gradient value based on the detection gradient value set includes:
[0030] Multiple detection gradient values in the detection gradient value set are compared to obtain the comparison result;
[0031] Based on the comparison results, the upper limit of the detection gradient value set is determined, and the upper limit of the detection gradient value is determined as the target detection gradient value.
[0032] Optionally, determining the target size of the image to be processed based on the target detection gradient value includes:
[0033] The P-th training image that matches the target detection gradient value is determined as the target image; where P is a positive integer;
[0034] The size of the target image is obtained, and the size of the target image is determined as the target size of the image to be processed.
[0035] Optionally, obtaining the size of the target image and determining the size of the target image as the target size of the image to be processed includes:
[0036] Obtain the number of target images;
[0037] When the number of target images is equal to 1, the size of the target image is obtained, and the size of the target image is determined as the target size of the image to be processed; or
[0038] When the number of target images is greater than 1, the size of each target image is obtained, and the size of each target image is calculated to obtain the target size of the image to be processed.
[0039] Embodiments of this application also provide a model training apparatus, comprising:
[0040] The first acquisition module is used to acquire a training task set; wherein the training task set includes multiple training tasks, and each training task includes a brain segmentation task or a brain classification task.
[0041] The training module is used to input the (N+1)th training task into the Nth model to be trained, and update the Nth model parameters of the Nth model to be trained based on the (N+1)th training task to obtain the (N+1)th updated parameters; where N is a positive integer;
[0042] The first calculation module is used to calculate the target model parameters based on the (N+1)th update parameter and the Nth model parameter;
[0043] The acquisition module is used to obtain the target model based on the target model parameters.
[0044] Embodiments of this application also provide an image processing apparatus, including the target model as described above, and further comprising:
[0045] The second acquisition module is used to acquire a training image set; wherein the training image set includes multiple training images, and each training image includes a brain segmentation task or a brain classification task.
[0046] The processing module is used to acquire the Mth training image, perform size processing to obtain the Mth training image, and input the Mth training image into the target model to obtain the Mth model parameters and the Mth size model; where M is a positive integer;
[0047] The second calculation module is used to calculate the Mth detection gradient value based on the Mth model parameters, and to obtain a set of detection gradient values based on the Mth detection gradient value.
[0048] The third calculation module is used to calculate the target detection gradient value based on the detection gradient value set, and to determine the target size of the image to be processed based on the target detection gradient value.
[0049] Embodiments of this application also provide an electronic device, including a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, wherein the processor executes the computer program to implement the method described above.
[0050] Embodiments of this application also provide a computer-readable storage medium, the computer-readable storage medium including a stored computer program, wherein, when the computer program is executed, it controls the device where the computer-readable storage medium is located to perform the method described above.
[0051] The embodiments of this application have the following technical effects:
[0052] The above-mentioned technical solution of this application 1) includes both brain segmentation tasks and brain classification tasks in the training task set, which makes full use of brain data, solves the problem of brain data shortage, reduces the cost of brain data collection, and the target model obtained by training based on the training task set can handle brain segmentation tasks and brain classification tasks at the same time, and has a wide range of applications.
[0053] 2) The model has achieved adaptive learning of the input image size, which enables the model to converge quickly and perform well in both brain segmentation and brain classification tasks, and has a wide range of applications.
[0054] Additional aspects and advantages of this application will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of this application. Attached Figure Description
[0055] Figure 1 This is a schematic flowchart of a model training method provided in an embodiment of this application;
[0056] Figure 2 This is a schematic flowchart of an image processing method provided in an embodiment of this application;
[0057] Figure 3 This is a schematic diagram of the structure of a model training device provided in an embodiment of this application;
[0058] Figure 4 This is a schematic diagram of the structure of an image processing device provided in an embodiment of this application. Detailed Implementation
[0059] The embodiments of this application are described in detail below. Examples of these embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the accompanying drawings are exemplary and intended to explain this application, and should not be construed as limiting this application.
[0060] To facilitate understanding of the embodiments by those skilled in the art, some terms are explained below:
[0061] (1) U-Net: A network model that uses a fully convolutional network for semantic segmentation.
[0062] (2) Dice function: a set similarity measurement function.
[0063] like Figure 1 As shown, embodiments of this application provide a model training method, including:
[0064] Step S11: Obtain a training task set; wherein the training task set includes multiple training tasks, and each training task includes a brain segmentation task or a brain classification task.
[0065] In an optional embodiment of this application, the training task set includes both brain segmentation tasks and brain segmentation tasks; wherein, the brain segmentation tasks may include various brain segmentation tasks such as brain region segmentation, brain hemorrhage location segmentation, brain tumor lesion segmentation, and cranial segmentation.
[0066] Brain classification tasks can include tasks such as classifying brain tumor lesions;
[0067] Furthermore, in the embodiments of this application, each training task is divided into a training subtask and a testing subtask; wherein, the model to be trained is trained based on the training subtask to obtain the training result, and the training result is tested based on the testing subtask that matches the training subtask to obtain the test result, and the training result is determined to meet the requirements based on the test result.
[0068] Step S12: Input the (N+1)th training task into the Nth model to be trained, and update the Nth model parameters of the Nth model to be trained based on the (N+1)th training task to obtain the (N+1)th updated parameters; where N is a positive integer;
[0069] In an optional embodiment of this application, the step of inputting the (N+1)th training task into the Nth model to be trained, and updating the Nth model parameters of the Nth model to be trained based on the (N+1)th training task to obtain the (N+1)th updated parameters, includes:
[0070] The training subtask of the (N+1)th training task is input into the Nth model to be trained, and the Nth model parameters of the Nth model to be trained are updated based on the training subtask of the (N+1)th training task to obtain the (N+1)th updated parameters and the (N+1)th updated model; wherein, the training task includes training subtasks and testing subtasks.
[0071] In an optional embodiment of this application, a deep learning model suitable for medical image analysis can be selected as the model to be trained. For example, a U-Net network can be defined as the model to be trained, and a parameter can be randomly initialized as the initial model parameter P0.
[0072] In an optional embodiment of this application, when training the model to be trained, a training task is first randomly selected from the training task set as the first training task, and the first training task is input into the model to be trained.
[0073] For example, the brain hemorrhage location segmentation task is randomly selected as the first training task, and the brain hemorrhage location segmentation task is divided into training sub-tasks and test sub-tasks.
[0074] Specifically, the training subtask of the brain hemorrhage location segmentation task is input into the model to be trained, and then the model to be trained is trained based on the backpropagation algorithm and the training subtask to obtain the first update parameters and the first update model.
[0075] Similarly, the model to be trained can be trained based on any training task, and the model parameters corresponding to the model to be trained can be updated to obtain the corresponding updated model.
[0076] Step S13: Calculate the target model parameters based on the (N+1)th update parameter and the Nth model parameter;
[0077] In an optional embodiment of this application, the step of calculating the target model parameters based on the (N+1)th update parameter and the Nth model parameter includes:
[0078] Input the test subtask of the N+1th training task into the N+1th updated model and output the N+1th test result;
[0079] Based on the N+1th test result, the N+1th loss function is calculated;
[0080] Based on the (N+1)th loss function, the (N+1)th gradient value is calculated;
[0081] The Nth model parameter is calculated based on the (N+1)th gradient value to obtain the (N+1)th model parameter;
[0082] The target model parameters are calculated based on the (N+1)th model parameters.
[0083] In an optional embodiment of this application, after obtaining the first update parameters, a first update model is obtained, the test subtask in the first training task is input into the first update model, a first test result is output, and based on the first test result, a first loss function matching the first update model is calculated.
[0084] Furthermore, the first gradient value corresponding to the first loss function is calculated.
[0085] The first gradient value and the initial model parameters P0 are used to update the initial model parameters P0, thereby obtaining the first model parameters P1 and the first model to be trained.
[0086] In one optional embodiment of this application, brain tumor lesion segmentation is randomly selected as the second training task, and the brain tumor lesion segmentation is divided into training sub-tasks and testing sub-tasks.
[0087] Specifically, the training subtask of brain tumor lesion segmentation is input into the first model to be trained, and then the first model to be trained is trained based on the backpropagation algorithm and the training subtask to obtain the second updated parameters.
[0088] After obtaining the second update parameters, the second update model is obtained. The test subtask in the second training task is input into the second update model, the second test result is output, and based on the second test result, the second loss function matching the second model to be trained is calculated.
[0089] Furthermore, the second gradient value corresponding to the second loss function is calculated.
[0090] The second gradient value and the first model parameter P1 are used to update the first model parameter P1, thereby obtaining the second model parameter P2 and the second model to be trained.
[0091] In an optional embodiment of this application, the above steps are repeated, and brain and skull segmentation is randomly selected as the N+1th training task, and brain and skull segmentation is divided into training sub-tasks and test sub-tasks.
[0092] Specifically, the training subtask in brain and skull segmentation is input into the Nth model to be trained, and then the Nth model to be trained is trained based on the backpropagation algorithm and the training subtask to obtain the N+1th updated parameters.
[0093] After obtaining the (N+1)th updated parameters, the (N+1)th updated model is obtained. The test subtask in the (N+1)th training task is input into the (N+1)th updated model, the (N+1)th test result is output, and based on the (N+1)th test result, the (N+1)th loss function matching the (N+1)th updated model is calculated.
[0094] Furthermore, the gradient value corresponding to the (N+1)th loss function is calculated.
[0095] Based on the (N+1)th gradient value and the Nth model parameter P N Calculations are performed to evaluate the Nth model parameter P. N Update the model to obtain the (N+1)th model parameter P. N+1 And the N+1th model to be trained.
[0096] In an optional embodiment of this application, the step of calculating the Nth model parameter based on the (N+1)th gradient value to obtain the (N+1)th model parameter includes:
[0097] Obtain the (N+1)th learning rate;
[0098] The Nth model parameters are calculated based on the N+1th gradient value and the N+1th learning rate to obtain the N+1th model parameters.
[0099] In an optional embodiment of this application, to further accelerate the convergence speed of model training, an N+1 learning rate is incorporated during the process of updating the Nth model parameter and obtaining the N+1th model parameter. Specifically, before updating the Nth model parameter and obtaining the N+1th model parameter, a matching learning rate can be preset for each training task, that is, different training tasks correspond to different learning rates. For example, when two training tasks contain different amounts of data or the data complexity of the two training tasks is different, the learning rates corresponding to these two training tasks will also be different, and so on. The learning rate corresponding to each training task can be determined according to actual needs.
[0100] In an optional embodiment of this application, for ease of calculation and simplified operation, the same learning rate can be preset for each training task, that is, only one learning rate is preset throughout the entire training process of the initial model to be trained; wherein, the value of the learning rate can be 0.005 or other suitable values.
[0101] Furthermore, different learning rates can be preset for different initial models to be trained or different training task sets.
[0102] Step S14: Obtain the target model based on the target model parameters.
[0103] In an optional embodiment of this application, after obtaining the (N+1)th training model, in order to verify whether the (N+1)th training model meets the requirements, a test subtask in the (N+1)th training task is obtained, and the test subtask in the (N+1)th training task is input into the (N+1)th training model, and the verification result is output.
[0104] The test loss function is calculated based on the test results, and the accuracy of the (N+1)th training model is determined based on the test loss function. When the test loss function meets the preset conditions, the (N+1)th training model is determined as the target model; otherwise, when the test loss function does not meet the preset conditions, the above steps are repeated. The (N+2)th training task is selected from the task training set, and the (N+2)th training task is divided into training sub-tasks and test sub-tasks. The (N+1)th training model is trained based on the (N+2)th training sub-task. The above steps are repeated to obtain the (N+2)th training model. This process is repeated until the target model is obtained.
[0105] In an optional embodiment of this application, both the loss function and the test loss function can be obtained based on the Dice function and the cross-entropy loss function. The embodiments of this application do not impose specific limitations on this.
[0106] In the embodiments of this application, the training task set includes both brain segmentation tasks and brain classification tasks, which makes full use of brain data, solves the problem of brain data shortage, reduces the cost of brain data collection, and the target model trained based on the training task set can handle brain segmentation tasks and brain classification tasks at the same time, with a wide range of applications.
[0107] like Figure 2 As shown, embodiments of this application also provide an image processing method, including the target model as described above, and further including:
[0108] Step 21: Obtain a training image set; wherein the training image set includes multiple training images, and each training image includes a brain segmentation task or a brain classification task;
[0109] In an optional embodiment of this application, the training image set includes both brain segmentation tasks and brain segmentation tasks; wherein, the brain segmentation tasks may include various brain segmentation tasks such as brain region segmentation, brain hemorrhage location segmentation, brain tumor lesion segmentation, and skull segmentation.
[0110] Brain classification tasks can include tasks such as classifying brain tumor lesions.
[0111] Step 22: Obtain the Mth training image, perform size processing on the Mth training image to obtain the Mth training image, and input the Mth training image into the target model to obtain the Mth model parameters and the Mth size model; where M is a positive integer;
[0112] In one optional embodiment of this application, a first training image is randomly obtained from the training image set, and then the training sub-images of the first training image are input into the target model to obtain the first model parameters and the first size model; wherein, the first training image may not be subject to center cropping, that is, the image in the first training image is kept at its original size;
[0113] In one optional embodiment of this application, a second training image is randomly obtained from the training image set, and each image in the second training image is randomly centered and cropped. Then, the training sub-images of the second training image are input into the first size model.
[0114] Similarly, the training sub-images of each training image are input into the corresponding size model.
[0115] Step 23: Based on the Mth model parameters, calculate the Mth detection gradient value, and based on the Mth detection gradient value, obtain the detection gradient value set;
[0116] In an optional embodiment of this application, calculating the Mth detection gradient value based on the Mth model parameters includes:
[0117] The detection sub-image of the Mth training image is input into the Mth size model, and the Mth detection result is output.
[0118] Based on the Mth detection result and the Mth model parameters, the Mth detection gradient value is calculated.
[0119] In one optional embodiment of this application, each training image is divided into a training sub-image and a detection sub-image.
[0120] In an optional embodiment of this application, the detection sub-image from the first training image is input into the first size model to obtain the first detection result;
[0121] Based on the first detection result, the first detection loss function is calculated, and based on the first detection loss function, the first detection gradient value is calculated and retained.
[0122] In one optional embodiment of this application, the detection sub-image from the second training image is input into the second-size model to obtain the second detection result;
[0123] Based on the second detection result, the second detection loss function is calculated, and based on the second detection loss function, the second detection gradient value is calculated and retained.
[0124] In an optional embodiment of this application, the detection sub-image from the Mth training image is input into the Mth size model to obtain the Mth detection result;
[0125] Based on the Mth detection result, the Mth detection loss function is calculated, and based on the Mth detection loss function, the Mth detection gradient value is calculated and retained.
[0126] In one optional embodiment of this application, a set of detection gradient values is obtained based on a first detection gradient value, a second detection gradient value, ..., an Mth detection gradient value, etc.
[0127] Step 24: Calculate the target detection gradient value based on the detection gradient value set, and determine the target size of the image to be processed based on the target detection gradient value.
[0128] In an optional embodiment of this application, the step of calculating the target detection gradient value based on the detection gradient value set includes:
[0129] Multiple detection gradient values in the detection gradient value set are compared to obtain the comparison result;
[0130] Based on the comparison results, the upper limit of the detection gradient value set is determined, and the upper limit of the detection gradient value is determined as the target detection gradient value.
[0131] In an optional embodiment of this application, the first detection gradient value, the second detection gradient value, ... the Mth detection gradient value in the detection gradient value set are compared and sorted from largest to smallest to obtain a detection gradient value queue;
[0132] The first detection gradient value in the detection gradient value queue is determined as the upper limit of the detection gradient value, which is also the target detection gradient value.
[0133] In an optional embodiment of this application, determining the target size of the image to be processed based on the target detection gradient value includes:
[0134] The P-th training image that matches the target detection gradient value is determined as the target image; where P is a positive integer;
[0135] The size of the target image is obtained, and the size of the target image is determined as the target size of the image to be processed.
[0136] In an optional embodiment of this application, after determining the target detection gradient value, a P-th training image matching the target detection gradient value is obtained, and the size of the P-th training image is obtained. Then, the size of the P-th training image is determined as the target size; wherein, the target size may include the length, width, and height of the P-th training image.
[0137] In an optional embodiment of this application, obtaining the size of the target image and determining the size of the target image as the target size of the image to be processed includes:
[0138] Obtain the number of target images;
[0139] When the number of target images is equal to 1, the size of the target image is obtained, and the size of the target image is determined as the target size of the image to be processed; or
[0140] When the number of target images is greater than 1, the size of each target image is obtained, and the size of each target image is calculated to obtain the target size of the image to be processed.
[0141] In an optional embodiment of this application, since the upper limit of the detection gradient value may correspond to multiple detection gradient values, that is, there are multiple detection gradient values that are the maximum value at the same time, all of these detection gradient values are determined as target detection gradient values, and the training images corresponding to these target detection gradient values are determined as target images.
[0142] In an optional embodiment of this application, when the number of target images is greater than 1, the length, width, and height of each target image are obtained, and a first average value is calculated based on the average length of the multiple target images; a second average value is calculated based on the average width of the multiple target images; and a third average value is calculated based on the average height of the multiple target images. The first average value, the second average value, and the third average value are then determined as the target size.
[0143] In an optional embodiment of this application, after determining the target size, before inputting the image to be processed into the target image, the image to be processed is first cropped at the center based on the target size to obtain the image to be input, and then the image to be input is input into the target model.
[0144] In an optional embodiment of this application, after the image to be input is input into the target model, the image to be input is processed based on the target model to obtain the processing result. In order to verify the selection accuracy of the target size, a verification image can be preset and the verification image is centered to obtain a verification image of the target size. Then, the verification image of the target size is input into the target model to obtain the verification result. The current performance of the target model can be verified through the verification result. The better the current performance of the target model, the higher the accuracy of the target size.
[0145] The embodiments of this application realize the adaptive learning of the model to the input size of the image, which enables the model to converge quickly and perform well in both brain segmentation and brain classification tasks, and has a wide range of applications.
[0146] like Figure 3 As shown, embodiments of this application also provide a model training apparatus 30, comprising:
[0147] The first acquisition module 31 is used to acquire a training task set; wherein, the training task set includes multiple training tasks, and each training task includes a brain segmentation task or a brain classification task.
[0148] Training module 32 is used to input the (N+1)th training task into the Nth model to be trained, and update the Nth model parameters of the Nth model to be trained based on the (N+1)th training task to obtain the (N+1)th updated parameters; where N is a positive integer;
[0149] The first calculation module 33 is used to calculate the target model parameters based on the (N+1)th update parameter and the Nth model parameter;
[0150] The module 34 is used to obtain the target model based on the target model parameters.
[0151] Optionally, the step of inputting the (N+1)th training task into the Nth model to be trained, and updating the Nth model parameters of the Nth model to be trained based on the (N+1)th training task to obtain the (N+1)th updated parameters, includes:
[0152] The training subtask of the (N+1)th training task is input into the Nth model to be trained, and the Nth model parameters of the Nth model to be trained are updated based on the training subtask of the (N+1)th training task to obtain the (N+1)th updated parameters and the (N+1)th updated model; wherein, the training task includes training subtasks and testing subtasks.
[0153] Optionally, the step of calculating the target model parameters based on the (N+1)th update parameter and the Nth model parameter includes:
[0154] Input the test subtask of the N+1th training task into the N+1th updated model and output the N+1th test result;
[0155] Based on the N+1th test result, the N+1th loss function is calculated;
[0156] Based on the (N+1)th loss function, the (N+1)th gradient value is calculated;
[0157] The Nth model parameter is calculated based on the (N+1)th gradient value to obtain the (N+1)th model parameter;
[0158] The target model parameters are calculated based on the (N+1)th model parameters.
[0159] Optionally, the step of calculating the Nth model parameter based on the (N+1)th gradient value to obtain the (N+1)th model parameter includes:
[0160] Obtain the (N+1)th learning rate;
[0161] The Nth model parameters are calculated based on the N+1th gradient value and the N+1th learning rate to obtain the N+1th model parameters.
[0162] like Figure 4 As shown, embodiments of this application also provide an image processing apparatus 40, including the target model as described above, and further including:
[0163] The second acquisition module 41 is used to acquire a training image set; wherein, the training image set includes multiple training images, and each training image includes a brain segmentation task or a brain classification task.
[0164] Processing module 42 is used to acquire the Mth training image, perform size processing to obtain the Mth training image, and input the Mth training image into the target model to obtain the Mth model parameters and the Mth size model; where M is a positive integer;
[0165] The second calculation module 43 is used to calculate the Mth detection gradient value based on the Mth model parameters, and to obtain a set of detection gradient values based on the Mth detection gradient value.
[0166] The third calculation module 44 is used to calculate the target detection gradient value based on the detection gradient value set, and to determine the target size of the image to be processed based on the target detection gradient value.
[0167] Optionally, calculating the Mth detection gradient value based on the Mth model parameters includes:
[0168] The detection sub-image of the Mth training image is input into the Mth size model, and the Mth detection result is output.
[0169] Based on the Mth detection result and the Mth model parameters, the Mth detection gradient value is calculated. Optionally, calculating the target detection gradient value based on the detection gradient value set includes:
[0170] Multiple detection gradient values in the detection gradient value set are compared to obtain the comparison result;
[0171] Based on the comparison results, the upper limit of the detection gradient value set is determined, and the upper limit of the detection gradient value is determined as the target detection gradient value.
[0172] Optionally, determining the target size of the image to be processed based on the target detection gradient value includes:
[0173] The P-th training image that matches the target detection gradient value is determined as the target image; where P is a positive integer;
[0174] The size of the target image is obtained, and the size of the target image is determined as the target size of the image to be processed.
[0175] Optionally, obtaining the size of the target image and determining the size of the target image as the target size of the image to be processed includes:
[0176] Obtain the number of target images;
[0177] When the number of target images is equal to 1, the size of the target image is obtained, and the size of the target image is determined as the target size of the image to be processed; or
[0178] When the number of target images is greater than 1, the size of each target image is obtained, and the size of each target image is calculated to obtain the target size of the image to be processed.
[0179] Embodiments of this application also provide an electronic device, including a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, wherein the processor executes the computer program to implement the method described above.
[0180] Embodiments of this application also provide a computer-readable storage medium, the computer-readable storage medium including a stored computer program, wherein, when the computer program is executed, it controls the device where the computer-readable storage medium is located to perform the method described above.
[0181] Furthermore, other configurations and functions of the apparatus in the embodiments of this application are known to those skilled in the art, and will not be described in detail here to reduce redundancy.
[0182] It should be noted that the logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as a sequenced list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by, or in conjunction with, an instruction execution system, apparatus, or device (such as a computer-based system, a processor-included system, or other system that can fetch and execute instructions from, an instruction execution system, apparatus, or device). For the purposes of this specification, "computer-readable medium" can be any means that can contain, store, communicate, propagate, or transmit programs for use by, or in conjunction with, an instruction execution system, apparatus, or device. More specific examples (a non-exhaustive list) of computer-readable media include: an electrical connection having one or more wires (electronic device), a portable computer disk drive (magnetic device), random access memory (RAM), read-only memory (ROM), erasable and editable read-only memory (EPROM or flash memory), fiber optic devices, and portable optical disc read-only memory (CDROM). Alternatively, the computer-readable medium may be paper or other suitable media on which the program can be printed, since the program can be obtained electronically, for example, by optically scanning the paper or other medium, followed by editing, interpreting, or otherwise processing as necessary, and then stored in a computer memory.
[0183] It should be understood that various parts of this application can be implemented using hardware, software, firmware, or a combination thereof. In the above embodiments, multiple steps or methods can be implemented using software or firmware stored in memory and executed by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, it can be implemented using any one or a combination of the following techniques known in the art: discrete logic circuits having logic gates for implementing logical functions on data signals, application-specific integrated circuits (ASICs) having suitable combinational logic gates, programmable gate arrays (PGAs), field-programmable gate arrays (FPGAs), etc.
[0184] In the description of this specification, the references to terms such as "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., indicate that a specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of this application. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples.
[0185] In the description of this application, it should be understood that the terms "center", "longitudinal", "lateral", "length", "width", "thickness", "upper", "lower", "front", "rear", "left", "right", "vertical", "horizontal", "top", "bottom", "inner", "outer", "clockwise", "counterclockwise", "axial", "radial", "circumferential", etc., indicating the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings, are only for the convenience of describing this application and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation, and therefore should not be construed as a limitation of this application.
[0186] Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one of that feature. In the description of this application, "multiple" means at least two, such as two, three, etc., unless otherwise explicitly specified.
[0187] In this application, unless otherwise expressly specified and limited, the terms "installation," "connection," "joining," and "fixing," etc., should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral part; they can refer to a mechanical connection or an electrical connection; they can refer to a direct connection or an indirect connection through an intermediate medium; they can refer to the internal communication of two components or the interaction between two components, unless otherwise expressly limited. Those skilled in the art can understand the specific meaning of the above terms in this application according to the specific circumstances.
[0188] In this application, unless otherwise expressly specified and limited, "above" or "below" the second feature can mean that the first feature is in direct contact with the second feature, or that the first feature is in indirect contact with the second feature through an intermediate medium. Furthermore, "above," "on top of," and "over" the second feature can mean that the first feature is directly above or diagonally above the second feature, or simply that the first feature is at a higher horizontal level than the second feature. "Below," "below," and "under" the second feature can mean that the first feature is directly below or diagonally below the second feature, or simply that the first feature is at a lower horizontal level than the second feature.
[0189] Although embodiments of this application have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting this application. Those skilled in the art can make changes, modifications, substitutions and variations to the above embodiments within the scope of this application.
Claims
1. An image processing method, characterized in that, Applied to medical image analysis scenarios, it includes the target model, and also includes: Obtain a training image set; wherein the training image set includes multiple training images, and each training image includes a brain segmentation task or a brain classification task; Obtain the Mth training image, perform size processing on the Mth training image to obtain the Mth training image, and input the Mth training image into the target model to obtain the Mth model parameters and the Mth size model; where M is a positive integer; Based on the Mth model parameters, the Mth detection gradient value is calculated, and based on the Mth detection gradient value, a set of detection gradient values is obtained. The target detection gradient value is calculated based on the detection gradient value set, and the target size of the image to be processed is determined based on the target detection gradient value. The brain segmentation task includes brain region segmentation, brain hemorrhage location segmentation, brain tumor lesion segmentation, and skull segmentation; the brain classification task includes brain tumor lesion classification. The target model is trained in the following way: Obtain a training task set; wherein the training task set includes multiple training tasks, and each training task includes a brain segmentation task or a brain classification task; The (N+1)th training task is input into the Nth model to be trained, and the Nth model parameters of the Nth model to be trained are updated based on the (N+1)th training task to obtain the (N+1)th updated parameters; where N is a positive integer; Based on the (N+1)th update parameter and the Nth model parameter, the target model parameters are calculated. Based on the target model parameters, the target model is obtained; The brain segmentation task includes brain region segmentation, brain hemorrhage location segmentation, brain tumor lesion segmentation, and skull segmentation; the brain classification task includes brain tumor lesion classification; and the model to be trained is a deep learning model suitable for medical image analysis.
2. The method according to claim 1, characterized in that, The calculation of the Mth detection gradient value based on the Mth model parameters includes: The detection sub-image of the Mth training image is input into the Mth size model, and the Mth detection result is output. Based on the Mth detection result and the Mth model parameters, the Mth detection gradient value is calculated.
3. The method according to claim 1, characterized in that, The step of calculating the target detection gradient value based on the detection gradient value set includes: Multiple detection gradient values in the detection gradient value set are compared to obtain the comparison result; Based on the comparison results, the upper limit of the detection gradient value set is determined, and the upper limit of the detection gradient value is determined as the target detection gradient value.
4. The method according to claim 1, characterized in that, Determining the target size of the image to be processed based on the target detection gradient value includes: The P-th training image that matches the target detection gradient value is determined as the target image; where P is a positive integer; The size of the target image is obtained, and the size of the target image is determined as the target size of the image to be processed.
5. The method according to claim 4, characterized in that, The step of obtaining the size of the target image and determining the size of the target image as the target size of the image to be processed includes: Obtain the number of target images; When the number of target images is equal to 1, the size of the target image is obtained, and the size of the target image is determined as the target size of the image to be processed; or When the number of target images is greater than 1, the size of each target image is obtained, and the size of each target image is calculated to obtain the target size of the image to be processed.
6. An image processing apparatus, characterized in that, Including the target model, it also includes: The second acquisition module is used to acquire a training image set; wherein, the training image set includes multiple training images, and each training image includes a brain segmentation task or a brain classification task; The processing module is used to acquire the Mth training image, perform size processing to obtain the Mth training image, and input the Mth training image into the target model to obtain the Mth model parameters and the Mth size model; where M is a positive integer; The second calculation module is used to calculate the Mth detection gradient value based on the Mth model parameters, and to obtain a set of detection gradient values based on the Mth detection gradient value. The third calculation module is used to calculate the target detection gradient value based on the detection gradient value set, and to determine the target size of the image to be processed based on the target detection gradient value. The brain segmentation task includes brain region segmentation, brain hemorrhage location segmentation, brain tumor lesion segmentation, and skull segmentation; the brain classification task includes brain tumor lesion classification. The target model is trained in the following way: Obtain a training task set; wherein the training task set includes multiple training tasks, and each training task includes a brain segmentation task or a brain classification task; The (N+1)th training task is input into the Nth model to be trained, and the Nth model parameters of the Nth model to be trained are updated based on the (N+1)th training task to obtain the (N+1)th updated parameters; where N is a positive integer; Based on the (N+1)th update parameter and the Nth model parameter, the target model parameters are calculated. Based on the target model parameters, the target model is obtained; The brain segmentation task includes brain region segmentation, brain hemorrhage location segmentation, brain tumor lesion segmentation, and skull segmentation; the brain classification task includes brain tumor lesion classification; and the model to be trained is a deep learning model suitable for medical image analysis.
7. An electronic device, characterized in that, The method includes a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, wherein the processor, when executing the computer program, implements the method as claimed in any one of claims 1 to 5.
8. A computer-readable storage medium, characterized in that, The computer-readable storage medium includes a stored computer program, wherein, when the computer program is executed, it controls the device on which the computer-readable storage medium is located to perform the method as described in any one of claims 1 to 5.
Citation Information
Patent Citations
Brain image segmentation method and device, computer equipment and readable storage medium
CN111951272A
Hematoma segmentation method based on multi-task deep learning model
CN113902731A
Medical image processing method and system, computer device, and readable storage medium
WO2020093987A1