WO2024055446A1 - Image segmentation method and apparatus, device, and readable storage medium - Google Patents

Image segmentation method and apparatus, device, and readable storage medium Download PDF

Info

Publication number
WO2024055446A1
WO2024055446A1 PCT/CN2022/138172 CN2022138172W WO2024055446A1 WO 2024055446 A1 WO2024055446 A1 WO 2024055446A1 CN 2022138172 W CN2022138172 W CN 2022138172W WO 2024055446 A1 WO2024055446 A1 WO 2024055446A1
Authority
WO
WIPO (PCT)
Prior art keywords
image
segmentation
optimization
initial
target
Prior art date
Application number
PCT/CN2022/138172
Other languages
French (fr)
Chinese (zh)
Inventor
胡战利
耿孟晓
黄振兴
张娜
梁栋
郑海荣
Original Assignee
深圳先进技术研究院
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 深圳先进技术研究院 filed Critical 深圳先进技术研究院
Publication of WO2024055446A1 publication Critical patent/WO2024055446A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/11Region-based segmentation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/08Learning methods
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/0002Inspection of images, e.g. flaw detection
    • G06T7/0012Biomedical image inspection
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/12Edge-based segmentation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/13Edge detection
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20081Training; Learning
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/30Subject of image; Context of image processing
    • G06T2207/30004Biomedical image processing
    • G06T2207/30096Tumor; Lesion

