Image segmentation method, device, equipment and readable storage medium
By employing a target energy functional in the active contour model and utilizing adaptive weighting coefficients for image segmentation, the problems of insufficient robustness and accuracy in existing technologies are solved, achieving higher image segmentation results.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- SHENZHEN INST OF ADVANCED TECH
- Filing Date
- 2022-09-13
- Publication Date
- 2026-05-29
AI Technical Summary
Existing active contour models suffer from poor robustness and low image segmentation accuracy because their energy generalization function includes three constant weighting coefficients.
The target energy functional is used, which includes a fidelity term carrying constant weight coefficients, a length term carrying a first adaptive weight coefficient, and a smoothing term carrying a second adaptive weight coefficient. An optimization algorithm is used to segment the initial segmented image and the original image. The adaptive weight coefficients are determined from the original image.
It improves the robustness and image segmentation accuracy of the active contour model, adapts to the needs of different images to be segmented, reduces labor costs and improves segmentation accuracy.
Smart Images

Figure CN115457054B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of image processing, and in particular to an image segmentation method, apparatus, device, and readable storage medium. Background Technology
[0002] Image segmentation is an image processing method used to extract objects of interest from images. It can be applied in fields such as medical image processing and remote sensing image processing. Among these methods, the Active Contour Model (ACTM) is a commonly used image segmentation model. It can iteratively segment a target object in the original image multiple times to obtain a segmented image. The target object is the object to be segmented in the original image, such as a lung nodule in a CT (Computed Tomography) image.
[0003] Typically, the core of an active contour model includes an energy function, which serves as an evaluation metric indicating the segmentation error of the segmented image in the current iteration. By iteratively minimizing the energy function, the target segmented image can be obtained, where the relative error between the segmentation curve and the contour of the target object is less than a threshold. Currently, the energy function of an active contour model usually includes a fidelity term, a length term, and a smoothness term, each carrying constant weight coefficients. The fidelity term indicates the relative error between the current segmentation curve and the target contour in the current iteration's segmented image; the length term indicates the length of the current segmentation curve; and the smoothness term indicates the smoothness of the current segmentation curve. By minimizing the energy function through the active contour model, the current segmentation curve in the current iteration's segmented image can continuously approach the target contour and continuously shrink towards the target contour while maintaining smoothness, thus obtaining a target segmented image that can better indicate the target object.
[0004] However, the energy function of the above-mentioned active contour model includes three constant weight coefficients, which makes the weight coefficients of the fidelity term, length term and smoothness term the same for different images to be segmented. This may result in poor robustness of the active contour model and low image segmentation accuracy. Summary of the Invention
[0005] This application provides an image segmentation method, apparatus, device, and readable storage medium, which can solve the problems of poor robustness and low image segmentation accuracy caused by the energy functional of the active contour model including three constant weight coefficients.
[0006] The technical solution is as follows:
[0007] Firstly, an image segmentation method is provided, the method comprising:
[0008] Obtain the original image to be segmented, wherein the original image includes the target object;
[0009] Obtain an initial segmentation image, which is an image obtained by coarsely segmenting the target object in the original image;
[0010] The initial segmented image and the original image are input into the active contour model for image segmentation to obtain the target segmented image of the original image. The active contour model uses the target energy generalization function.
[0011] The target energy function is used to indicate the segmentation error of the intermediate segmented images generated during the image segmentation process. The target energy function includes a fidelity term carrying constant weight coefficients, a length term carrying a first adaptive weight coefficient, and a smoothing term carrying a second adaptive weight coefficient. The first adaptive weight coefficient and the second adaptive weight coefficient are determined by the original image.
[0012] As an example, the first adaptive weighting coefficient and the second adaptive weighting coefficient are represented by the following formulas:
[0013]
[0014]
[0015] in, Let β(I) be the first adaptive weight coefficient, y be the pixel coordinate of the pixel in the original image, I(y) be the pixel value of the pixel indicated by y in the original image, and β(I) be the second adaptive weight coefficient. This is the gradient operator.
[0016] As an example, the target energy functional includes a main variable representing the intermediate segmented image;
[0017] The step of inputting the initial segmented image and the original image into an active contour model for image segmentation to obtain the target segmented image of the original image includes:
[0018] The initial segmented image and the original image are input into the active contour model. Through the active contour model, the target energy function is minimized using an optimization algorithm to obtain the target master variable that satisfies the minimization of the target energy function. The intermediate segmented image represented by the target master variable is the target segmented image. The intermediate segmented image is the optimized initial segmented image obtained by optimizing the segmentation error of the initial segmented image.
[0019] As an example, the optimization algorithm is the alternating direction multiplier method;
[0020] The process of minimizing the target energy functional using an optimization algorithm to obtain the target main variable that satisfies the minimization of the target energy functional includes:
[0021] Based on the target energy functional, an augmented Lagrangian function is constructed, wherein the augmented Lagrangian function includes at least the principal variable representing the intermediate segmented image;
[0022] The main variables in the augmented Lagrange function are iteratively optimized using the alternating direction multiplier method to obtain the iteratively optimized main variables, which are the target main variables that satisfy the minimization of the target energy functional.
[0023] As an example, the augmented Lagrange function is expressed by the following formula:
[0024]
[0025] Where Γ(u(x),p,q) is the augmented Lagrangian function, x is the pixel coordinate of a pixel in the intermediate segmented image, u(x) is the pixel value of the pixel indicated by x in the intermediate segmented image, u(x) is the main variable representing the intermediate segmented image, and p is an auxiliary variable. q is a Lagrange multiplier, E(u(x)) is the target energy functional, Ω is the image region of the intermediate segmented image, and θ is the penalty coefficient.
[0026] As an example, the augmented Lagrange function also includes auxiliary variables and Lagrange multipliers, the auxiliary variables being variables related to the gradient of the principal variable of the intermediate segmented image;
[0027] The iterative optimization of the principal variables in the augmented Lagrange function using the alternating direction multiplier method yields the iteratively optimized principal variables, including:
[0028] A minimization equation is constructed based on the augmented Lagrange function, which is an equation that jointly optimizes the main variables and auxiliary variables representing the intermediate segmented image;
[0029] Based on the minimization equation, an iterative equation is constructed using the alternating direction multiplier method. The iterative equation includes a first equation, a second equation, and a third equation. The first equation is used to determine the main variable after the k-th optimization based on the auxiliary variable after the (k-1)-th optimization and the Lagrange multiplier after the (k-1)-th optimization. The second equation is used to determine the auxiliary variable after the k-th optimization based on the main variable after the k-th optimization and the Lagrange multiplier after the (k-1)-th optimization. The third equation is used to determine the Lagrange multiplier after the k-th optimization based on the main variable after the k-th optimization and the auxiliary variable after the k-th optimization, where k is a positive integer.
[0030] The master variables that satisfy the preset conditions as determined by the first equation are identified as the master variables after iterative optimization.
[0031] As an example, the minimization equation is expressed by the following formula:
[0032]
[0033] Where x is the pixel coordinate of a pixel in the intermediate segmented image, u(x) is the pixel value of the pixel indicated by x in the intermediate segmented image, u(x) is the main variable representing the intermediate segmented image, p is the auxiliary variable, q is the Lagrange multiplier, and Γ(u,p,q) is the augmented Lagrange function.
[0034] As an example, the iterative equation is expressed by the following formula:
[0035]
[0036] Where k is a positive integer, Let u(x) be the first equation. k Let u(x) be the pixel value of the pixel indicated by x in the image obtained after optimizing the segmentation error of the initial segmented image for the kth time. k Let p be the main variable after the k-th optimization. k-1 Let q be the auxiliary variable after the (k-1)th optimization. k-1 For the (k-1)th optimized Lagrange multiplier, For the second equation, p k Let be the auxiliary variable after the kth optimization. For the aforementioned third-party program, q k Let be the Lagrange multiplier after the kth optimization.
[0037] As an example, before obtaining the initial segmented image, the method further includes:
[0038] The original image is used as input to the initial segmentation model, and the initial segmentation model is used to determine the initial segmented image. The initial segmentation model is used to coarsely segment the target object in the original image to obtain a coarsely segmented image.
[0039] As an example, the target energy functional is expressed by the following formula:
[0040]
[0041] Where E(u(x)) is the target energy functional, x is the pixel coordinate of a pixel in the intermediate segmented image, u(x) is the pixel value of the pixel indicated by x in the intermediate segmented image, and u(x)∈[0,1], u(x)=1 indicates that the pixel indicated by x is located in the region where the target object is located in the intermediate segmented image, u(x)=0 indicates that the pixel indicated by x is located in another region of the intermediate segmented image other than the region where the target object is located, F(u(x)) is the fidelity term, L(u(x)) is the length term, P(u(x)) is the smoothness term, λ is the constant weight coefficient, and I is the original image. Let β(I) be the first adaptive weight coefficient, β(I) be the second adaptive weight coefficient, Ω be the image region of the intermediate segmented image, c1 be the first average pixel value of at least one pixel in the original image located inside the initial segmentation curve, c2 be the second average pixel value of at least one pixel in the original image located outside the initial segmentation curve, the initial segmentation curve is the contour line used to segment the target object in the initial segmented image and the initial segmentation curve is a closed curve, τ is the scale parameter, and G is ... second adaptive weight coefficient. τ It is a Gaussian function. This is the gradient operator.
[0042] Secondly, an image segmentation apparatus is provided, the apparatus comprising:
[0043] The first acquisition module is used to acquire the original image to be segmented, wherein the original image includes the target object;
[0044] The second acquisition module is used to acquire an initial segmentation image, which is an image after coarse segmentation of the target object in the original image;
[0045] The first segmentation module is used to input the initial segmented image and the original image into an active contour model for image segmentation to obtain a target segmented image of the original image. The active contour model adopts a target energy generalization function.
[0046] The target energy function is used to indicate the segmentation error of the intermediate segmented images generated during the image segmentation process. The target energy function includes a fidelity term carrying constant weight coefficients, a length term carrying a first adaptive weight coefficient, and a smoothing term carrying a second adaptive weight coefficient. The first adaptive weight coefficient and the second adaptive weight coefficient are determined by the original image.
[0047] As an example, the first adaptive weighting coefficient and the second adaptive weighting coefficient are represented by the following formulas:
[0048]
[0049]
[0050] in, Let β(I) be the first adaptive weight coefficient, y be the pixel coordinate of the pixel in the original image, I(y) be the pixel value of the pixel indicated by y in the original image, and β(I) be the second adaptive weight coefficient. This is the gradient operator.
[0051] As an example, the target energy functional includes main variables representing the intermediate segmented image;
[0052] The first segmentation module is further configured to input the initial segmented image and the original image into the active contour model, and through the active contour model, use an optimization algorithm to minimize the target energy function to obtain a target master variable that satisfies the minimization of the target energy function. The intermediate segmented image represented by the target master variable is the target segmented image, and the intermediate segmented image is the optimized initial segmented image obtained by optimizing the segmentation error of the initial segmented image.
[0053] As an example, the optimization algorithm is the alternating direction multiplier method;
[0054] The first segmentation module is further configured to construct an augmented Lagrangian function based on the target energy functional, wherein the augmented Lagrangian function includes at least the principal variable representing the intermediate segmented image;
[0055] The main variables in the augmented Lagrange function are iteratively optimized using the alternating direction multiplier method to obtain the iteratively optimized main variables, which are the target main variables that satisfy the minimization of the target energy functional.
[0056] As an example, the augmented Lagrange function also includes auxiliary variables and Lagrange multipliers, the auxiliary variables being variables related to the gradient of the principal variable of the intermediate segmentation image, and the Lagrange multipliers being used to transform the problem of minimizing the target energy function into a saddle point problem of jointly optimizing the principal variable representing the intermediate segmentation image and the auxiliary variables;
[0057] The first segmentation module is further configured to construct a minimization equation based on the augmented Lagrange function, wherein the minimization equation is an equation that jointly optimizes the main variables and the auxiliary variables representing the intermediate segmented image;
[0058] Based on the minimization equation, an iterative equation is constructed using the alternating direction multiplier method. The iterative equation includes a first equation, a second equation, and a third equation. The first equation is used to determine the main variable after the k-th optimization based on the auxiliary variable after the (k-1)-th optimization and the Lagrange multiplier after the (k-1)-th optimization. The second equation is used to determine the auxiliary variable after the k-th optimization based on the main variable after the k-th optimization and the Lagrange multiplier after the (k-1)-th optimization. The third equation is used to determine the Lagrange multiplier after the k-th optimization based on the main variable after the k-th optimization and the auxiliary variable after the k-th optimization, where k is a positive integer.
[0059] The master variables that satisfy the preset conditions as determined by the first equation are identified as the master variables after iterative optimization.
[0060] As an example, the minimization equation is expressed by the following formula:
[0061]
[0062] Where x is the pixel coordinate of a pixel in the intermediate segmented image, u(x) is the pixel value of the pixel indicated by x in the intermediate segmented image, u(x) is the main variable representing the intermediate segmented image, p is the auxiliary variable, q is the Lagrange multiplier, and Γ(u,p,q) is the augmented Lagrange function.
[0063] As an example, the iterative equation is expressed by the following formula:
[0064]
[0065] Where k is a positive integer, Let u(x) be the first equation. k Let u(x) be the pixel value of the pixel indicated by x in the image obtained after optimizing the segmentation error of the initial segmented image for the kth time. k Let p be the main variable after the k-th optimization. k-1Let q be the auxiliary variable after the (k-1)th optimization. k-1 For the (k-1)th optimized Lagrange multiplier, For the second equation, p k Let be the auxiliary variable after the kth optimization. For the aforementioned third-party program, q k Let be the Lagrange multiplier after the kth optimization.
[0066] As an example, the image segmentation adjustment device further includes a second segmentation module, which is used to take the original image as input to an initial segmentation model, and determine the initial segmented image through the initial segmentation model. The initial segmentation model is used to coarsely segment the target object in the original image to obtain a coarsely segmented image.
[0067] As an example, the target energy functional is expressed by the following formula:
[0068]
[0069] Where E(u(x)) is the target energy functional, x is the pixel coordinate of a pixel in the intermediate segmented image, u(x) is the pixel value of the pixel indicated by x in the intermediate segmented image, and u(x)∈[0,1], u(x)=1 indicates that the pixel indicated by x is located in the region where the target object is located in the intermediate segmented image, u(x)=0 indicates that the pixel indicated by x is located in another region of the intermediate segmented image other than the region where the target object is located, F(u(x)) is the fidelity term, L(u(x)) is the length term, P(u(x)) is the smoothness term, λ is the constant weight coefficient, and I is the original image. Let β(I) be the first adaptive weight coefficient, β(I) be the second adaptive weight coefficient, Ω be the image region of the intermediate segmented image, c1 be the first average pixel value of at least one pixel in the original image located inside the initial segmentation curve, c2 be the second average pixel value of at least one pixel in the original image located outside the initial segmentation curve, the initial segmentation curve is the contour line used to segment the target object in the initial segmented image and the initial segmentation curve is a closed curve, τ is the scale parameter, and G is ... second adaptive weight coefficient. τ It is a Gaussian function. This is the gradient operator.
[0070] Thirdly, a computer device is provided, the computer device including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program, when executed by the processor, implements the image segmentation method described above.
[0071] Fourthly, a computer-readable storage medium is provided, the computer-readable storage medium storing a computer program that, when executed by a processor, implements the above-described image segmentation method.
[0072] The beneficial effects of the technical solutions provided in this application are:
[0073] In this embodiment, an initial segmentation image and an original image to be segmented, including the target object, are first acquired. Then, the initial segmentation image and the original image are input into an active contour model for image segmentation to obtain the target segmented image of the original image. The initial segmentation image is the image after coarse segmentation of the target object in the original image. The active contour model uses a target energy functional, which indicates the segmentation error of intermediate segmented images during the image segmentation process. The target energy functional includes a fidelity term with constant weight coefficients, a length term with a first adaptive weight coefficient, and a smoothing term with a second adaptive weight coefficient. The first and second adaptive weight coefficients are determined through the original image; that is, the weight coefficients of the length and smoothing terms are not constants but adaptive weight coefficients related to the original image to be segmented. Thus, when performing image segmentation on the image to be segmented using the active contour model, the weight coefficients of the length and smoothing terms of the target energy functional in the active contour model can be adjusted accordingly based on different images to be segmented, thereby improving the robustness and image segmentation accuracy of the active contour model. Attached Figure Description
[0074] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0075] Figure 1 This is a flowchart of an image segmentation method provided in an embodiment of this application;
[0076] Figure 2 This is a flowchart of another image segmentation method provided in the embodiments of this application;
[0077] Figure 3 This is a schematic diagram of the framework of an image segmentation method provided in an embodiment of this application;
[0078] Figure 4 This is a schematic diagram of the structure of an image segmentation device provided in an embodiment of this application;
[0079] Figure 5This is a schematic diagram of the structure of a computer device provided in an embodiment of this application. Detailed Implementation
[0080] To make the objectives, technical solutions, and advantages of this application clearer, the embodiments of this application will be described in further detail below with reference to the accompanying drawings.
[0081] It should be understood that "multiple" as mentioned in this application refers to two or more. In the description of this application, unless otherwise stated, " / " indicates "or," for example, A / B can mean A or B; "and / or" in this document is merely a description of the relationship between related objects, indicating that three relationships can exist, for example, A and / or B can represent: A existing alone, A and B existing simultaneously, and B existing alone. Furthermore, to facilitate a clear description of the technical solutions of this application, the terms "first," "second," etc., are used to distinguish identical or similar items with essentially the same function and effect. Those skilled in the art will understand that the terms "first," "second," etc., do not limit the quantity or execution order, and that "first," "second," etc., do not necessarily imply differences.
[0082] Before providing a detailed explanation of the embodiments of this application, the application scenarios of these embodiments will be described first.
[0083] The image segmentation method provided in this application can be applied to scenarios such as medical image processing and remote sensing image processing. It can divide an image into a background region and a target region, where the target region is the area containing the object to be segmented. For example, in the scenario of medical image processing, this image segmentation method can segment lesion areas from medical images to help determine the patient's physical condition.
[0084] As an example, lung cancer is a malignant tumor that poses a huge challenge to human health, with its incidence and mortality rates rising rapidly in various countries. To assess lung cancer, image segmentation methods can be used to segment lung nodules (target objects) in medical images, replacing or assisting doctors in making diagnoses, improving doctors' work efficiency, and quickly determining the patient's physical condition.
[0085] This application proposes an image segmentation method that can segment target objects in an original image using an active contour model. The active contour model uses a target energy functional that includes a fidelity term with constant weight coefficients, a length term with a first adaptive weight coefficient, and a smoothing term with a second adaptive weight coefficient. The first and second adaptive weight coefficients are determined by the original image, which can improve the robustness of the active contour model and the accuracy of image segmentation.
[0086] Please refer to Figure 1 , Figure 1 This is a flowchart of an image segmentation method provided in an embodiment of this application. The method can be applied to a computer device, which can be a terminal, server, or embedded device, etc. The terminal can be a desktop computer or tablet computer, etc. The method includes the following steps:
[0087] Step 101: The computer device acquires the original image to be segmented.
[0088] The original image includes the target object, which is the object to be segmented in the original image.
[0089] For example, the original image can be a medical image in a medical image processing scenario, such as a CT (Computed Tomography) image, an ultrasound image, or an MR (Magnetic Resonance) image, and the target object can be a nodule, a tumor, etc. Segmenting the original image means segmenting the lesion area (target area) such as the nodule or tumor in the original image.
[0090] Step 102: The computer device acquires the initial segmented image.
[0091] The initial segmentation image is the image obtained by coarsely segmenting the target object in the original image. Moreover, the initial segmentation image is a binary image, that is, the pixel value of the pixels in the initial segmentation image can be 0 or 1. The initial segmentation image carries information about the initial segmentation curve, which can be determined by the binary nature of the pixels in the initial segmentation image. The initial segmentation curve is the contour line (initial contour line) used to segment the target object in the initial segmentation image, and the initial segmentation curve is a closed curve.
[0092] For example, the initial segmentation image can be a segmentation image obtained by manually setting initial contour lines in the original image, or it can be a segmentation image obtained through an initial segmentation model. For instance, after manually setting initial contour lines in the original image, the pixel values of pixels located inside the initial contour lines are set to 1, and the pixel values of pixels located outside the initial contour lines are set to 0, thus obtaining the initial segmentation image. Alternatively, for example, before the computer device acquires the initial segmentation image, it uses the original image as input to the initial segmentation model, and the initial segmentation image is determined by the initial segmentation model. The initial segmentation model is used to coarsely segment the target object in the original image, obtaining a coarsely segmented image, which is the initial segmentation image.
[0093] As an example, the initial segmentation model can be a model that uses deep learning methods for coarse segmentation, such as the U-Net network, SegNet network, or DeepLab network. This application embodiment does not limit this. Furthermore, the initial segmentation model needs to be trained before use. Since the initial segmented image obtained by the initial segmentation model is used as input to the active contour model in this application embodiment, the initial segmentation model only needs to perform coarse segmentation on the original image, meaning the accuracy requirement for the initial segmentation model is low. Therefore, images with a small number of samples can be used to train the initial segmentation model. That is, in this application embodiment, a small number of training images can be used to train the initial segmentation model to obtain the initial segmentation model. Then, the original image is obtained and used as input to the initial segmentation model to obtain the initial segmented image. Afterward, the original image and the initial segmented image are used as input to the active contour model to segment the target object in the original image, obtaining the target segmented image. This eliminates the need to manually set the initial segmentation curve, reducing labor costs and achieving high segmentation accuracy with small sample data.
[0094] Step 103: The computer device inputs the initial segmented image and the original image into the active contour model for image segmentation to obtain the target segmented image of the original image.
[0095] The active contour model uses a target energy function, which is used to indicate the segmentation error of intermediate segmented images generated during image segmentation. The target energy function includes a fidelity term with constant weight coefficients, a length term with first adaptive weight coefficients, and a smoothing term with second adaptive weight coefficients. The first and second adaptive weight coefficients are determined from the original image.
[0096] In other words, the weight coefficients of the length and smoothness terms of the target energy functional function used in the active contour model are not constants, but adaptive weight coefficients related to the original image. Thus, the weight coefficients of the length and smoothness terms of the target energy functional function can be adjusted according to different images to be segmented, resulting in high robustness and segmentation accuracy of the active contour model when segmenting target objects in the original image.
[0097] The target energy functional includes a fidelity term indicating the relative error between the segmentation curve in the intermediate segmentation image and the target contour line, where the target contour line is the segmentation curve in the true standard segmentation image; a length term indicating the length of the segmentation curve in the intermediate segmentation image; and a smoothness term indicating the smoothness of the segmentation curve in the intermediate segmentation image.
[0098] As an example, the first and second adaptive weighting coefficients can be determined based on the gradient of the original image. Since the first and second adaptive weighting coefficients are related to the gradient of the original image, edge information of different original images can be obtained relatively fully through the first and second adaptive weighting coefficients, thus resulting in high robustness and segmentation accuracy of the active contour model.
[0099] For example, the first adaptive weight coefficient can be represented by the following formula (1), and the second adaptive weight coefficient can be represented by the following formula (2):
[0100]
[0101]
[0102] in, Let β(I) be the first adaptive weighting coefficient, y be the pixel coordinate of a pixel in the original image, I(y) be the pixel value of the pixel indicated by y in the original image, and β(I) be the second adaptive weighting coefficient. This is the gradient operator.
[0103] For example, the pixel coordinates represented by y are multi-dimensional, including both horizontal and vertical coordinates.
[0104] The intermediate segmented image is a segmented image generated during the image segmentation process of the original image. Moreover, the intermediate segmented image is a binary image, carrying information about the intermediate segmentation curves. The intermediate segmentation curves in the intermediate segmented image are the contour lines used to segment the target object in the intermediate segmented image, and the segmentation curves in the intermediate segmented image are closed curves.
[0105] For example, an intermediate segmentation image is an optimized initial segmentation image obtained by optimizing the segmentation error of the initial segmentation image. The optimized initial segmentation image may include the target segmentation image, that is, a certain intermediate segmentation image can be the target segmentation image.
[0106] For example, the fidelity term includes the main variable representing the intermediate segmented image, and the fidelity term can be represented by the following formula (3):
[0107]
[0108] Where F(u(x)) is the fidelity term, x is the pixel coordinate of a pixel in the intermediate segmented image, u(x) is the pixel value of the pixel indicated by x in the intermediate segmented image, and u(x)∈[0,1]. u(x)=1 indicates that the pixel indicated by x is located in the region where the target object is located in the intermediate segmented image, u(x)=0 indicates that the pixel indicated by x is located in another region of the intermediate segmented image other than the region where the target object is located, I is the original image, Ω is the image region of the intermediate segmented image, c1 is a constant, c1 is the first average value of the pixel values of at least one pixel located in the region inside the initial segmentation curve in the original image, c2 is a constant, c2 is the second average value of the pixel values of at least one pixel located in the region outside the initial segmentation curve in the original image. The pixel values of all pixels indicated by all pixel coordinates in the intermediate segmented image can represent the intermediate segmented image, that is, u(x) can represent the intermediate segmented image, and u(x) is the main variable representing the intermediate segmented image.
[0109] For example, the pixel coordinates represented by x are multi-dimensional, including both horizontal and vertical coordinates.
[0110] As an example, based on the original image and the initial segmentation image, the first average value c1 can be determined by the following formula (4), and the second average value c2 can be determined by the following formula (5):
[0111]
[0112]
[0113] Where z is the pixel coordinate of a pixel in the initial segmented image, r(z) is the pixel value of the pixel indicated by z in the initial segmented image, I is the original image, and Ω is the image region of the intermediate segmented image.
[0114] For example, the pixel coordinates represented by z are multi-dimensional, including both horizontal and vertical coordinates.
[0115] It should be noted that in the embodiments of this application, the image regions in the original image, the initial segmented image and the intermediate segmented image are the same, that is, the number of pixels in the image is the same, but the pixel values of the pixels indicated by the same pixel coordinates in the image may be the same or different.
[0116] As an example, the first average and the second average can also be variables related to the main variables representing the intermediate segmented image. For example, the first average is the average pixel value of at least one pixel in the original image located inside the intermediate segmentation curve, and the second average is the average pixel value of at least one pixel in the original image located outside the intermediate segmentation curve. The intermediate segmentation curve is the contour line used to segment the target object in the intermediate segmented image, and the intermediate segmentation curve is a closed curve. In this case, the formulas for determining the first average and the second average can be found in formulas (23) and (24) of Embodiment 2 below, which will not be elaborated here.
[0117] For example, the length term includes the principal variables representing the intermediate segmented image. The length term can be represented by the integral of the principal variables of the intermediate segmented image. For example, the length term is represented by the following formula (6):
[0118]
[0119] Where L(u(x)) is the length term, x is the pixel coordinate of a pixel in the intermediate segmented image, u(x) is the pixel value of the pixel indicated by x in the intermediate segmented image, Ω is the image region of the intermediate segmented image, and G τ Let τ be a Gaussian function and τ be a scaling parameter.
[0120] As an example, G τ It can be expressed by the following formula (7):
[0121]
[0122] For example, the smoothing term includes the principal variables representing the intermediate segmented image. The smoothing term can be represented by the integral of the second-order gradient of the principal variables of the intermediate segmented image. For example, the smoothing term is represented by the following formula (8):
[0123]
[0124] Where P(u(x)) is the smoothing term, x is the pixel coordinate of a pixel in the intermediate segmented image, u(x) is the pixel value of the pixel indicated by x in the intermediate segmented image, and Ω is the image region of the intermediate segmented image. This is the gradient operator.
[0125] As an example, the target energy functional is expressed by the following formula (9):
[0126]
[0127] Where E(u(x)) is the target energy functional, x is the pixel coordinate of a pixel in the intermediate segmented image, u(x) is the pixel value of the pixel indicated by x in the intermediate segmented image, and u(x)∈[0,1]. u(x)=1 indicates that the pixel indicated by x is located in the region where the target object is located in the intermediate segmented image, u(x)=0 indicates that the pixel indicated by x is located in other regions of the intermediate segmented image besides the region where the target object is located, u(x) represents the intermediate segmented image, F(u(x)) is the fidelity term, L(u(x)) is the length term, P(u(x)) is the smoothing term, λ is the constant weight coefficient, and I is the original image. β(I) is the first adaptive weight coefficient, β(I) is the second adaptive weight coefficient, Ω is the image region of the intermediate segmented image, c1 is the first average pixel value of at least one pixel in the original image located inside the initial segmentation curve, c2 is the second average pixel value of at least one pixel in the original image located outside the initial segmentation curve, τ is the scale parameter, and G... τ It is a Gaussian function. This is the gradient operator. Furthermore, since u(x) can represent the intermediate segmented image, it can be seen from the above formula (9) that the target energy functional includes the main variable representing the intermediate segmented image, which is u(x).
[0128] As an example, the target energy functional includes principal variables representing intermediate segmented images. The computer device can input the initial segmented image and the original image into an active contour model. Through the active contour model, an optimization algorithm is used to minimize the target energy functional, obtaining the target principal variable that satisfies this minimization. The intermediate segmented image represented by the target principal variable is the target segmented image. In other words, through the active contour model, an optimization algorithm can be used to find the optimal solution to the target energy functional minimization problem. The optimal solution is the target principal variable corresponding to the minimum segmentation error indicated by the target energy functional.
[0129] For example, the first average value is the average pixel value of at least one pixel in the original image located inside the initial segmentation curve, and the second average value is the average pixel value of at least one pixel in the original image located outside the initial segmentation curve. The computer device inputs the initial segmentation image and the original image into the active contour model. Using the initial active contour model, it first determines the first and second adaptive weight coefficients based on the original image, then determines the first and second average values based on the original image and the initial segmentation image. Finally, based on the original image, the initial segmentation image, the first and second adaptive weight coefficients, the first and second average values, an optimization algorithm is used to minimize the target energy functional, i.e., to solve the problem of minimizing the target energy functional, thus obtaining the target master variable that satisfies the minimization of the target energy functional.
[0130] For example, consider the target energy function in formula (9) above. This target energy function contains multiple divisible variables, including the main variable u(x) and the gradient of the main variable. Furthermore, minimizing the target energy functional is a non-smooth optimization problem, making it impossible to establish a direct numerical method. In other words, minimizing the target energy functional is quite complex. Therefore, the alternating direction multiplier method can be used to transform the minimization problem of the target energy functional into a problem involving the main variable u(x) and its gradient. The multiple easily solvable subproblems are transformed into gradients with respect to the main variable u(x) and the main variable. This involves a saddle point problem requiring joint optimization. For example, using the alternating direction multiplier method as the optimization algorithm, the computer can first construct an augmented Lagrangian function based on the target energy functional. Then, the alternating direction multiplier method is used to iteratively optimize the principal variables in the augmented Lagrangian function, obtaining the iteratively optimized principal variables. These optimized principal variables are the target principal variables that minimize the target energy functional. The augmented Lagrangian function must include at least the principal variables representing the intermediate segmented images.
[0131] For example, the augmented Lagrangian function can be expressed by the following formula (10):
[0132]
[0133] Where Γ(u(x),p,q) is the augmented Lagrangian function, x is the pixel coordinate of a pixel in the intermediate segmented image, u(x) is the pixel value of the pixel indicated by x in the intermediate segmented image, and p is an auxiliary variable. q is the Lagrange multiplier, E(u(x)) is the target energy function, Ω is the image region of the intermediate segmented image, and θ is the penalty coefficient.
[0134] For example, the augmented Lagrangian function also includes auxiliary variables p and Lagrange multipliers q. The auxiliary variable p is a splittable auxiliary variable introduced when using the alternating direction multiplier method. The auxiliary variable p is a variable related to the gradient of the principal variable of the intermediate segmented image. The Lagrange multipliers q are variables introduced when constructing the augmented Lagrangian function. Through the Lagrange multipliers q, the problem of minimizing the target energy function can be transformed into a saddle point problem of jointly optimizing the principal and auxiliary variables representing the intermediate segmented image.
[0135] For example, a computer device uses the alternating direction multiplier method to iteratively optimize the main variables in the augmented Lagrangian function, obtaining the iteratively optimized main variables. This can be achieved through the following steps:
[0136] Step 1) Construct the minimization equation based on the augmented Lagrange function.
[0137] The minimization equation is a joint optimization equation for the main and auxiliary variables representing the intermediate segmented image.
[0138] For example, the minimization equation can be expressed by the following formula (11):
[0139]
[0140] Where x is the pixel coordinate of a pixel in the intermediate segmented image, u(x) is the pixel value of the pixel indicated by x in the intermediate segmented image, p is an auxiliary variable, q is a Lagrange multiplier, and Γ(u,p,q) is the augmented Lagrange function.
[0141] Step 2) Based on the minimization equation, construct the iterative equation using the alternating direction multiplier method. The iterative equation includes the first equation, the second equation, and the third equation.
[0142] The first equation is used to determine the principal variable after the k-th optimization based on the auxiliary variable after the (k-1)-th optimization and the Lagrange multiplier after the (k-1)-th optimization. The second equation is used to determine the auxiliary variable after the k-th optimization based on the principal variable after the k-th optimization and the Lagrange multiplier after the (k-1)-th optimization. The third equation is used to determine the Lagrange multiplier after the k-th optimization based on the principal variable after the k-th optimization and the auxiliary variable after the k-th optimization. k is a positive integer, k is the iteration number, and k represents the number of optimization iterations to optimize the segmentation error of the initial segmented image.
[0143] For example, the first equation in the iterative equation can be represented by the following formula (12), the second equation can be represented by the following formula (13), and the third equation can be represented by the following formula (14):
[0144]
[0145]
[0146]
[0147] Where k is a positive integer, u(x) k Let u(x) be the pixel value of the pixel indicated by x in the image obtained after optimizing the segmentation error of the initial segmented image for the kth time. k Let p be the main variable after the k-th optimization. k-1 Let q be the auxiliary variable after the (k-1)th optimization. k-1 For the (k-1)th optimized Lagrange multiplier, p k Let q be the auxiliary variable after the k-th optimization. k It is the Lagrange multiplier optimized in the kth iteration.
[0148] It should be noted that when k equals 1, that is, when the computer device performs the first iteration to optimize the segmentation error of the initial segmented image, it can obtain the initial segmented image after the first optimization, and the main variable u(x) after the (k-1)th optimization is... 0 p is the initial main variable, and the auxiliary variable after the (k-1)th optimization. 0 As the initial auxiliary variable, the Lagrange multiplier q after the (k-1)th optimization. 0 The initial Lagrange multipliers are defined as follows: The initial principal variable can be determined by the initial segmentation image, while the initial auxiliary variable and the initial Lagrange multipliers can be preset, for example, both the initial auxiliary variable and the initial Lagrange multipliers can be zero matrices.
[0149] As an example, after constructing the iterative equations using the alternating direction multiplier method, the solutions to the first, second, and third equations can be solved separately to obtain the principal variables, auxiliary variables, and Lagrange multipliers after the kth optimization.
[0150] As an example, combining formulas (9) and (10), the subproblem of solving the first equation formula (12) can be expressed as the problem of solving the following formula (15):
[0151]
[0152] It should be noted that the problem in formula (15) is a non-convex optimization problem, and formula (15) can be approximated by linearization as follows: formula (16) and formula (17):
[0153]
[0154]
[0155] Where, u(x) k Let u(x) be the main variable after the k-th optimization, u(x) be the pixel value of the pixel indicated by x in the intermediate segmentation image, Ω be the image region of the intermediate segmentation image, λ be a constant weight coefficient, I be the original image, c1 be the first average pixel value of at least one pixel in the original image located inside the initial segmentation curve, and c2 be the second average pixel value of at least one pixel in the original image located outside the initial segmentation curve. Let G be the first adaptive weight coefficient, τ be the scale parameter, and G be the weight coefficient. τ Let u(x) be a Gaussian function. k-1 Let θ be the main variable after the (k-1)th optimization, and div be the penalty coefficient. 2 for The conjugate operator, p is the gradient operator. k-1Let q be the auxiliary variable after the (k-1)th optimization. k-1 It is the Lagrange multiplier optimized in the (k-1)th iteration.
[0156] Because u(x) k ∈[0,1], that is u(x) k It has binary properties, therefore the solution u(x) satisfies formula (16). k It can be expressed by the following formula (18):
[0157]
[0158] Wherein, the main variable u(x) after the kth optimization is... k This can represent the optimized initial segmentation image obtained by optimizing the segmentation error of the initial segmentation image for the kth time. It is determined by the above formula (17). Wherein, when k equals 1, u(x) in formula (17) k-1 p is the initial host variable. k-1 q is the initial auxiliary variable. k-1 These are the initial Lagrange multipliers.
[0159] According to the above formula (18), it can be concluded that the computer device can determine the main variable after the k-th optimization based on the main variable after the k-1th optimization, the auxiliary variable after the k-1th optimization, the Lagrange multiplier after the k-1th optimization, and the first adaptive weight coefficient. That is, the main variable after the k-th optimization is related to the main variable after the k-1th optimization, the auxiliary variable after the k-1th optimization, the Lagrange multiplier after the k-1th optimization, and the first adaptive weight coefficient.
[0160] After minimizing the target energy functional using formula (18), the iterative equation is constructed using the alternating direction multiplier method. After iteratively optimizing the first equation of the iterative equation, the principal variable after the kth optimization can be obtained.
[0161] As an example, combining formulas (9) and (10), the subproblem of solving the second equation formula (13) can be expressed as the problem of solving the following formula (19):
[0162]
[0163] Where Ω represents the image region of the intermediate segmented image, β(I) is the second adaptive weight coefficient, p is an auxiliary variable, and θ is the penalty coefficient. This is the gradient operator, u(x). k Let q be the main variable after the k-th optimization. k-1 It is the Lagrange multiplier optimized in the (k-1)th iteration.
[0164] The solution p that satisfies formula (19) k It can be expressed by the following formula (20):
[0165]
[0166] Where, p k Let be the auxiliary variable after the k-th optimization, and shrinkage be the compression threshold operator. The product is a point-by-point multiplication, where θ is the penalty coefficient. This is the gradient operator, u(x). k Let q be the main variable after the k-th optimization. k-1 Let be the Lagrange multiplier after the (k-1)th optimization, and β(I) be the second adaptive weight coefficient. Where, when k equals 1, q in formula (20) k-1 These are the initial Lagrange multipliers.
[0167] According to the above formula (20), it can be concluded that the computer device can determine the auxiliary variable after the kth optimization based on the main variable after the kth optimization, the Lagrange multiplier after the (k-1)th optimization, and the second adaptive weight coefficient. That is, the auxiliary variable after the kth optimization is related to the main variable after the kth optimization, the Lagrange multiplier after the (k-1)th optimization, and the second adaptive weight coefficient.
[0168] After minimizing the target energy functional using formula (20), the iterative equation is constructed using the alternating direction multiplier method. By iteratively optimizing the second equation of the iterative equation, the auxiliary variable after the kth optimization can be obtained.
[0169] As an example, the solution q of the third equation (14) is obtained by using the gradient ascent method. k It can be expressed by the following formula (21):
[0170]
[0171] Where, q k For the k-th optimized Lagrange multiplier, q k-1 Let p be the Lagrange multiplier after the (k-1)th optimization, θ be the penalty coefficient, and p be the multiplier. k Let k be the auxiliary variable after the kth optimization. This is the gradient operator, u(x). k Let be the main variable after the k-th optimization. Where, when k equals 1, q in formula (21) k-1 These are the initial Lagrange multipliers.
[0172] According to the above formula (21), it can be concluded that the computer device can determine the Lagrange multiplier after the kth optimization based on the main variable after the kth optimization, the auxiliary variable after the kth optimization, and the Lagrange multiplier after the (k-1)th optimization.
[0173] After minimizing the target energy functional using formula (21), the iterative equation is constructed using the alternating direction multiplier method. By iteratively optimizing the third equation of the iterative equation, the Lagrange multiplier after the kth optimization can be obtained.
[0174] Step 3) The master variables that satisfy the preset conditions determined by the first equation are identified as the master variables after iterative optimization.
[0175] Among them, the preset condition is the cutoff condition of the active contour model. The preset condition can be a loop stop condition and / or a threshold stop condition. For example, satisfying the loop stop condition means that the number of iterations k is greater than the maximum number of iterations. Satisfying the threshold stop condition means that the 1 norm of the difference between the main variable after the kth optimization and the main variable after the (k-1)th optimization corresponding to the number of iterations k is less than or equal to the product of the 1 norm of the main variable after the kth optimization and the stop threshold. The threshold stop condition can be expressed by the following formula (22):
[0176]
[0177] Where, u(x) k Let u(x) be the main variable after the k-th optimization. k-1 Let be the main variable after the (k-1)th optimization, ||||1 be the 1 norm, and ε be the stopping threshold.
[0178] For example, the computer equipment solves the solutions to the first equation, the second equation, and the third equation respectively, and obtains the main variable, the auxiliary variable, and the Lagrange multiplier after the kth optimization. Then, it determines whether the iteration number k meets the preset conditions. If the iteration number k is greater than the maximum iteration number, and / or the main variable after the kth optimization corresponding to the iteration number k meets the stopping threshold condition, then it is determined that the iteration number k meets the preset conditions; otherwise, it is determined that the iteration number k does not meet the preset conditions.
[0179] As an example, if it is determined that the iteration number k does not meet the preset condition, then the iteration number k is updated to k+1, and the steps of solving the first equation, the second equation, and the third equation respectively are continued to obtain the main variable, auxiliary variable, and Lagrange multiplier after the k-th optimization with updated k, until the iteration number k meets the preset condition. If it is determined that the iteration number k meets the preset condition, then the main variable after the k-th optimization determined by the first equation is determined as the main variable after iterative optimization.
[0180] Thus, through steps 1)-3) above, after the computer device constructs the augmented Lagrangian function based on the target energy functional, it can first construct the minimization equation based on the augmented Lagrangian function; then, based on the minimization equation, it uses the alternating direction multiplier method to construct an iterative equation including the first equation represented by formula (12), the second equation represented by formula (13), and the third equation represented by formula (14); then, when the iteration number k equals 1, the solution u(x) of the first optimized first equation is determined according to formula (18). 1 This yields the main variable u(x) after the first optimization. 1 The solution p of the second equation after the first optimization is determined according to formula (20). 1 The auxiliary variable p after the first optimization is obtained. 1 The solution q of the third-party process after the first optimization is determined according to formula (21). 1 The first optimized Lagrange multiplier q is obtained. 1 Then, determine whether the iteration number k meets the preset condition. If not, update k to k+1, and continue to determine the main variable u(x) after the second optimization according to formula (18). 2 The auxiliary variable p after the second optimization is determined according to formula (20). 2 The second optimized Lagrange multiplier q is determined according to formula (21). 2 This process continues until the iteration number k satisfies the preset condition. The optimized main variable u(x) determined by the first equation after the kth iteration satisfies the preset condition is then used. k This is determined as the main variable u(x) after iterative optimization. k The main variable u(x) after iterative optimization k The intermediate segmented image is represented as the target segmented image.
[0181] In summary, the computer device can input the initial segmented image and the original image into the active contour model. Using the initial active contour model, the first and second adaptive weight coefficients are determined based on the original image. Then, based on the original image and the initial segmented image, the first and second average values are determined using formulas (4) and (5). Finally, based on the original image, the initial segmented image, the first adaptive weight coefficient, the second adaptive weight coefficient, the first average value, and the second average value, the target energy function is minimized using formulas (18), (20), and (21) with an optimization algorithm. The main variable, auxiliary variable and Lagrange multiplier after the kth optimization are obtained; then it is determined whether the iteration number k meets the preset condition. If not, k is updated to k plus the preset value. Then, the target energy function is minimized by the optimization algorithm through formula (18), formula (20) and formula (21) to obtain the main variable, auxiliary variable and Lagrange multiplier after the kth optimization after k update. The iteration number k after k update is determined to meet the preset condition until the iteration number k meets the preset condition. The main variable after the kth optimization determined by the first equation is determined as the main variable after iterative optimization.
[0182] Alternatively, the computer device can input the initial segmented image and the original image into the active contour model. Through the initial active contour model, the first adaptive weight coefficient and the second adaptive weight coefficient are first determined based on the original image; then, based on the original image and the initial segmented image, the first average value and the second average value are determined through formulas (4) and (5); then, based on the original image, the initial segmented image, the first adaptive weight coefficient, the second adaptive weight coefficient, the first average value, and the second average value, the target energy function is minimized using the optimization algorithm through formulas (18), (20), and (21) to obtain the main variable, auxiliary variable, and Lagrange multiplier after the kth optimization; then, the iteration is determined. If the iteration number k does not meet the preset conditions, then based on the original image and the intermediate segmented image represented by the principal variable after the kth optimization, the first average value and the second average value are updated by formula (23) and formula (24), and k is updated to k plus the preset value. Then, by using formula (18), formula (20) and formula (21), the target energy function is minimized by the optimization algorithm to obtain the principal variable, auxiliary variable and Lagrange multiplier after the kth optimization after k is updated. Continue to determine whether the iteration number k after k is updated meets the preset conditions until the iteration number k meets the preset conditions. The principal variable after the kth optimization determined by the first equation is determined as the principal variable after iterative optimization.
[0183] In this embodiment, an initial segmentation image and an original image to be segmented, including the target object, are first acquired. Then, the initial segmentation image and the original image are input into an active contour model for image segmentation to obtain the target segmented image of the original image. The initial segmentation image is the image after coarse segmentation of the target object in the original image. The active contour model uses a target energy functional, which indicates the segmentation error of intermediate segmented images during the image segmentation process. The target energy functional includes a fidelity term with constant weight coefficients, a length term with a first adaptive weight coefficient, and a smoothing term with a second adaptive weight coefficient. The first and second adaptive weight coefficients are determined through the original image; that is, the weight coefficients of the length and smoothing terms are not constants but adaptive weight coefficients related to the original image to be segmented. Thus, when performing image segmentation on the image to be segmented using the active contour model, the weight coefficients of the length and smoothing terms of the target energy functional in the active contour model can be adjusted accordingly based on different images to be segmented, thereby improving the robustness and image segmentation accuracy of the active contour model.
[0184] It should be noted that before the computer device performs image segmentation on the target object in the original image using the active contour model, it has already pre-built the aforementioned model. Figure 1 The embodiment includes an active contour model and a process for image segmentation using the active contour model. After acquiring the original image to be segmented, the computer device can directly obtain the target segmented image according to the pre-set image segmentation process using the active contour model. For example, the computer device can perform image segmentation using the active contour model by executing the following image segmentation method.
[0185] For details, please refer to Figure 2 , Figure 2 This is a flowchart of another image segmentation method provided in an embodiment of this application. This method can be applied to a computer device, which can be a terminal, server, or embedded device, etc. The terminal can be a desktop computer or tablet computer, etc. The method includes the following steps:
[0186] Step 201: The computer device acquires the original image to be segmented, the initial segmentation image, and the preset parameters of the active contour model.
[0187] The original image includes the target object, which is the object to be segmented in the original image.
[0188] The initial segmentation image is the image after coarse segmentation of the target object in the original image. The initial segmentation image is a binary image and carries information about the initial segmentation curve.
[0189] For example, the pixel value of a pixel in the initial segmentation image can be 0 or 1. A pixel value of 1 in the initial segmentation image indicates that the pixel is located in the region where the target object is located in the initial segmentation image, while a pixel value of 0 in the initial segmentation image indicates that the pixel is located in another region in the initial segmentation image other than the region where the target object is located.
[0190] As an example, the initial segmentation image can be a segmentation image obtained by manually setting the initial contour lines in the original image, or it can be a segmentation image obtained through an initial segmentation model.
[0191] The preset parameters are commonly used parameters in the active contour model. For example, preset parameters may include constant weight coefficients, scale parameters, penalty coefficients, preset condition values corresponding to preset conditions, initial auxiliary variables, and initial Lagrange multipliers. The specific meanings of constant weight coefficients, scale parameters, penalty coefficients, initial auxiliary variables, and initial Lagrange multipliers can be found above. Figure 1 Examples of embodiments are not described in detail here.
[0192] Among them, the preset condition is the cutoff condition of the active contour model. The preset condition can be a loop stop condition and / or a threshold stop condition. The preset condition value corresponding to the loop stop condition is the maximum number of iterations, and the preset condition value corresponding to the threshold stop condition is the stop threshold. The maximum number of iterations and the stop threshold can be preset.
[0193] For example, the initial auxiliary variable p 0 and the initial Lagrange multiplier q 0 It is a zero matrix, and the scale parameter τ can be a small constant such as 0.01 or 0.001 that has been set beforehand.
[0194] For example, the constant weight coefficient and penalty coefficient are obtained through continuous debugging. That is, the parameters that need to be debugged in the implementation of this application include the constant weight coefficient and penalty coefficient. The computational complexity of the active contour model is relatively low.
[0195] Step 202: The computer device determines the first adaptive weighting coefficient and the second adaptive weighting coefficient based on the original image.
[0196] Wherein, the first adaptive weighting coefficient is the weighting coefficient of the length term included in the target energy functional in the active contour model, and the second adaptive weighting coefficient is the weighting coefficient of the smoothness term included in the target energy functional in the active contour model.
[0197] For example, computer equipment can be based on the above. Figure 1 Formulas (1) and (2) in the embodiment determine the first adaptive weight coefficient and the second adaptive weight coefficient, respectively.
[0198] Step 203: The computer device determines the initial master variables based on the initial segmented image.
[0199] The initial master variable can represent the initial segmented image. For example, the pixel value of the pixel indicated by any pixel coordinate x in the initial segmented image is the initial master variable u(x). 0 .
[0200] Step 204: The computer device iterates over the main variable, auxiliary variable and Lagrange multiplier based on the original image, the initial segmented image, preset parameters, the first adaptive weight coefficient, the second adaptive weight coefficient and the initial main variable, starting from the iteration number k equals 1.
[0201] Where k represents the number of iterations to optimize the segmentation error of the initial segmented image, and k is a positive integer.
[0202] Here, the main variable can represent the intermediate segmented image, the auxiliary variable is the variable related to the gradient of the main variable of the intermediate segmented image, and the Lagrange multiplier is the variable introduced when constructing the augmented Lagrange function. Through the Lagrange multiplier q, the problem of minimizing the target energy function can be transformed into a saddle point problem of jointly optimizing the main variable and auxiliary variable representing the intermediate segmented image, so that multiple subproblems corresponding to the saddle point problem can be solved more easily.
[0203] For example, detailed descriptions of the main variables, auxiliary variables, and Lagrange multipliers can be found in Embodiment 1 above, and the embodiments of this application will not be repeated here.
[0204] Step 205: The computer equipment determines the main variables, auxiliary variables, and Lagrange multipliers after the kth optimization.
[0205] For example, the computer device determines the principal variable, auxiliary variable, and Lagrange multiplier after the kth optimization using the target energy functional of the active contour model. Specifically, the computer device can determine the principal variable after the kth optimization based on the original image, preset parameters, first adaptive weighting coefficients, initial principal variable, principal variable after the (k-1)th optimization, auxiliary variable after the (k-1)th optimization, and Lagrange multiplier after the (k-1)th optimization; determine the auxiliary variable after the kth optimization based on the preset parameters, second adaptive weighting coefficients, principal variable after the kth optimization, and Lagrange multiplier after the (k-1)th optimization; and determine the Lagrange multiplier after the kth optimization based on the preset parameters, principal variable after the kth optimization, auxiliary variable after the kth optimization, and Lagrange multiplier after the (k-1)th optimization.
[0206] As an example, computer equipment can be based on the above. Figure 1Formulas (18), (20), and (21) in the embodiments determine the main variable, auxiliary variable, and Lagrange multiplier after the kth optimization, respectively.
[0207] It should be noted that, according to the above Figure 1 Formula (18) in the embodiment shows that the main variable after the kth optimization is related to the auxiliary variable after the (k-1)th optimization and the first adaptive weight coefficient. Figure 1 Formula (20) in the embodiment shows that the auxiliary variable after the (k-1)th optimization is related to the second adaptive weight coefficient. Furthermore, it shows that the main variable after the kth optimization is related to the first adaptive weight coefficient and the second adaptive weight coefficient. The first adaptive weight coefficient and the second adaptive weight coefficient are determined by the original image.
[0208] As an example, if k equals 1, then the main variable after the (k-1)th optimization is the initial main variable, the auxiliary variable after the (k-1)th optimization is the initial auxiliary variable, the Lagrange multiplier after the (k-1)th optimization is the initial Lagrange multiplier, the intermediate segmented image is the initial segmented image generated after the first optimization of the initial segmented image, and the main variable after the first optimization represents the first optimized initial segmented image obtained by optimizing the segmentation error of the initial segmented image. The computer equipment can then proceed according to the above... Figure 1 Formula (18) in the embodiment determines the main variable u(x) after the first optimization. 1 According to the above Figure 1 Formula (20) in the embodiment determines the auxiliary variable p after the first optimization. 1 According to the above Figure 1 Formula (21) in the embodiment determines the first optimized Lagrange multiplier q. 1 .
[0209] As an example, if k is greater than 1, then the intermediate segmentation image is the initial segmentation image generated after k optimizations of the initial segmentation image. The main variable after the kth optimization represents the intermediate segmentation image, which is the initial segmentation image after the kth optimization of the segmentation error of the initial segmentation image. The computer device can then proceed according to the above... Figure 1 Formula (18) in the embodiment determines the main variable u(x) after the k-th optimization. k According to the above Figure 1 Formula (20) in the embodiment determines the auxiliary variable p after the kth optimization. k According to the above Figure 1 Formula (21) in the embodiment determines the Lagrange multiplier q after the kth optimization. k .
[0210] As an example, before determining the main variables, auxiliary variables, and Lagrange multipliers after the k-th optimization, the computer device also determines a first average and a second average. Specifically, it determines the first average of the pixel values of at least one pixel in the original image located within the region of the initial segmentation curve, and the second average of the pixel values of at least one pixel in the original image located outside the region of the initial segmentation curve. For example, based on the original image and the initial segmentation image, through the above... Figure 1 Formula (4) in the embodiment determines the first average value c1, and formula (5) determines the second average value c2.
[0211] For example, a computer device can input the initial segmented image and the original image into an active contour model. Through the initial active contour model, the first adaptive weight coefficient and the second adaptive weight coefficient are determined based on the original image. Then, based on the original image and the initial segmented image, the first average value and the second average value are determined using formulas (4) and (5). Then, based on the original image, the initial segmented image, the first adaptive weight coefficient, the second adaptive weight coefficient, the first average value, and the second average value, the optimization algorithm is used to minimize the target energy function to obtain the main variable, auxiliary variable, and Lagrange multiplier after the kth optimization. Then, it is determined whether the iteration number k meets the preset condition. If it does not meet the condition, k is updated to k plus the preset value, and the process jumps to the steps of determining the main variable, auxiliary variable, and Lagrange multiplier after the kth optimization and subsequent steps.
[0212] As an example, the first average value can also be the average pixel value of at least one pixel in the region inside the intermediate segmentation curve in the original image, and the second average value can also be the average pixel value of at least one pixel in the region outside the intermediate segmentation curve in the original image, where the intermediate segmentation curve is the contour line used to segment the target object in the intermediate segmentation image and is a closed curve. In this case, the first average value and the second average value can be determined based on the original image and the intermediate segmentation image. Specifically, the first average value can be determined by the following formula (23), and the second average value can be determined by the following formula (24):
[0213]
[0214]
[0215] Where x is the pixel coordinate of a pixel in the intermediate segmented image, u(x) is the pixel value of the pixel indicated by x in the intermediate segmented image, I is the original image, and Ω is the image region of the intermediate segmented image.
[0216] For example, the computer device can input the initial segmented image and the original image into the active contour model. Through the initial active contour model, the first adaptive weight coefficient and the second adaptive weight coefficient are determined according to the original image. Then, according to the original image and the initial segmented image, the first average value and the second average value are determined by formula (4) and formula (5). Then, according to the original image, the initial segmented image, the first adaptive weight coefficient, the second adaptive weight coefficient, the first average value and the second average value, the optimization algorithm is used to minimize the target energy function to obtain the main variable, auxiliary variable and Lagrange multiplier after the kth optimization. Then, it is determined whether the iteration number k meets the preset condition. If it does not meet the condition, the first average value and the second average value are updated according to the original image and the intermediate segmented image represented by the main variable after the kth optimization by formula (23) and formula (24). k is updated to k plus the preset value, and the process jumps to the steps of determining the main variable, auxiliary variable and Lagrange multiplier after the kth optimization and subsequent steps.
[0217] Step 206: The computer device determines whether the number of iterations k meets the preset conditions.
[0218] It should be noted that after step 205, the number of iterations k is greater than 1.
[0219] The preset conditions include a loop stopping condition and / or a stopping threshold condition. The loop stopping condition is met when the number of iterations k is greater than the maximum number of iterations. The threshold stopping condition is met when the 1 norm of the difference between the main variable after the kth optimization and the main variable after the (k-1)th optimization is less than or equal to the product of the 1 norm of the main variable after the kth optimization and the stopping threshold.
[0220] For example, if the computer device determines that the number of iterations k is greater than the maximum number of iterations, and / or, if through the above... Figure 1 In the embodiment, formula (22) determines that if the 1 norm of the difference between the main variable after the kth optimization and the main variable after the (k-1)th optimization corresponding to the iteration number k is less than or equal to the product of the 1 norm of the main variable after the kth optimization and the stopping threshold, then the iteration number k is determined to meet the preset condition and step 208 is executed; otherwise, the iteration number k is determined not to meet the preset condition and step 207 is executed.
[0221] Step 207: If the computer device determines that the iteration number k does not meet the preset condition, it updates k to k plus the preset value and jumps to the steps of determining the main variable, auxiliary variable and Lagrange multiplier after the kth optimization and subsequent steps.
[0222] For example, the preset value is a positive integer, and the preset value can be 1 or other values. This application embodiment does not limit this.
[0223] Step 208: If the computer device determines that the number of iterations k meets the preset conditions, then the optimized master variable after the kth iteration that meets the preset conditions is determined as the target master variable, and the intermediate segmented image represented by the target master variable is the target segmented image.
[0224] Thus, through steps 201-208 above, the computer device can perform image segmentation on the original image to obtain the target segmented image. That is, steps 201-208 above are the processing steps of the computer device performing image segmentation through the active contour model.
[0225] Additionally, please refer to Figure 3 , Figure 3 This is a schematic diagram illustrating the framework of an image segmentation method provided in an embodiment of this application. For example... Figure 3 As shown, Figure 3 Figure (a) in the image is the original image, which is a medical image, and the target object is a lung nodule. Figure 3 Figure (b) in the figure is the initial segmented image, which is a binary image. Figure 3 Figure (c) in the figure represents the initial segmentation curve in the original image from the initial segmentation image. Figure 3 Figure (d) in the middle is a Figure 3 The image in (c) is a magnified version of the first target region, where the first target region refers to... Figure 3 The region located inside the initial segmentation curve in figure (c). Figure 3 Image (e) in the diagram is the target segmentation image. Figure 3 Figure (f) in the figure shows the representation of the target segmentation curve in the target segmentation image in the original image. Figure 3 The (g) diagram in the middle is... Figure 3 The image in (f) shows the magnified image of the second target region, where the second target region refers to... Figure 3 The region located inside the target segmentation curve in figure (f) is shown. The target segmentation curve is the contour line used to segment the target object in the target segmentation image, and it is a closed curve.
[0226] and Figure 3 Compared to diagram (d) in the middle, Figure 3 In Figure (g), the boundary of the second target region is relatively smooth, that is, the target segmentation curve is relatively smooth, and the image segmentation accuracy is high.
[0227] Among them, such as Figure 3As shown, the original image to be segmented can be obtained first, and the original image can be used as the input of the initial segmentation model to determine the initial segmentation image. Then, the original image and the initial segmentation image can be used as the input of the active contour model to determine the target segmentation image.
[0228] The active contour model employs a target energy functional, which indicates the segmentation error of intermediate segmented images during image segmentation. The target energy functional includes a fidelity term with constant weights, a length term with a first adaptive weight, and a smoothing term with a second adaptive weight. These first and second adaptive weights are determined using the original image; that is, the weights of the length and smoothing terms are not constants but adaptive weights related to the original image to be segmented. Thus, when segmenting an image using the active contour model, the weights of the length and smoothing terms in the target energy functional can be adjusted according to different images, thereby improving the robustness and image segmentation accuracy of the active contour model.
[0229] It should be noted that, Figure 3 For a detailed explanation of the initial segmentation model, active contour model, target energy functional, fidelity term, length term carrying the first adaptive weight coefficient, smoothing term carrying the second adaptive weight coefficient, and how to determine the target segmentation image that meets the preset conditions, please refer to steps 201-208 above or the above. Figure 1 Example.
[0230] In this embodiment, the original image to be segmented, the initial segmentation image, and preset parameters are first obtained. Then, the first adaptive weight coefficient and the second adaptive weight coefficient are determined based on the original image, and the initial master variable is determined based on the initial segmentation image. Then, starting from the iteration number k, the master variable, auxiliary variable, and Lagrange multiplier are iterated to determine the master variable, auxiliary variable, and Lagrange multiplier after the kth optimization. Then, it is determined whether the iteration number k meets the preset condition. If it is determined that the iteration number k does not meet the preset condition, k is updated to k plus a preset value, and the process jumps to the step of determining the master variable, auxiliary variable, and Lagrange multiplier after the kth optimization. If it is determined that the iteration number k meets the preset condition, the master variable after the kth optimization that meets the preset condition is determined as the target master variable, and the intermediate segmentation image represented by the target master variable is the target segmentation image.
[0231] Since the computer device obtains the target segmentation image through the active contour model, the master variable after the k-th optimization is related to the first adaptive weight coefficient and the second adaptive weight coefficient. The first adaptive weight coefficient and the second adaptive weight coefficient are determined by the original image. That is, the first adaptive weight coefficient and the second adaptive weight coefficient are not constants, but adaptive weight coefficients related to the original image. The first adaptive weight coefficient and the second adaptive weight coefficient can better match different original images to be segmented. Therefore, the master variable after the k-th optimization that meets the preset conditions is better, and the target segmentation image represented by the master variable after the k-th optimization is better. This improves the robustness of the active contour model and the image segmentation accuracy.
[0232] Please refer to Figure 4 , Figure 4 This is a schematic diagram of an image segmentation device provided in an embodiment of this application. The image segmentation and adjustment device can be implemented by software, hardware, or a combination of both, and can be part or all of a computer device, which can be described below. Figure 5 The computer equipment shown. See also Figure 4 The image segmentation and adjustment device includes: a first acquisition module 401, a second acquisition module 402, and a first segmentation module 403.
[0233] The first acquisition module 401 is used to acquire the original image to be segmented, and the original image includes the target object;
[0234] The second acquisition module 402 is used to acquire an initial segmentation image, which is the image after coarse segmentation of the target object in the original image;
[0235] The first segmentation module 403 is used to input the initial segmentation image and the original image into the active contour model for image segmentation to obtain the target segmentation image of the original image. The active contour model adopts the target energy generalization function.
[0236] The target energy function is used to indicate the segmentation error of the intermediate segmented images generated during the image segmentation process. The target energy function includes a fidelity term carrying constant weight coefficients, a length term carrying a first adaptive weight coefficient, and a smoothing term carrying a second adaptive weight coefficient. The first and second adaptive weight coefficients are determined by the original image.
[0237] As an example, the first adaptive weighting coefficient and the second adaptive weighting coefficient are represented by the following formulas:
[0238]
[0239]
[0240] in, Let β(I) be the first adaptive weighting coefficient, y be the pixel coordinate of a pixel in the original image, I(y) be the pixel value of the pixel indicated by y in the original image, and β(I) be the second adaptive weighting coefficient. This is the gradient operator.
[0241] As an example, the target energy function includes main variables representing the intermediate segmented image;
[0242] The first segmentation module 403 is also used to take the original image and the initial segmentation image as input to the active contour model. Through the active contour model, the target energy function is minimized by an optimization algorithm to obtain the target master variable that satisfies the minimization of the target energy function. The intermediate segmentation image represented by the target master variable is the target segmentation image. The intermediate segmentation image is the optimized initial segmentation image obtained by optimizing the segmentation error of the initial segmentation image.
[0243] As an example, the optimization algorithm is the alternating direction multiplier method;
[0244] The first segmentation module 403 is also used to construct an augmented Lagrangian function based on the target energy generalized function, wherein the augmented Lagrangian function includes at least the main variable representing the intermediate segmented image;
[0245] The principal variables in the augmented Lagrangian function are iteratively optimized using the alternating direction multiplier method to obtain the iteratively optimized principal variables, which are the target principal variables that satisfy the minimization of the target energy functional.
[0246] As an example, the augmented Lagrangian function also includes auxiliary variables and Lagrange multipliers. The auxiliary variables are variables related to the gradient of the principal variables of the intermediate segmented image, and the Lagrange multipliers are used to transform the problem of minimizing the target energy function into a saddle point problem of jointly optimizing the principal and auxiliary variables representing the intermediate segmented image.
[0247] The first segmentation module 403 is also used to construct a minimization equation based on the augmented Lagrangian function. The minimization equation is an equation that jointly optimizes the main variables and auxiliary variables representing the intermediate segmented image.
[0248] Based on the minimization equation, an iterative equation is constructed using the alternating direction multiplier method. The iterative equation includes a first equation, a second equation, and a third equation. The first equation is used to determine the principal variable after the k-th optimization based on the auxiliary variable after the (k-1)-th optimization and the Lagrange multiplier after the (k-1)-th optimization. The second equation is used to determine the auxiliary variable after the k-th optimization based on the principal variable after the k-th optimization and the Lagrange multiplier after the (k-1)-th optimization. The third equation is used to determine the Lagrange multiplier after the k-th optimization based on the principal variable after the k-th optimization and the auxiliary variable after the k-th optimization. k is a positive integer.
[0249] The master variables that satisfy the preset conditions, as determined by the first equation, are identified as the master variables after iterative optimization.
[0250] As an example, the minimization equation is expressed by the following formula:
[0251]
[0252] Where x is the pixel coordinate of a pixel in the intermediate segmented image, u(x) is the pixel value of the pixel indicated by x in the intermediate segmented image, u(x) is the main variable representing the intermediate segmented image, p is the auxiliary variable, q is the Lagrange multiplier, and Γ(u,p,q) is the augmented Lagrange function.
[0253] As an example, the iterative equation is represented by the following formula:
[0254]
[0255] Where k is a positive integer, Let u(x) be the first equation. k Let u(x) be the pixel value of the pixel indicated by x in the image obtained after optimizing the segmentation error of the initial segmented image for the kth time. k Let p be the main variable after the k-th optimization. k-1 Let q be the auxiliary variable after the (k-1)th optimization. k-1 For the (k-1)th optimized Lagrange multiplier, For the second equation, p k Let k be the auxiliary variable after the kth optimization. For third-party processes, q k It is the Lagrange multiplier optimized in the kth iteration.
[0256] As an example, the image segmentation adjustment device also includes a second segmentation module, which takes the original image as input to the initial segmentation model and determines an initial segmented image through the initial segmentation model. The initial segmentation model is used to coarsely segment the target object in the original image to obtain a coarsely segmented image.
[0257] As an example, the target energy functional can be expressed by the following formula:
[0258]
[0259] Where E(u(x)) is the target energy functional, x is the pixel coordinate of a pixel in the intermediate segmentation image, u(x) is the pixel value of the pixel indicated by x in the intermediate segmentation image, and u(x)∈[0,1]. u(x)=1 indicates that the pixel indicated by x is located in the region where the target object is located in the intermediate segmentation image, u(x)=0 indicates that the pixel indicated by x is located in another region of the intermediate segmentation image other than the region where the target object is located, F(u(x)) is the fidelity term, L(u(x)) is the length term, P(u(x)) is the smoothness term, λ is the constant weight coefficient, and I is the original image. β(I) is the first adaptive weighting coefficient, β(I) is the second adaptive weighting coefficient, Ω is the image region of the intermediate segmented image, c1 is the first average pixel value of at least one pixel in the original image located inside the initial segmentation curve, c2 is the second average pixel value of at least one pixel in the original image located outside the initial segmentation curve, the initial segmentation curve is the contour line used to segment the target object in the initial segmentation image and the initial segmentation curve is a closed curve, τ is the scale parameter, and G... τ It is a Gaussian function. This is the gradient operator.
[0260] It should be noted that the image segmentation device provided in the above embodiments is only an example of the division of the above functional modules. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.
[0261] The functional units and modules in the above embodiments can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit. Furthermore, the specific names of the functional units and modules are only for easy differentiation and are not intended to limit the scope of protection of the embodiments of this application.
[0262] The image segmentation apparatus and image segmentation method embodiments provided in the above embodiments belong to the same concept. The specific working process and technical effects of the units and modules in the above embodiments can be found in the method embodiment section, and will not be repeated here.
[0263] Please refer to Figure 5 , Figure 5 This is a schematic diagram of the structure of a computer device provided in an embodiment of this application. Figure 5 As shown, the computer device includes: a processor 501, a memory 502, and a computer program 503 stored in the memory 502 and executable on the processor 501. When the processor 501 executes the computer program 503, it implements the steps in the image segmentation method in the above embodiments.
[0264] The computer equipment can be the above. Figure 1 Examples or the above Figure 2 The computer device in the embodiments may be a near-eye display device, or a desktop computer, laptop computer, web server, handheld computer, mobile phone, tablet computer, wireless terminal device, communication device, or embedded device. The embodiments of this application do not limit the type of computer device. Those skilled in the art will understand that... Figure 5 The examples of computer devices are merely examples and do not constitute a limitation on computer devices. They may include more or fewer components than shown in the illustration, or combinations of certain components, or different components, such as input / output devices, network access devices, etc.
[0265] Processor 501 can be a Central Processing Unit (CPU), or it can be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor can be a microprocessor or any conventional processor.
[0266] In some embodiments, memory 502 may be on-chip memory or off-chip memory of a computer device, such as cache memory, SRAM (Static Random-Access Memory), DRAM (Dynamic Static Random-Access Memory), or floppy disk. In other embodiments, memory 502 may be a plug-in hard disk, SmartMedia Card (SMC), Secure Digital (SD) card, or Flash Card provided on the computer device. Furthermore, memory 502 may include internal storage units of on-chip and off-chip memory of the computer device, as well as external storage devices. Memory 502 is used to store the operating system, applications, boot loader, data, and other programs. Memory 502 can also be used to temporarily store data that has been output or will be output.
[0267] This application also provides a computer device, which includes: at least one processor, a memory, and a computer program stored in the memory and executable on the at least one processor, wherein the processor executes the computer program to implement the steps in any of the above method embodiments.
[0268] This application also provides a computer-readable storage medium storing a computer program that, when executed by a processor, can implement the steps in the various method embodiments described above.
[0269] This application provides a computer program product that, when run on a computer, causes the computer to perform the steps described in the various method embodiments above.
[0270] If the integrated unit is implemented as 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, all or part of the processes in the above method embodiments of this application can be implemented by a computer program instructing related hardware. This computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the various method embodiments described above. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or some intermediate form. The computer-readable medium can include at least: any entity or device capable of carrying the computer program code to a photographing device / terminal device, a recording medium, a computer memory, ROM (Read-Only Memory), RAM (Random Access Memory), CD-ROM (Compact Disc Read-Only Memory), magnetic tape, floppy disk, and optical data storage devices. The computer-readable storage medium mentioned in this application can be a non-volatile storage medium; in other words, it can be a non-transient storage medium.
[0271] It should be understood that all or part of the steps of the above embodiments can be implemented by software, hardware, firmware, or any combination thereof. When implemented in software, it can be implemented in whole or in part as a computer program product. The computer program product includes one or more computer instructions. The computer instructions can be stored in the above-described computer-readable storage medium.
[0272] The above-described embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application, and should all be included within the protection scope of this application.
Claims
1. An image segmentation method, characterized in that, The method includes: Obtain the original image to be segmented, wherein the original image includes the target object; Obtain an initial segmentation image, which is an image obtained by coarsely segmenting the target object in the original image; The initial segmented image and the original image are input into the active contour model for image segmentation to obtain the target segmented image of the original image. The active contour model uses the target energy generalization function. The target energy function is used to indicate the segmentation error of the intermediate segmented images generated during the image segmentation process. The target energy function includes a fidelity term carrying constant weight coefficients, a length term carrying a first adaptive weight coefficient, and a smoothing term carrying a second adaptive weight coefficient. The first adaptive weight coefficient and the second adaptive weight coefficient are determined by the original image. The first adaptive weighting coefficient and the second adaptive weighting coefficient are respectively represented by the following formulas: in, Let be the first adaptive weighting coefficient, and y be the pixel coordinates of the pixel in the original image. The pixel value of the pixel indicated by y in the original image. The second adaptive weighting coefficient, This is the gradient operator.
2. The method as described in claim 1, characterized in that, The target energy functional includes a main variable representing the intermediate segmented image; The step of inputting the initial segmented image and the original image into an active contour model for image segmentation to obtain the target segmented image of the original image includes: The initial segmented image and the original image are input into the active contour model. Through the active contour model, the target energy function is minimized using an optimization algorithm to obtain the target master variable that satisfies the minimization of the target energy function. The intermediate segmented image represented by the target master variable is the target segmented image. The intermediate segmented image is the optimized initial segmented image obtained by optimizing the segmentation error of the initial segmented image.
3. The method as described in claim 2, characterized in that, The optimization algorithm is the alternating direction multiplier method; The process of minimizing the target energy functional using an optimization algorithm to obtain the target main variable that satisfies the minimization of the target energy functional includes: Based on the target energy functional, an augmented Lagrangian function is constructed, wherein the augmented Lagrangian function includes at least the principal variable representing the intermediate segmented image; The main variables in the augmented Lagrange function are iteratively optimized using the alternating direction multiplier method to obtain the iteratively optimized main variables, which are the target main variables that satisfy the minimization of the target energy functional.
4. The method as described in claim 3, characterized in that, The augmented Lagrange function is expressed by the following formula: in, Let x be the augmented Lagrangian function, and let x be the pixel coordinates of the pixel in the intermediate segmented image. The main variable representing the intermediate segmented image is specifically the pixel value of the pixel indicated by x in the intermediate segmented image. As an auxiliary variable, and , For Lagrange multipliers, Let be the target energy generalization function. The image region of the intermediate segmented image. This is the penalty coefficient.
5. The method as described in claim 3, characterized in that, The augmented Lagrange function also includes auxiliary variables and Lagrange multipliers, wherein the auxiliary variables are variables related to the gradient of the principal variable of the intermediate segmented image; The iterative optimization of the principal variables in the augmented Lagrange function using the alternating direction multiplier method yields the iteratively optimized principal variables, including: A minimization equation is constructed based on the augmented Lagrange function, which is an equation that jointly optimizes the main variables and auxiliary variables representing the intermediate segmented image; Based on the minimization equation, an iterative equation is constructed using the alternating direction multiplier method. The iterative equation includes a first equation, a second equation, and a third equation. The first equation is used to determine the main variable after the k-th optimization based on the auxiliary variable after the (k-1)-th optimization and the Lagrange multiplier after the (k-1)-th optimization. The second equation is used to determine the auxiliary variable after the k-th optimization based on the main variable after the k-th optimization and the Lagrange multiplier after the (k-1)-th optimization. The third equation is used to determine the Lagrange multiplier after the k-th optimization based on the main variable after the k-th optimization and the auxiliary variable after the k-th optimization, where k is a positive integer. The master variables that satisfy the preset conditions as determined by the first equation are identified as the master variables after iterative optimization.
6. The method as described in claim 5, characterized in that, The minimization equation is expressed by the following formula: Where x is the pixel coordinate of a pixel in the intermediate segmented image. The main variable representing the intermediate segmented image is specifically the pixel value of the pixel indicated by x in the intermediate segmented image. For the auxiliary variable, For the Lagrange multipliers, Let be the augmented Lagrangian function.
7. The method as described in claim 5, characterized in that, The iterative equation is expressed by the following formula: Where k is a positive integer, For the first equation, The main variable after the k-th optimization is specifically the pixel value of the pixel indicated by x in the image obtained after optimizing the segmentation error of the initial segmented image for the k-th time. For the auxiliary variable after the (k-1)th optimization, For the (k-1)th optimized Lagrange multiplier, For the second equation, Let be the auxiliary variable after the kth optimization. For the aforementioned third-party program, Let be the Lagrange multiplier after the kth optimization.
8. The method as described in claim 1, characterized in that, Before obtaining the initial segmented image, the method further includes: The original image is used as input to the initial segmentation model, and the initial segmentation model is used to determine the initial segmented image. The initial segmentation model is used to coarsely segment the target object in the original image to obtain a coarsely segmented image.
9. The method according to any one of claims 1-8, characterized in that, The target energy functional is expressed by the following formula: in, Let x be the target energy functional, and let x be the pixel coordinates of the pixels in the intermediate segmented image. Let x be the pixel value of the pixel indicated by x in the intermediate segmented image, and , This indicates that the pixel indicated by x is located in the region where the target object is located in the intermediate segmented image. This indicates that the pixel indicated by x is located in a region of the intermediate segmented image other than the region where the target object is located. For the aforementioned fidelity item, For the length item, For the smooth term, Let I be the constant weight coefficient, and let I be the original image. The first adaptive weight coefficient, The second adaptive weighting coefficient, The image region of the intermediate segmented image. It is the first average value of the pixel values of at least one pixel located in the region inside the initial segmentation curve in the original image. The second average value is the pixel value of at least one pixel in the original image located outside the initial segmentation curve, wherein the initial segmentation curve is a contour line used to segment the target object in the initial segmentation image and is a closed curve. For scale parameters, It is a Gaussian function. This is the gradient operator.
10. An image segmentation apparatus, characterized in that, The device includes: The first acquisition module is used to acquire the original image to be segmented, wherein the original image includes the target object; The second acquisition module is used to acquire an initial segmentation image, wherein the initial segmentation image is an image after coarse segmentation of the target object in the original image; The first segmentation module is used to input the initial segmented image and the original image into an active contour model for image segmentation to obtain a target segmented image of the original image. The active contour model adopts a target energy generalization function. The target energy function is used to indicate the segmentation error of the intermediate segmented images generated during the image segmentation process. The target energy function includes a fidelity term carrying constant weight coefficients, a length term carrying a first adaptive weight coefficient, and a smoothing term carrying a second adaptive weight coefficient. The first adaptive weight coefficient and the second adaptive weight coefficient are determined by the original image. The first adaptive weighting coefficient and the second adaptive weighting coefficient are respectively represented by the following formulas: in, Let be the first adaptive weighting coefficient, and y be the pixel coordinates of the pixel in the original image. The pixel value of the pixel indicated by y in the original image. The second adaptive weighting coefficient, This is the gradient operator.
11. A computer device, characterized in that, The computer device includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program, when executed by the processor, implements the method as described in any one of claims 1 to 9.
12. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the method as described in any one of claims 1 to 9.