Definitions

  • the present application relates to the field of image processing, and in particular to an image segmentation method, device, equipment and readable storage medium.
  • Image segmentation is an image processing method used to segment objects of interest from images. It can be applied to medical image processing, remote sensing image processing and other fields. Among them, the Active Contour Model is a commonly used image segmentation model. It can perform multiple iterations of segmentation on the target object in the original image to obtain the target segmentation image.
  • the target object is the object to be segmented in the original image. For example, it is pulmonary nodules in CT (Computed Tomography) images.
  • the core of the active contour model includes the energy functional function.
  • the energy functional function is used as an evaluation index to indicate the segmentation error of the current iteration of the segmented image.
  • the target segmentation image can be obtained by minimizing the energy functional function multiple iterations.
  • the target segmentation image The relative error between the segmentation curve in and the contour line of the target object is less than the threshold.
  • the energy functional function of the active contour model usually includes a fidelity term, a length term and a smoothness term carrying constant weight coefficients respectively.
  • the fidelity term is used to indicate the relative error between the current segmentation curve and the target contour in the segmentation image of the current iteration.
  • the length term is used to indicate the length of the current segmentation curve
  • the smoothness term is used to indicate the smoothness of the current segmentation curve.
  • the energy functional function of the above 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, which may cause the active contour model to be less robust. Poor, the image segmentation accuracy is low.
  • This application provides an image segmentation method, device, equipment and readable storage medium, which can solve the problem of poor robustness of the active contour model and poor image quality caused by the energy functional function of the active contour model including three constant weight coefficients.
  • the problem of low segmentation accuracy is a problem of low segmentation accuracy.
  • an image segmentation method includes:
  • an initial segmentation image which is an image after rough segmentation of the target object in the original image
  • the target energy functional function is used to indicate the segmentation error of the intermediate segmentation image generated during the image segmentation process.
  • the target energy functional function includes a fidelity term carrying a constant weight coefficient and a length term carrying a first adaptive weight coefficient. and a smooth term carrying a second adaptive weight coefficient, the first adaptive weight coefficient and the second adaptive weight coefficient being determined by the original image.
  • the first adaptive weight coefficient and the second adaptive weight coefficient are respectively expressed by the following formulas:
  • y is the pixel coordinate of the pixel in the original image
  • I(y) is the pixel value of the pixel indicated by y in the original image
  • ⁇ (I) is the second automatic Adaptation weight coefficient
  • the target energy functional includes a main variable representing the intermediate segmentation image
  • the step of inputting 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 includes:
  • the initial segmented image and the original image are input into the active contour model.
  • an optimization algorithm is used to minimize the target energy functional function to obtain a target energy functional function that satisfies the target energy functional function.
  • the target main variable for function minimization, the intermediate segmentation image represented by the target main variable is the target segmentation image, and the intermediate segmentation image is the optimized initial segmentation obtained by optimizing the segmentation error of the initial segmentation image. image.
  • the optimization algorithm is the alternating direction multiplier method
  • the optimization algorithm is used to minimize the target energy functional function to obtain the target main variables that satisfy the minimization of the target energy functional function, including:
  • the augmented Lagrangian function Construct an augmented Lagrangian function according to the target energy functional, the augmented Lagrangian function at least including a main variable representing the intermediate segmentation image;
  • the alternating direction multiplier method is used to iteratively optimize the main variables in the augmented Lagrangian function to obtain the iteratively optimized main variables.
  • the iteratively optimized main variables are the ones that satisfy the target energy.
  • the augmented Lagrangian function is expressed by the following formula:
  • ⁇ (u(x),p,q) is the augmented Lagrangian function
  • x is the pixel coordinate of the pixel in the intermediate segmented image
  • u(x) is the x indication in the intermediate segmented image
  • the pixel value of the pixel is the main variable representing the intermediate segmentation image
  • p is the auxiliary variable
  • q is the Lagrange multiplier
  • E(u(x)) is the target energy functional function
  • is the image area of the intermediate segmentation image
  • is the penalty coefficient.
  • the augmented Lagrangian function further includes an auxiliary variable and a Lagrange multiplier, where the auxiliary variable is a variable related to the gradient of the main variable of the intermediate segmented image;
  • the alternating direction multiplier method is used to iteratively optimize the main variables in the augmented Lagrangian function to obtain the iteratively optimized main variables, including:
  • the alternating direction multiplier method is used to construct an iterative equation.
  • the iterative equation includes a first equation, a second equation and a third equation.
  • the first equation is used according to the k-1th optimization.
  • the auxiliary variables and the Lagrange multiplier after the k-1th optimization determine the main variable after the k-th optimization, and the second equation is used to determine the main variable after the k-th optimization and the k-1th optimization.
  • the final Lagrange multiplier determines the auxiliary variable after the kth optimization, and the third equation is used to determine the kth optimization based on the main variable after the kth optimization and the auxiliary variable after the kth optimization.
  • Lagrange multiplier, k is a positive integer;
  • the main variables that satisfy the preset conditions determined through the first equation are determined as the main variables after the iterative optimization.
  • x is the pixel coordinate of the 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
  • ⁇ (u, p, q) is the augmented Lagrangian function.
  • k is a positive integer
  • u(x) k is the pixel value of the pixel indicated by x in the image obtained after the kth optimization of the segmentation error of the initial segmented image
  • u(x) k is the kth
  • the main variable after the optimization p k-1 is the auxiliary variable after the k-1 optimization
  • q k-1 is the Lagrange multiplier after the k-1 optimization
  • p k is the auxiliary variable after the kth optimization
  • q k is the Lagrange multiplier after the kth optimization.
  • the method further includes:
  • the original image is used as the input of the initial segmentation model, and the initial segmentation image is determined through the initial segmentation model.
  • the initial segmentation model is used to roughly segment the target object in the original image to obtain a rough segmentation. Image.
  • the target energy functional function is expressed by the following formula:
  • E(u(x)) is the target energy functional function
  • x is the pixel coordinate of the pixel in the intermediate segmented image
  • u(x) is the pixel value of the pixel indicated by x in the intermediate segmented image
  • F(u(x)) is the fidelity term
  • L(u(x)) is the length term
  • P(u( x)) is the smooth term
  • is the constant weight coefficient
  • I is the original image
  • ⁇ (I) is the second adaptive weight coefficient
  • is the image area of the intermediate segmentation image
  • c 1 is the area inside the initial segmentation curve in the original image.
  • the first average value of the pixel value of at least one pixel, c 2 is the second average value of the pixel value of at least one pixel in the original image located outside the initial segmentation curve, and the initial segmentation curve is used in
  • the contour line of the target object is segmented in the initial segmentation image and the initial segmentation curve is a closed curve
  • is a scale parameter
  • G ⁇ is a Gaussian function
  • an image segmentation device in a second aspect, includes:
  • the first acquisition module is used to acquire the original image to be segmented, where the original image includes the target object;
  • the second acquisition module is used to acquire an initial segmentation image, where the initial segmentation image is an image after rough segmentation of the target object in the original image;
  • a first segmentation module configured 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, and the active contour model uses a target energy functional function;
  • the target energy functional function is used to indicate the segmentation error of the intermediate segmentation image generated during the image segmentation process.
  • the target energy functional function includes a fidelity term carrying a constant weight coefficient and a length term carrying a first adaptive weight coefficient. and a smooth term carrying a second adaptive weight coefficient, the first adaptive weight coefficient and the second adaptive weight coefficient being determined by the original image.
  • the first adaptive weight coefficient and the second adaptive weight coefficient are respectively expressed by the following formulas:
  • y is the pixel coordinate of the pixel in the original image
  • I(y) is the pixel value of the pixel indicated by y in the original image
  • ⁇ (I) is the second automatic Adaptation weight coefficient
  • the target energy functional includes a main variable representing the intermediate segmented image
  • the first segmentation module is also used to input the initial segmentation image and the original image into the active contour model, and use the optimization algorithm to minimize the target energy functional through the active contour model. process to obtain the target main variable that satisfies the minimization of the target energy functional function, the intermediate segmentation image represented by the target main variable is the target segmentation image, and the intermediate segmentation image is obtained by segmenting the initial segmentation image.
  • the optimized initial segmentation image is obtained by optimizing the error.
  • the optimization algorithm is the alternating direction multiplier method
  • the first segmentation module is also configured to construct an augmented Lagrangian function according to the target energy functional function, where the augmented Lagrangian function at least includes a main variable representing the intermediate segmented image;
  • the alternating direction multiplier method is used to iteratively optimize the main variables in the augmented Lagrangian function to obtain the iteratively optimized main variables.
  • the iteratively optimized main variables are the ones that satisfy the target energy.
  • the augmented Lagrangian function also includes an auxiliary variable and a Lagrange multiplier.
  • the auxiliary variable is a variable related to the gradient of the main variable of the intermediate segmentation image.
  • the Lagrangian The daily multiplier is used to convert the minimization problem of the target energy functional into a saddle point problem for joint optimization of the main variable representing the intermediate segmentation image and the auxiliary variable;
  • the first segmentation module is also used to construct a minimization equation based on the augmented Lagrangian function.
  • the minimization equation is a joint optimization of the main variable representing the intermediate segmentation image and the auxiliary variable. equation;
  • the alternating direction multiplier method is used to construct an iterative equation.
  • the iterative equation includes a first equation, a second equation and a third equation.
  • the first equation is used according to the k-1th optimization.
  • the auxiliary variables and the Lagrange multiplier after the k-1th optimization determine the main variable after the k-th optimization, and the second equation is used to determine the main variable after the k-th optimization and the k-1th optimization.
  • the final Lagrange multiplier determines the auxiliary variable after the kth optimization, and the third equation is used to determine the kth optimization based on the main variable after the kth optimization and the auxiliary variable after the kth optimization.
  • Lagrange multiplier, k is a positive integer;
  • the main variables that satisfy the preset conditions determined through the first equation are determined as the main variables after the iterative optimization.
  • x is the pixel coordinate of the 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
  • ⁇ (u, p, q) is the augmented Lagrangian function.
  • k is a positive integer
  • u(x) k is the pixel value of the pixel indicated by x in the image obtained after the kth optimization of the segmentation error of the initial segmented image
  • u(x) k is the kth
  • the main variable after the optimization p k-1 is the auxiliary variable after the k-1 optimization
  • q k-1 is the Lagrange multiplier after the k-1 optimization
  • p k is the auxiliary variable after the kth optimization
  • q k is the Lagrange multiplier after the kth optimization.
  • the image segmentation adjustment device further includes a second segmentation module, the second segmentation module is used to use the original image as an input of an initial segmentation model, and determine the initial segmentation image through the initial segmentation model, The initial segmentation model is used to roughly segment the target object in the original image to obtain a roughly segmented image.
  • the target energy functional function is expressed by the following formula:
  • E(u(x)) is the target energy functional function
  • x is the pixel coordinate of the pixel in the intermediate segmented image
  • u(x) is the pixel value of the pixel indicated by x in the intermediate segmented image
  • F(u(x)) is the fidelity term
  • L(u(x)) is the length term
  • P(u( x)) is the smooth term
  • is the constant weight coefficient
  • I is the original image
  • ⁇ (I) is the second adaptive weight coefficient
  • is the image area of the intermediate segmentation image
  • c 1 is the area inside the initial segmentation curve in the original image.
  • the first average value of the pixel value of at least one pixel, c 2 is the second average value of the pixel value of at least one pixel in the original image located outside the initial segmentation curve, and the initial segmentation curve is used in
  • the contour line of the target object is segmented in the initial segmentation image and the initial segmentation curve is a closed curve
  • is a scale parameter
  • G ⁇ is a Gaussian function
  • a computer device in a third aspect, includes a memory, a processor, and a computer program stored in the memory and executable on the processor.
  • the computer program is executed by the processor.
  • a computer-readable storage medium stores a computer program.
  • the computer program is executed by a processor, the above-mentioned image segmentation method is implemented.
  • the initial segmented image and the original image to be segmented including the target object are first obtained, and then 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 initial segmented image is an image after rough segmentation of the target object in the original image.
  • the active contour model uses a target energy functional function.
  • the target energy functional function is used to indicate the segmentation error of the intermediate segmented image during the image segmentation process.
  • the target energy includes a fidelity term carrying a constant weight coefficient, a length term carrying a first adaptive weight coefficient and a smooth term carrying a second adaptive weight coefficient, and the first adaptive weight coefficient and the second adaptive weight coefficient are determined by What is determined by the original image, that is, the weight coefficients of the length term and the smoothness term are not constants, but adaptive weight coefficients related to the original image to be segmented.
  • the weight coefficients of the length term and smoothness term of the target energy functional function in the active contour model can be adjusted accordingly according to different images to be segmented, thereby improving the performance of the active contour. Model robustness and image segmentation accuracy.
  • Figure 1 is a flow chart of an image segmentation method provided by an embodiment of the present application.
  • Figure 2 is a flow chart of another image segmentation method provided by an embodiment of the present application.
  • Figure 3 is a schematic framework diagram of an image segmentation method provided by an embodiment of the present application.
  • Figure 4 is a schematic structural diagram of an image segmentation device provided by an embodiment of the present application.
  • FIG. 5 is a schematic structural diagram of a computer device provided by an embodiment of the present application.
  • the image segmentation method provided by the embodiment of the present application can be applied to scenarios such as medical image processing and remote sensing image processing.
  • An image can be divided into a background area and a target area.
  • the target area is the area where the target to be segmented is located.
  • this image segmentation method can segment the diseased area from the medical image to assist in determining the patient's physical condition.
  • lung cancer is a malignant tumor that poses a huge challenge to human health, and the incidence and mortality of lung cancer are increasing rapidly in various countries.
  • image segmentation methods can be used to segment pulmonary nodules (target objects) in medical images to replace or assist doctors in making diagnoses, improve doctors' work efficiency, and quickly determine the patient's physical condition.
  • the embodiment of the present application proposes an image segmentation method that can perform image segmentation on the target object in the original image through an active contour model.
  • the target energy functional function used by the active contour model includes a fidelity term carrying a constant weight coefficient,
  • the length term of the first adaptive weight coefficient and the smooth term carrying the second adaptive weight coefficient, and the first adaptive weight coefficient and the second adaptive weight coefficient are determined through the original image, which can improve the robustness of the active contour model and image segmentation accuracy.
  • FIG. 1 is a flow chart of an image segmentation method provided by an embodiment of the present application.
  • This method can be applied to computer equipment.
  • the computer equipment can be a terminal, a server or an embedded device, etc.
  • the terminal can be a desktop computer or a tablet computer, etc.
  • the method includes the following steps:
  • Step 101 The computer device obtains the original image to be segmented.
  • the original image includes the target object, and the target object is the object to be segmented in the original image.
  • the original image can be a medical image in a medical image processing scenario, such as CT (Computed Tomography) image, ultrasound image or MR (Magnetic Resonance) image, etc.
  • CT Computer Tomography
  • MR Magnetic Resonance
  • segmenting the original image is to segment the lesion areas (target areas) such as nodules and tumors in the original image.
  • Step 102 The computer device obtains an initial segmentation image.
  • the initial segmented image is an image obtained by roughly segmenting the target object in the original image.
  • 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 the information of the initial segmentation curve.
  • the initial segmentation curve can be passed through the binary nature of the pixels of the initial segmentation image. It is determined that 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.
  • the initial segmented image can be a segmented image obtained by manually setting initial contours in the original image, or it can also be a segmented image obtained through an initial segmentation model. For example, after manually setting the initial contour line in the original image, set the pixel value of the pixels located in the area inside the initial contour line in the original image to 1, and set the pixel value of the pixels located in the area outside the initial contour line to 0, thus obtaining the initial contour line. Split the image. Or, for example, before the computer device obtains the initial segmentation image, the original image is used as the input of the initial segmentation model, and the initial segmentation image is determined through the initial segmentation model. The initial segmentation model is used to roughly segment the target object in the original image to obtain the rough segmentation. image, and the obtained rough segmentation image is the initial segmentation image.
  • the initial segmentation model can be a model that uses a deep learning method to perform rough segmentation.
  • the initial segmentation model can use a U-Net network, a Segnet network, or a DeepLab network, etc. This is not limited in the embodiments of the present application.
  • the initial segmentation model needs to be trained. Since in the embodiment of the present application, the initial segmentation image obtained by the initial segmentation model is used as the input of the active contour model, the initial segmentation model only needs to roughly segment the original image, that is, the accuracy requirement for the initial segmentation model is low, so The initial segmentation model can be trained using images with a smaller number of samples.
  • a training image with a small number of samples can be used to train the initial segmentation model to be trained to obtain the initial segmentation model, and then the original image is obtained, and the original image is used as the input of the initial segmentation model.
  • the segmentation model obtains the initial segmentation image, and then uses the original image and the initial segmentation image as the input of the active contour model.
  • the target object in the original image is image segmented through the active contour model to obtain the target segmentation image. In this way, there is no need to manually set the initial segmentation curve. , which can reduce labor costs and achieve higher segmentation accuracy through small sample data.
  • Step 103 The computer device inputs the initial segmented image and the original image into the active contour model to perform image segmentation, and obtains a target segmented image of the original image.
  • the active contour model uses a target energy functional function.
  • the target energy functional function is used to indicate the segmentation error of the intermediate segmented image generated during the image segmentation process.
  • the target energy functional function includes a fidelity term carrying a constant weight coefficient, a first adaptive term carrying The length term of the weight coefficient and the smooth term carrying the second adaptive weight coefficient, the first adaptive weight coefficient and the second adaptive weight coefficient are determined through the original image.
  • the weight coefficients of the length term and smoothness term of the target energy functional function used by the active contour model are not constants, but adaptive weight coefficients related to the original image. In this way, the weight coefficients of the length term and smoothness term of the target energy functional function can be adjusted accordingly according to different images to be segmented, so that when the target object in the original image is segmented through the active contour model, the robustness of the active contour model can be improved accuracy and segmentation accuracy.
  • the fidelity term included in the target energy functional function indicates the relative error between the segmentation curve in the intermediate segmentation image and the target contour line.
  • the target contour line is the segmentation curve in the real standard segmentation image
  • the length item indicates the segmentation in the intermediate segmentation image.
  • the length of the curve, and the smoothness term indicate the smoothness of the segmentation curve in the intermediate segmentation image.
  • the first adaptive weight coefficient and the second adaptive weight coefficient may be determined according to the gradient of the original image. Since the first adaptive weight coefficient and the second adaptive weight coefficient are related to the gradient of the original image, the edge information of different original images can be more fully obtained through the first adaptive weight coefficient and the second adaptive weight coefficient. In this way, The contour model has higher robustness and segmentation accuracy.
  • the first adaptive weight coefficient can be expressed by the following formula (1)
  • the second adaptive weight coefficient can be expressed by the following formula (2):
  • y is the pixel coordinate of the pixel in the original image
  • I(y) is the pixel value of the pixel indicated by y in the original image
  • ⁇ (I) is the second adaptive weight coefficient
  • the pixel coordinates of the pixel represented by y are multi-dimensional, such as including abscissa and ordinate.
  • the intermediate segmented image is a segmented image generated during the image segmentation process of the original image.
  • the intermediate segmentation image is a binary image, and the intermediate segmentation image carries information of the intermediate segmentation curve.
  • the intermediate segmentation curve in the intermediate segmentation image is a contour line used to segment the target object in the intermediate segmentation image and the segmentation curve in the intermediate segmentation image is a closed curve.
  • the intermediate segmented image is an optimized initial segmented image obtained by optimizing the segmentation error of the initial segmented image.
  • the optimized initial segmented image may include the target segmented image, that is, an intermediate segmented image may be the target segmented image.
  • the fidelity term includes the main variable representing the intermediate segmentation image, and the fidelity term can be expressed by the following formula (3):
  • F(u(x)) is the fidelity term
  • x is the pixel coordinate of the pixel in the intermediate segmentation image
  • u(x) is the pixel value of the pixel indicated by x in the intermediate segmentation image
  • I is the original image
  • is the image area of the intermediate segmentation image
  • c 1 is a constant
  • c 1 is the first average value of the pixel value of at least one pixel located in the internal area of the initial segmentation curve in the original image
  • c 2 is a constant
  • c 2 is the second average value of the pixel values of at least one pixel located outside the initial segmentation curve in the original image.
  • the pixel coordinates of the pixel represented by x are multi-dimensional, such as including abscissa and ordinate.
  • the first average value c 1 can be determined by the following formula (4)
  • the second average value c 2 can be determined by the following formula (5):
  • z is the pixel coordinate of the 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
  • is the image area of the intermediate segmented image.
  • the pixel coordinates of the pixel represented by z are multi-dimensional, such as including abscissa and ordinate.
  • the image areas 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 pixels indicated by the same pixel coordinates in the image may be the same. Or different.
  • the first average value and the second average value may also be variables related to the main variable representing the intermediate segmentation image.
  • the first average value is a pixel of at least one pixel located in the internal area of the intermediate segmentation curve in the original image.
  • the average value of the value, the second average value is the average value of the pixel value of at least one pixel in the area outside the middle segmentation curve in the original image
  • the middle segmentation curve is the contour line used to segment the target object in the middle segmentation image
  • the middle segmentation The curve is a closed curve.
  • the formulas for determining the first average value and the second average value can be referred to formula (23) and formula (24) in Embodiment 2 below, which will not be described in detail here.
  • the length term includes the main variable representing the intermediate segmentation image, and the length term can be expressed by the integral of the main variable of the intermediate segmentation image.
  • the length term is expressed by the following formula (6):
  • L(u(x)) is the length term
  • x is the pixel coordinate of the 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 area of the intermediate segmented image
  • G ⁇ is a Gaussian function
  • is a scale parameter.
  • G ⁇ can be expressed by the following formula (7):
  • the smooth term includes the main variable representing the intermediate segmentation image.
  • the smooth term can be expressed by the integral of the second-order gradient of the main variable of the intermediate segmentation image.
  • the smooth term is expressed by the following formula (8):
  • P(u(x)) is the smooth term
  • x is the pixel coordinate of the pixel in the intermediate segmentation image
  • u(x) is the pixel value of the pixel indicated by x in the intermediate segmentation image
  • is the image area of the intermediate segmentation image
  • the target energy functional used by the target energy functional is expressed by the following formula (9):
  • E(u(x)) is the target energy functional function
  • x is the pixel coordinate of the pixel in the intermediate segmentation image
  • u(x) is the pixel value of the pixel indicated by x in the intermediate segmentation image
  • I is the original image
  • ⁇ (I) is the second adaptive weight coefficient
  • is the image area of the intermediate segmentation image
  • c 1 is the pixel value of at least one pixel located in the internal area of the initial segmentation curve in the original image.
  • An average value, c 2 is the second average value of the pixel value of at least one pixel located in the outer area of the initial segmentation curve in the original image, ⁇ is the scale parameter, G ⁇ is the Gaussian function, is the gradient operator.
  • u(x) can represent the intermediate segmented image, it can be known from the above formula (9) that the target energy functional function includes a main variable representing the intermediate segmented image, and the main variable is u(x).
  • the target energy functional includes a host variable representing an intermediate segmented image.
  • the computer device may input the initial segmented image and the original image into an active contour model, and use an optimization algorithm to minimize the target energy functional through the active contour model. process to obtain the target main variable that satisfies the minimization of the target energy functional function, and the intermediate segmented image represented by the target main variable is the target segmented image. That is to say, through the active contour model, the optimization algorithm can be used to solve the optimal solution to the problem of minimizing the target energy functional function.
  • the optimal solution is the target main variable corresponding to the minimum segmentation error indicated by the target energy functional function.
  • the first average is the average of the pixel value of at least one pixel in the original image located in the internal area of the initial segmentation curve
  • the second average is the average of the pixel value of at least one pixel in the original image located in the outer area of the initial segmentation curve. value.
  • the computer device inputs the initial segmented image and the original image into the active contour model. Through the initial active contour model, first determines the first adaptive weight coefficient and the second adaptive weight coefficient based on the original image, and then determines based on the original image and the initial segmented image.
  • the first average value and the second average value and then based on the original image, the initial segmentation image, the first adaptive weight coefficient, the second adaptive weight coefficient, the first average value and the second average value, an optimization algorithm is used to calculate the target energy
  • the functional function is minimized, that is, the minimization problem of the target energy functional function is solved, and the target main variable that satisfies the minimization of the target energy functional function is obtained.
  • the target energy functional function contains multiple variables that can be split.
  • the multiple variables include the main variable u(x) and the gradient of the main variable.
  • the minimization problem of the target energy functional function is a non-smooth optimization problem, and a numerical method for direct solution cannot be established. That is, the minimization problem of the target energy functional function is more complicated.
  • the alternating direction multiplier method can be used to solve the target energy general function.
  • the minimization problem of the function is transformed into the gradient of the main variable u(x) and the main variable Multiple easy-to-solve sub-problems of Saddle point problems for joint optimization.
  • the optimization algorithm is the alternating direction multiplier method.
  • the computer equipment can first construct an augmented Lagrangian function based on the target energy functional, and then use the alternating direction multiplier method to calculate the main variables in the augmented Lagrangian function. Carry out iterative optimization to obtain the main variables after iterative optimization.
  • the main variables after iterative optimization are the target main variables that satisfy the minimization of the target energy functional function.
  • the augmented Lagrangian function at least includes the main variable representing the intermediate segmentation image.
  • the augmented Lagrangian function can be expressed by the following formula (10):
  • ⁇ (u(x),p,q) is the augmented Lagrangian function
  • x is the pixel coordinate of the 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 the Lagrange multiplier
  • E(u(x)) is the target energy functional function
  • is the image area of the intermediate segmented image
  • is the penalty coefficient.
  • the augmented Lagrangian function also includes an auxiliary variable p and a Lagrange multiplier q.
  • the auxiliary variable p is a splittable auxiliary variable introduced when the alternating direction multiplier method is used.
  • the auxiliary variable p is the auxiliary variable with the intermediate segmentation image.
  • Variables related to the gradient of the main variable, the Lagrange multiplier q is a variable introduced when constructing the augmented Lagrangian function.
  • the minimization problem of the target energy functional function can be converted into A saddle point problem for joint optimization of primary and auxiliary variables representing intermediate segmented images.
  • the computer device uses the alternating direction multiplier method to iteratively optimize the main variables in the augmented Lagrangian function, and obtain the iteratively optimized main variables, which can be achieved through the following steps:
  • Step 1) Construct the 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 segmentation image.
  • x is the pixel coordinate of the pixel in the intermediate segmentation image
  • u(x) is the pixel value of the pixel indicated by x in the intermediate segmentation image
  • p is the auxiliary variable
  • q is the Lagrange multiplier
  • ⁇ (u,p, q) is the augmented Lagrangian function.
  • Step 2 According to the minimization equation, use the alternating direction multiplier method to construct an iterative equation.
  • the iterative equation includes the first equation, the second equation and the third equation.
  • the first equation is used to determine the main variable after the k-th optimization based on the auxiliary variables after the k-1th optimization and the Lagrange multiplier after the k-1th optimization.
  • the second equation is used to determine the main variable after the k-th optimization.
  • the main variable after k-th optimization and the Lagrange multiplier after k-1th optimization determine the auxiliary variables after k-th optimization.
  • the third equation is used to determine the auxiliary variables after k-th optimization based on the main variable after k-th optimization and the k-th optimization.
  • the optimized auxiliary variables determine the Lagrange multiplier after the kth optimization, k is a positive integer, k is the number of iterations, and k represents the number of optimization times for iterative optimization of the segmentation error of the initial segmented image.
  • the first equation in the iterative equation can be expressed by the following formula (12)
  • the second equation can be expressed by the following formula (13)
  • the third equation can be expressed by the following formula (14):
  • k is a positive integer
  • u(x) k is the pixel value of the pixel indicated by x in the image obtained after the k-th optimization of the segmentation error of the initial segmented image
  • u(x) k is the k-th optimization.
  • Main variable p k-1 is the auxiliary variable after the k-1th optimization
  • q k-1 is the Lagrange multiplier after the k-1th optimization
  • p k is the auxiliary variable after the k-th optimization
  • q k is the Lagrange multiplier after the kth optimization.
  • the initial segmentation image after the first optimization can be obtained, and the main segmentation image after the k-1th optimization can be obtained.
  • the variable u(x) 0 is the initial main variable
  • the auxiliary variable p 0 after the k-1th optimization is the initial auxiliary variable
  • the Lagrange multiplier q 0 after the k-1th optimization is the initial Lagrange Multiplier.
  • the initial main variable can be determined through the initial segmentation image, and the initial auxiliary variable and the initial Lagrangian multiplier can be set in advance.
  • the initial auxiliary variable and the initial Lagrangian multiplier can both be zero matrices.
  • the solutions to the first equation, the second equation and the third equation can be solved respectively, and the main variables after the kth optimization and the kth optimization can be obtained.
  • u(x) k is the main variable after the kth optimization
  • u(x) is the pixel value of the pixel indicated by x in the intermediate segmentation image
  • is the image area of the intermediate segmentation image
  • is the constant weight coefficient
  • I is the original image
  • c 1 is the first average value of the pixel value of at least one pixel located in the internal area of the initial segmentation curve in the original image
  • c 2 is the first average value of the pixel value of at least one pixel located in the external area of the initial segmentation curve in the original image.
  • Two average values is the first adaptive weight coefficient
  • is the scale parameter
  • G ⁇ is the Gaussian function
  • u(x) k-1 is the main variable after the k-1th optimization
  • is the penalty coefficient
  • div 2 is The conjugate operator of is the gradient operator
  • p k-1 is the auxiliary variable after the k-1th optimization
  • q k-1 is the Lagrange multiplier after the k-1th optimization.
  • the main variable u(x) k after the kth optimization can represent the optimized initial segmented image obtained by performing the kth optimization on the segmentation error of the initial segmented image, Determined by the above formula (17).
  • u(x) k-1 in formula (17) is the initial main variable
  • p k-1 is the initial auxiliary variable
  • q k-1 is the initial Lagrange multiplier.
  • the computer equipment can be based on the main variable after the k-1th optimization, the auxiliary variable after the k-1th optimization, and the Lagrange multiplier after the k-1th optimization. and the first adaptive weight coefficient to determine the main variable after the k-th optimization, that is, the main variable after the k-th optimization and the main variable after the k-1th optimization, the auxiliary variable after the k-1th optimization, It is related to the Lagrange multiplier and the first adaptive weight coefficient after the k-1th optimization.
  • the alternating direction multiplier method is used to construct the iterative equation. After iterative optimization of the first equation of the iterative equation, the kth time Optimized main variables.
  • is the image area of the intermediate segmentation image
  • ⁇ (I) is the second adaptive weight coefficient
  • p is the auxiliary variable
  • is the penalty coefficient
  • u(x) k is the main variable after the k-th optimization
  • q k-1 is the Lagrange multiplier after the k-1th optimization.
  • p k is the auxiliary variable after the kth optimization
  • shrinkage is the compression threshold operator, and is the point-wise product
  • is the penalty coefficient
  • u(x) k is the main variable after the kth optimization
  • q k-1 is the Lagrange multiplier after the k-1th optimization
  • ⁇ (I) is the second adaptive weight coefficient.
  • k is the initial Lagrange multiplier.
  • the computer equipment can determine the k-th optimization based on the main variables after the k-th optimization, the Lagrange multiplier after the k-1th optimization and the second adaptive weight coefficient.
  • the final auxiliary variable 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-1th optimization, and the second adaptive weight coefficient.
  • q k is the Lagrange multiplier after the k-th optimization
  • q k-1 is the Lagrange multiplier after the k-1 optimization
  • is the penalty coefficient
  • p k is the k-th optimization.
  • the auxiliary variables after is the gradient operator
  • u(x) k is the main variable after the kth optimization.
  • q k-1 in formula (21) is the initial Lagrange multiplier.
  • the computer equipment can determine the k-th value based on the main variable after the k-th optimization, the auxiliary variable after the k-th optimization, and the Lagrange multiplier after the k-1th optimization. Sub-optimized Lagrange multiplier.
  • Step 3 Determine the main variables that meet the preset conditions determined through the first equation as the main variables after iterative optimization.
  • the preset condition is a cutoff condition of the active contour model, and the preset condition may be a loop stop condition and/or a threshold stop condition.
  • meeting the loop stop condition means that the number of iterations k is greater than the maximum number of iterations
  • meeting the threshold stop condition means that the difference between the main variable after the kth optimization and the main variable after the k-1th optimization corresponding to the iteration number k
  • the 1 norm of is less than or equal to the product of the 1 norm of the main variable after the kth optimization and the stopping threshold.
  • the threshold stopping condition can be expressed by the following formula (22):
  • u(x) k is the main variable after the k-th optimization
  • u(x) k-1 is the main variable after the k-1 optimization
  • 1 is the 1 norm
  • is the stopping threshold.
  • the computer equipment solves the solutions of the first equation, the second equation and the third equation respectively, and obtains the main variable after the kth optimization, the auxiliary variable after the kth optimization and the Lagrange multiplier after the kth optimization. After that, determine whether the number of iterations k satisfies the preset conditions. If the number of iterations k is greater than the maximum number of iterations, and/or the k-th optimized main variable corresponding to the number of iterations k meets the stop threshold condition, then it is determined that the number of iterations k satisfies the preset conditions. Set the conditions, otherwise it is determined that the iteration number k does not meet the preset conditions.
  • the number of iterations k is updated to k plus 1, and the solution of the first equation, the second equation and the third equation is continued to be solved respectively, and the third equation after updating k is obtained.
  • the computer equipment constructs the augmented Lagrangian function according to the target energy functional function, it can first construct the minimization equation according to the augmented Lagrangian function; and then according to the minimization equation,
  • the alternating direction multiplier method is used to construct an iterative equation including the first equation expressed by formula (12), the second equation expressed by formula (13) and the third equation expressed by formula (14); then when the iteration number k is equal to 1,
  • the solution u(x) 1 of the first equation after the first optimization is determined, and the main variable u(x) 1 after the first optimization is obtained.
  • the formula (20) the solution of the first equation u(x) 1 after the first optimization is determined.
  • the auxiliary variable p 1 after the first optimization is obtained.
  • the solution q 1 of the third equation after the first optimization is determined, and the Lagrang after the first optimization is obtained.
  • Daily multiplier q 1 then determine whether the iteration number k meets the preset conditions.
  • the computer device can input the initial segmented image and the original image into the active contour model.
  • the initial active contour model first determine the first adaptive weight coefficient and the second adaptive weight coefficient based on the original image; and then determine the first adaptive weight coefficient based on the original image and the initial image.
  • the computer device can also input the initial segmented image and the original image into the active contour model.
  • the initial active contour model first determine the first adaptive weight coefficient and the second adaptive weight coefficient based on the original image; and then determine the first adaptive weight coefficient and the second adaptive weight coefficient based on the original image and the initial image.
  • the initial segmented image and the original image to be segmented including the target object are first obtained, and then 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 initial segmented image is an image after rough segmentation of the target object in the original image.
  • the active contour model uses a target energy functional function.
  • the target energy functional function is used to indicate the segmentation error of the intermediate segmented image during the image segmentation process.
  • the target energy includes a fidelity term carrying a constant weight coefficient, a length term carrying a first adaptive weight coefficient and a smooth term carrying a second adaptive weight coefficient, and the first adaptive weight coefficient and the second adaptive weight coefficient are determined by What is determined by the original image, that is, the weight coefficients of the length term and the smoothness term are not constants, but adaptive weight coefficients related to the original image to be segmented.
  • the weight coefficients of the length term and smoothness term of the target energy functional function in the active contour model can be adjusted accordingly according to different images to be segmented, thereby improving the performance of the active contour. Model robustness and image segmentation accuracy.
  • the active contour model in the embodiment of FIG. 1 has been pre-constructed, and the image segmentation through the active contour model has been set. Processing process, so that after acquiring the original image to be segmented, the computer device can directly obtain the target segmented image according to the preset image segmentation process through the active contour model.
  • the computer device may implement image segmentation through the active contour model by executing the image segmentation method described below.
  • FIG. 2 is a flow chart of another image segmentation method provided by an embodiment of the present application.
  • This method can be applied to computer equipment.
  • the computer equipment can be a terminal, a server or an embedded device, etc.
  • the terminal can be a desktop computer or a tablet computer, etc.
  • the method includes the following steps:
  • Step 201 The computer device obtains the original image to be segmented, the initial segmented image, and the preset parameters of the active contour model.
  • the original image includes the target object, and the target object is the object to be segmented in the original image.
  • the initial segmentation image is an image after rough segmentation of the target object in the original image
  • the initial segmentation image is a binary image
  • the initial segmentation image carries the information of the initial segmentation curve.
  • the pixel value of a pixel in the initial segmented image can be 0 or 1.
  • a pixel value of 1 in the initial segmented image indicates that the pixel is located in the area where the target object is in the initial segmented image.
  • the pixel value of a pixel in the initial segmented image is 0 indicates that the pixel is located in an area other than the area where the target object is located in the initial segmentation image.
  • the initial segmentation image can be a segmentation image obtained by manually setting initial contours in the original image, or it can also be a segmentation image obtained by an initial segmentation model.
  • the preset parameters are commonly used parameters in active contour models.
  • the preset parameters can include constant weight coefficients, scale parameters, penalty coefficients, preset condition values corresponding to preset conditions, initial auxiliary variables and initial Lagrangian. Multiplier.
  • the specific meanings of the constant weight coefficient, scale parameter, penalty coefficient, initial auxiliary variable and initial Lagrange multiplier can be found in the above-mentioned embodiment of Figure 1, and will not be described again in the embodiment of this application.
  • the preset condition is the cut-off condition of the active contour model
  • the preset condition can be the loop stop condition and/or the threshold stop condition
  • the preset condition value corresponding to the loop stop condition is the maximum number of iterations
  • the preset condition corresponding to the threshold stop condition The value is the stopping threshold, and the maximum number of iterations and stopping threshold can be set in advance.
  • the initial auxiliary variable p 0 and the initial Lagrange multiplier q 0 are zero matrices, and the scale parameter ⁇ can be a preset smaller constant such as 0.01 or 0.001.
  • 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 the penalty coefficient.
  • the calculation complexity of the active contour model is low.
  • Step 202 The computer device determines the first adaptive weight coefficient and the second adaptive weight coefficient according to the original image.
  • the first adaptive weight coefficient is the weight coefficient of the length term included in the target energy functional function in the active contour model
  • the second adaptive weight coefficient is the weight coefficient of the smooth term included in the target energy functional function in the active contour model
  • the computer device may determine the first adaptive weight coefficient and the second adaptive weight coefficient respectively according to formula (1) and formula (2) in the embodiment of FIG. 1 .
  • Step 203 The computer device determines the initial main variables according to the initial segmentation image.
  • the initial main variable can represent the initial segmentation image.
  • the pixel value of the pixel indicated by any pixel coordinate x among all pixel coordinates in the initial segmented image is the initial main variable u(x) 0 .
  • Step 204 Based on the original image, the initial segmented image, the preset parameters, the first adaptive weight coefficient, the second adaptive weight coefficient and the initial main variable, starting from the iteration number k equal to 1, the main variable, the auxiliary variable and the pull Grange multipliers are iterated.
  • k represents the number of optimization times for iterative optimization of the segmentation error of the initial segmentation image, and k is a positive integer.
  • the main variable can represent the intermediate segmentation image
  • the auxiliary variable is the variable related to the gradient of the main variable of the intermediate segmentation image
  • the Lagrange multiplier is the variable introduced when constructing the augmented Lagrangian function.
  • the daily multiplier q can convert the minimization problem of the target energy functional into a saddle point problem that jointly optimizes the main variables and auxiliary variables representing the intermediate segmentation image, so that multiple sub-problems corresponding to the saddle point problem can be easily solved.
  • Step 205 The computer device determines the main variables, auxiliary variables and Lagrange multipliers after the kth optimization respectively.
  • the computer equipment determines the main variables, auxiliary variables and Lagrange multipliers after the kth optimization through the target energy functional function of the active contour model.
  • the computer device can calculate the original image, the preset parameters, the first adaptive weight coefficient, the initial main variable, the main variable after the k-1th optimization, the auxiliary variable after the k-1th optimization and the k-th optimization.
  • the Lagrange multiplier after the 1st optimization is used to determine the main variable after the kth optimization; according to the preset parameters, the second adaptive weight coefficient, the main variable after the kth optimization and the k-1th optimization
  • the Lagrange multiplier is used to determine the auxiliary variables after the kth optimization; according to the preset parameters, the main variables after the kth optimization, the auxiliary variables after the kth optimization and the Lagrange variables after the k-1th optimization Grange multiplier, determine the Lagrange multiplier after the kth optimization.
  • the computer device can determine the main variable, the auxiliary variable and the Lagrange multiplier after the kth optimization respectively according to the formula (18), the formula (20) and the formula (21) in the embodiment of FIG. 1 . .
  • the main variable after the kth optimization is related to the auxiliary variable after the k-1th optimization and the first adaptive weight coefficient.
  • the above Formula (20) in the embodiment of Figure 1 can be derived that the auxiliary variable after the k-1th optimization is related to the second adaptive weight coefficient, and further it can be derived that the main variable after the kth optimization is related to the first adaptive weight
  • the coefficient and the second adaptive weight coefficient are related, and the first adaptive weight coefficient and the second adaptive weight coefficient are determined through the original image.
  • the main variable after the k-1th optimization is the initial main variable
  • the auxiliary variable after the k-1th optimization is the initial auxiliary variable
  • the lag after the k-1th optimization is the initial Lagrange multiplier
  • the intermediate segmented image is the initial segmented image generated after one optimization of the initial segmented image
  • the main variable after the first optimization represents the segmentation error of the initial segmented image.
  • the initial segmentation image after the first optimization obtained from the first optimization.
  • the computer device can determine the main variable u(x) 1 after the first optimization according to the formula (18) in the above-mentioned embodiment of Figure 1, and determine the auxiliary variable u(x) 1 after the first optimization according to the formula (20) in the above-mentioned embodiment of Figure 1.
  • the variable p 1 determines the Lagrange multiplier q 1 after the first optimization according to the formula (21) in the embodiment of Figure 1 mentioned above.
  • the intermediate segmented image is the initial segmented image generated after k times of optimization of the initial segmented image.
  • the main variable after the kth optimization represents the intermediate segmented image
  • the intermediate segmented image is the initial segmented image.
  • the initial segmentation image after the kth optimization is generated by performing the kth optimization on the segmentation error.
  • the computer device can determine the main variable u(x) k after the k-th optimization according to the formula (18) in the above-mentioned embodiment of Figure 1, and determine the auxiliary variable u(x) k after the k-th optimization according to the formula (20) in the above-mentioned embodiment of Figure 1.
  • the variable p k determines the Lagrange multiplier q k after the kth optimization according to the formula (21) in the embodiment of Figure 1 mentioned above.
  • the computer device determines the main variables, auxiliary variables and Lagrange multipliers after the k-th optimization respectively, it also determines the first average value and the second average value, that is, it determines that the original image is located inside the initial segmentation curve.
  • the first average value of the pixel values of at least one pixel of the area determines the second average value of the pixel values of at least one pixel of the original image located outside the initial segmentation curve.
  • the first average value c 1 is determined through the formula (4) in the embodiment of FIG . 1
  • the second average value c 2 is determined through the formula (5).
  • the computer device can input the initial segmented image and the original image into the active contour model.
  • the initial active contour model Through the initial active contour model, first determine the first adaptive weight coefficient and the second adaptive weight coefficient based on the original image, and then determine the first adaptive weight coefficient based on the original image and the initial segmentation.
  • the first average value can also be the average value of at least one pixel value of the original image located in the internal area of the middle segmentation curve
  • the second average value can also be the average value of at least one pixel value of the original image located in the outer area of the middle segmentation curve.
  • the average value of the pixel values of the pixels, the intermediate segmentation curve is the contour line used to segment the target object in the intermediate segmentation image and the intermediate segmentation curve is a closed curve.
  • the first average value and the second average value may be determined based on the original image and the intermediate segmented image.
  • the first average value can be determined by the following formula (23)
  • the second average value can be determined by the following formula (24):
  • x is the pixel coordinate of the 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
  • is the image area of the intermediate segmented image.
  • the computer device can input the initial segmented image and the original image into the active contour model.
  • the initial active contour model Through the initial active contour model, first determine the first adaptive weight coefficient and the second adaptive weight coefficient based on the original image, and then determine the first adaptive weight coefficient based on the original image and the initial segmentation.
  • Step 206 The computer device determines whether the iteration number k satisfies the preset condition.
  • step 205 the number of iterations k is greater than 1.
  • the preset conditions include loop stop conditions and/or stop threshold conditions. 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 main variable after the kth optimization corresponding to the iteration number k corresponds to the k-th optimized main variable and The 1-norm of the difference value of the main variable after the k-1th optimization is less than or equal to the product of the 1-norm of the main variable after the k-th optimization and the stopping threshold.
  • step 207 determines whether the number of iterations k is greater than the maximum number of iterations, and/or if it determines through the formula (22) in the embodiment of FIG. 1 that the k-th optimized main variable corresponding to the iteration number k corresponds to the k-1
  • the 1-norm of the difference between the main variables after the optimization is less than or equal to the product of the 1-norm of the main variable after the k-th optimization and the stop threshold, then it is determined that the iteration number k satisfies the preset condition, and step 208 is executed. Otherwise, determine If the number of iterations k does not meet the preset condition, step 207 is executed.
  • Step 207 If the computer device determines that the number of iterations k does not meet the preset conditions, it updates k to k plus the preset value, and jumps to determine the main variables, auxiliary variables and Lagrange multipliers after the kth optimization. sub-steps and subsequent steps.
  • the preset value is a positive integer, and the preset value can be 1 or other values, which is not limited in the embodiments of the present application.
  • Step 208 If the computer device determines that the iteration number k satisfies the preset condition, it determines the k-th optimized main variable that meets the preset condition as the target main variable, and the intermediate segmented image represented by the target main variable is the target segmented image.
  • the computer device can perform image segmentation on the original image to obtain the target segmented image. That is, the above-mentioned steps 201 to 208 are the processing process of the computer device performing image segmentation through the active contour model.
  • FIG. 3 is a schematic framework diagram of an image segmentation method provided by an embodiment of the present application.
  • (a) in Figure 3 is the original image, the original image is a medical image, and the target object is pulmonary nodules.
  • Picture (b) in Figure 3 is the initial segmentation image, and the initial segmentation image is a binary image.
  • Picture (c) in Figure 3 is the representation of the initial segmentation curve in the initial segmentation image in the original image.
  • Figure 3 (d) is an enlarged image of the first target area in Figure 3 (c).
  • the first target area refers to the area inside the initial segmentation curve in Figure 3 (c).
  • the area of the region, (e) in Figure 3 is the target segmentation image
  • (f) in Figure 3 is the representation of the target segmentation curve in the target segmentation image in the original image
  • (g) in Figure 3 is An enlarged image of the second target area in Figure 3(f).
  • the second target area refers to the area located inside the target segmentation curve in Figure 3(f).
  • the target segmentation curve is a contour line used to segment the target object in the target segmentation image and the target segmentation curve is a closed curve.
  • the boundary of the second target area in the picture (g) in Figure 3 is smoother, that is, the target segmentation curve is smoother, and the image segmentation accuracy is higher.
  • the active contour model uses a target energy functional function.
  • the target energy functional function is used to indicate the segmentation error of the intermediate segmented image in the image segmentation process.
  • the target energy functional function includes a fidelity term carrying a constant weight coefficient, a first adaptive term carrying The length term of the weight coefficient and the smooth term carrying the second adaptive weight coefficient, and the first adaptive weight coefficient and the second adaptive weight coefficient are determined through the original image, that is, the weight coefficient of the length term and the smooth term is not a constant, but an adaptive weight coefficient related to the original image to be segmented.
  • the weight coefficients of the length term and smoothness term of the target energy functional function in the active contour model can be adjusted accordingly according to different images to be segmented, thereby improving the performance of the active contour.
  • Model robustness and image segmentation accuracy can be performed when performing image segmentation on the image to be segmented through the active contour model.
  • the original image to be segmented, the initial segmented image and the 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 main variables are determined based on the initial segmented image.
  • the main variable after the kth optimization that meets the preset conditions is determined as the target main variable, and the intermediate segmented image represented by the target main variable is the target segmented image.
  • the main variable after the kth optimization is related to the first adaptive weight coefficient and the second adaptive weight coefficient, and the first adaptive weight coefficient and the second adaptive weight coefficient are related to each other.
  • the adaptation weight coefficient is 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 Different original images to be segmented are better matched, so the k-th optimized main variable that meets the preset conditions is determined to be better, and the target segmentation image represented by the k-th optimized main variable is better. This improves Improved the robustness and image segmentation accuracy of the active contour model.
  • FIG. 4 is a schematic structural diagram of an image segmentation device provided by an embodiment of the present application.
  • the image segmentation adjustment device can be implemented as part or all of a computer device by software, hardware, or a combination of the two.
  • the computer device can be the computer device shown in Figure 5 below.
  • the image segmentation adjustment device includes: a first acquisition module 401 , a second acquisition module 402 and a first segmentation module 403 .
  • the first acquisition module 401 is used to acquire the original image to be segmented, where the original image includes the target object;
  • the second acquisition module 402 is used to acquire an initial segmented image.
  • the initial segmented image is an image after rough segmentation of the target object in the original image;
  • the first segmentation module 403 is used to input the initial segmented image and the original image into the active contour model to perform image segmentation to obtain a target segmented image of the original image.
  • the active contour model adopts a target energy function
  • the target energy functional function is used to indicate the segmentation error of the intermediate segmentation image generated during the image segmentation process.
  • the target energy functional function includes a fidelity term carrying a constant weight coefficient, a length term carrying a first adaptive weight coefficient, and a second term carrying a second adaptive weight coefficient.
  • the smooth term of the adaptive weight coefficient, the first adaptive weight coefficient and the second adaptive weight coefficient are determined through the original image.
  • the first adaptive weight coefficient and the second adaptive weight coefficient are respectively expressed by the following formulas:
  • y is the pixel coordinate of the pixel in the original image
  • I(y) is the pixel value of the pixel indicated by y in the original image
  • ⁇ (I) is the second adaptive weight coefficient
  • the target energy functional includes main variables representing intermediate segmented images
  • the first segmentation module 403 is also used to use the original image and the initial segmented image as the input of the active contour model.
  • the optimization algorithm is used to minimize the target energy functional function, so as to obtain the target energy functional function that satisfies the minimization process.
  • the target main variable of , the intermediate segmentation image represented by the target main variable is the target segmentation image, and the intermediate segmentation image is the optimized initial segmentation image obtained by optimizing the segmentation error of the initial segmentation image.
  • the optimization algorithm is the alternating direction multiplier method
  • the first segmentation module 403 is also used to construct an augmented Lagrangian function according to the target energy functional function.
  • the augmented Lagrangian function at least includes a main variable representing the intermediate segmented image;
  • the alternating direction multiplier method is used to iteratively optimize the main variables in the augmented Lagrangian function, and the main variables after iterative optimization are obtained.
  • the main variables after iterative optimization are the target main variables that satisfy the minimization of the target energy functional function.
  • the augmented Lagrangian function also includes auxiliary variables and Lagrange multipliers.
  • the auxiliary variables are variables related to the gradient of the main variable of the intermediate segmentation image.
  • the Lagrangian multiplier is used to convert the target
  • the minimization problem of the energy functional function is transformed into a saddle point problem that jointly optimizes the main variables and auxiliary variables representing the intermediate segmentation image;
  • 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 segmentation image;
  • the alternating direction multiplier method is used to construct an iterative equation.
  • the iterative equation includes the first equation, the second equation and the third equation.
  • the first equation is used according to the auxiliary variables after the k-1th optimization and the k-th
  • the Lagrange multiplier after the 1st optimization determines the main variable after the kth optimization
  • the second equation is used to determine the main variable after the kth optimization and the Lagrange multiplier after the k-1th optimization.
  • the third equation is used to determine the Lagrange multiplier after the kth optimization based on the main variables after the kth optimization and the auxiliary variables after the kth optimization.
  • k is positive. integer;
  • the main variables that meet the preset conditions determined through the first equation are determined as the main variables after iterative optimization.
  • x is the pixel coordinate of the pixel in the intermediate segmentation image
  • u(x) is the pixel value of the pixel indicated by x in the intermediate segmentation image
  • u(x) is the main variable representing the intermediate segmentation image
  • p is the auxiliary variable
  • q is Lagrange multiplier
  • ⁇ (u,p,q) is the augmented Lagrangian function.
  • the iteration equation is represented by the following formula:
  • k is a positive integer
  • u(x) k is the pixel value of the pixel indicated by x in the image obtained after the kth optimization of the segmentation error of the initial segmented image
  • u(x) k is the main variable after the kth optimization
  • p k-1 is the auxiliary variable after the k-1th optimization
  • q k-1 is the Lagrange multiplier after the k-1th optimization
  • p k is the auxiliary variable after the kth optimization
  • q k is the Lagrange multiplier after the kth optimization.
  • the image segmentation adjustment device further includes a second segmentation module.
  • the second segmentation module is used to use the original image as the input of the initial segmentation model, and determine the initial segmentation image through the initial segmentation model.
  • the initial segmentation model is used to perform segmentation on the original image.
  • the target object is roughly segmented to obtain a roughly segmented image.
  • the target energy functional is expressed by:
  • E(u(x)) is the target energy functional function
  • x is the pixel coordinate of the pixel in the intermediate segmentation image
  • u(x) is the pixel value of the pixel indicated by x in the intermediate segmentation image
  • ⁇ (I) is the second adaptive weight coefficient
  • is the image area of the intermediate segmentation image
  • c 1 is the pixel value of at least one pixel located in the internal area of the initial segmentation curve in the original image.
  • An average value, c 2 is the second average value of the pixel value of at least one pixel located in the outer area of the initial segmentation curve in the original image
  • the initial segmentation curve is the contour line used to segment the target object in the initial segmentation image
  • the initial segmentation curve is a closed curve
  • is a scale parameter
  • G ⁇ is a Gaussian function
  • image segmentation device provided in the above embodiments is only explained by taking the division of the above functional modules as an example.
  • the above functions can be allocated to different functional modules according to needs, that is, the internal structure of the device Divide it into different functional modules to complete all or part of the functions described above.
  • Each functional unit and module in the above embodiments can be integrated into one processing unit, or each unit can exist physically alone, or two or more units can be integrated into one unit.
  • the above-mentioned integrated unit can either use hardware. It can also be implemented in the form of software functional units.
  • the specific names of each functional unit and module are only for the convenience of distinguishing each other and are not used to limit the protection scope of the embodiments of the present application.
  • the image segmentation device provided by the above embodiments and the image segmentation method embodiments belong to the same concept.
  • the specific working processes and technical effects of the units and modules in the above embodiments can be found in the method embodiments section, and will not be described again here.
  • FIG. 5 is a schematic structural diagram of a computer device provided by an embodiment of the present application.
  • 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.
  • the processor 501 executes the computer program 503 stored in the memory 502 and executable on the processor 501.
  • the processor 501 executes the computer program 503 the image in the above embodiment is realized. Steps in the segmentation method.
  • the computer device may be the computer device in the above-mentioned embodiment of FIG. 1 or the above-mentioned embodiment of FIG. 2 .
  • the computer device may be a near-eye display device, or a desktop computer, a portable computer, a network server, a palmtop computer, a mobile phone, a tablet computer, a wireless terminal device, a communication device or an embedded device.
  • the embodiments of this application do not limit the type of computer device.
  • Figure 5 is only an example of a computer device and does not constitute a limitation on the computer device. It may include more or fewer components than shown in the figure, or some components may be combined, or different components may be used, such as It can also include input and output devices, network access devices, etc.
  • the processor 501 can be a central processing unit (Central Processing Unit, CPU).
  • the processor 501 can also be other general-purpose processors, digital signal processors (Digital Signal Processor, DSP), or application specific integrated circuits (Application Specific Integrated Circuit, ASIC). , off-the-shelf programmable gate array (Field-Programmable Gate Array, FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc.
  • a general purpose processor may be a microprocessor or any conventional processor.
  • the memory 502 can be an on-chip memory or an off-chip memory of a computer device, such as a cache memory of a computer device, SRAM (Static Random-Access Memory), or DRAM (Dynamic Static Random-Access). Memory, dynamic random access memory) or floppy disk, etc.
  • the memory 502 can also be a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash memory card (Flash Card), etc. equipped on the computer device.
  • the memory 502 may also include both on-chip memory and off-chip memory internal storage units of the computer device, as well as external storage devices.
  • the memory 502 is used to store operating systems, application programs, boot loaders, data, and other programs.
  • the memory 502 may also be used to temporarily store data that has been output or is to be output.
  • An embodiment of the present 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, and when the processor executes the computer program, the steps in any of the above-mentioned method embodiments are implemented.
  • Embodiments of the present application also provide a computer-readable storage medium.
  • the computer-readable storage medium stores a computer program.
  • the steps in the above method embodiments can be implemented.
  • the embodiment of the present application provides a computer program product, which, when run on a computer, causes the computer to perform the steps in each of the above method embodiments.
  • Integrated units may be stored in a computer-readable storage medium if they are implemented in the form of software functional units and sold or used as independent products. Based on this understanding, this application can implement all or part of the processes in the above method embodiments by instructing relevant hardware through a computer program.
  • the computer program can be stored in a computer-readable storage medium, and the computer program can be used when being processed. When the processor executes, the steps of each of the above method embodiments can be implemented.
  • the computer program includes computer program code, which can be in source code form, object code form, executable file or some intermediate form, etc.
  • the computer-readable medium may at least include: any entity or device capable of carrying computer program code to the camera device/terminal device, recording media, computer memory, ROM (Read-Only Memory), RAM (Random Access Memory) , Random Access Memory), CD-ROM (Compact Disc Read-Only Memory, read-only disk), tapes, floppy disks and optical data storage devices, etc.
  • the computer-readable storage media mentioned in this application may be non-volatile storage media, in other words, may be non-transitory storage media.

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Health & Medical Sciences (AREA)
  • General Health & Medical Sciences (AREA)
  • Artificial Intelligence (AREA)
  • Data Mining & Analysis (AREA)
  • Radiology & Medical Imaging (AREA)
  • Quality & Reliability (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Medical Informatics (AREA)
  • Biomedical Technology (AREA)
  • Biophysics (AREA)
  • Computational Linguistics (AREA)
  • Nuclear Medicine, Radiotherapy & Molecular Imaging (AREA)
  • Evolutionary Computation (AREA)
  • Molecular Biology (AREA)
  • Computing Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Mathematical Physics (AREA)
  • Software Systems (AREA)
  • Image Analysis (AREA)

Abstract

The present application belongs to the field of image processing. Disclosed are an image segmentation method and apparatus, a device, and a readable storage medium. The method comprises: acquiring an initial segmentation image and an original image to be segmented comprising a target object, and inputting into an active contour model the initial segmentation image and said original image to perform image segmentation, so as to obtain a target segmentation image. A target energy functional used by the active contour model comprises a fidelity term carrying a constant weighting coefficient, a length term carrying a first adaptive weighting coefficient and a smooth term carrying a second adaptive weighting coefficient, the first adaptive weighting coefficient and the second adaptive weighting coefficient being determined by means of said original image. Thus, when an image to be segmented is segmented by means of the active contour model, the weighting coefficients of the length term and the smooth term of the target energy functional of the active contour model can be correspondingly adjusted according to different images to be segmented, thereby improving the robustness and the image segmentation precision of the active contour model.

Description

图像分割方法、装置、设备及可读存储介质Image segmentation method, device, equipment and readable storage medium 技术领域Technical field
本申请涉及图像处理领域,特别涉及一种图像分割方法、装置、设备及可读存储介质。The present application relates to the field of image processing, and in particular to an image segmentation method, device, equipment and readable storage medium.
背景技术Background technique
图像分割是一种用于从图像中分割出感兴趣目标的图像处理方法,可以应用于医学图像处理、遥感图像处理等领域。其中,活动轮廓模型(Active Contour Model)是一种常用的图像分割模型,其可以对原始图像中的目标物体进行多次迭代分割,得到目标分割图像,目标物体为原始图像中的待分割物体,比如为CT(Computed Tomography,电子计算机断层扫描)图像中的肺结节等。Image segmentation is an image processing method used to segment objects of interest from images. It can be applied to medical image processing, remote sensing image processing and other fields. Among them, the Active Contour Model is a commonly used image segmentation model. It can perform multiple iterations of segmentation on the target object in the original image to obtain the target segmentation image. The target object is the object to be segmented in the original image. For example, it is pulmonary nodules in CT (Computed Tomography) images.
通常,活动轮廓模型的核心包括能量泛函数,能量泛函数用于作为评价指标指示当前迭代的分割图像的分割误差,通过对能量泛函数进行多次最小化迭代可以得到目标分割图像,目标分割图像中的分割曲线与目标物体的轮廓线的相对误差小于阈值。目前,活动轮廓模型的能量泛函数通常包括分别携带常数权重系数的保真项、长度项和光滑项,保真项用于指示当前迭代的分割图像中的当前分割曲线与目标轮廓线的相对误差,长度项用于指示当前分割曲线的长度,光滑项用于指示当前分割曲线的光滑程度,如此通过活动轮廓模型对能量泛函数进行最小化可以使得当前迭代的分割图像中的当前分割曲线持续接近目标轮廓线、以及持续向目标轮廓线紧缩并保持平滑,从而得到的目标分割图像可以较优的指示目标物体。Usually, the core of the active contour model includes the energy functional function. The energy functional function is used as an evaluation index to indicate the segmentation error of the current iteration of the segmented image. The target segmentation image can be obtained by minimizing the energy functional function multiple iterations. The target segmentation image The relative error between the segmentation curve in and the contour line of the target object is less than the threshold. At present, the energy functional function of the active contour model usually includes a fidelity term, a length term and a smoothness term carrying constant weight coefficients respectively. The fidelity term is used to indicate the relative error between the current segmentation curve and the target contour in the segmentation image of the current iteration. , the length term is used to indicate the length of the current segmentation curve, and the smoothness term is used to indicate the smoothness of the current segmentation curve. In this way, minimizing the energy functional function through the active contour model can make the current segmentation curve in the segmentation image of the current iteration continue to be close. The target contour line and the target contour line are continuously compressed and kept smooth, so that the obtained target segmentation image can better indicate the target object.
但是,上述活动轮廓模型的能量泛函数包括三个常数权重系数,这使得对于不同的待分割图像,保真项、长度项和光滑项的权重系数相同,可能导致活动轮廓模型的鲁棒性较差,图像分割精度较低。However, the energy functional function of the above 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, which may cause the active contour model to be less robust. Poor, the image segmentation accuracy is low.
发明内容Contents of the invention
本申请提供了一种图像分割方法、装置、设备及可读存储介质,可以解决由于活动轮廓模型的能量泛函数包括三个常数权重系数,而导致的活动轮廓模型的鲁棒性较差、图像分割精度较低的问题。This application provides an image segmentation method, device, equipment and readable storage medium, which can solve the problem of poor robustness of the active contour model and poor image quality caused by the energy functional function of the active contour model including three constant weight coefficients. The problem of low segmentation accuracy.
所述技术方案如下:The technical solutions are as follows:
第一方面,提供了一种图像分割方法,所述方法包括:In a first aspect, an image segmentation method is provided, and the method includes:
获取待分割的原始图像,所述原始图像包括目标物体;Acquire an original image to be segmented, wherein the original image includes a target object;
获取初始分割图像,所述初始分割图像为对所述原始图像中的所述目标物体进行粗分割 后的图像;Obtain an initial segmentation image, which is an image after rough segmentation of the target object in the original image;
将所述初始分割图像和所述原始图像输入到活动轮廓模型中进行图像分割,得到所述原始图像的目标分割图像,所述活动轮廓模型采用目标能量泛函数;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, and the active contour model uses a target energy functional function;
其中,所述目标能量泛函数用于指示图像分割过程中产生的中间分割图像的分割误差,所述目标能量泛函数包括携带常数权重系数的保真项、携带第一自适应权重系数的长度项和携带第二自适应权重系数的光滑项,所述第一自适应权重系数和所述第二自适应权重系数通过所述原始图像确定。Wherein, the target energy functional function is used to indicate the segmentation error of the intermediate segmentation image generated during the image segmentation process. The target energy functional function includes a fidelity term carrying a constant weight coefficient and a length term carrying a first adaptive weight coefficient. and a smooth term carrying a second adaptive weight coefficient, the first adaptive weight coefficient and the second adaptive weight coefficient being determined by the original image.
作为一个示例,所述第一自适应权重系数和所述第二自适应权重系数分别通过如下公式表示:As an example, the first adaptive weight coefficient and the second adaptive weight coefficient are respectively expressed by the following formulas:
Figure PCTCN2022138172-appb-000001
Figure PCTCN2022138172-appb-000001
Figure PCTCN2022138172-appb-000002
Figure PCTCN2022138172-appb-000002
其中,
Figure PCTCN2022138172-appb-000003
为所述第一自适应权重系数,y为所述原始图像中像素的像素坐标,I(y)为所述原始图像中y指示的像素的像素值,β(I)为所述第二自适应权重系数,
Figure PCTCN2022138172-appb-000004
为梯度运算符。
in,
Figure PCTCN2022138172-appb-000003
is the first adaptive weight coefficient, y is the pixel coordinate of the pixel in the original image, I(y) is the pixel value of the pixel indicated by y in the original image, β(I) is the second automatic Adaptation weight coefficient,
Figure PCTCN2022138172-appb-000004
is the gradient operator.
作为一个示例,所述目标能量泛函数包括表示所述中间分割图像的主变量;As an example, the target energy functional includes a main variable representing the intermediate segmentation image;
所述将所述初始分割图像和所述原始图像输入到活动轮廓模型中进行图像分割,得到所述原始图像的目标分割图像,包括:The step of inputting 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 includes:
将所述初始分割图像和所述原始图像输入到所述活动轮廓模型中,通过所述活动轮廓模型,采用最优化算法对所述目标能量泛函数进行最小化处理,得到满足所述目标能量泛函数最小化的目标主变量,所述目标主变量表示的中间分割图像为所述目标分割图像,所述中间分割图像为通过对所述初始分割图像的分割误差进行优化得到的优化后的初始分割图像。The initial segmented image and the original image are input into the active contour model. Through the active contour model, an optimization algorithm is used to minimize the target energy functional function to obtain a target energy functional function that satisfies the target energy functional function. The target main variable for function minimization, the intermediate segmentation image represented by the target main variable is the target segmentation image, and the intermediate segmentation image is the optimized initial segmentation obtained by optimizing the segmentation error of the initial segmentation image. image.
作为一个示例,所述最优化算法为交替方向乘子法;As an example, the optimization algorithm is the alternating direction multiplier method;
所述采用最优化算法对所述目标能量泛函数进行最小化处理,得到满足所述目标能量泛函数最小化的目标主变量,包括:The optimization algorithm is used to minimize the target energy functional function to obtain the target main variables that satisfy the minimization of the target energy functional function, including:
根据所述目标能量泛函数,构建增广拉格朗日函数,所述增广拉格朗日函数至少包括表示所述中间分割图像的主变量;Construct an augmented Lagrangian function according to the target energy functional, the augmented Lagrangian function at least including a main variable representing the intermediate segmentation image;
采用所述交替方向乘子法对所述增广拉格朗日函数中的主变量进行迭代优化,得到迭代优化后的主变量,所述迭代优化后的主变量为所述满足所述目标能量泛函数最小化的目标主变量。The alternating direction multiplier method is used to iteratively optimize the main variables in the augmented Lagrangian function to obtain the iteratively optimized main variables. The iteratively optimized main variables are the ones that satisfy the target energy. The target host variable for minimizing the generic function.
作为一个示例,所述增广拉格朗日函数通过如下公式表示:As an example, the augmented Lagrangian function is expressed by the following formula:
Figure PCTCN2022138172-appb-000005
Figure PCTCN2022138172-appb-000005
其中,Γ(u(x),p,q)为所述增广拉格朗日函数,x为所述中间分割图像中像素的像素坐标,u(x)为所述中间分割图像中x指示的像素的像素值,u(x)为表示所述中间分割图像的主变量,p为辅助变量,且
Figure PCTCN2022138172-appb-000006
q为拉格朗日乘子,E(u(x))为所述目标能量泛函数,Ω为所述中间分割图像的图像区域,θ为罚系数。
Where, Γ(u(x),p,q) is the augmented Lagrangian function, x is the pixel coordinate of the pixel in the intermediate segmented image, u(x) is the x indication in the intermediate segmented image The pixel value of the pixel, u(x) is the main variable representing the intermediate segmentation image, p is the auxiliary variable, and
Figure PCTCN2022138172-appb-000006
q is the Lagrange multiplier, E(u(x)) is the target energy functional function, Ω is the image area of the intermediate segmentation image, and θ is the penalty coefficient.
作为一个示例,所述增广拉格朗日函数还包括辅助变量和拉格朗日乘子,所述辅助变量为与所述中间分割图像的主变量的梯度有关的变量;As an example, the augmented Lagrangian function further includes an auxiliary variable and a Lagrange multiplier, where the auxiliary variable is a variable related to the gradient of the main variable of the intermediate segmented image;
所述采用所述交替方向乘子法对所述增广拉格朗日函数中的主变量进行迭代优化,得到迭代优化后的主变量,包括:The alternating direction multiplier method is used to iteratively optimize the main variables in the augmented Lagrangian function to obtain the iteratively optimized main variables, including:
根据所述增广拉格朗日函数构建最小化方程,所述最小化方程为对表示所述中间分割图像的主变量和所述辅助变量进行联合优化的方程;Construct a minimization equation according to the augmented Lagrangian function, where the minimization equation is an equation that jointly optimizes the main variable representing the intermediate segmentation image and the auxiliary variable;
根据最小化方程,采用所述交替方向乘子法构建迭代方程,所述迭代方程包括第一方程、第二方程和第三方程,所述第一方程用于根据第k-1次优化后的辅助变量和第k-1次优化后的拉格朗日乘子确定第k次优化后的主变量,所述第二方程用于根据第k次优化后的主变量和第k-1次优化后的拉格朗日乘子确定第k次优化后的辅助变量,所述第三方程用于根据第k次优化后的主变量和第k次优化后的辅助变量确定第k次优化后的拉格朗日乘子,k为正整数;According to the minimization equation, the alternating direction multiplier method is used to construct an iterative equation. The iterative equation includes a first equation, a second equation and a third equation. The first equation is used according to the k-1th optimization. The auxiliary variables and the Lagrange multiplier after the k-1th optimization determine the main variable after the k-th optimization, and the second equation is used to determine the main variable after the k-th optimization and the k-1th optimization. The final Lagrange multiplier determines the auxiliary variable after the kth optimization, and the third equation is used to determine the kth optimization based on the main variable after the kth optimization and the auxiliary variable after the kth optimization. Lagrange multiplier, k is a positive integer;
将通过所述第一方程确定的满足预设条件的主变量,确定为所述迭代优化后的主变量。The main variables that satisfy the preset conditions determined through the first equation are determined as the main variables after the iterative optimization.
作为一个示例,所述最小化方程通过如下公式表示:As an example, the minimization equation is expressed by the following formula:
Figure PCTCN2022138172-appb-000007
Figure PCTCN2022138172-appb-000007
其中,x为所述中间分割图像中像素的像素坐标,u(x)为所述中间分割图像中x指示的像素的像素值,u(x)为表示所述中间分割图像的主变量,p为所述辅助变量,q为所述拉格朗日乘子,Γ(u,p,q)为所述增广拉格朗日函数。Where, x is the pixel coordinate of the 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 Lagrangian function.
作为一个示例,所述迭代方程通过如下公式表示:As an example, the iteration equation is expressed by the following formula:
Figure PCTCN2022138172-appb-000008
Figure PCTCN2022138172-appb-000008
其中,k为正整数,
Figure PCTCN2022138172-appb-000009
为所述第一方程,u(x) k为对所述初始分割图像的分割误差进行第k次优化后得到的图像中x指示的像素的像素值,u(x) k为所述第k次优化后的主变量,p k-1为所述第k-1次优化后的辅助变量,q k-1为所述第k-1次优化后的拉格朗日乘子,
Figure PCTCN2022138172-appb-000010
为所述第二方程,p k为所述第k次优化后的辅助变量,
Figure PCTCN2022138172-appb-000011
为所述第三方程,q k为所述第k次优化后的拉格朗日乘子。
Among them, k is a positive integer,
Figure PCTCN2022138172-appb-000009
is the first equation, u(x) k is the pixel value of the pixel indicated by x in the image obtained after the kth optimization of the segmentation error of the initial segmented image, u(x) k is the kth The main variable after the optimization, p k-1 is the auxiliary variable after the k-1 optimization, q k-1 is the Lagrange multiplier after the k-1 optimization,
Figure PCTCN2022138172-appb-000010
is the second equation, p k is the auxiliary variable after the kth optimization,
Figure PCTCN2022138172-appb-000011
is the third equation, q k is the Lagrange multiplier after the kth optimization.
作为一个示例,所述获取初始分割图像之前,所述方法还包括:As an example, before obtaining the initial segmentation image, the method further includes:
将所述原始图像作为初始分割模型的输入,通过所述初始分割模型确定所述初始分割图像,所述初始分割模型用于对所述原始图像中的所述目标物体进行粗分割,得到粗分割的图像。The original image is used as the input of the initial segmentation model, and the initial segmentation image is determined through the initial segmentation model. The initial segmentation model is used to roughly segment the target object in the original image to obtain a rough segmentation. Image.
作为一个示例,所述目标能量泛函数通过如下公式表示:As an example, the target energy functional function is expressed by the following formula:
Figure PCTCN2022138172-appb-000012
Figure PCTCN2022138172-appb-000012
其中,E(u(x))为所述目标能量泛函数,x为所述中间分割图像中像素的像素坐标,u(x)为所述中间分割图像中x指示的像素的像素值,且u(x)∈[0,1],u(x)=1表示x指示的像素位于所述中间分割图像中所述目标物体所在的区域,u(x)=0表示x指示的像素位于所述中间分割图像中除所述目标物体所在的区域之外的其它区域,F(u(x))为所述保真项,L(u(x))为所述长度项,P(u(x))为所述光滑项,λ为所述常数权重系数,I为所述原始图像,
Figure PCTCN2022138172-appb-000013
为所述第一自适应权重系数,β(I)为所述第二自适应权重系数,Ω为所述中间分割图像的图像区域,c 1为所述原始图像中位于初始分割曲线内部区域的至少一个像素的像素值的第一平均值,c 2为所述原始图像中位于所述初始分割曲线外部区域的至少一个像素的像素值的第二平均值,所述初始分割曲线为用于在所述初始分割图像中分割所述目标物体的轮廓线且所述初始分割曲线为封闭曲线,τ为尺度参数,G τ为高斯函数,
Figure PCTCN2022138172-appb-000014
为梯度运算符。
Wherein, E(u(x)) is the target energy functional function, x is the pixel coordinate of the 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 means that the pixel indicated by x is located in the area where the target object is located in the intermediate segmented image, u(x)=0 means that the pixel indicated by x is located at For other areas in the intermediate segmented image except the area where the target object is located, F(u(x)) is the fidelity term, L(u(x)) is the length term, and P(u( x)) is the smooth term, λ is the constant weight coefficient, I is the original image,
Figure PCTCN2022138172-appb-000013
is the first adaptive weight coefficient, β(I) is the second adaptive weight coefficient, Ω is the image area of the intermediate segmentation image, and c 1 is the area inside the initial segmentation curve in the original image. The first average value of the pixel value of at least one pixel, c 2 is the second average value of the pixel value of at least one pixel in the original image located outside the initial segmentation curve, and the initial segmentation curve is used in The contour line of the target object is segmented in the initial segmentation image and the initial segmentation curve is a closed curve, τ is a scale parameter, G τ is a Gaussian function,
Figure PCTCN2022138172-appb-000014
is the gradient operator.
第二方面,提供了一种种图像分割装置,所述装置包括:In a second aspect, an image segmentation device is provided, and the device includes:
第一获取模块,用于获取待分割的原始图像,所述原始图像包括目标物体;The first acquisition module is used to acquire the original image to be segmented, where the original image includes the target object;
第二获取模块,用于获取初始分割图像,所述初始分割图像为对所述原始图像中的所述目标物体进行粗分割后的图像;The second acquisition module is used to acquire an initial segmentation image, where the initial segmentation image is an image after rough segmentation of the target object in the original image;
第一分割模块,用于将所述初始分割图像和所述原始图像输入到活动轮廓模型中进行图像分割,得到所述原始图像的目标分割图像,所述活动轮廓模型采用目标能量泛函数;A first segmentation module, configured 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, and the active contour model uses a target energy functional function;
其中,所述目标能量泛函数用于指示图像分割过程中产生的中间分割图像的分割误差,所述目标能量泛函数包括携带常数权重系数的保真项、携带第一自适应权重系数的长度项和携带第二自适应权重系数的光滑项,所述第一自适应权重系数和所述第二自适应权重系数通过所述原始图像确定。Wherein, the target energy functional function is used to indicate the segmentation error of the intermediate segmentation image generated during the image segmentation process. The target energy functional function includes a fidelity term carrying a constant weight coefficient and a length term carrying a first adaptive weight coefficient. and a smooth term carrying a second adaptive weight coefficient, the first adaptive weight coefficient and the second adaptive weight coefficient being determined by the original image.
作为一个示例,所述第一自适应权重系数和所述第二自适应权重系数分别通过如下公式表示:As an example, the first adaptive weight coefficient and the second adaptive weight coefficient are respectively expressed by the following formulas:
Figure PCTCN2022138172-appb-000015
Figure PCTCN2022138172-appb-000015
Figure PCTCN2022138172-appb-000016
Figure PCTCN2022138172-appb-000016
其中,
Figure PCTCN2022138172-appb-000017
为所述第一自适应权重系数,y为所述原始图像中像素的像素坐标,I(y)为所述原始图像中y指示的像素的像素值,β(I)为所述第二自适应权重系数,
Figure PCTCN2022138172-appb-000018
为梯度运算符。
in,
Figure PCTCN2022138172-appb-000017
is the first adaptive weight coefficient, y is the pixel coordinate of the pixel in the original image, I(y) is the pixel value of the pixel indicated by y in the original image, β(I) is the second automatic Adaptation weight coefficient,
Figure PCTCN2022138172-appb-000018
is the gradient operator.
作为一个示例,目标能量泛函数包括表示所述中间分割图像的主变量;As an example, the target energy functional includes a main variable representing the intermediate segmented image;
所述第一分割模块,还用于将所述初始分割图像和所述原始图像输入到所述活动轮廓模型中,通过所述活动轮廓模型,采用最优化算法对所述目标能量泛函数进行最小化处理,得到满足所述目标能量泛函数最小化的目标主变量,所述目标主变量表示的中间分割图像为所述目标分割图像,所述中间分割图像为通过对所述初始分割图像的分割误差进行优化得到的优化后的初始分割图像。The first segmentation module is also used to input the initial segmentation image and the original image into the active contour model, and use the optimization algorithm to minimize the target energy functional through the active contour model. process to obtain the target main variable that satisfies the minimization of the target energy functional function, the intermediate segmentation image represented by the target main variable is the target segmentation image, and the intermediate segmentation image is obtained by segmenting the initial segmentation image. The optimized initial segmentation image is obtained by optimizing the error.
作为一个示例,最优化算法为交替方向乘子法;As an example, the optimization algorithm is the alternating direction multiplier method;
所述第一分割模块,还用于根据所述目标能量泛函数,构建增广拉格朗日函数,所述增广拉格朗日函数至少包括表示所述中间分割图像的主变量;The first segmentation module is also configured to construct an augmented Lagrangian function according to the target energy functional function, where the augmented Lagrangian function at least includes a main variable representing the intermediate segmented image;
采用所述交替方向乘子法对所述增广拉格朗日函数中的主变量进行迭代优化,得到迭代优化后的主变量,所述迭代优化后的主变量为所述满足所述目标能量泛函数最小化的目标主变量。The alternating direction multiplier method is used to iteratively optimize the main variables in the augmented Lagrangian function to obtain the iteratively optimized main variables. The iteratively optimized main variables are the ones that satisfy the target energy. The target host variable for minimizing the generic function.
作为一个示例,所述增广拉格朗日函数还包括辅助变量和拉格朗日乘子,所述辅助变量 为与所述中间分割图像的主变量的梯度有关的变量,所述拉格朗日乘子用于将对所述目标能量泛函数的最小化问题转换为对表示所述中间分割图像的主变量和所述辅助变量进行联合优化的鞍点问题;As an example, the augmented Lagrangian function also includes an auxiliary variable and a Lagrange multiplier. The auxiliary variable is a variable related to the gradient of the main variable of the intermediate segmentation image. The Lagrangian The daily multiplier is used to convert the minimization problem of the target energy functional into a saddle point problem for joint optimization of the main variable representing the intermediate segmentation image and the auxiliary variable;
所述第一分割模块,还用于根据所述增广拉格朗日函数构建最小化方程,所述最小化方程为对表示所述中间分割图像的主变量和所述辅助变量进行联合优化的方程;The first segmentation module is also used to construct a minimization equation based on the augmented Lagrangian function. The minimization equation is a joint optimization of the main variable representing the intermediate segmentation image and the auxiliary variable. equation;
根据最小化方程,采用所述交替方向乘子法构建迭代方程,所述迭代方程包括第一方程、第二方程和第三方程,所述第一方程用于根据第k-1次优化后的辅助变量和第k-1次优化后的拉格朗日乘子确定第k次优化后的主变量,所述第二方程用于根据第k次优化后的主变量和第k-1次优化后的拉格朗日乘子确定第k次优化后的辅助变量,所述第三方程用于根据第k次优化后的主变量和第k次优化后的辅助变量确定第k次优化后的拉格朗日乘子,k为正整数;According to the minimization equation, the alternating direction multiplier method is used to construct an iterative equation. The iterative equation includes a first equation, a second equation and a third equation. The first equation is used according to the k-1th optimization. The auxiliary variables and the Lagrange multiplier after the k-1th optimization determine the main variable after the k-th optimization, and the second equation is used to determine the main variable after the k-th optimization and the k-1th optimization. The final Lagrange multiplier determines the auxiliary variable after the kth optimization, and the third equation is used to determine the kth optimization based on the main variable after the kth optimization and the auxiliary variable after the kth optimization. Lagrange multiplier, k is a positive integer;
将通过所述第一方程确定的满足预设条件的主变量,确定为所述迭代优化后的主变量。The main variables that satisfy the preset conditions determined through the first equation are determined as the main variables after the iterative optimization.
作为一个示例,所述最小化方程通过如下公式表示:As an example, the minimization equation is expressed by the following formula:
Figure PCTCN2022138172-appb-000019
Figure PCTCN2022138172-appb-000019
其中,x为所述中间分割图像中像素的像素坐标,u(x)为所述中间分割图像中x指示的像素的像素值,u(x)为表示所述中间分割图像的主变量,p为所述辅助变量,q为所述拉格朗日乘子,Γ(u,p,q)为所述增广拉格朗日函数。Where, x is the pixel coordinate of the 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 Lagrangian function.
作为一个示例,所述迭代方程通过如下公式表示:As an example, the iteration equation is expressed by the following formula:
Figure PCTCN2022138172-appb-000020
Figure PCTCN2022138172-appb-000020
其中,k为正整数,
Figure PCTCN2022138172-appb-000021
为所述第一方程,u(x) k为对所述初始分割图像的分割误差进行第k次优化后得到的图像中x指示的像素的像素值,u(x) k为所述第k次优化后的主变量,p k-1为所述第k-1次优化后的辅助变量,q k-1为所述第k-1次优化后的拉格朗日乘子,
Figure PCTCN2022138172-appb-000022
为所述第二方程,p k为所述第k次优化后的辅助变量,
Figure PCTCN2022138172-appb-000023
为所述第三方程,q k为所述第k次优化后的拉格朗日 乘子。
Among them, k is a positive integer,
Figure PCTCN2022138172-appb-000021
is the first equation, u(x) k is the pixel value of the pixel indicated by x in the image obtained after the kth optimization of the segmentation error of the initial segmented image, u(x) k is the kth The main variable after the optimization, p k-1 is the auxiliary variable after the k-1 optimization, q k-1 is the Lagrange multiplier after the k-1 optimization,
Figure PCTCN2022138172-appb-000022
is the second equation, p k is the auxiliary variable after the kth optimization,
Figure PCTCN2022138172-appb-000023
is the third equation, q k is the Lagrange multiplier after the kth optimization.
作为一个示例,所述图像分割调整装置还包括第二分割模块,所述第二分割模块用于将所述原始图像作为初始分割模型的输入,通过所述初始分割模型确定所述初始分割图像,所述初始分割模型用于对所述原始图像中的所述目标物体进行粗分割,得到粗分割的图像。As an example, the image segmentation adjustment device further includes a second segmentation module, the second segmentation module is used to use the original image as an input of an initial segmentation model, and determine the initial segmentation image through the initial segmentation model, The initial segmentation model is used to roughly segment the target object in the original image to obtain a roughly segmented image.
作为一个示例,所述目标能量泛函数通过如下公式表示:As an example, the target energy functional function is expressed by the following formula:
Figure PCTCN2022138172-appb-000024
Figure PCTCN2022138172-appb-000024
其中,E(u(x))为所述目标能量泛函数,x为所述中间分割图像中像素的像素坐标,u(x)为所述中间分割图像中x指示的像素的像素值,且u(x)∈[0,1],u(x)=1表示x指示的像素位于所述中间分割图像中所述目标物体所在的区域,u(x)=0表示x指示的像素位于所述中间分割图像中除所述目标物体所在的区域之外的其它区域,F(u(x))为所述保真项,L(u(x))为所述长度项,P(u(x))为所述光滑项,λ为所述常数权重系数,I为所述原始图像,
Figure PCTCN2022138172-appb-000025
为所述第一自适应权重系数,β(I)为所述第二自适应权重系数,Ω为所述中间分割图像的图像区域,c 1为所述原始图像中位于初始分割曲线内部区域的至少一个像素的像素值的第一平均值,c 2为所述原始图像中位于所述初始分割曲线外部区域的至少一个像素的像素值的第二平均值,所述初始分割曲线为用于在所述初始分割图像中分割所述目标物体的轮廓线且所述初始分割曲线为封闭曲线,τ为尺度参数,G τ为高斯函数,
Figure PCTCN2022138172-appb-000026
为梯度运算符。
Wherein, E(u(x)) is the target energy functional function, x is the pixel coordinate of the 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 means that the pixel indicated by x is located in the area where the target object is located in the intermediate segmented image, u(x)=0 means that the pixel indicated by x is located at For other areas in the intermediate segmented image except the area where the target object is located, F(u(x)) is the fidelity term, L(u(x)) is the length term, and P(u( x)) is the smooth term, λ is the constant weight coefficient, I is the original image,
Figure PCTCN2022138172-appb-000025
is the first adaptive weight coefficient, β(I) is the second adaptive weight coefficient, Ω is the image area of the intermediate segmentation image, and c 1 is the area inside the initial segmentation curve in the original image. The first average value of the pixel value of at least one pixel, c 2 is the second average value of the pixel value of at least one pixel in the original image located outside the initial segmentation curve, and the initial segmentation curve is used in The contour line of the target object is segmented in the initial segmentation image and the initial segmentation curve is a closed curve, τ is a scale parameter, G τ is a Gaussian function,
Figure PCTCN2022138172-appb-000026
is the gradient operator.
第三方面,提供了一种计算机设备,所述计算机设备包括存储器、处理器以及存储在所述存储器中并可在所述处理器上运行的计算机程序,所述计算机程序被所述处理器执行时实现上述的图像分割方法。In a third aspect, a computer device is provided. The computer device includes a memory, a processor, and a computer program stored in the memory and executable on the processor. The computer program is executed by the processor. When implementing the above image segmentation method.
第四方面,提供了一种计算机可读存储介质,所述计算机可读存储介质存储有计算机程序,所述计算机程序被处理器执行时实现上述的图像分割方法。In a fourth aspect, a computer-readable storage medium is provided. The computer-readable storage medium stores a computer program. When the computer program is executed by a processor, the above-mentioned image segmentation method is implemented.
本申请实施例提供的技术方案带来的有益效果是:The beneficial effects brought by the technical solutions provided by the embodiments of this application are:
本申请实施例中,先获取初始分割图像以及包括目标物体的待分割的原始图像,再将初始分割图像和原始图像输入到活动轮廓模型中进行图像分割,得到原始图像的目标分割图像。 其中,初始分割图像为对原始图像中的目标物体进行粗分割后的图像,活动轮廓模型采用目标能量泛函数,目标能量泛函数用于指示图像分割过程中的中间分割图像的分割误差,目标能量泛函数包括携带常数权重系数的保真项、携带第一自适应权重系数的长度项和携带第二自适应权重系数的光滑项,且第一自适应权重系数和第二自适应权重系数是通过原始图像确定的,也即是,长度项和光滑项的权重系数不是常数,而是与待分割的原始图像相关的自适应权重系数。如此,在通过活动轮廓模型对待分割图像进行图像分割时,活动轮廓模型中的目标能量泛函数的长度项和光滑项的权重系数可以根据不同的待分割图像进行相应的调整,从而提高了活动轮廓模型的鲁棒性和图像分割精度。In the embodiment of the present application, the initial segmented image and the original image to be segmented including the target object are first obtained, and then 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. Among them, the initial segmented image is an image after rough segmentation of the target object in the original image. The active contour model uses a target energy functional function. The target energy functional function is used to indicate the segmentation error of the intermediate segmented image during the image segmentation process. The target energy The generic function includes a fidelity term carrying a constant weight coefficient, a length term carrying a first adaptive weight coefficient and a smooth term carrying a second adaptive weight coefficient, and the first adaptive weight coefficient and the second adaptive weight coefficient are determined by What is determined by the original image, that is, the weight coefficients of the length term and the smoothness term are not constants, but adaptive weight coefficients related to the original image to be segmented. In this way, when performing image segmentation on the image to be segmented through the active contour model, the weight coefficients of the length term and smoothness term of the target energy functional function in the active contour model can be adjusted accordingly according to different images to be segmented, thereby improving the performance of the active contour. Model robustness and image segmentation accuracy.
附图说明Description of drawings
为了更清楚地说明本申请实施例中的技术方案,下面将对实施例描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the description of the embodiments will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the present application. For those of ordinary skill in the art, other drawings can also be obtained based on these drawings without exerting creative efforts.
图1是本申请实施例提供的一种图像分割方法的流程图;Figure 1 is a flow chart of an image segmentation method provided by an embodiment of the present application;
图2是本申请实施例提供的另一种图像分割方法的流程图;Figure 2 is a flow chart of another image segmentation method provided by an embodiment of the present application;
图3是本申请实施例提供的一种图像分割方法的框架示意图;Figure 3 is a schematic framework diagram of an image segmentation method provided by an embodiment of the present application;
图4是本申请实施例提供的一种图像分割装置的结构示意图;Figure 4 is a schematic structural diagram of an image segmentation device provided by an embodiment of the present application;
图5为本申请实施例提供的一种计算机设备的结构示意图。FIG. 5 is a schematic structural diagram of a computer device provided by an embodiment of the present application.
具体实施方式Detailed ways
为使本申请的目的、技术方案和优点更加清楚,下面将结合附图对本申请实施方式作进一步地详细描述。In order to make the purpose, technical solutions and advantages of the present application clearer, the embodiments of the present application will be further described in detail below with reference to the accompanying drawings.
应当理解的是,本申请提及的“多个”是指两个或两个以上。在本申请的描述中,除非另有说明,“/”表示或的意思,比如,A/B可以表示A或B;本文中的“和/或”仅仅是一种描述关联对象的关联关系,表示可以存在三种关系,比如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B这三种情况。另外,为了便于清楚描述本申请的技术方案,采用了“第一”、“第二”等字样对功能和作用基本相同的相同项或相似项进行区分。本领域技术人员可以理解“第一”、“第二”等字样并不对数量和执行次序进行限定,并且“第一”、“第二”等字样也并不限定一定不同。It should be understood that "plurality" mentioned in this application means two or more. In the description of this application, unless otherwise stated, "/" means or, for example, A/B can mean A or B; "and/or" in this article is just an association relationship describing related objects, It means that there can be three relationships, for example, A and/or B, which can mean: A exists alone, A and B exist simultaneously, and B exists alone. In addition, in order to facilitate a clear description of the technical solution of the present application, words such as “first” and “second” are used to distinguish identical or similar items with basically the same functions and effects. Those skilled in the art can understand that words such as "first" and "second" do not limit the number and execution order, and words such as "first" and "second" do not limit the number and execution order.
在对本申请实施例进行详细地解释说明之前,先对本申请实施例的应用场景予以说明。Before explaining the embodiments of the present application in detail, the application scenarios of the embodiments of the present application will be described first.
本申请实施例提供的图像分割方法可以应用于医学图像处理、遥感图像处理等场景,可以将一幅图像划分成背景区域和目标区域,目标区域为待分割目标所在的区域。比如,在医学图像处理的场景中,该图像分割方法可以从医学图像中分割出病变区域,以辅助确定病人的身体状况。The image segmentation method provided by the embodiment of the present application can be applied to scenarios such as medical image processing and remote sensing image processing. An image can be divided into a background area and a target area. The target area is the area where the target to be segmented is located. For example, in the scenario of medical image processing, this image segmentation method can segment the diseased area from the medical image to assist in determining the patient's physical condition.
作为一个示例,肺癌是一种对人类健康构成巨大挑战的恶性肿瘤,各国肺癌的发病率和死亡率都在迅速上升。为了评估肺癌,可以通过图像分割方法对医学图像中的肺结节(目标物体)进行图像分割,以替代或辅助医生作出诊断,提高医生的工作效率,快速确定病人的身体状况。As an example, lung cancer is a malignant tumor that poses a huge challenge to human health, and the incidence and mortality of lung cancer are increasing rapidly in various countries. In order to evaluate lung cancer, image segmentation methods can be used to segment pulmonary nodules (target objects) in medical images to replace or assist doctors in making diagnoses, improve doctors' work efficiency, and quickly determine the patient's physical condition.
本申请实施例提出一种图像分割方法,可以通过活动轮廓模型对原始图像中的目标物体进行图像分割,其中,该活动轮廓模型采用的目标能量泛函数包括携带常数权重系数的保真项、携带第一自适应权重系数的长度项和携带第二自适应权重系数的光滑项,且第一自适应权重系数和第二自适应权重系数通过原始图像确定,如此可以提高活动轮廓模型的鲁棒性和图像分割精度。The embodiment of the present application proposes an image segmentation method that can perform image segmentation on the target object in the original image through an active contour model. The target energy functional function used by the active contour model includes a fidelity term carrying a constant weight coefficient, The length term of the first adaptive weight coefficient and the smooth term carrying the second adaptive weight coefficient, and the first adaptive weight coefficient and the second adaptive weight coefficient are determined through the original image, which can improve the robustness of the active contour model and image segmentation accuracy.
请参考图1,图1是本申请实施例提供的一种图像分割方法的流程图。该方法可以应用于计算机设备中,计算机设备可以为终端、服务器或嵌入式设备等,终端可以为台式机或平板电脑等。该方法包括如下步骤:Please refer to Figure 1, which is a flow chart of an image segmentation method provided by an embodiment of the present application. This method can be applied to computer equipment. The computer equipment can be a terminal, a server or an embedded device, etc. The terminal can be a desktop computer or a tablet computer, etc. The method includes the following steps:
步骤101,计算机设备获取待分割的原始图像。Step 101: The computer device obtains the original image to be segmented.
其中,原始图像包括目标物体,目标物体为原始图像中的待分割物体。Among them, the original image includes the target object, and the target object is the object to be segmented in the original image.
比如,原始图像可以为医学图像处理场景中的医学图像,如CT(Computed Tomography,计算机断层扫描)图像、超声图像或MR(Magnetic Resonance,核磁共振)图像等,目标物体可以为结节、瘤等,对原始图像进行分割即为在原始图像中的分割出结节、瘤等病变区域(目标区域)。For example, the original image can be a medical image in a medical image processing scenario, such as CT (Computed Tomography) image, ultrasound image or MR (Magnetic Resonance) image, etc., and the target object can be a nodule, tumor, etc. , segmenting the original image is to segment the lesion areas (target areas) such as nodules and tumors in the original image.
步骤102,计算机设备获取初始分割图像。Step 102: The computer device obtains an initial segmentation image.
其中,初始分割图像为对原始图像中的目标物体进行粗分割后的图像。而且,初始分割图像为二值图像,即初始分割图像中的像素的像素值可以为0或1,初始分割图像携带初始分割曲线的信息,初始分割曲线可以通过初始分割图像的像素的二值性确定,初始分割曲线为用于在初始分割图像中分割目标物体的轮廓线(初始轮廓线)且初始分割曲线为封闭曲线。The initial segmented image is an image obtained by roughly 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 the information of the initial segmentation curve. The initial segmentation curve can be passed through the binary nature of the pixels of the initial segmentation image. It is determined that 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.
比如,初始分割图像可以为人为在原始图像中手动设置初始轮廓线后得到的分割图像, 或者也可以为通过初始分割模型得到的分割图像。比如,在原始图像中手动设置初始轮廓线后,将原始图像中位于初始轮廓线内部区域的像素的像素值设置为1,位于初始轮廓线外部区域的像素的像素值设置为0,从而得到初始分割图像。或者,比如,计算机设备获取初始分割图像之前,将原始图像作为初始分割模型的输入,通过初始分割模型确定初始分割图像,初始分割模型用于对原始图像中的目标物体进行粗分割,得到粗分割的图像,得到的粗分割图像即为初始分割图像。For example, the initial segmented image can be a segmented image obtained by manually setting initial contours in the original image, or it can also be a segmented image obtained through an initial segmentation model. For example, after manually setting the initial contour line in the original image, set the pixel value of the pixels located in the area inside the initial contour line in the original image to 1, and set the pixel value of the pixels located in the area outside the initial contour line to 0, thus obtaining the initial contour line. Split the image. Or, for example, before the computer device obtains the initial segmentation image, the original image is used as the input of the initial segmentation model, and the initial segmentation image is determined through the initial segmentation model. The initial segmentation model is used to roughly segment the target object in the original image to obtain the rough segmentation. image, and the obtained rough segmentation image is the initial segmentation image.
作为一个示例,初始分割模型可以为采用深度学习方法进行粗分割的模型,比如初始分割模型可以采用U-Net网络、Segnet网络或DeepLab网络等,本申请实施例对此不做限定。另外,在使用初始分割模型之前,需先对初始分割模型进行训练。由于本申请实施例中,初始分割模型得到的初始分割图像用于作为活动轮廓模型的输入,因此初始分割模型只需对原始图像进行粗略的分割,即对初始分割模型的精度要求较低,如此可以采用样本数量较少的图像对初始分割模型进行训练。也即是,本申请实施例中,可以先采用样本数量较少的训练图像对待训练初始分割模型进行训练,得到初始分割模型,然后获取原始图像,将原始图像作为初始分割模型的输入,通过初始分割模型得到初始分割图像,之后将原始图像和初始分割图像作为活动轮廓模型的输入,通过活动轮廓模型对原始图像中的目标物体进行图像分割,得到目标分割图像,如此不需要手动设置初始分割曲线,可以降低人工成本,且可以通过小样本数据实现较高的分割精度。As an example, the initial segmentation model can be a model that uses a deep learning method to perform rough segmentation. For example, the initial segmentation model can use a U-Net network, a Segnet network, or a DeepLab network, etc. This is not limited in the embodiments of the present application. In addition, before using the initial segmentation model, the initial segmentation model needs to be trained. Since in the embodiment of the present application, the initial segmentation image obtained by the initial segmentation model is used as the input of the active contour model, the initial segmentation model only needs to roughly segment the original image, that is, the accuracy requirement for the initial segmentation model is low, so The initial segmentation model can be trained using images with a smaller number of samples. That is to say, in the embodiment of the present application, a training image with a small number of samples can be used to train the initial segmentation model to be trained to obtain the initial segmentation model, and then the original image is obtained, and the original image is used as the input of the initial segmentation model. The segmentation model obtains the initial segmentation image, and then uses the original image and the initial segmentation image as the input of the active contour model. The target object in the original image is image segmented through the active contour model to obtain the target segmentation image. In this way, there is no need to manually set the initial segmentation curve. , which can reduce labor costs and achieve higher segmentation accuracy through small sample data.
步骤103,计算机设备将初始分割图像和原始图像输入到活动轮廓模型中进行图像分割,得到原始图像的目标分割图像。Step 103: The computer device inputs the initial segmented image and the original image into the active contour model to perform image segmentation, and obtains a target segmented image of the original image.
其中,活动轮廓模型采用目标能量泛函数,目标能量泛函数用于指示图像分割过程中产生的中间分割图像的分割误差,目标能量泛函数包括携带常数权重系数的保真项、携带第一自适应权重系数的长度项和携带第二自适应权重系数的光滑项,第一自适应权重系数和第二自适应权重系数通过原始图像确定。Among them, the active contour model uses a target energy functional function. The target energy functional function is used to indicate the segmentation error of the intermediate segmented image generated during the image segmentation process. The target energy functional function includes a fidelity term carrying a constant weight coefficient, a first adaptive term carrying The length term of the weight coefficient and the smooth term carrying the second adaptive weight coefficient, the first adaptive weight coefficient and the second adaptive weight coefficient are determined through the original image.
也即是,活动轮廓模型采用的目标能量泛函数的长度项和光滑项的权重系数不是常数,而是与原始图像相关的自适应权重系数。如此,目标能量泛函数的长度项和光滑项的权重系数可以根据不同的待分割图像进行相应的调整,从而通过活动轮廓模型对原始图像中的目标物体进行图像分割时,活动轮廓模型的鲁棒性和分割精度较高。That is to say, the weight coefficients of the length term and smoothness term of the target energy functional function used by the active contour model are not constants, but adaptive weight coefficients related to the original image. In this way, the weight coefficients of the length term and smoothness term of the target energy functional function can be adjusted accordingly according to different images to be segmented, so that when the target object in the original image is segmented through the active contour model, the robustness of the active contour model can be improved accuracy and segmentation accuracy.
其中,目标能量泛函数包括的保真项指示中间分割图像中的分割曲线与目标轮廓线的相对误差,目标轮廓线为真实的标准分割图像中的分割曲线,长度项指示中间分割图像中的分割曲线的长度,光滑项指示中间分割图像中的分割曲线的光滑程度。Among them, the fidelity term included in the target energy functional function indicates the relative error between the segmentation curve in the intermediate segmentation image and the target contour line. The target contour line is the segmentation curve in the real standard segmentation image, and the length item indicates the segmentation in the intermediate segmentation image. The length of the curve, and the smoothness term indicate the smoothness of the segmentation curve in the intermediate segmentation image.
作为一个示例,第一自适应权重系数和第二自适应权重系数可以根据原始图像的梯度确定。由于第一自适应权重系数和第二自适应权重系数与原始图像的梯度有关,因此通过第一自适应权重系数和第二自适应权重系数可以较为充分的获取不同原始图像的边缘信息,如此活动轮廓模型的鲁棒性和分割精度较高。As an example, the first adaptive weight coefficient and the second adaptive weight coefficient may be determined according to the gradient of the original image. Since the first adaptive weight coefficient and the second adaptive weight coefficient are related to the gradient of the original image, the edge information of different original images can be more fully obtained through the first adaptive weight coefficient and the second adaptive weight coefficient. In this way, The contour model has higher robustness and segmentation accuracy.
比如,第一自适应权重系数可以通过如下公式(1)表示,第二自适应权重系数通过如下公式(2)表示:For example, the first adaptive weight coefficient can be expressed by the following formula (1), and the second adaptive weight coefficient can be expressed by the following formula (2):
Figure PCTCN2022138172-appb-000027
Figure PCTCN2022138172-appb-000027
Figure PCTCN2022138172-appb-000028
Figure PCTCN2022138172-appb-000028
其中,
Figure PCTCN2022138172-appb-000029
为第一自适应权重系数,y为原始图像中像素的像素坐标,I(y)为原始图像中y指示的像素的像素值,β(I)为第二自适应权重系数,
Figure PCTCN2022138172-appb-000030
为梯度运算符。
in,
Figure PCTCN2022138172-appb-000029
is the first adaptive weight coefficient, y is the pixel coordinate of the pixel in the original image, I(y) is the pixel value of the pixel indicated by y in the original image, β(I) is the second adaptive weight coefficient,
Figure PCTCN2022138172-appb-000030
is the gradient operator.
比如,y表示的像素的像素坐标是多维的,比如包含横坐标和纵坐标。For example, the pixel coordinates of the pixel represented by y are multi-dimensional, such as including abscissa and ordinate.
其中,中间分割图像为对原始图像进行图像分割过程中产生的分割图像。而且,中间分割图像为二值图像,中间分割图像携带中间分割曲线的信息,中间分割图像中的中间分割曲线为用于在中间分割图像中分割目标物体的轮廓线且中间分割图像中的分割曲线为封闭曲线。Among them, the intermediate segmented image is a segmented image generated during the image segmentation process of the original image. Moreover, the intermediate segmentation image is a binary image, and the intermediate segmentation image carries information of the intermediate segmentation curve. The intermediate segmentation curve in the intermediate segmentation image is a contour line used to segment the target object in the intermediate segmentation image and the segmentation curve in the intermediate segmentation image is a closed curve.
比如,中间分割图像为通过对初始分割图像的分割误差进行优化得到的优化后的初始分割图像,优化后的初始分割图像可以包括目标分割图像,即某个中间分割图像可以为目标分割图像。For example, the intermediate segmented image is an optimized initial segmented image obtained by optimizing the segmentation error of the initial segmented image. The optimized initial segmented image may include the target segmented image, that is, an intermediate segmented image may be the target segmented image.
比如,保真项包括表示中间分割图像的主变量,保真项可以通过如下公式(3)表示:For example, the fidelity term includes the main variable representing the intermediate segmentation image, and the fidelity term can be expressed by the following formula (3):
F(u(x))=∫ Ω((I-c 1) 2u(x)+(I-c 1) 2(1-u(x)))dx  (3) F(u(x))=∫ Ω ((Ic 1 ) 2 u(x)+(Ic 1 ) 2 (1-u(x)))dx (3)
其中,F(u(x))为保真项,x为中间分割图像中像素的像素坐标,u(x)为中间分割图像中x指示的像素的像素值,且u(x)∈[0,1],u(x)=1表示x指示的像素位于中间分割图像中目标物体所在的区域,u(x)=0表示x指示的像素位于中间分割图像中除目标物体所在的区域之外的其它区域,I为原始图像,Ω为中间分割图像的图像区域,c 1为常数,c 1为原始图像中位于初始分割曲线内部区域的至少一个像素的像素值的第一平均值,c 2为常数,c 2为原始图像中位于初始分割曲线外部区域的至少一个像素的像素值的第二平均值。中间分割图像中的所有像素坐标对应指示的所有像素的像素值可以表示中间分割图像,即u(x)可以表示中间 分割图像,u(x)为表示中间分割图像的主变量。 Among them, F(u(x)) is the fidelity term, x is the pixel coordinate of the 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 area where the target object is located in the intermediate segmentation image, u(x)=0 indicates that the pixel indicated by Other areas of , I is the original image, Ω is the image area of the intermediate segmentation image, c 1 is a constant, c 1 is the first average value of the pixel value of at least one pixel located in the internal area of the initial segmentation curve in the original image, c 2 is a constant, and c 2 is the second average value of the pixel values of at least one pixel located outside the initial segmentation curve in the original image. The pixel values of all pixels corresponding to all pixel coordinates in the intermediate segmentation image can represent the intermediate segmentation image, that is, u(x) can represent the intermediate segmentation image, and u(x) is the main variable representing the intermediate segmentation image.
比如,x表示的像素的像素坐标是多维的,比如包含横坐标和纵坐标。For example, the pixel coordinates of the pixel represented by x are multi-dimensional, such as including abscissa and ordinate.
作为一个示例,根据原始图像和初始分割图像,可以通过如下公式(4)确定第一平均值c 1,通过如下公式(5)确定第二平均值c 2As an example, according to the original image and the initial segmented image, the first average value c 1 can be determined by the following formula (4), and the second average value c 2 can be determined by the following formula (5):
Figure PCTCN2022138172-appb-000031
Figure PCTCN2022138172-appb-000031
Figure PCTCN2022138172-appb-000032
Figure PCTCN2022138172-appb-000032
其中,z为初始分割图像中像素的像素坐标,r(z)为初始分割图像中z指示的像素的像素值,I为原始图像,Ω为中间分割图像的图像区域。Among them, z is the pixel coordinate of the 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 area of the intermediate segmented image.
比如,z表示的像素的像素坐标是多维的,比如包含横坐标和纵坐标。For example, the pixel coordinates of the pixel represented by z are multi-dimensional, such as including abscissa and ordinate.
需要说明是,本申请实施例中,原始图像、初始分割图像和中间分割图像中的图像区域相同,即图像中的像素的个数相同,但是图像中相同像素坐标指示的像素的像素值可能相同或不同。It should be noted that in the embodiment of the present application, the image areas 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 pixels indicated by the same pixel coordinates in the image may be the same. Or different.
作为一个示例,第一平均值和第二平均值也可以为与表示中间分割图像的主变量有关的变量,比如,第一平均值为原始图像中位于中间分割曲线内部区域的至少一个像素的像素值的平均值,第二平均值为原始图像中位于中间分割曲线外部区域的至少一个像素的像素值的平均值,中间分割曲线为用于在中间分割图像中分割目标物体的轮廓线且中间分割曲线为封闭曲线。这种情况下,确定第一平均值和确定第二平均值的公式可以参见下述实施例2的公式(23)和公式(24),这里先不做赘述。As an example, the first average value and the second average value may also be variables related to the main variable representing the intermediate segmentation image. For example, the first average value is a pixel of at least one pixel located in the internal area of the intermediate segmentation curve in the original image. The average value of the value, the second average value is the average value of the pixel value of at least one pixel in the area outside the middle segmentation curve in the original image, the middle segmentation curve is the contour line used to segment the target object in the middle segmentation image and the middle segmentation The curve is a closed curve. In this case, the formulas for determining the first average value and the second average value can be referred to formula (23) and formula (24) in Embodiment 2 below, which will not be described in detail here.
比如,长度项包括表示中间分割图像的主变量,长度项可以通过中间分割图像的主变量的积分表示,例如,长度项通过如下公式(6)表示:For example, the length term includes the main variable representing the intermediate segmentation image, and the length term can be expressed by the integral of the main variable of the intermediate segmentation image. For example, the length term is expressed by the following formula (6):
Figure PCTCN2022138172-appb-000033
Figure PCTCN2022138172-appb-000033
其中,L(u(x))为长度项,x为中间分割图像中像素的像素坐标,u(x)为中间分割图像中x指示的像素的像素值,Ω为中间分割图像的图像区域,G τ为高斯函数,τ为尺度参数。 Among them, L(u(x)) is the length term, x is the pixel coordinate of the 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 area of the intermediate segmented image, G τ is a Gaussian function, and τ is a scale parameter.
作为一个示例,G τ可以通过如下公式(7)表示: As an example, G τ can be expressed by the following formula (7):
Figure PCTCN2022138172-appb-000034
Figure PCTCN2022138172-appb-000034
比如,光滑项包括表示中间分割图像的主变量,光滑项可以通过中间分割图像的主变量 的二阶梯度的积分表示,例如,光滑项通过如下公式(8)表示:For example, the smooth term includes the main variable representing the intermediate segmentation image. The smooth term can be expressed by the integral of the second-order gradient of the main variable of the intermediate segmentation image. For example, the smooth term is expressed by the following formula (8):
Figure PCTCN2022138172-appb-000035
Figure PCTCN2022138172-appb-000035
其中,P(u(x))为光滑项,x为中间分割图像中像素的像素坐标,u(x)为中间分割图像中x指示的像素的像素值,Ω为中间分割图像的图像区域,
Figure PCTCN2022138172-appb-000036
为梯度运算符。
Among them, P(u(x)) is the smooth term, x is the pixel coordinate of the pixel in the intermediate segmentation image, u(x) is the pixel value of the pixel indicated by x in the intermediate segmentation image, Ω is the image area of the intermediate segmentation image,
Figure PCTCN2022138172-appb-000036
is the gradient operator.
作为一个示例,目标能量泛函数采用的目标能量泛函数通过如下公式(9)表示:As an example, the target energy functional used by the target energy functional is expressed by the following formula (9):
Figure PCTCN2022138172-appb-000037
Figure PCTCN2022138172-appb-000037
其中,E(u(x))为目标能量泛函数,x为中间分割图像中像素的像素坐标,u(x)为中间分割图像中x指示的像素的像素值,且u(x)∈[0,1],u(x)=1表示x指示的像素位于中间分割图像中目标物体所在的区域,u(x)=0表示x指示的像素位于中间分割图像中除目标物体所在的区域之外的其它区域,u(x)表示中间分割图像,F(u(x))为保真项,L(u(x))为长度项,P(u(x))为光滑项,λ为常数权重系数,I为原始图像,
Figure PCTCN2022138172-appb-000038
为第一自适应权重系数,β(I)为第二自适应权重系数,Ω为中间分割图像的图像区域,c 1为原始图像中位于初始分割曲线内部区域的至少一个像素的像素值的第一平均值,c 2为原始图像中位于初始分割曲线外部区域的至少一个像素的像素值的第二平均值,τ为尺度参数,G τ为高斯函数,
Figure PCTCN2022138172-appb-000039
为梯度运算符。另外,由于u(x)可以表示中间分割图像,因此通过上述公式(9)可知,目标能量泛函数包括表示中间分割图像的主变量,主变量即为u(x)。
Among them, E(u(x)) is the target energy functional function, x is the pixel coordinate of the 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 means that the pixel indicated by x is located in the area where the target object is located in the intermediate segmentation image, u(x)=0 means that the pixel indicated by In other areas except Constant weight coefficient, I is the original image,
Figure PCTCN2022138172-appb-000038
is the first adaptive weight coefficient, β(I) is the second adaptive weight coefficient, Ω is the image area of the intermediate segmentation image, c 1 is the pixel value of at least one pixel located in the internal area of the initial segmentation curve in the original image. An average value, c 2 is the second average value of the pixel value of at least one pixel located in the outer area of the initial segmentation curve in the original image, τ is the scale parameter, G τ is the Gaussian function,
Figure PCTCN2022138172-appb-000039
is the gradient operator. In addition, since u(x) can represent the intermediate segmented image, it can be known from the above formula (9) that the target energy functional function includes a main variable representing the intermediate segmented image, and the main variable is u(x).
作为一个示例,目标能量泛函数包括表示中间分割图像的主变量,计算机设备可以将初始分割图像和原始图像输入到活动轮廓模型中,通过活动轮廓模型,采用最优化算法对目标能量泛函数进行最小化处理,得到满足目标能量泛函数最小化的目标主变量,目标主变量表示的中间分割图像为目标分割图像。也即是,通过活动轮廓模型,可以采用最优化算法求解目标能量泛函数最小化问题的最优解,最优解即为目标能量泛函数指示的分割误差最小时对应的目标主变量。As an example, the target energy functional includes a host variable representing an intermediate segmented image. The computer device may input the initial segmented image and the original image into an active contour model, and use an optimization algorithm to minimize the target energy functional through the active contour model. process to obtain the target main variable that satisfies the minimization of the target energy functional function, and the intermediate segmented image represented by the target main variable is the target segmented image. That is to say, through the active contour model, the optimization algorithm can be used to solve the optimal solution to the problem of minimizing the target energy functional function. The optimal solution is the target main variable corresponding to the minimum segmentation error indicated by the target energy functional function.
比如,第一平均值为原始图像中位于初始分割曲线内部区域的至少一个像素的像素值的平均值,第二平均值为原始图像中位于初始分割曲线外部区域的至少一个像素的像素值的平均值。计算机设备将初始分割图像和原始图像输入到活动轮廓模型,通过初始活动轮廓模型,先根据原始图像确定第一自适应权重系数和第二自适应权重系数,再根据原始图像和初始分 割图像,确定第一平均值和第二平均值,之后根据原始图像、初始分割图像、第一自适应权重系数、第二自适应权重系数、第一平均值和第二平均值,采用最优化算法对目标能量泛函数进行最小化处理,即求解目标能量泛函数的最小化问题,得到满足目标能量泛函数最小化的目标主变量。For example, the first average is the average of the pixel value of at least one pixel in the original image located in the internal area of the initial segmentation curve, and the second average is the average of the pixel value of at least one pixel in the original image located in the outer area of the initial segmentation curve. value. The computer device inputs the initial segmented image and the original image into the active contour model. Through the initial active contour model, first determines the first adaptive weight coefficient and the second adaptive weight coefficient based on the original image, and then determines based on the original image and the initial segmented image. The first average value and the second average value, and then based on the original image, the initial segmentation image, the first adaptive weight coefficient, the second adaptive weight coefficient, the first average value and the second average value, an optimization algorithm is used to calculate the target energy The functional function is minimized, that is, the minimization problem of the target energy functional function is solved, and the target main variable that satisfies the minimization of the target energy functional function is obtained.
比如,参见上述公式(9)的目标能量泛函数,该目标能量泛函数含有可分裂的多个变量,多个变量包括主变量u(x)和主变量的梯度
Figure PCTCN2022138172-appb-000040
且求解目标能量泛函数的最小化问题是非光滑优化问题,无法建立直接求解的数值方法,即求解目标能量泛函数的最小化问题较为复杂,如此可以采用交替方向乘子法,将对目标能量泛函数的最小化问题转换为关于主变量u(x)和主变量的梯度
Figure PCTCN2022138172-appb-000041
的多个易求解的子问题,即转换为对主变量u(x)和主变量的梯度
Figure PCTCN2022138172-appb-000042
进行联合优化的鞍点问题。比如,最优化算法为交替方向乘子法,计算机设备可以先根据目标能量泛函数,构建增广拉格朗日函数,然后采用交替方向乘子法对增广拉格朗日函数中的主变量进行迭代优化,得到迭代优化后的主变量,迭代优化后的主变量为满足目标能量泛函数最小化的目标主变量。其中,增广拉格朗日函数至少包括表示中间分割图像的主变量。
For example, see the target energy functional function of the above formula (9). The target energy functional function contains multiple variables that can be split. The multiple variables include the main variable u(x) and the gradient of the main variable.
Figure PCTCN2022138172-appb-000040
Moreover, the minimization problem of the target energy functional function is a non-smooth optimization problem, and a numerical method for direct solution cannot be established. That is, the minimization problem of the target energy functional function is more complicated. In this case, the alternating direction multiplier method can be used to solve the target energy general function. The minimization problem of the function is transformed into the gradient of the main variable u(x) and the main variable
Figure PCTCN2022138172-appb-000041
Multiple easy-to-solve sub-problems of
Figure PCTCN2022138172-appb-000042
Saddle point problems for joint optimization. For example, the optimization algorithm is the alternating direction multiplier method. The computer equipment can first construct an augmented Lagrangian function based on the target energy functional, and then use the alternating direction multiplier method to calculate the main variables in the augmented Lagrangian function. Carry out iterative optimization to obtain the main variables after iterative optimization. The main variables after iterative optimization are the target main variables that satisfy the minimization of the target energy functional function. Among them, the augmented Lagrangian function at least includes the main variable representing the intermediate segmentation image.
比如,增广拉格朗日函数可以通过如下公式(10)表示:For example, the augmented Lagrangian function can be expressed by the following formula (10):
Figure PCTCN2022138172-appb-000043
Figure PCTCN2022138172-appb-000043
其中,Γ(u(x),p,q)为增广拉格朗日函数,x为中间分割图像中像素的像素坐标,u(x)为中间分割图像中x指示的像素的像素值,p为辅助变量,且
Figure PCTCN2022138172-appb-000044
q为拉格朗日乘子,E(u(x))为目标能量泛函数,Ω为中间分割图像的图像区域,θ为罚系数。
Among them, Γ(u(x),p,q) is the augmented Lagrangian function, x is the pixel coordinate of the 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, and
Figure PCTCN2022138172-appb-000044
q is the Lagrange multiplier, E(u(x)) is the target energy functional function, Ω is the image area of the intermediate segmented image, and θ is the penalty coefficient.
比如,增广拉格朗日函数还包括辅助变量p和拉格朗日乘子q,辅助变量p为采用交替方向乘子法时引入的可分裂辅助变量,辅助变量p为与中间分割图像的主变量的梯度有关的变量,拉格朗日乘子q为构建增广拉格朗日函数时引入的变量,通过拉格朗日乘子q可以将对目标能量泛函数的最小化问题转换为对表示中间分割图像的主变量和辅助变量进行联合优化的鞍点问题。For example, the augmented Lagrangian function also includes an auxiliary variable p and a Lagrange multiplier q. The auxiliary variable p is a splittable auxiliary variable introduced when the alternating direction multiplier method is used. The auxiliary variable p is the auxiliary variable with the intermediate segmentation image. Variables related to the gradient of the main variable, the Lagrange multiplier q is a variable introduced when constructing the augmented Lagrangian function. The minimization problem of the target energy functional function can be converted into A saddle point problem for joint optimization of primary and auxiliary variables representing intermediate segmented images.
示例地,计算机设备采用交替方向乘子法对增广拉格朗日函数中的主变量进行迭代优化,得到迭代优化后的主变量,可以通过如下步骤实现:For example, the computer device uses the alternating direction multiplier method to iteratively optimize the main variables in the augmented Lagrangian function, and obtain the iteratively optimized main variables, which can be achieved through the following steps:
步骤1)根据增广拉格朗日函数构建最小化方程。Step 1) Construct the minimization equation based on the augmented Lagrangian function.
其中,最小化方程为对表示中间分割图像的主变量和辅助变量进行联合优化的方程。Among them, the minimization equation is an equation that jointly optimizes the main variables and auxiliary variables representing the intermediate segmentation image.
比如,最小化方程可以通过如下公式(11)表示:For example, the minimization equation can be expressed by the following formula (11):
Figure PCTCN2022138172-appb-000045
Figure PCTCN2022138172-appb-000045
其中,x为中间分割图像中像素的像素坐标,u(x)为中间分割图像中x指示的像素的像素值,p为辅助变量,q为拉格朗日乘子,Γ(u,p,q)为增广拉格朗日函数。Among them, x is the pixel coordinate of the pixel in the intermediate segmentation image, u(x) is the pixel value of the pixel indicated by x in the intermediate segmentation image, p is the auxiliary variable, q is the Lagrange multiplier, Γ(u,p, q) is the augmented Lagrangian function.
步骤2)根据最小化方程,采用交替方向乘子法构建迭代方程,迭代方程包括第一方程、第二方程和第三方程。Step 2) According to the minimization equation, use the alternating direction multiplier method to construct an iterative equation. The iterative equation includes the first equation, the second equation and the third equation.
其中,第一方程用于根据第k-1次优化后的辅助变量和第k-1次优化后的拉格朗日乘子确定第k次优化后的主变量,第二方程用于根据第k次优化后的主变量和第k-1次优化后的拉格朗日乘子确定第k次优化后的辅助变量,第三方程用于根据第k次优化后的主变量和第k次优化后的辅助变量确定第k次优化后的拉格朗日乘子,k为正整数,k为迭代次数,k表示对初始分割图像的分割误差进行迭代优化的优化次数。Among them, the first equation is used to determine the main variable after the k-th optimization based on the auxiliary variables after the k-1th optimization and the Lagrange multiplier after the k-1th optimization. The second equation is used to determine the main variable after the k-th optimization. The main variable after k-th optimization and the Lagrange multiplier after k-1th optimization determine the auxiliary variables after k-th optimization. The third equation is used to determine the auxiliary variables after k-th optimization based on the main variable after k-th optimization and the k-th optimization. The optimized auxiliary variables determine the Lagrange multiplier after the kth optimization, k is a positive integer, k is the number of iterations, and k represents the number of optimization times for iterative optimization of the segmentation error of the initial segmented image.
比如,迭代方程中的第一方程可以通过如下公式(12)表示,第二方程可以通过如下公式(13)表示,第三方程可以通过如下公式(14)表示:For example, the first equation in the iterative equation can be expressed by the following formula (12), the second equation can be expressed by the following formula (13), and the third equation can be expressed by the following formula (14):
Figure PCTCN2022138172-appb-000046
Figure PCTCN2022138172-appb-000046
Figure PCTCN2022138172-appb-000047
Figure PCTCN2022138172-appb-000047
Figure PCTCN2022138172-appb-000048
Figure PCTCN2022138172-appb-000048
其中,k为正整数,u(x) k为对初始分割图像的分割误差进行第k次优化后得到的图像中x指示的像素的像素值,u(x) k为第k次优化后的主变量,p k-1为第k-1次优化后的辅助变量,q k-1为第k-1次优化后的拉格朗日乘子,p k为第k次优化后的辅助变量,q k为第k次优化后的拉格朗日乘子。 Among them, k is a positive integer, u(x) k is the pixel value of the pixel indicated by x in the image obtained after the k-th optimization of the segmentation error of the initial segmented image, u(x) k is the k-th optimization. Main variable, p k-1 is the auxiliary variable after the k-1th optimization, q k-1 is the Lagrange multiplier after the k-1th optimization, p k is the auxiliary variable after the k-th optimization , q k is the Lagrange multiplier after the kth optimization.
需要说明是,当k等于1,即计算机设备在对初始分割图像的分割误差进行第一次迭代优化时,可以得到第一次优化后的初始分割图像,且第k-1次优化后的主变量u(x) 0为初始主变量,第k-1次优化后的辅助变量p 0为初始辅助变量,第k-1次优化后的拉格朗日乘子q 0为初始拉格朗日乘子。其中,初始主变量可以通过初始分割图像确定,初始辅助变量和初始拉格朗日乘子可以预先设置,比如初始辅助变量和初始拉格朗日乘子可以均为零矩阵。 It should be noted that when k equals 1, that is, when the computer device performs the first iterative optimization of the segmentation error of the initial segmentation image, the initial segmentation image after the first optimization can be obtained, and the main segmentation image after the k-1th optimization can be obtained. The variable u(x) 0 is the initial main variable, the auxiliary variable p 0 after the k-1th optimization is the initial auxiliary variable, and the Lagrange multiplier q 0 after the k-1th optimization is the initial Lagrange Multiplier. Among them, the initial main variable can be determined through the initial segmentation image, and the initial auxiliary variable and the initial Lagrangian multiplier can be set in advance. For example, the initial auxiliary variable and the initial Lagrangian multiplier can both be zero matrices.
作为一个示例,在采用交替方向乘子法构建迭代方程之后,即可以分别求解第一方程、第二方程和第三方程的解,得到第k次优化后的主变量、第k次优化后的辅助变量和第k次优化后的拉格朗日乘子。As an example, after using the alternating direction multiplier method to construct the iterative equation, the solutions to the first equation, the second equation and the third equation can be solved respectively, and the main variables after the kth optimization and the kth optimization can be obtained. Auxiliary variables and Lagrange multipliers after kth optimization.
作为一个示例,结合公式(9)和公式(10),可以将求解第一方程公式(12)的子问题 表示为求解如下公式(15)的问题:As an example, combining formula (9) and formula (10), the sub-problem of solving the first equation formula (12) can be expressed as the problem of solving the following formula (15):
Figure PCTCN2022138172-appb-000049
Figure PCTCN2022138172-appb-000049
需要说明是,公式(15)的问题为非凸优化问题,可以采用线性化的方法将公式(15)近似为如下公式(16)和公式(17):It should be noted that the problem of formula (15) is a non-convex optimization problem. The linearization method can be used to approximate formula (15) into the following formula (16) and formula (17):
Figure PCTCN2022138172-appb-000050
Figure PCTCN2022138172-appb-000050
Figure PCTCN2022138172-appb-000051
Figure PCTCN2022138172-appb-000051
其中,u(x) k为第k次优化后的主变量,u(x)为中间分割图像中x指示的像素的像素值,Ω为中间分割图像的图像区域,λ为常数权重系数,I为原始图像,c 1为原始图像中位于初始分割曲线内部区域的至少一个像素的像素值的第一平均值,c 2为原始图像中位于初始分割曲线外部区域的至少一个像素的像素值的第二平均值,
Figure PCTCN2022138172-appb-000052
为第一自适应权重系数,τ为尺度参数,G τ为高斯函数,u(x) k-1为第k-1次优化后的主变量,θ为罚系数,div 2
Figure PCTCN2022138172-appb-000053
的共轭算子,
Figure PCTCN2022138172-appb-000054
为梯度运算符,p k-1为第k-1次优化后的辅助变量,q k-1为第k-1次优化后的拉格朗日乘子。
Among them, u(x) k is the main variable after the kth optimization, u(x) is the pixel value of the pixel indicated by x in the intermediate segmentation image, Ω is the image area of the intermediate segmentation image, λ is the constant weight coefficient, I is the original image, c 1 is the first average value of the pixel value of at least one pixel located in the internal area of the initial segmentation curve in the original image, and c 2 is the first average value of the pixel value of at least one pixel located in the external area of the initial segmentation curve in the original image. Two average values,
Figure PCTCN2022138172-appb-000052
is the first adaptive weight coefficient, τ is the scale parameter, G τ is the Gaussian function, u(x) k-1 is the main variable after the k-1th optimization, θ is the penalty coefficient, div 2 is
Figure PCTCN2022138172-appb-000053
The conjugate operator of
Figure PCTCN2022138172-appb-000054
is the gradient operator, p k-1 is the auxiliary variable after the k-1th optimization, and q k-1 is the Lagrange multiplier after the k-1th optimization.
由于u(x) k∈[0,1],即u(x) k具有二值性,因此满足公式(16)的解u(x) k可以通过如下公式(18)表示: Since u(x) k ∈[0,1], that is, u(x) k has binary nature, the solution u(x) k that satisfies formula (16) can be expressed by the following formula (18):
Figure PCTCN2022138172-appb-000055
Figure PCTCN2022138172-appb-000055
其中,第k次优化后的主变量u(x) k可以表示对初始分割图像的分割误差进行第k次优化得到的优化后的初始分割图像,
Figure PCTCN2022138172-appb-000056
通过上述公式(17)确定。其中,当k等于1,公式(17)中的u(x) k-1为初始主变量,p k-1为初始辅助变量,q k-1为初始拉格朗日乘子。
Among them, the main variable u(x) k after the kth optimization can represent the optimized initial segmented image obtained by performing the kth optimization on the segmentation error of the initial segmented image,
Figure PCTCN2022138172-appb-000056
Determined by the above formula (17). Among them, when k is equal to 1, u(x) k-1 in formula (17) is the initial main variable, p k-1 is the initial auxiliary variable, and q k-1 is the initial Lagrange multiplier.
根据上述公式(18)可以得出:计算机设备可以根据第k-1次优化后的主变量、第k-1次优化后的辅助变量、第k-1次优化后的拉格朗日乘子和第一自适应权重系数,确定第k次优化后的主变量,即第k次优化后的主变量与第k-1次优化后的主变量、第k-1次优化后的辅助变量、第k-1次优化后的拉格朗日乘子、第一自适应权重系数有关。According to the above formula (18), it can be concluded that the computer equipment can be based on the main variable after the k-1th optimization, the auxiliary variable after the k-1th optimization, and the Lagrange multiplier after the k-1th optimization. and the first adaptive weight coefficient to determine the main variable after the k-th optimization, that is, the main variable after the k-th optimization and the main variable after the k-1th optimization, the auxiliary variable after the k-1th optimization, It is related to the Lagrange multiplier and the first adaptive weight coefficient after the k-1th optimization.
通过公式(18),采用最优化算法对目标能量泛函数进行最小化处理后,即采用交替方向乘子法构建迭代方程,通过对迭代方程的第一方程进行迭代优化后,可以得到第k次优化后的主变量。According to formula (18), after using the optimization algorithm to minimize the target energy functional function, the alternating direction multiplier method is used to construct the iterative equation. After iterative optimization of the first equation of the iterative equation, the kth time Optimized main variables.
作为一个示例,结合公式(9)和公式(10),可以将求解第二方程公式(13)的子问题表示为求解如下公式(19)的问题:As an example, combining formula (9) and formula (10), the sub-problem of solving the second equation formula (13) can be expressed as the problem of solving the following formula (19):
Figure PCTCN2022138172-appb-000057
Figure PCTCN2022138172-appb-000057
其中,Ω为中间分割图像的图像区域,β(I)为第二自适应权重系数,p为辅助变量,θ为罚系数,
Figure PCTCN2022138172-appb-000058
为梯度运算符,u(x) k为第k次优化后的主变量,q k-1为第k-1次优化后的拉格朗日乘子。
Among them, Ω is the image area of the intermediate segmentation image, β(I) is the second adaptive weight coefficient, p is the auxiliary variable, θ is the penalty coefficient,
Figure PCTCN2022138172-appb-000058
is the gradient operator, u(x) k is the main variable after the k-th optimization, and q k-1 is the Lagrange multiplier after the k-1th optimization.
满足公式(19)的解p k可以通过如下公式(20)表示: The solution p k that satisfies formula (19) can be expressed by the following formula (20):
Figure PCTCN2022138172-appb-000059
Figure PCTCN2022138172-appb-000059
其中,p k为第k次优化后的辅助变量,shrinkage为压缩阈值算子,且
Figure PCTCN2022138172-appb-000060
Figure PCTCN2022138172-appb-000061
为逐点乘积,θ为罚系数,
Figure PCTCN2022138172-appb-000062
为梯度运算符,u(x) k为第k次优化后的主变量,q k-1为第k-1次优化后的拉格朗日乘子,β(I)为第二自适应权重系数。其中,当k等于1,公式(20)中的q k-1为初始拉格朗日乘子。
Among them, p k is the auxiliary variable after the kth optimization, shrinkage is the compression threshold operator, and
Figure PCTCN2022138172-appb-000060
Figure PCTCN2022138172-appb-000061
is the point-wise product, θ is the penalty coefficient,
Figure PCTCN2022138172-appb-000062
is the gradient operator, u(x) k is the main variable after the kth optimization, q k-1 is the Lagrange multiplier after the k-1th optimization, β(I) is the second adaptive weight coefficient. Among them, when k equals 1, q k-1 in formula (20) is the initial Lagrange multiplier.
根据上述公式(20)可以得出:计算机设备可以根据第k次优化后的主变量、第k-1次优化后的拉格朗日乘子和第二自适应权重系数,确定第k次优化后的辅助变量,即第k次优化后的辅助变量与第k次优化后的主变量、第k-1次优化后的拉格朗日乘子、第二自适应权重系数有关。According to the above formula (20), it can be concluded that the computer equipment can determine the k-th optimization based on the main variables after the k-th optimization, the Lagrange multiplier after the k-1th optimization and the second adaptive weight coefficient. The final auxiliary variable, 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-1th optimization, and the second adaptive weight coefficient.
通过公式(20),采用最优化算法对目标能量泛函数进行最小化处理后,即采用交替方向乘子法构建迭代方程,通过对迭代方程的第二方程进行迭代优化后,可以得到第k次优化后的辅助变量。Through formula (20), after using the optimization algorithm to minimize the target energy functional function, the alternating direction multiplier method is used to construct the iterative equation. After iterative optimization of the second equation of the iterative equation, the kth time Optimized auxiliary variables.
作为一个示例,通过梯度上升法求解第三方程公式(14)的解q k可以通过如下公式(21)表示: As an example, the solution q k of the third equation (14) solved by the gradient ascent method can be expressed by the following formula (21):
Figure PCTCN2022138172-appb-000063
Figure PCTCN2022138172-appb-000063
其中,q k为第k次优化后的拉格朗日乘子,q k-1为第k-1次优化后的拉格朗日乘子,θ为 罚系数,p k为第k次优化后的辅助变量,
Figure PCTCN2022138172-appb-000064
为梯度运算符,u(x) k为第k次优化后的主变量。其中,当k等于1,公式(21)中的q k-1为初始拉格朗日乘子。
Among them, q k is the Lagrange multiplier after the k-th optimization, q k-1 is the Lagrange multiplier after the k-1 optimization, θ is the penalty coefficient, and p k is the k-th optimization. The auxiliary variables after
Figure PCTCN2022138172-appb-000064
is the gradient operator, u(x) k is the main variable after the kth optimization. Among them, when k equals 1, q k-1 in formula (21) is the initial Lagrange multiplier.
根据上述公式(21)可以得出:计算机设备可以根据第k次优化后的主变量、第k次优化后的辅助变量和第k-1次优化后的拉格朗日乘子,确定第k次优化后的拉格朗日乘子。According to the above formula (21), it can be concluded that the computer equipment can determine the k-th value based on the main variable after the k-th optimization, the auxiliary variable after the k-th optimization, and the Lagrange multiplier after the k-1th optimization. Sub-optimized Lagrange multiplier.
通过公式(21),采用最优化算法对目标能量泛函数进行最小化处理后,即采用交替方向乘子法构建迭代方程,通过对迭代方程的第三方程进行迭代优化后,可以得到第k次优化后的拉格朗日乘子。Through formula (21), after using the optimization algorithm to minimize the target energy functional function, the alternating direction multiplier method is used to construct the iterative equation. After iterative optimization of the third equation of the iterative equation, the kth time Optimized Lagrange multiplier.
步骤3)将通过第一方程确定的满足预设条件的主变量,确定为迭代优化后的主变量。Step 3) Determine the main variables that meet the preset conditions determined through the first equation as the main variables after iterative optimization.
其中,预设条件为活动轮廓模型的截止条件,预设条件可以为循环停止条件和/或阈值停止条件。比如,满足循环停止条件是指迭代次数k大于最大迭代次数,满足阈值停止条件为是指迭代次数k对应的第k次优化后的主变量与第k-1次优化后的主变量的差值的1范数小于或等于第k次优化后的主变量的1范数与停止阈值的乘积,阈值停止条件可以通过如下公式(22)表示:The preset condition is a cutoff condition of the active contour model, and the preset condition may be a loop stop condition and/or a threshold stop condition. For example, meeting the loop stop condition means that the number of iterations k is greater than the maximum number of iterations, and meeting the threshold stop condition means that the difference between the main variable after the kth optimization and the main variable after the k-1th optimization corresponding to the iteration number k The 1 norm of is less than or equal to the product of the 1 norm of the main variable after the kth optimization and the stopping threshold. The threshold stopping condition can be expressed by the following formula (22):
||(u(x) k-u(x) k-1)|| 1≤ε ||u(x) k|| 1   (22) ||(u(x) k -u(x) k-1) || 1 ≤ε ||u(x) k || 1 (22)
其中,u(x) k为第k次优化后的主变量,u(x) k-1为第k-1次优化后的主变量,|| || 1为1范数,ε为停止阈值。 Among them, u(x) k is the main variable after the k-th optimization, u(x) k-1 is the main variable after the k-1 optimization, || || 1 is the 1 norm, and ε is the stopping threshold. .
比如,计算机设备分别求解第一方程、第二方程和第三方程的解,得到第k次优化后的主变量、第k次优化后的辅助变量和第k次优化后的拉格朗日乘子之后,确定迭代次数k是否满足预设条件,若迭代次数k大于最大迭代次数,和/或迭代次数k对应的第k次优化后的主变量满足停止阈值条件,则确定迭代次数k满足预设条件,否则确定迭代次数k不满足预设条件。For example, the computer equipment solves the solutions of the first equation, the second equation and the third equation respectively, and obtains the main variable after the kth optimization, the auxiliary variable after the kth optimization and the Lagrange multiplier after the kth optimization. After that, determine whether the number of iterations k satisfies the preset conditions. If the number of iterations k is greater than the maximum number of iterations, and/or the k-th optimized main variable corresponding to the number of iterations k meets the stop threshold condition, then it is determined that the number of iterations k satisfies the preset conditions. Set the conditions, otherwise it is determined that the iteration number k does not meet the preset conditions.
作为一个示例,若确定迭代次数k不满足预设条件,则将迭代次数k更新为k加1,继续执行分别求解第一方程、第二方程和第三方程的解,得到更新k后的第k次优化后的主变量、辅助变量和拉格朗日乘子的步骤,直至迭代次数k满足预设条件。若确定迭代次数k满足预设条件,则将通过第一方程确定的第k次优化后的主变量确定为迭代优化后的主变量。As an example, if it is determined that the number of iterations k does not meet the preset conditions, the number of iterations k is updated to k plus 1, and the solution of the first equation, the second equation and the third equation is continued to be solved respectively, and the third equation after updating k is obtained. The steps of the main variables, auxiliary variables and Lagrange multipliers after k times of optimization, until the iteration number k meets the preset conditions. If it is determined that the number of iterations k satisfies the preset conditions, then the main variable after the kth optimization determined by the first equation is determined as the main variable after the iterative optimization.
如此,通过上述步骤1)-步骤3),计算机设备根据目标能量泛函数构建增广拉格朗日函数之后,可以先根据增广拉格朗日函数构建最小化方程;再根据最小化方程,采用交替方向乘子法构建包括公式(12)表示的第一方程、公式(13)表示的第二方程和公式(14)表示的第三方程的迭代方程;然后在迭代次数k等于1时,根据公式(18)确定第1次优化后的第一方程的解u(x) 1,得到第1次优化后的主变量u(x) 1,根据公式(20)确定第1次优化 后的第二方程的解p 1,得到第1次优化后的辅助变量p 1,根据公式(21)确定第1次优化后的第三方程的解q 1,得到第1次优化后的拉格朗日乘子q 1;之后确定迭代次数k是否满足预设条件,若不满足,则将k更新为k加1,继续根据公式(18)确定第2次优化后的主变量u(x) 2,根据公式(20)确定第2次优化后的辅助变量p 2,根据公式(21)确定第2次优化后的拉格朗日乘子q 2,直至迭代次数k满足预设条件,将通过第一方程确定的满足预设条件的第k次优化后的主变量u(x) k,确定为迭代优化后的主变量u(x) k,迭代优化后的主变量u(x) k表示的中间分割图像为目标分割图像。 In this way, through the above steps 1) to 3), after the computer equipment constructs the augmented Lagrangian function according to the target energy functional function, it can first construct the minimization equation according to the augmented Lagrangian function; and then according to the minimization equation, The alternating direction multiplier method is used to construct an iterative equation including the first equation expressed by formula (12), the second equation expressed by formula (13) and the third equation expressed by formula (14); then when the iteration number k is equal to 1, According to the formula (18), the solution u(x) 1 of the first equation after the first optimization is determined, and the main variable u(x) 1 after the first optimization is obtained. According to the formula (20), the solution of the first equation u(x) 1 after the first optimization is determined. From the solution p 1 of the second equation, the auxiliary variable p 1 after the first optimization is obtained. According to formula (21), the solution q 1 of the third equation after the first optimization is determined, and the Lagrang after the first optimization is obtained. Daily multiplier q 1 ; then determine whether the iteration number k meets the preset conditions. If not, update k to k plus 1, and continue to determine the main variable u(x) 2 after the second optimization according to formula (18) , determine the auxiliary variable p 2 after the second optimization according to formula (20), determine the Lagrange multiplier q 2 after the second optimization according to formula (21), until the iteration number k meets the preset conditions, it will be passed The main variable u(x) k after the kth optimization that meets the preset conditions determined by the first equation is determined as the main variable u(x) k after iterative optimization, and the main variable u(x) k after iterative optimization is expressed The middle segmented image is the target segmented image.
综上,计算机设备可以将初始分割图像和原始图像输入到活动轮廓模型,通过初始活动轮廓模型,先根据原始图像确定第一自适应权重系数和第二自适应权重系数;再根据原始图像和初始分割图像,通过公式(4)和公式(5)确定第一平均值和第二平均值;然后根据原始图像、初始分割图像、第一自适应权重系数、第二自适应权重系数、第一平均值和第二平均值,通过公式(18)、公式(20)和公式(21),采用最优化算法对目标能量泛函数进行最小化处理后,可以得到第k次优化后的主变量、辅助变量和拉格朗日乘子;之后确定迭代次数k是否满足预设条件,若不满足则将k更新为k加预设数值,并继续通过公式(18)、公式(20)和公式(21),采用最优化算法对目标能量泛函数进行最小化处理后,得到k更新后的第k次优化后的主变量、辅助变量和拉格朗日乘子,继续确定k更新后的迭代次数k是否满足预设条件,直至迭代次数k是否满足预设条件,将通过第一方程确定的第k次优化后的主变量确定为迭代优化后的主变量。In summary, the computer device can input the initial segmented image and the original image into the active contour model. Through the initial active contour model, first determine the first adaptive weight coefficient and the second adaptive weight coefficient based on the original image; and then determine the first adaptive weight coefficient based on the original image and the initial image. Segment the image and determine the first average value and the second average value through formula (4) and formula (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, through formula (18), formula (20) and formula (21), after using the optimization algorithm to minimize the target energy functional function, the main variables and auxiliary variables after the kth optimization can be obtained variables and Lagrange multipliers; then determine whether the iteration number k meets the preset conditions, if not, update k to k plus the preset value, and continue through formula (18), formula (20) and formula (21) ), after using the optimization algorithm to minimize the target energy functional function, obtain the k-th optimized main variable, auxiliary variable and Lagrange multiplier after k update, and continue to determine the iteration number k after k update Whether the preset conditions are met until the iteration number k is met, the main variable after the kth optimization determined by the first equation is determined as the main variable after iterative optimization.
或者,计算机设备也可以将初始分割图像和原始图像输入到活动轮廓模型,通过初始活动轮廓模型,先根据原始图像确定第一自适应权重系数和第二自适应权重系数;再根据原始图像和初始分割图像,通过公式(4)和公式(5)确定第一平均值和第二平均值;然后根据原始图像、初始分割图像、第一自适应权重系数、第二自适应权重系数、第一平均值和第二平均值,通过公式(18)、公式(20)和公式(21),采用最优化算法对目标能量泛函数进行最小化处理,得到第k次优化后的主变量、辅助变量和拉格朗日乘子;之后确定迭代次数k是否满足预设条件,若不满足则根据原始图像和第k次优化后的主变量表示的中间分割图像,通过公式(23)和公式(24),更新第一平均值和第二平均值,将k更新为k加预设数值,并继续通过公式(18)、公式(20)和公式(21),采用最优化算法对目标能量泛函数进行最小化处理后,得到k更新后的第k次优化后的主变量、辅助变量和拉格朗日乘子,继续确定k更新后的迭代次数k是否满足预设条件,直至迭代次数k是否满足预设条件,将通过第一方程确定的第k次优化后的主变量确定为迭代优化后的主变量。Alternatively, the computer device can also input the initial segmented image and the original image into the active contour model. Through the initial active contour model, first determine the first adaptive weight coefficient and the second adaptive weight coefficient based on the original image; and then determine the first adaptive weight coefficient and the second adaptive weight coefficient based on the original image and the initial image. Segment the image and determine the first average value and the second average value through formula (4) and formula (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, through formula (18), formula (20) and formula (21), the optimization algorithm is used to minimize the target energy functional function, and the main variable, auxiliary variable and sum after the kth optimization are obtained Lagrange multiplier; then determine whether the iteration number k satisfies the preset conditions. If it does not meet the intermediate segmentation image represented by the original image and the k-th optimized main variable, use formula (23) and formula (24) , update the first average value and the second average value, update k to k plus the preset value, and continue to use the optimization algorithm to perform the target energy functional function through formula (18), formula (20) and formula (21). After the minimization process, the main variables, auxiliary variables and Lagrange multipliers of the k-th optimization after k updates are obtained, and continue to determine whether the iteration number k after k updates satisfies the preset conditions until the iteration number k satisfies Under preset conditions, the main variable after the kth optimization determined through the first equation is determined as the main variable after iterative optimization.
本申请实施例中,先获取初始分割图像以及包括目标物体的待分割的原始图像,再将初始分割图像和原始图像输入到活动轮廓模型中进行图像分割,得到原始图像的目标分割图像。其中,初始分割图像为对原始图像中的目标物体进行粗分割后的图像,活动轮廓模型采用目标能量泛函数,目标能量泛函数用于指示图像分割过程中的中间分割图像的分割误差,目标能量泛函数包括携带常数权重系数的保真项、携带第一自适应权重系数的长度项和携带第二自适应权重系数的光滑项,且第一自适应权重系数和第二自适应权重系数是通过原始图像确定的,也即是,长度项和光滑项的权重系数不是常数,而是与待分割的原始图像相关的自适应权重系数。如此,在通过活动轮廓模型对待分割图像进行图像分割时,活动轮廓模型中的目标能量泛函数的长度项和光滑项的权重系数可以根据不同的待分割图像进行相应的调整,从而提高了活动轮廓模型的鲁棒性和图像分割精度。In the embodiment of the present application, the initial segmented image and the original image to be segmented including the target object are first obtained, and then 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. Among them, the initial segmented image is an image after rough segmentation of the target object in the original image. The active contour model uses a target energy functional function. The target energy functional function is used to indicate the segmentation error of the intermediate segmented image during the image segmentation process. The target energy The generic function includes a fidelity term carrying a constant weight coefficient, a length term carrying a first adaptive weight coefficient and a smooth term carrying a second adaptive weight coefficient, and the first adaptive weight coefficient and the second adaptive weight coefficient are determined by What is determined by the original image, that is, the weight coefficients of the length term and the smoothness term are not constants, but adaptive weight coefficients related to the original image to be segmented. In this way, when performing image segmentation on the image to be segmented through the active contour model, the weight coefficients of the length term and smoothness term of the target energy functional function in the active contour model can be adjusted accordingly according to different images to be segmented, thereby improving the performance of the active contour. Model robustness and image segmentation accuracy.
需要说明的是,计算机设备在通过活动轮廓模型对原始图像中的目标物体进行图像分割之前,已经预先构建了上述图1实施例中的活动轮廓模型,且设置了通过活动轮廓模型进行图像分割的处理过程,从而在获取待分割的原始图像之后,计算机设备可以直接根据预先设置的通过活动轮廓模型进行图像分割的处理过程,得到目标分割图像。比如,计算机设备可以通过执行下述图像分割方法实现通过活动轮廓模型进行图像分割的处理。It should be noted that before the computer device performs image segmentation on the target object in the original image through the active contour model, the active contour model in the embodiment of FIG. 1 has been pre-constructed, and the image segmentation through the active contour model has been set. Processing process, so that after acquiring the original image to be segmented, the computer device can directly obtain the target segmented image according to the preset image segmentation process through the active contour model. For example, the computer device may implement image segmentation through the active contour model by executing the image segmentation method described below.
具体地,请参考图2,图2是本申请实施例提供的另一种图像分割方法的流程图。该方法可以应用于计算机设备中,计算机设备可以为终端、服务器或嵌入式设备等,终端可以为台式机或平板电脑等。该方法包括如下步骤:Specifically, please refer to Figure 2, which is a flow chart of another image segmentation method provided by an embodiment of the present application. This method can be applied to computer equipment. The computer equipment can be a terminal, a server or an embedded device, etc. The terminal can be a desktop computer or a tablet computer, etc. The method includes the following steps:
步骤201,计算机设备获取待分割的原始图像、初始分割图像和活动轮廓模型的预设参数。Step 201: The computer device obtains the original image to be segmented, the initial segmented image, and the preset parameters of the active contour model.
其中,原始图像包括目标物体,目标物体为原始图像中的待分割物体。Among them, the original image includes the target object, and the target object is the object to be segmented in the original image.
其中,初始分割图像为对原始图像中的目标物体进行粗分割后的图像,初始分割图像为二值图像,初始分割图像携带初始分割曲线的信息。Among them, the initial segmentation image is an image after rough segmentation of the target object in the original image, the initial segmentation image is a binary image, and the initial segmentation image carries the information of the initial segmentation curve.
比如,初始分割图像中的像素的像素值可以为0或1,初始分割图像中像素的像素值为1指示该像素位于初始分割图像中目标物体所在的区域,初始分割图像中像素的像素值为0指示该像素位于初始分割图像中除目标物体所在的区域之外的其它区域。For example, the pixel value of a pixel in the initial segmented image can be 0 or 1. A pixel value of 1 in the initial segmented image indicates that the pixel is located in the area where the target object is in the initial segmented image. The pixel value of a pixel in the initial segmented image is 0 indicates that the pixel is located in an area other than the area where the target object is located in the initial segmentation image.
作为一个示例,初始分割图像可以为人为在原始图像中手动设置初始轮廓线后得到的分割图像,或者也可以为通过初始分割模型得到的分割图像。As an example, the initial segmentation image can be a segmentation image obtained by manually setting initial contours in the original image, or it can also be a segmentation image obtained by an initial segmentation model.
其中,预设参数为活动轮廓模型中的常用参数,比如,预设参数可以包括常数权重系数、 尺度参数、罚系数、预设条件对应的预设条件值、初始辅助变量和初始拉格朗日乘子。其中,常数权重系数、尺度参数、罚系数、初始辅助变量和初始拉格朗日乘子的具体含义可以参见上述图1实施例,本申请实施例在此不再赘述。Among them, the preset parameters are commonly used parameters in active contour models. For example, the preset parameters can include constant weight coefficients, scale parameters, penalty coefficients, preset condition values corresponding to preset conditions, initial auxiliary variables and initial Lagrangian. Multiplier. The specific meanings of the constant weight coefficient, scale parameter, penalty coefficient, initial auxiliary variable and initial Lagrange multiplier can be found in the above-mentioned embodiment of Figure 1, and will not be described again in the embodiment of this application.
其中,预设条件为活动轮廓模型的截止条件,预设条件可以为循环停止条件和/或阈值停止条件,循环停止条件对应的预设条件值为最大迭代次数,阈值停止条件对应的预设条件值为停止阈值,最大迭代次数和停止阈值可以预先设置。Among them, the preset condition is the cut-off condition of the active contour model, the preset condition can be the loop stop condition and/or the threshold stop condition, the preset condition value corresponding to the loop stop condition is the maximum number of iterations, and the preset condition corresponding to the threshold stop condition The value is the stopping threshold, and the maximum number of iterations and stopping threshold can be set in advance.
比如,初始辅助变量p 0和初始拉格朗日乘子q 0为零矩阵,尺度参数τ可以为预先设置的0.01或0.001等较小的常数。 For example, the initial auxiliary variable p 0 and the initial Lagrange multiplier q 0 are zero matrices, and the scale parameter τ can be a preset smaller constant such as 0.01 or 0.001.
比如,常数权重系数和罚系数是通过不断地调试后得到的,也即是本申请实施中需要调试的参数包括常数权重系数和罚系数,活动轮廓模型的计算复杂度较低。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 the penalty coefficient. The calculation complexity of the active contour model is low.
步骤202,计算机设备根据原始图像确定第一自适应权重系数和第二自适应权重系数。Step 202: The computer device determines the first adaptive weight coefficient and the second adaptive weight coefficient according to the original image.
其中,第一自适应权重系数是活动轮廓模型中目标能量泛函数包括的长度项的权重系数,第二自适应权重系数是活动轮廓模型中目标能量泛函数包括的光滑项的权重系数。Wherein, the first adaptive weight coefficient is the weight coefficient of the length term included in the target energy functional function in the active contour model, and the second adaptive weight coefficient is the weight coefficient of the smooth term included in the target energy functional function in the active contour model.
比如,计算机设备可以根据上述图1实施例中的公式(1)和公式(2),分别确定第一自适应权重系数和第二自适应权重系数。For example, the computer device may determine the first adaptive weight coefficient and the second adaptive weight coefficient respectively according to formula (1) and formula (2) in the embodiment of FIG. 1 .
步骤203,计算机设备根据初始分割图像确定初始主变量。Step 203: The computer device determines the initial main variables according to the initial segmentation image.
其中,初始主变量可以表示初始分割图像。比如,初始分割图像中所有像素坐标中任一像素坐标x指示的像素的像素值为初始主变量u(x) 0Among them, the initial main variable can represent the initial segmentation image. For example, the pixel value of the pixel indicated by any pixel coordinate x among all pixel coordinates in the initial segmented image is the initial main variable u(x) 0 .
步骤204,计算机设备根据原始图像、初始分割图像、预设参数、第一自适应权重系数、第二自适应权重系数和初始主变量,从迭代次数k等于1开始对主变量、辅助变量和拉格朗日乘子进行迭代。Step 204: Based on the original image, the initial segmented image, the preset parameters, the first adaptive weight coefficient, the second adaptive weight coefficient and the initial main variable, starting from the iteration number k equal to 1, the main variable, the auxiliary variable and the pull Grange multipliers are iterated.
其中,k表示对初始分割图像的分割误差进行迭代优化的优化次数,k为正整数。Among them, k represents the number of optimization times for iterative optimization of the segmentation error of the initial segmentation image, and k is a positive integer.
其中,主变量可以表示中间分割图像,辅助变量为与中间分割图像的主变量的梯度有关的变量,拉格朗日乘子为构建增广拉格朗日函数时引入的变量,通过拉格朗日乘子q可以将对目标能量泛函数的最小化问题转换为对表示中间分割图像的主变量和辅助变量进行联合优化的鞍点问题,从而可以较为容易的求解鞍点问题对应的多个子问题。Among them, the main variable can represent the intermediate segmentation image, the auxiliary variable is the variable related to the gradient of the main variable of the intermediate segmentation image, and the Lagrange multiplier is the variable introduced when constructing the augmented Lagrangian function. Through Lagrang The daily multiplier q can convert the minimization problem of the target energy functional into a saddle point problem that jointly optimizes the main variables and auxiliary variables representing the intermediate segmentation image, so that multiple sub-problems corresponding to the saddle point problem can be easily solved.
比如,主变量、辅助变量和拉格朗日乘子的详细说明可以参考上述实施例1,本申请实施例在此不做赘述。For example, detailed description of the main variables, auxiliary variables and Lagrange multipliers can be referred to the above-mentioned Embodiment 1, and will not be described in detail here.
步骤205,计算机设备分别确定第k次优化后的主变量、辅助变量和拉格朗日乘子。Step 205: The computer device determines the main variables, auxiliary variables and Lagrange multipliers after the kth optimization respectively.
比如,计算机设备通过活动轮廓模型的目标能量泛函数,分别确定第k次优化后的主变 量、辅助变量和拉格朗日乘子。示例地,计算机设备可以根据原始图像、预设参数、第一自适应权重系数、初始主变量、第k-1次优化后的主变量、第k-1次优化后的辅助变量和第k-1次优化后的拉格朗日乘子,确定第k次优化后的主变量;根据预设参数、第二自适应权重系数、第k次优化后的主变量和第k-1次优化后的拉格朗日乘子,确定第k次优化后的辅助变量;根据预设参数、第k次优化后的主变量、第k次优化后的辅助变量和第k-1次优化后的拉格朗日乘子,确定第k次优化后的拉格朗日乘子。For example, the computer equipment determines the main variables, auxiliary variables and Lagrange multipliers after the kth optimization through the target energy functional function of the active contour model. For example, the computer device can calculate the original image, the preset parameters, the first adaptive weight coefficient, the initial main variable, the main variable after the k-1th optimization, the auxiliary variable after the k-1th optimization and the k-th optimization. The Lagrange multiplier after the 1st optimization is used to determine the main variable after the kth optimization; according to the preset parameters, the second adaptive weight coefficient, the main variable after the kth optimization and the k-1th optimization The Lagrange multiplier is used to determine the auxiliary variables after the kth optimization; according to the preset parameters, the main variables after the kth optimization, the auxiliary variables after the kth optimization and the Lagrange variables after the k-1th optimization Grange multiplier, determine the Lagrange multiplier after the kth optimization.
作为一个示例,计算机设备可以根据上述图1实施例中的公式(18)、公式(20)和公式(21),分别确定第k次优化后的主变量、辅助变量和拉格朗日乘子。As an example, the computer device can determine the main variable, the auxiliary variable and the Lagrange multiplier after the kth optimization respectively according to the formula (18), the formula (20) and the formula (21) in the embodiment of FIG. 1 . .
需要说明的是,根据上述图1实施例中的公式(18)可以得出第k次优化后的主变量与第k-1次优化后的辅助变量、第一自适应权重系数有关,根本上述图1实施例中的公式(20)可以得出第k-1次优化后的辅助变量与第二自适应权重系数有关,进一步可以得出第k次优化后的主变量与第一自适应权重系数、第二自适应权重系数有关,且第一自适应权重系数和第二自适应权重系数通过原始图像确定。It should be noted that according to the formula (18) in the above embodiment of Figure 1, it can be concluded that the main variable after the kth optimization is related to the auxiliary variable after the k-1th optimization and the first adaptive weight coefficient. Basically, the above Formula (20) in the embodiment of Figure 1 can be derived that the auxiliary variable after the k-1th optimization is related to the second adaptive weight coefficient, and further it can be derived that the main variable after the kth optimization is related to the first adaptive weight The coefficient and the second adaptive weight coefficient are related, and the first adaptive weight coefficient and the second adaptive weight coefficient are determined through the original image.
作为一个示例,若k等于1,则第k-1次优化后的主变量为初始主变量,第k-1次优化后的辅助变量为初始辅助变量,第k-1次优化后的拉格朗日乘子为初始拉格朗日乘子,中间分割图像为对初始分割图像进行1次优化后产生的初始分割图像,第1次优化后的主变量表示对初始分割图像的分割误差进行第1次优化得到的第1次优化后的初始分割图像。计算机设备可以根据上述图1实施例中的公式(18)确定第1次优化后的主变量u(x) 1,根据上述图1实施例中的公式(20)确定第1次优化后的辅助变量p 1,根据上述图1实施例中的公式(21)确定第1次优化后的拉格朗日乘子q 1As an example, if k equals 1, then the main variable after the k-1th optimization is the initial main variable, the auxiliary variable after the k-1th optimization is the initial auxiliary variable, and the lag after the k-1th optimization The Lange multiplier is the initial Lagrange multiplier, the intermediate segmented image is the initial segmented image generated after one optimization of the initial segmented image, and the main variable after the first optimization represents the segmentation error of the initial segmented image. The initial segmentation image after the first optimization obtained from the first optimization. The computer device can determine the main variable u(x) 1 after the first optimization according to the formula (18) in the above-mentioned embodiment of Figure 1, and determine the auxiliary variable u(x) 1 after the first optimization according to the formula (20) in the above-mentioned embodiment of Figure 1. The variable p 1 determines the Lagrange multiplier q 1 after the first optimization according to the formula (21) in the embodiment of Figure 1 mentioned above.
作为一个示例,若k大于1,则中间分割图像为对初始分割图像进行k次优化后产生的初始分割图像,第k次优化后的主变量表示中间分割图像,中间分割图像为对初始分割图像的分割误差进行第k次优化后产生的第k次优化后的初始分割图像。计算机设备可以根据上述图1实施例中的公式(18)确定第k次优化后的主变量u(x) k,根据上述图1实施例中的公式(20)确定第k次优化后的辅助变量p k,根据上述图1实施例中的公式(21)确定第k次优化后的拉格朗日乘子q kAs an example, if k is greater than 1, the intermediate segmented image is the initial segmented image generated after k times of optimization of the initial segmented image. The main variable after the kth optimization represents the intermediate segmented image, and the intermediate segmented image is the initial segmented image. The initial segmentation image after the kth optimization is generated by performing the kth optimization on the segmentation error. The computer device can determine the main variable u(x) k after the k-th optimization according to the formula (18) in the above-mentioned embodiment of Figure 1, and determine the auxiliary variable u(x) k after the k-th optimization according to the formula (20) in the above-mentioned embodiment of Figure 1. The variable p k determines the Lagrange multiplier q k after the kth optimization according to the formula (21) in the embodiment of Figure 1 mentioned above.
作为一个示例,计算机设备分别确定第k次优化后的主变量、辅助变量和拉格朗日乘子之前,还确定第一平均值和第二平均值,即确定原始图像中位于初始分割曲线内部区域的至少一个像素的像素值的第一平均值,确定原始图像中位于初始分割曲线外部区域的至少一个像素的像素值的第二平均值。比如,根据原始图像和初始分割图像,通过上述图1实施例中 的公式(4)确定第一平均值c 1,以及公式(5)确定第二平均值c 2As an example, before the computer device determines the main variables, auxiliary variables and Lagrange multipliers after the k-th optimization respectively, it also determines the first average value and the second average value, that is, it determines that the original image is located inside the initial segmentation curve. The first average value of the pixel values of at least one pixel of the area determines the second average value of the pixel values of at least one pixel of the original image located outside the initial segmentation curve. For example, based on the original image and the initial segmented image, the first average value c 1 is determined through the formula (4) in the embodiment of FIG . 1 , and the second average value c 2 is determined through the formula (5).
比如,计算机设备可以将初始分割图像和原始图像输入到活动轮廓模型,通过初始活动轮廓模型,先根据原始图像确定第一自适应权重系数和第二自适应权重系数,再根据原始图像和初始分割图像,通过公式(4)和公式(5)确定第一平均值和第二平均值,然后根据原始图像、初始分割图像、第一自适应权重系数、第二自适应权重系数、第一平均值和第二平均值,采用最优化算法对目标能量泛函数进行最小化处理,得到第k次优化后的主变量、辅助变量和拉格朗日乘子,然后确定迭代次数k是否满足预设条件,若不满足则将k更新为k加预设数值,并跳转至分别确定第k次优化后的主变量、辅助变量和拉格朗日乘子的步骤及后续步骤并跳转至分别确定第k次优化后的主变量、辅助变量和拉格朗日乘子的步骤及后续步骤。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, first determine the first adaptive weight coefficient and the second adaptive weight coefficient based on the original image, and then determine the first adaptive weight coefficient based on the original image and the initial segmentation. image, determine the first average value and the second average value through formula (4) and formula (5), and then determine the first average value and the second average value according to the original image, the initial segmented image, the first adaptive weight coefficient, the second adaptive weight coefficient, and the first average value and the second average value, use the optimization algorithm to minimize the target energy functional function, obtain the main variables, auxiliary variables and Lagrange multipliers after the kth optimization, and then determine whether the iteration number k satisfies the preset conditions , if it is not satisfied, update k to k plus the preset value, and jump to the steps of determining the main variables, auxiliary variables and Lagrange multipliers after the kth optimization and subsequent steps and jump to determine respectively. The steps and subsequent steps of the main variables, auxiliary variables and Lagrange multipliers after the kth optimization.
作为一个示例,第一平均值也可以为原始图像中位于中间分割曲线内部区域的至少一个像素的像素值的平均值,第二平均值也可以为原始图像中位于中间分割曲线外部区域的至少一个像素的像素值的平均值,中间分割曲线为用于在中间分割图像中分割目标物体的轮廓线且中间分割曲线为封闭曲线。这种情况下,可以根据原始图像和中间分割图像确定第一平均值和第二平均值。具体地,可以通过如下公式(23)确定第一平均值,通过如下公式(24)确定第二平均值:As an example, the first average value can also be the average value of at least one pixel value of the original image located in the internal area of the middle segmentation curve, and the second average value can also be the average value of at least one pixel value of the original image located in the outer area of the middle segmentation curve. The average value of the pixel values of the pixels, the intermediate segmentation curve is the contour line used to segment the target object in the intermediate segmentation image and the intermediate segmentation curve is a closed curve. In this case, the first average value and the second average value may be determined based on the original image and the intermediate segmented 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):
Figure PCTCN2022138172-appb-000065
Figure PCTCN2022138172-appb-000065
Figure PCTCN2022138172-appb-000066
Figure PCTCN2022138172-appb-000066
其中,x为中间分割图像中像素的像素坐标,u(x)为中间分割图像中x指示的像素的像素值,I为原始图像,Ω为中间分割图像的图像区域。Among them, x is the pixel coordinate of the 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 area of the intermediate segmented image.
比如,计算机设备可以将初始分割图像和原始图像输入到活动轮廓模型,通过初始活动轮廓模型,先根据原始图像确定第一自适应权重系数和第二自适应权重系数,再根据原始图像和初始分割图像,通过公式(4)和公式(5)确定第一平均值和第二平均值,然后根据原始图像、初始分割图像、第一自适应权重系数、第二自适应权重系数、第一平均值和第二平均值,采用最优化算法对目标能量泛函数进行最小化处理,得到第k次优化后的主变量、辅助变量和拉格朗日乘子,然后确定迭代次数k是否满足预设条件,若不满足则根据原始图像和第k次优化后的主变量表示的中间分割图像,通过公式(23)和公式(24),更新第一平均值和第二平均值,将k更新为k加预设数值,并跳转至分别确定第k次优化后的主变量、 辅助变量和拉格朗日乘子的步骤及后续步骤并跳转至分别确定第k次优化后的主变量、辅助变量和拉格朗日乘子的步骤及后续步骤。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, first determine the first adaptive weight coefficient and the second adaptive weight coefficient based on the original image, and then determine the first adaptive weight coefficient based on the original image and the initial segmentation. image, determine the first average value and the second average value through formula (4) and formula (5), and then determine the first average value and the second average value according to the original image, the initial segmented image, the first adaptive weight coefficient, the second adaptive weight coefficient, and the first average value and the second average value, use the optimization algorithm to minimize the target energy functional function, obtain the main variables, auxiliary variables and Lagrange multipliers after the kth optimization, and then determine whether the iteration number k meets the preset conditions , if it is not satisfied, update the first average and the second average through formula (23) and formula (24) based on the original image and the intermediate segmented image represented by the k-th optimized main variable, and update k to k Add the preset value, and jump to the steps of determining the main variables, auxiliary variables and Lagrange multipliers after the k-th optimization respectively, and the subsequent steps and jump to the steps of determining the main variables, auxiliary variables after the k-th optimization respectively. Variables and Lagrange Multipliers steps and subsequent steps.
步骤206,计算机设备确定迭代次数k是否满足预设条件。Step 206: The computer device determines whether the iteration number k satisfies the preset condition.
需要说明的是,在步骤205之后,迭代次数k大于1。It should be noted that after step 205, the number of iterations k is greater than 1.
其中,预设条件包括循环停止条件和/或停止阈值条件,满足循环停止条件是指迭代次数k大于最大迭代次数,满足阈值停止条件是指迭代次数k对应的第k次优化后的主变量与第k-1次优化后的主变量的差值的1范数小于或等于第k次优化后的主变量的1范数与停止阈值的乘积。Among them, the preset conditions include loop stop conditions and/or stop threshold conditions. 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 main variable after the kth optimization corresponding to the iteration number k corresponds to the k-th optimized main variable and The 1-norm of the difference value of the main variable after the k-1th optimization is less than or equal to the product of the 1-norm of the main variable after the k-th optimization and the stopping threshold.
比如,计算机设备若确定迭代次数k大于最大迭代次数,和/或,若通过上述图1实施例中的公式(22)确定迭代次数k对应的第k次优化后的主变量与第k-1次优化后的主变量的差值的1范数小于或等于第k次优化后的主变量的1范数与停止阈值的乘积,则确定迭代次数k满足预设条件,执行步骤208,否则确定迭代次数k不满足预设条件,执行步骤207。For example, if the computer device determines that the number of iterations k is greater than the maximum number of iterations, and/or if it determines through the formula (22) in the embodiment of FIG. 1 that the k-th optimized main variable corresponding to the iteration number k corresponds to the k-1 The 1-norm of the difference between the main variables after the optimization is less than or equal to the product of the 1-norm of the main variable after the k-th optimization and the stop threshold, then it is determined that the iteration number k satisfies the preset condition, and step 208 is executed. Otherwise, determine If the number of iterations k does not meet the preset condition, step 207 is executed.
步骤207,计算机设备若确定迭代次数k不满足预设条件,则将k更新为k加预设数值,并跳转至分别确定第k次优化后的主变量、辅助变量和拉格朗日乘子的步骤及后续步骤。Step 207: If the computer device determines that the number of iterations k does not meet the preset conditions, it updates k to k plus the preset value, and jumps to determine the main variables, auxiliary variables and Lagrange multipliers after the kth optimization. sub-steps and subsequent steps.
比如,预设数值为正整数,预设数值可以为1或其他数值,本申请实施例对此不做限定。For example, the preset value is a positive integer, and the preset value can be 1 or other values, which is not limited in the embodiments of the present application.
步骤208,计算机设备若确定迭代次数k满足预设条件,则将满足预设条件的第k次优化后的主变量确定为目标主变量,目标主变量表示的中间分割图像为目标分割图像。Step 208: If the computer device determines that the iteration number k satisfies the preset condition, it determines the k-th optimized main variable that meets the preset condition as the target main variable, and the intermediate segmented image represented by the target main variable is the target segmented image.
如此,通过上述步骤201-步骤208,计算机设备可以对原始图像进行图像分割,得到目标分割图像,即上述步骤201-步骤208为计算机设备通过活动轮廓模型进行图像分割的处理过程。In this way, through the above-mentioned steps 201 to 208, the computer device can perform image segmentation on the original image to obtain the target segmented image. That is, the above-mentioned steps 201 to 208 are the processing process of the computer device performing image segmentation through the active contour model.
另外,请参考图3,图3是本申请实施例提供的一种图像分割方法的框架示意图。如图3所示,图3中的(a)图是原始图像,原始图像为医学图像,目标物体为肺结节。图3中的(b)图是初始分割图像,初始分割图像为二值图像。图3中的(c)图是初始分割图像中的初始分割曲线在原始图像中的表示。图3中的(d)图是对图3中的(c)图中的第一目标区域进行放大后的图像,第一目标区域是指图3中的(c)图中位于初始分割曲线内部区域的区域,图3中的(e)图是目标分割图像,图3中的(f)图是目标分割图像中的目标分割曲线在原始图像中的表示,图3中的(g)图是对图3中的(f)图中的第二目标区域进行放大后的图像,第二目标区域是指图3中的(f)图中位于目标分割曲线内部区域的区域。其中,目标分割曲线为用于在目标分割图像中分割目标物体的轮廓线且目标分割曲线为封闭曲线。In addition, please refer to FIG. 3 , which is a schematic framework diagram of an image segmentation method provided by an embodiment of the present application. As shown in Figure 3, (a) in Figure 3 is the original image, the original image is a medical image, and the target object is pulmonary nodules. Picture (b) in Figure 3 is the initial segmentation image, and the initial segmentation image is a binary image. Picture (c) in Figure 3 is the representation of the initial segmentation curve in the initial segmentation image in the original image. Figure 3 (d) is an enlarged image of the first target area in Figure 3 (c). The first target area refers to the area inside the initial segmentation curve in Figure 3 (c). The area of the region, (e) in Figure 3 is the target segmentation image, (f) in Figure 3 is the representation of the target segmentation curve in the target segmentation image in the original image, (g) in Figure 3 is An enlarged image of the second target area in Figure 3(f). The second target area refers to the area located inside the target segmentation curve in Figure 3(f). Wherein, the target segmentation curve is a contour line used to segment the target object in the target segmentation image and the target segmentation curve is a closed curve.
与图3中的(d)图相比,图3中的(g)图中第二目标区域的边界较为光滑,即目标分 割曲线较为光滑,图像分割精度较高。Compared with the picture (d) in Figure 3, the boundary of the second target area in the picture (g) in Figure 3 is smoother, that is, the target segmentation curve is smoother, and the image segmentation accuracy is higher.
其中,如图3所示,可以先获取待分割的原始图像,将原始图像作为初始分割模型的输入,通过初始分割模型确定初始分割图像,然后将原始图像和初始分割图像作为活动轮廓模型的输入,通过活动轮廓模型确定目标分割图像。Among them, as shown in Figure 3, you can first obtain the original image to be segmented, use the original image as the input of the initial segmentation model, determine the initial segmentation image through the initial segmentation model, and then use the original image and the initial segmentation image as the input of the active contour model , determine the target segmentation image through the active contour model.
其中,该活动轮廓模型采用目标能量泛函数,目标能量泛函数用于指示图像分割过程中的中间分割图像的分割误差,目标能量泛函数包括携带常数权重系数的保真项、携带第一自适应权重系数的长度项和携带第二自适应权重系数的光滑项,且第一自适应权重系数和第二自适应权重系数是通过原始图像确定的,也即是,长度项和光滑项的权重系数不是常数,而是与待分割的原始图像相关的自适应权重系数。如此,在通过活动轮廓模型对待分割图像进行图像分割时,活动轮廓模型中的目标能量泛函数的长度项和光滑项的权重系数可以根据不同的待分割图像进行相应的调整,从而提高了活动轮廓模型的鲁棒性和图像分割精度。Among them, the active contour model uses a target energy functional function. The target energy functional function is used to indicate the segmentation error of the intermediate segmented image in the image segmentation process. The target energy functional function includes a fidelity term carrying a constant weight coefficient, a first adaptive term carrying The length term of the weight coefficient and the smooth term carrying the second adaptive weight coefficient, and the first adaptive weight coefficient and the second adaptive weight coefficient are determined through the original image, that is, the weight coefficient of the length term and the smooth term is not a constant, but an adaptive weight coefficient related to the original image to be segmented. In this way, when performing image segmentation on the image to be segmented through the active contour model, the weight coefficients of the length term and smoothness term of the target energy functional function in the active contour model can be adjusted accordingly according to different images to be segmented, thereby improving the performance of the active contour. Model robustness and image segmentation accuracy.
需要说明的是,图3中的初始分割模型、活动轮廓模型、目标能量泛函数、保真项、携带第一自适应权重系数的长度项、携带第二自适应权重系数的光滑项、以及如何确定满足预设条件的目标分割图像的详细解释说明可以参见上述步骤201-步骤208或上述图1实施例。It should be noted that the initial segmentation model, active contour model, target energy functional, fidelity term, length term carrying the first adaptive weight coefficient, smooth term carrying the second adaptive weight coefficient in Figure 3, and how For a detailed explanation of determining the target segmentation image that satisfies the preset conditions, please refer to the above-mentioned steps 201 to 208 or the above-mentioned embodiment of FIG. 1 .
本申请实施例中,先获取待分割的原始图像、初始分割图像和获取预设参数,再根据原始图像确定第一自适应权重系数和第二自适应权重系数,根据初始分割图像确定初始主变量,然后从迭代次数k等于开始对主变量、辅助变量和拉格朗日乘子进行迭代,分别确定第k次优化后的主变量、辅助变量和拉格朗日乘子,之后确定迭代次数k是否满足预设条件,若确定迭代次数k不满足预设条件,则将k更新为k加预设数值,跳转至分别确定第k次优化后的主变量、辅助变量和拉格朗日乘子的步骤,若确定迭代次数k满足预设条件,则将满足预设条件的第k次优化后的主变量确定为目标主变量,目标主变量表示的中间分割图像为目标分割图像。In the embodiment of the present application, the original image to be segmented, the initial segmented image and the 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 main variables are determined based on the initial segmented image. , and then iterate on the main variables, auxiliary variables and Lagrange multipliers starting from the iteration number k equal to, respectively determine the main variables, auxiliary variables and Lagrange multipliers after the kth optimization, and then determine the iteration number k Whether the preset conditions are met, if it is determined that the number of iterations k does not meet the preset conditions, then k is updated to k plus the preset value, and jumps to determine the main variables, auxiliary variables and Lagrange multipliers after the kth optimization. In the sub-step, if it is determined that the iteration number k satisfies the preset conditions, the main variable after the kth optimization that meets the preset conditions is determined as the target main variable, and the intermediate segmented image represented by the target main variable is the target segmented image.
由于计算机设备通过活动轮廓模型得到目标分割图像的过程中,第k次优化后的主变量与第一自适应权重系数、第二自适应权重系数有关,且第一自适应权重系数和第二自适应权重系数通过原始图像确定,即第一自适应权重系数和第二自适应权重系数不是常数,而是原始图像相关的自适应权重系数,第一自适应权重系数和第二自适应权重系数可以较优的匹配的不同的待分割的原始图像,因此确定的满足预设条件的第k次优化后的主变量较优,第k次优化后的主变量表示的目标分割图像较优,如此提高了活动轮廓模型的鲁棒性和图像分割精度。Since the computer device obtains the target segmentation image through the active contour model, the main variable after the kth optimization is related to the first adaptive weight coefficient and the second adaptive weight coefficient, and the first adaptive weight coefficient and the second adaptive weight coefficient are related to each other. The adaptation weight coefficient is 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 Different original images to be segmented are better matched, so the k-th optimized main variable that meets the preset conditions is determined to be better, and the target segmentation image represented by the k-th optimized main variable is better. This improves Improved the robustness and image segmentation accuracy of the active contour model.
请参考图4,图4是本申请实施例提供的一种图像分割装置的结构示意图。该图像分割调整装置可以由软件、硬件或者两者的结合实现成为计算机设备的部分或者全部,该计算机设备可以为下文图5所示的计算机设备。参见图4,该图像分割调整装置包括:第一获取模块401、第二获取模块402和第一分割模块403。Please refer to FIG. 4 , which is a schematic structural diagram of an image segmentation device provided by an embodiment of the present application. The image segmentation adjustment device can be implemented as part or all of a computer device by software, hardware, or a combination of the two. The computer device can be the computer device shown in Figure 5 below. Referring to FIG. 4 , the image segmentation adjustment device includes: a first acquisition module 401 , a second acquisition module 402 and a first segmentation module 403 .
其中,第一获取模块401,用于获取待分割的原始图像,原始图像包括目标物体;Among them, the first acquisition module 401 is used to acquire the original image to be segmented, where the original image includes the target object;
第二获取模块402,用于获取初始分割图像,初始分割图像为对原始图像中的所目标物体进行粗分割后的图像;The second acquisition module 402 is used to acquire an initial segmented image. The initial segmented image is an image after rough segmentation of the target object in the original image;
第一分割模块403,用于将初始分割图像和原始图像输入到活动轮廓模型中进行图像分割,得到原始图像的目标分割图像,活动轮廓模型采用目标能量泛函数;The first segmentation module 403 is used to input the initial segmented image and the original image into the active contour model to perform image segmentation to obtain a target segmented image of the original image. The active contour model adopts a target energy function;
其中,目标能量泛函数用于指示图像分割过程中产生的中间分割图像的分割误差,目标能量泛函数包括携带常数权重系数的保真项、携带第一自适应权重系数的长度项和携带第二自适应权重系数的光滑项,第一自适应权重系数和第二自适应权重系数通过原始图像确定。Among them, the target energy functional function is used to indicate the segmentation error of the intermediate segmentation image generated during the image segmentation process. The target energy functional function includes a fidelity term carrying a constant weight coefficient, a length term carrying a first adaptive weight coefficient, and a second term carrying a second adaptive weight coefficient. The smooth term of the adaptive weight coefficient, the first adaptive weight coefficient and the second adaptive weight coefficient are determined through the original image.
作为一个示例,第一自适应权重系数和第二自适应权重系数分别通过如下公式表示:As an example, the first adaptive weight coefficient and the second adaptive weight coefficient are respectively expressed by the following formulas:
Figure PCTCN2022138172-appb-000067
Figure PCTCN2022138172-appb-000067
Figure PCTCN2022138172-appb-000068
Figure PCTCN2022138172-appb-000068
其中,
Figure PCTCN2022138172-appb-000069
为第一自适应权重系数,y为原始图像中像素的的像素坐标,I(y)为原始图像中y指示的像素的像素值,β(I)为第二自适应权重系数,
Figure PCTCN2022138172-appb-000070
为梯度运算符。
in,
Figure PCTCN2022138172-appb-000069
is the first adaptive weight coefficient, y is the pixel coordinate of the pixel in the original image, I(y) is the pixel value of the pixel indicated by y in the original image, β(I) is the second adaptive weight coefficient,
Figure PCTCN2022138172-appb-000070
is the gradient operator.
作为一个示例,目标能量泛函数包括表示中间分割图像的主变量;As an example, the target energy functional includes main variables representing intermediate segmented images;
第一分割模块403,还用于将原始图像和初始分割图像作为活动轮廓模型的输入,通过活动轮廓模型,采用最优化算法对目标能量泛函数进行最小化处理,得到满足目标能量泛函数最小化的目标主变量,目标主变量表示的中间分割图像为目标分割图像,中间分割图像为通过对初始分割图像的分割误差进行优化得到的优化后的初始分割图像。The first segmentation module 403 is also used to use the original image and the initial segmented image as the input of the active contour model. Through the active contour model, the optimization algorithm is used to minimize the target energy functional function, so as to obtain the target energy functional function that satisfies the minimization process. The target main variable of , the intermediate segmentation image represented by the target main variable is the target segmentation image, and the intermediate segmentation image is the optimized initial segmentation image obtained by optimizing the segmentation error of the initial segmentation image.
作为一个示例,最优化算法为交替方向乘子法;As an example, the optimization algorithm is the alternating direction multiplier method;
第一分割模块403,还用于根据目标能量泛函数,构建增广拉格朗日函数,增广拉格朗日函数至少包括表示中间分割图像的主变量;The first segmentation module 403 is also used to construct an augmented Lagrangian function according to the target energy functional function. The augmented Lagrangian function at least includes a main variable representing the intermediate segmented image;
采用交替方向乘子法对增广拉格朗日函数中的主变量进行迭代优化,得到迭代优化后的主变量,迭代优化后的主变量为满足目标能量泛函数最小化的目标主变量。The alternating direction multiplier method is used to iteratively optimize the main variables in the augmented Lagrangian function, and the main variables after iterative optimization are obtained. The main variables after iterative optimization are the target main variables that satisfy the minimization of the target energy functional function.
作为一个示例,增广拉格朗日函数还包括辅助变量和拉格朗日乘子,辅助变量为与中间 分割图像的主变量的梯度有关的变量,拉格朗日乘子用于将对目标能量泛函数的最小化问题转换为对表示中间分割图像的主变量和辅助变量进行联合优化的鞍点问题;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 main variable of the intermediate segmentation image. The Lagrangian multiplier is used to convert the target The minimization problem of the energy functional function is transformed into a saddle point problem that jointly optimizes the main variables and auxiliary variables representing the intermediate segmentation image;
第一分割模块403,还用于根据增广拉格朗日函数构建最小化方程,最小化方程为对表示中间分割图像的主变量和辅助变量进行联合优化的方程;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 segmentation image;
根据最小化方程,采用交替方向乘子法构建迭代方程,迭代方程包括第一方程、第二方程和第三方程,第一方程用于根据第k-1次优化后的辅助变量和第k-1次优化后的拉格朗日乘子确定第k次优化后的主变量,第二方程用于根据第k次优化后的主变量和第k-1次优化后的拉格朗日乘子确定第k次优化后的辅助变量,第三方程用于根据第k次优化后的主变量和第k次优化后的辅助变量确定第k次优化后的拉格朗日乘子,k为正整数;According to the minimization equation, the alternating direction multiplier method is used to construct an iterative equation. The iterative equation includes the first equation, the second equation and the third equation. The first equation is used according to the auxiliary variables after the k-1th optimization and the k-th The Lagrange multiplier after the 1st optimization determines the main variable after the kth optimization, and the second equation is used to determine the main variable after the kth optimization and the Lagrange multiplier after the k-1th optimization. Determine the auxiliary variables after the kth optimization. The third equation is used to determine the Lagrange multiplier after the kth optimization based on the main variables after the kth optimization and the auxiliary variables after the kth optimization. k is positive. integer;
将通过第一方程确定的满足预设条件的主变量,确定为迭代优化后的主变量。The main variables that meet the preset conditions determined through the first equation are determined as the main variables after iterative optimization.
作为一个示例,最小化方程通过如下公式表示:As an example, the minimization equation is expressed by:
Figure PCTCN2022138172-appb-000071
Figure PCTCN2022138172-appb-000071
其中,x为中间分割图像中像素的像素坐标,u(x)为中间分割图像中x指示的像素的像素值,u(x)为表示中间分割图像的主变量,p为辅助变量,q为拉格朗日乘子,Γ(u,p,q)为增广拉格朗日函数。Among them, x is the pixel coordinate of the pixel in the intermediate segmentation image, u(x) is the pixel value of the pixel indicated by x in the intermediate segmentation image, u(x) is the main variable representing the intermediate segmentation image, p is the auxiliary variable, and q is Lagrange multiplier, Γ(u,p,q) is the augmented Lagrangian function.
作为一个示例,迭代方程通过如下公式表示:As an example, the iteration equation is represented by the following formula:
Figure PCTCN2022138172-appb-000072
Figure PCTCN2022138172-appb-000072
其中,k为正整数,
Figure PCTCN2022138172-appb-000073
为第一方程,u(x) k为对初始分割图像的分割误差进行第k次优化后得到的图像中x指示的像素的像素值,u(x) k为第k次优化后的主变量,p k-1为第k-1次优化后的辅助变量,q k-1为第k-1次优化后的拉格朗日乘子,
Figure PCTCN2022138172-appb-000074
为第二方程,p k为第k次优化后的辅助变量,
Figure PCTCN2022138172-appb-000075
为第三方程,q k为第k次优化后的拉格朗日乘子。
Among them, k is a positive integer,
Figure PCTCN2022138172-appb-000073
is the first equation, u(x) k is the pixel value of the pixel indicated by x in the image obtained after the kth optimization of the segmentation error of the initial segmented image, u(x) k is the main variable after the kth optimization , p k-1 is the auxiliary variable after the k-1th optimization, q k-1 is the Lagrange multiplier after the k-1th optimization,
Figure PCTCN2022138172-appb-000074
is the second equation, p k is the auxiliary variable after the kth optimization,
Figure PCTCN2022138172-appb-000075
is the third equation, q k is the Lagrange multiplier after the kth optimization.
作为一个示例,该图像分割调整装置还包括第二分割模块,第二分割模块用于将原始图像作为初始分割模型的输入,通过初始分割模型确定初始分割图像,初始分割模型用于对原 始图像中的目标物体进行粗分割,得到粗分割的图像。As an example, the image segmentation adjustment device further includes a second segmentation module. The second segmentation module is used to use the original image as the input of the initial segmentation model, and determine the initial segmentation image through the initial segmentation model. The initial segmentation model is used to perform segmentation on the original image. The target object is roughly segmented to obtain a roughly segmented image.
作为一个示例,目标能量泛函数通过如下公式表示:As an example, the target energy functional is expressed by:
Figure PCTCN2022138172-appb-000076
Figure PCTCN2022138172-appb-000076
其中,E(u(x))为目标能量泛函数,x为中间分割图像中像素的像素坐标,u(x)为中间分割图像中x指示的像素的像素值,且u(x)∈[0,1],u(x)=1表示x指示的像素位于中间分割图像中目标物体所在的区域,u(x)=0表示x指示的像素位于中间分割图像中除目标物体所在的区域之外的其它区域,F(u(x))为保真项,L(u(x))为长度项,P(u(x))为光滑项,λ为常数权重系数,I为原始图像,
Figure PCTCN2022138172-appb-000077
为第一自适应权重系数,β(I)为第二自适应权重系数,Ω为中间分割图像的图像区域,c 1为原始图像中位于初始分割曲线内部区域的至少一个像素的像素值的第一平均值,c 2为原始图像中位于初始分割曲线外部区域的至少一个像素的像素值的第二平均值,初始分割曲线为用于在初始分割图像中分割目标物体的轮廓线且初始分割曲线为封闭曲线,τ为尺度参数,G τ为高斯函数,
Figure PCTCN2022138172-appb-000078
为梯度运算符。
Among them, E(u(x)) is the target energy functional function, x is the pixel coordinate of the 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 means that the pixel indicated by x is located in the area where the target object is located in the intermediate segmentation image, u(x)=0 means that the pixel indicated by In other areas outside of
Figure PCTCN2022138172-appb-000077
is the first adaptive weight coefficient, β(I) is the second adaptive weight coefficient, Ω is the image area of the intermediate segmentation image, c 1 is the pixel value of at least one pixel located in the internal area of the initial segmentation curve in the original image. An average value, c 2 is the second average value of the pixel value of at least one pixel located in the outer area of the initial segmentation curve in the original image, 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 a scale parameter, G τ is a Gaussian function,
Figure PCTCN2022138172-appb-000078
is the gradient operator.
需要说明的是:上述实施例提供的图像分割装置,仅以上述各功能模块的划分进行举例说明,实际应用中,可以根据需要而将上述功能分配由不同的功能模块完成,即将装置的内部结构划分成不同的功能模块,以完成以上描述的全部或者部分功能。It should be noted that the image segmentation device provided in the above embodiments is only explained by taking the division of the above functional modules as an example. In practical applications, the above functions can be allocated to different functional modules according to needs, that is, the internal structure of the device Divide it into different functional modules to complete all or part of the functions described above.
上述实施例中的各功能单元、模块可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中,上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。另外,各功能单元、模块的具体名称也只是为了便于相互区分,并不用于限制本申请实施例的保护范围。Each functional unit and module in the above embodiments can be integrated into one processing unit, or each unit can exist physically alone, or two or more units can be integrated into one unit. The above-mentioned integrated unit can either use hardware. It can also be implemented in the form of software functional units. In addition, the specific names of each functional unit and module are only for the convenience of distinguishing each other and are not used to limit the protection scope of the embodiments of the present application.
上述实施例提供的图像分割装置与图像分割方法实施例属于同一构思,上述实施例中单元、模块的具体工作过程及带来的技术效果,可参见方法实施例部分,此处不再赘述。The image segmentation device provided by the above embodiments and the image segmentation method embodiments belong to the same concept. The specific working processes and technical effects of the units and modules in the above embodiments can be found in the method embodiments section, and will not be described again here.
请参考图5,图5是本申请实施例提供的一种计算机设备的结构示意图。如图5所示,计算机设备包括:处理器501、存储器502以及存储在存储器502中并可在处理器501上运行的计算机程序503,处理器501执行计算机程序503时实现上述实施例中的图像分割方法中的步骤。Please refer to FIG. 5 , which is a schematic structural diagram of a computer device provided by an embodiment of the present application. As shown in Figure 5, 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, the image in the above embodiment is realized. Steps in the segmentation method.
计算机设备可以是上述图1实施例或上述图2实施例中的计算机设备。计算机设备可以是近眼显示设备,或者是台式机、便携式电脑、网络服务器、掌上电脑、移动手机、平板电脑、无线终端设备、通信设备或嵌入式设备,本申请实施例不限定计算机设备的类型。本领域技术人员可以理解,图5仅仅是计算机设备的举例,并不构成对计算机设备的限定,可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件,比如还可以包括输入输出设备、网络接入设备等。The computer device may be the computer device in the above-mentioned embodiment of FIG. 1 or the above-mentioned embodiment of FIG. 2 . The computer device may be a near-eye display device, or a desktop computer, a portable computer, a network server, a palmtop computer, a mobile phone, a tablet computer, a wireless terminal device, a communication device or an embedded device. The embodiments of this application do not limit the type of computer device. Those skilled in the art can understand that Figure 5 is only an example of a computer device and does not constitute a limitation on the computer device. It may include more or fewer components than shown in the figure, or some components may be combined, or different components may be used, such as It can also include input and output devices, network access devices, etc.
处理器501可以是中央处理单元(Central Processing Unit,CPU),处理器501还可以是其他通用处理器、数字信号处理器(Digital Signal Processor,DSP)、专用集成电路(Application Specific Integrated Circuit,ASIC)、现成可编程门阵列(Field-Programmable Gate Array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件等。通用处理器可以是微处理器或者也可以是任何常规的处理器。The processor 501 can be a central processing unit (Central Processing Unit, CPU). The processor 501 can also be other general-purpose processors, digital signal processors (Digital Signal Processor, DSP), or application specific integrated circuits (Application Specific Integrated Circuit, ASIC). , off-the-shelf programmable gate array (Field-Programmable Gate Array, FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general purpose processor may be a microprocessor or any conventional processor.
存储器502在一些实施例中可以是计算机设备的片内存储器或片外存储器,比如计算机设备的高速缓冲存储器、SRAM(Static Random-Access Memory,静态随机存取存储器)、DRAM(Dynamic Static Random-Access Memory,动态随机存取存储器)或软盘等。存储器502在另一些实施例中也可以是计算机设备上配备的插接式硬盘、智能存储卡(Smart Media Card,SMC)、安全数字(Secure Digital,SD)卡、闪存卡(Flash Card)等。进一步地,存储器502还可以既包括计算机设备的片内存储器、片外存储器内部存储单元,也包括外部存储设备。存储器502用于存储操作系统、应用程序、引导装载程序(Boot Loader)、数据以及其他程序等。存储器502还可以用于暂时地存储已经输出或者将要输出的数据。In some embodiments, the memory 502 can be an on-chip memory or an off-chip memory of a computer device, such as a cache memory of a computer device, SRAM (Static Random-Access Memory), or DRAM (Dynamic Static Random-Access). Memory, dynamic random access memory) or floppy disk, etc. In other embodiments, the memory 502 can also be a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash memory card (Flash Card), etc. equipped on the computer device. Further, the memory 502 may also include both on-chip memory and off-chip memory internal storage units of the computer device, as well as external storage devices. The memory 502 is used to store operating systems, application programs, boot loaders, data, and other programs. The memory 502 may also be used to temporarily store data that has been output or is to be output.
本申请实施例还提供了一种计算机设备,该计算机设备包括:至少一个处理器、存储器以及存储在该存储器中并可在该至少一个处理器上运行的计算机程序,该处理器执行该计算机程序时实现上述任意各个方法实施例中的步骤。An embodiment of the present 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, and when the processor executes the computer program, the steps in any of the above-mentioned method embodiments are implemented.
本申请实施例还提供了一种计算机可读存储介质,该计算机可读存储介质存储有计算机程序,该计算机程序被处理器执行时可实现上述各个方法实施例中的步骤。Embodiments of the present application also provide a computer-readable storage medium. The computer-readable storage medium stores a computer program. When the computer program is executed by a processor, the steps in the above method embodiments can be implemented.
本申请实施例提供了一种计算机程序产品,当其在计算机上运行时,使得计算机执行上述各个方法实施例中的步骤。The embodiment of the present application provides a computer program product, which, when run on a computer, causes the computer to perform the steps in each of the above method embodiments.
集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请实现上述方法实施例中的全部或部分流程,可以通过计算机程序来指令相关的硬件来完成,该计算机程序可存储于一计算机可读存储介质中,该计算机程序在被处理器执行时,可实现上述各个方法实施例的步骤。其 中,该计算机程序包括计算机程序代码,该计算机程序代码可以为源代码形式、对象代码形式、可执行文件或某些中间形式等。该计算机可读介质至少可以包括:能够将计算机程序代码携带到拍照装置/终端设备的任何实体或装置、记录介质、计算机存储器、ROM(Read-Only Memory,只读存储器)、RAM(Random Access Memory,随机存取存储器)、CD-ROM(Compact Disc Read-Only Memory,只读光盘)、磁带、软盘和光数据存储设备等。本申请提到的计算机可读存储介质可以为非易失性存储介质,换句话说,可以是非瞬时性存储介质。Integrated units may be stored in a computer-readable storage medium if they are implemented in the form of software functional units and sold or used as independent products. Based on this understanding, this application can implement all or part of the processes in the above method embodiments by instructing relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and the computer program can be used when being processed. When the processor executes, the steps of each of the above method embodiments can be implemented. Wherein, the computer program includes computer program code, which can be in source code form, object code form, executable file or some intermediate form, etc. The computer-readable medium may at least include: any entity or device capable of carrying computer program code to the camera device/terminal device, recording media, computer memory, ROM (Read-Only Memory), RAM (Random Access Memory) , Random Access Memory), CD-ROM (Compact Disc Read-Only Memory, read-only disk), tapes, floppy disks and optical data storage devices, etc. The computer-readable storage media mentioned in this application may be non-volatile storage media, in other words, may be non-transitory storage media.
应当理解的是,实现上述实施例的全部或部分步骤可以通过软件、硬件、固件或者其任意结合来实现。当使用软件实现时,可以全部或部分地以计算机程序产品的形式实现。该计算机程序产品包括一个或多个计算机指令。该计算机指令可以存储在上述计算机可读存储介质中。It should be understood that all or part of the steps to implement the above embodiments can be implemented through software, hardware, firmware, or any combination thereof. When implemented using software, it may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. The computer instructions may be stored in the computer-readable storage medium described above.
以上所述实施例仅用以说明本申请的技术方案,而非对其限制;尽管参照前述实施例对本申请进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本申请各实施例技术方案的精神和范围,均应包含在本申请的保护范围之内。The above-described embodiments are only used to illustrate the technical solutions of the present application, but not to limit them; although the present application has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that they can still implement the above-mentioned implementations. The technical solutions described in the examples are modified, or some of the technical features are equivalently replaced; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions in the embodiments of this application, and should be included in within the protection scope of this application.

Claims (13)

  1. 一种图像分割方法,其特征在于,所述方法包括:An image segmentation method, characterized in that the method includes:
    获取待分割的原始图像,所述原始图像包括目标物体;Obtain an original image to be segmented, the original image including the target object;
    获取初始分割图像,所述初始分割图像为对所述原始图像中的所述目标物体进行粗分割后的图像;Obtain an initial segmented image, which is an image after rough segmentation of the target object in the original image;
    将所述初始分割图像和所述原始图像输入到活动轮廓模型中进行图像分割,得到所述原始图像的目标分割图像,所述活动轮廓模型采用目标能量泛函数;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, and the active contour model uses a target energy functional function;
    其中,所述目标能量泛函数用于指示图像分割过程中产生的中间分割图像的分割误差,所述目标能量泛函数包括携带常数权重系数的保真项、携带第一自适应权重系数的长度项和携带第二自适应权重系数的光滑项,所述第一自适应权重系数和所述第二自适应权重系数通过所述原始图像确定。Wherein, the target energy functional function is used to indicate the segmentation error of the intermediate segmentation image generated during the image segmentation process. The target energy functional function includes a fidelity term carrying a constant weight coefficient and a length term carrying a first adaptive weight coefficient. and a smooth term carrying a second adaptive weight coefficient, the first adaptive weight coefficient and the second adaptive weight coefficient being determined by the original image.
  2. 如权利要求1所述的方法,其特征在于,所述第一自适应权重系数和所述第二自适应权重系数分别通过如下公式表示:The method of claim 1, wherein the first adaptive weight coefficient and the second adaptive weight coefficient are respectively expressed by the following formulas:
    Figure PCTCN2022138172-appb-100001
    Figure PCTCN2022138172-appb-100001
    Figure PCTCN2022138172-appb-100002
    Figure PCTCN2022138172-appb-100002
    其中,
    Figure PCTCN2022138172-appb-100003
    为所述第一自适应权重系数,y为所述原始图像中像素的像素坐标,I(y)为所述原始图像中y指示的像素的像素值,β(I)为所述第二自适应权重系数,
    Figure PCTCN2022138172-appb-100004
    为梯度运算符。
    in,
    Figure PCTCN2022138172-appb-100003
    is the first adaptive weight coefficient, y is the pixel coordinate of the pixel in the original image, I(y) is the pixel value of the pixel indicated by y in the original image, β(I) is the second adaptive weight coefficient,
    Figure PCTCN2022138172-appb-100004
    is the gradient operator.
  3. 如权利要求1所述的方法,其特征在于,所述目标能量泛函数包括表示所述中间分割图像的主变量;The method of claim 1, wherein the target energy functional includes a main variable representing the intermediate segmentation image;
    所述将所述初始分割图像和所述原始图像输入到活动轮廓模型中进行图像分割,得到所述原始图像的目标分割图像,包括:The step of inputting 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 includes:
    将所述初始分割图像和所述原始图像输入到所述活动轮廓模型中,通过所述活动轮廓模型,采用最优化算法对所述目标能量泛函数进行最小化处理,得到满足所述目标能量泛函数最小化的目标主变量,所述目标主变量表示的中间分割图像为所述目标分割图像,所述中间分割图像为通过对所述初始分割图像的分割误差进行优化得到的优化后的初始分割图像。The initial segmented image and the original image are input into the active contour model. Through the active contour model, an optimization algorithm is used to minimize the target energy functional function to obtain a target energy functional function that satisfies the target energy functional function. The target main variable for function minimization, the intermediate segmentation image represented by the target main variable is the target segmentation image, and the intermediate segmentation image is the optimized initial segmentation obtained by optimizing the segmentation error of the initial segmentation image. image.
  4. 如权利要求3所述的方法,其特征在于,所述最优化算法为交替方向乘子法;The method of claim 3, wherein the optimization algorithm is an alternating direction multiplier method;
    所述采用最优化算法对所述目标能量泛函数进行最小化处理,得到满足所述目标能量泛函数最小化的目标主变量,包括:The optimization algorithm is used to minimize the target energy functional function to obtain the target main variables that satisfy the minimization of the target energy functional function, including:
    根据所述目标能量泛函数,构建增广拉格朗日函数,所述增广拉格朗日函数至少包括表 示所述中间分割图像的主变量;According to the target energy functional function, an augmented Lagrangian function is constructed, the augmented Lagrangian function at least includes a main variable representing the intermediate segmentation image;
    采用所述交替方向乘子法对所述增广拉格朗日函数中的主变量进行迭代优化,得到迭代优化后的主变量,所述迭代优化后的主变量为所述满足所述目标能量泛函数最小化的目标主变量。The alternating direction multiplier method is used to iteratively optimize the main variables in the augmented Lagrangian function to obtain the iteratively optimized main variables. The iteratively optimized main variables are the ones that satisfy the target energy. The target host variable for minimizing the generic function.
  5. 如权利要求4所述的方法,其特征在于,所述增广拉格朗日函数通过如下公式表示:The method of claim 4, wherein the augmented Lagrangian function is expressed by the following formula:
    Figure PCTCN2022138172-appb-100005
    Figure PCTCN2022138172-appb-100005
    其中,Γ(u(x),p,q)为所述增广拉格朗日函数,x为所述中间分割图像中像素的像素坐标,u(x)为所述中间分割图像中x指示的像素的像素值,u(x)为表示所述中间分割图像的主变量,p为辅助变量,且
    Figure PCTCN2022138172-appb-100006
    q为拉格朗日乘子,E(u(x))为所述目标能量泛函数,Ω为所述中间分割图像的图像区域,θ为罚系数。
    Where, Γ(u(x),p,q) is the augmented Lagrangian function, x is the pixel coordinate of the pixel in the intermediate segmented image, u(x) is the x indication in the intermediate segmented image The pixel value of the pixel, u(x) is the main variable representing the intermediate segmentation image, p is the auxiliary variable, and
    Figure PCTCN2022138172-appb-100006
    q is the Lagrange multiplier, E(u(x)) is the target energy functional function, Ω is the image area of the intermediate segmentation image, and θ is the penalty coefficient.
  6. 如权利要求4所述的方法,其特征在于,所述增广拉格朗日函数还包括辅助变量和拉格朗日乘子,所述辅助变量为与所述中间分割图像的主变量的梯度有关的变量;The method of claim 4, wherein the augmented Lagrangian function further includes an auxiliary variable and a Lagrange multiplier, and the auxiliary variable is a gradient with a main variable of the intermediate segmented image. relevant variables;
    所述采用所述交替方向乘子法对所述增广拉格朗日函数中的主变量进行迭代优化,得到迭代优化后的主变量,包括:The alternating direction multiplier method is used to iteratively optimize the main variables in the augmented Lagrangian function to obtain the iteratively optimized main variables, including:
    根据所述增广拉格朗日函数构建最小化方程,所述最小化方程为对表示所述中间分割图像的主变量和所述辅助变量进行联合优化的方程;Construct a minimization equation according to the augmented Lagrangian function, where the minimization equation is an equation that jointly optimizes the main variable representing the intermediate segmentation image and the auxiliary variable;
    根据最小化方程,采用所述交替方向乘子法构建迭代方程,所述迭代方程包括第一方程、第二方程和第三方程,所述第一方程用于根据第k-1次优化后的辅助变量和第k-1次优化后的拉格朗日乘子确定第k次优化后的主变量,所述第二方程用于根据第k次优化后的主变量和第k-1次优化后的拉格朗日乘子确定第k次优化后的辅助变量,所述第三方程用于根据第k次优化后的主变量和第k次优化后的辅助变量确定第k次优化后的拉格朗日乘子,k为正整数;According to the minimization equation, the alternating direction multiplier method is used to construct an iterative equation. The iterative equation includes a first equation, a second equation and a third equation. The first equation is used according to the k-1th optimization. The auxiliary variables and the Lagrange multiplier after the k-1th optimization determine the main variable after the k-th optimization, and the second equation is used to determine the main variable after the k-th optimization and the k-1th optimization. The final Lagrange multiplier determines the auxiliary variable after the kth optimization, and the third equation is used to determine the kth optimization based on the main variable after the kth optimization and the auxiliary variable after the kth optimization. Lagrange multiplier, k is a positive integer;
    将通过所述第一方程确定的满足预设条件的主变量,确定为所述迭代优化后的主变量。The main variables that satisfy the preset conditions determined through the first equation are determined as the main variables after the iterative optimization.
  7. 如权利要求6所述的方法,其特征在于,所述最小化方程通过如下公式表示:The method of claim 6, wherein the minimization equation is expressed by the following formula:
    Figure PCTCN2022138172-appb-100007
    Figure PCTCN2022138172-appb-100007
    其中,x为所述中间分割图像中像素的像素坐标,u(x)为所述中间分割图像中x指示的像素的像素值,u(x)为表示所述中间分割图像的主变量,p为所述辅助变量,q为所述拉格朗日乘子,Γ(u,p,q)为所述增广拉格朗日函数。Where, x is the pixel coordinate of the 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 Lagrangian function.
  8. 如权利要求6所述的方法,其特征在于,所述迭代方程通过如下公式表示:The method of claim 6, wherein the iterative equation is expressed by the following formula:
    Figure PCTCN2022138172-appb-100008
    Figure PCTCN2022138172-appb-100008
    其中,k为正整数,
    Figure PCTCN2022138172-appb-100009
    为所述第一方程,u(x) k为对所述初始分割图像的分割误差进行第k次优化后得到的图像中x指示的像素的像素值,u(x) k为所述第k次优化后的主变量,p k-1为所述第k-1次优化后的辅助变量,q k-1为所述第k-1次优化后的拉格朗日乘子,
    Figure PCTCN2022138172-appb-100010
    为所述第二方程,p k为所述第k次优化后的辅助变量,
    Figure PCTCN2022138172-appb-100011
    为所述第三方程,q k为所述第k次优化后的拉格朗日乘子。
    Among them, k is a positive integer,
    Figure PCTCN2022138172-appb-100009
    is the first equation, u(x) k is the pixel value of the pixel indicated by x in the image obtained after the kth optimization of the segmentation error of the initial segmented image, u(x) k is the kth The main variable after the optimization, p k-1 is the auxiliary variable after the k-1 optimization, q k-1 is the Lagrange multiplier after the k-1 optimization,
    Figure PCTCN2022138172-appb-100010
    is the second equation, p k is the auxiliary variable after the kth optimization,
    Figure PCTCN2022138172-appb-100011
    is the third equation, q k is the Lagrange multiplier after the kth optimization.
  9. 如权利要求1所述的方法,其特征在于,所述获取初始分割图像之前,所述方法还包括:The method of claim 1, wherein before obtaining the initial segmentation image, the method further includes:
    将所述原始图像作为初始分割模型的输入,通过所述初始分割模型确定所述初始分割图像,所述初始分割模型用于对所述原始图像中的所述目标物体进行粗分割,得到粗分割的图像。The original image is used as the input of the initial segmentation model, and the initial segmentation image is determined through the initial segmentation model. The initial segmentation model is used to roughly segment the target object in the original image to obtain a rough segmentation. Image.
  10. 如权利要求1-9任一所述的方法,其特征在于,所述目标能量泛函数通过如下公式表示:The method according to any one of claims 1 to 9, characterized in that the target energy functional function is expressed by the following formula:
    Figure PCTCN2022138172-appb-100012
    Figure PCTCN2022138172-appb-100012
    其中,E(u(x))为所述目标能量泛函数,x为所述中间分割图像中像素的像素坐标,u(x)为所述中间分割图像中x指示的像素的像素值,且u(x)∈[0,1],u(x)=1表示x指示的像素位于所述中间分割图像中所述目标物体所在的区域,u(x)=0表示x指示的像素位于所述中间分割图像中除所述目标物体所在的区域之外的其它区域,F(u(x))为所述保真项,L(u(x))为所述长度项,P(u(x))为所述光滑项,λ为所述常数权重系数,I为所述原始图像,
    Figure PCTCN2022138172-appb-100013
    为所 述第一自适应权重系数,β(I)为所述第二自适应权重系数,Ω为所述中间分割图像的图像区域,c1为所述原始图像中位于初始分割曲线内部区域的至少一个像素的像素值的第一平均值,c2为所述原始图像中位于所述初始分割曲线外部区域的至少一个像素的像素值的第二平均值,所述初始分割曲线为用于在所述初始分割图像中分割所述目标物体的轮廓线且所述初始分割曲线为封闭曲线,τ为尺度参数,G τ为高斯函数,
    Figure PCTCN2022138172-appb-100014
    为梯度运算符。
    Wherein, E(u(x)) is the target energy functional function, x is the pixel coordinate of the 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 means that the pixel indicated by x is located in the area where the target object is located in the intermediate segmented image, u(x)=0 means that the pixel indicated by x is located at For other areas in the intermediate segmented image except the area where the target object is located, F(u(x)) is the fidelity term, L(u(x)) is the length term, and P(u( x)) is the smooth term, λ is the constant weight coefficient, I is the original image,
    Figure PCTCN2022138172-appb-100013
    is the first adaptive weight coefficient, β(I) is the second adaptive weight coefficient, Ω is the image area of the intermediate segmentation image, c1 is at least one of the original images located in the internal area of the initial segmentation curve. The first average value of the pixel value of a pixel, c2 is the second average value of the pixel value of at least one pixel in the original image located outside the initial segmentation curve, the initial segmentation curve is used in the The contour line of the target object is segmented in the initial segmentation image and the initial segmentation curve is a closed curve, τ is a scale parameter, G τ is a Gaussian function,
    Figure PCTCN2022138172-appb-100014
    is the gradient operator.
  11. 一种图像分割装置,其特征在于,所述装置包括:An image segmentation device, characterized in that the device includes:
    第一获取模块,用于获取待分割的原始图像,所述原始图像包括目标物体;The first acquisition module is used to acquire the original image to be segmented, where the original image includes the target object;
    第二获取模块,用于获取初始分割图像,所述初始分割图像为对所述原始图像中的所述目标物体进行粗分割后的图像;The second acquisition module is used to acquire an initial segmentation image, where the initial segmentation image is an image after rough segmentation of the target object in the original image;
    第一分割模块,用于将所述初始分割图像和所述原始图像输入到活动轮廓模型中进行图像分割,得到所述原始图像的目标分割图像,所述活动轮廓模型采用目标能量泛函数;A first segmentation module, configured 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, and the active contour model uses a target energy functional function;
    其中,所述目标能量泛函数用于指示图像分割过程中产生的中间分割图像的分割误差,所述目标能量泛函数包括携带常数权重系数的保真项、携带第一自适应权重系数的长度项和携带第二自适应权重系数的光滑项,所述第一自适应权重系数和所述第二自适应权重系数通过所述原始图像确定。Wherein, the target energy functional function is used to indicate the segmentation error of the intermediate segmentation image generated during the image segmentation process. The target energy functional function includes a fidelity term carrying a constant weight coefficient and a length term carrying a first adaptive weight coefficient. and a smooth term carrying a second adaptive weight coefficient, the first adaptive weight coefficient and the second adaptive weight coefficient being determined by the original image.
  12. 一种计算机设备,其特征在于,所述计算机设备包括存储器、处理器以及存储在所述存储器中并可在所述处理器上运行的计算机程序,所述计算机程序被所述处理器执行时实现如权利要求1至10任一项所述的方法。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. The computer program is implemented when executed by the processor. The method according to any one of claims 1 to 10.
  13. 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质存储有计算机程序,所述计算机程序被处理器执行时实现如权利要求1至10任一项所述的方法。A computer-readable storage medium, characterized in that the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 10 is implemented.
PCT/CN2022/138172 2022-09-13 2022-12-09 Image segmentation method and apparatus, device, and readable storage medium WO2024055446A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202211108761.X 2022-09-13
CN202211108761.XA CN115457054A (en) 2022-09-13 2022-09-13 Image segmentation method, device and equipment and readable storage medium

Publications (1)

Publication Number Publication Date
WO2024055446A1 true WO2024055446A1 (en) 2024-03-21

Family

ID=84303374

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/138172 WO2024055446A1 (en) 2022-09-13 2022-12-09 Image segmentation method and apparatus, device, and readable storage medium

Country Status (2)

Country Link
CN (1) CN115457054A (en)
WO (1) WO2024055446A1 (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105160660A (en) * 2015-08-17 2015-12-16 中国科学院苏州生物医学工程技术研究所 Active contour blood vessel extraction method and system based on multi-feature Gaussian fitting
CN106548478A (en) * 2016-10-28 2017-03-29 中国科学院苏州生物医学工程技术研究所 Active contour image partition method based on local fit image
CN109523559A (en) * 2018-10-15 2019-03-26 石家庄学院 A kind of noise image dividing method based on improved energy functional model
US20190206052A1 (en) * 2017-12-29 2019-07-04 Shenzhen Institutes Of Advanced Technology Chinese Academy Of Sciences Carpal segmentation and recognition method and system, terminal and readable storage medium
CN110378924A (en) * 2019-07-19 2019-10-25 合肥学院 Level set image segmentation method based on local entropy

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105160660A (en) * 2015-08-17 2015-12-16 中国科学院苏州生物医学工程技术研究所 Active contour blood vessel extraction method and system based on multi-feature Gaussian fitting
CN106548478A (en) * 2016-10-28 2017-03-29 中国科学院苏州生物医学工程技术研究所 Active contour image partition method based on local fit image
US20190206052A1 (en) * 2017-12-29 2019-07-04 Shenzhen Institutes Of Advanced Technology Chinese Academy Of Sciences Carpal segmentation and recognition method and system, terminal and readable storage medium
CN109523559A (en) * 2018-10-15 2019-03-26 石家庄学院 A kind of noise image dividing method based on improved energy functional model
CN110378924A (en) * 2019-07-19 2019-10-25 合肥学院 Level set image segmentation method based on local entropy

Also Published As

Publication number Publication date
CN115457054A (en) 2022-12-09

Similar Documents

Publication Publication Date Title
US11551333B2 (en) Image reconstruction method and device
Annangi et al. A region based active contour method for x-ray lung segmentation using prior shape and low level features
US9014470B2 (en) Non-rigid dense correspondence
WO2020232985A1 (en) Two-dimensional scalar field data visualization method and system based on color table optimization
WO2021136368A1 (en) Method and apparatus for automatically detecting pectoralis major region in molybdenum target image
US11996198B2 (en) Determination of a growth rate of an object in 3D data sets using deep learning
WO2022206020A1 (en) Method and apparatus for estimating depth of field of image, and terminal device and storage medium
WO2022042348A1 (en) Medical image annotation method and apparatus, device, and storage medium
US10726948B2 (en) Medical imaging device- and display-invariant segmentation and measurement
CN109376698B (en) Face modeling method and device, electronic equipment, storage medium and product
US11941738B2 (en) Systems and methods for personalized patient body modeling
WO2020168647A1 (en) Image recognition method and related device
Yung et al. Efficient feature-based image registration by mapping sparsified surfaces
US20240135643A1 (en) Information processing method, computer device, and storage medium
WO2023092959A1 (en) Image segmentation method, training method for model thereof, and related apparatus and electronic device
CN111402221B (en) Image processing method and device and electronic equipment
Wang et al. INSPIRATION: A reinforcement learning-based human visual perception-driven image enhancement paradigm for underwater scenes
WO2024055446A1 (en) Image segmentation method and apparatus, device, and readable storage medium
Zhu et al. MRI enhancement based on visual-attention by adaptive contrast adjustment and image fusion
Zach et al. Practical methods for convex multi-view reconstruction
WO2023193491A1 (en) Information processing method and apparatus, and computer device and storage medium
CN110232401B (en) Focus judging method, device and computer equipment based on picture conversion
Teßmann et al. GPU accelerated normalized mutual information and B-Spline transformation.
Huang et al. TongueMobile: automated tongue segmentation and diagnosis on smartphones
Li et al. A hybrid optimization strategy for registering images with large local deformations and intensity variations

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 22958633

Country of ref document: EP

Kind code of ref document: A1