Image segmentation method, image segmentation model training method and corresponding device

CN118570232APending Publication Date: 2024-08-30INFERVISION MEDICAL TECH CO LTD
0 Cites 2 Cited by

Patent Information

Application Number
CN202410718629.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-04
Publication Date
2024-08-30

AI Technical Summary

Technical Problem

The existing general image segmentation model consumes too much computing and memory resources when processing three-dimensional medical images, making it difficult to apply to the image segmentation needs in the medical imaging field.

Method used

Using the image segmentation method, the image to be segmented is subjected to the first slicing process and feature extraction, and the coding network is used for downsampling and then input into the image segmentation network for segmentation to obtain the preliminary segmentation result, and then the second slicing process and upsampling process are performed. The decoding network is used for splicing to achieve high-resolution image segmentation while reducing computing and memory resource consumption.

Benefits of technology

It realizes the segmentation of large-size images with high resolution, reduces the consumption of memory and computing resources, improves the accuracy and quality of image segmentation, reduces memory usage through Checkpoint technology, and alleviates the problem of gradient explosion or disappearance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118570232A
    Figure CN118570232A
Patent Text Reader

Abstract

The embodiment of the invention discloses an image segmentation method, and relates to the technical field of artificial intelligence. The method is implemented based on an image segmentation model, and the image segmentation model comprises a first coding network, an image segmentation network and a second decoding network. The method comprises the following steps: acquiring a to-be-segmented image, and performing first dicing processing on the to-be-segmented image to obtain a first image block group; performing feature extraction and down-sampling on each image block in the first image block group by using the first coding network to obtain a first feature representation of each image block; performing image segmentation based on the first feature representation of each image block by using an image segmentation network to obtain a first segmentation result; performing second dicing processing on the first segmentation result to obtain a second image block group; and performing up-sampling processing and splicing on the image blocks in the second image block group by using a second decoding network to obtain a second segmentation result. According to the method and the device, the to-be-segmented image is subjected to block processing, and feature extraction and down-sampling are performed on each image block, so that effective segmentation of a high-resolution super-large image is realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of artificial intelligence technology, and in particular to an image segmentation method, an image segmentation model training method and a device. Background Art

[0002] With the rapid development of large-scale model technology in the field of artificial intelligence, large models have begun to be applied in the field of image processing to achieve more accurate and efficient image segmentation. The SAM (SegmentAnything Model) model is one of the representatives. It can generate arbitrary segmentation results on a two-dimensional image according to a given prompt through deep learning technology, and performs well in general image segmentation.

[0003] However, since general image segmentation models such as SAM usually use a Transformer-like structure, the memory and computational complexity of this structure will increase exponentially when processing three-dimensional medical imaging data. Medical images are usually three-dimensional data, and the Transformer structure needs to perform complex attention calculations on each three-dimensional position when processing three-dimensional data, which leads to a significant increase in the model's memory usage and computational consumption. This massive resource demand makes traditional segmentation models unsuitable for image segmentation needs in the field of medical imaging. Summary of the invention

[0004] In view of this, the present application provides an image segmentation method and device so as to reduce the consumption of memory and computing resources while achieving high-resolution image segmentation.

[0005] This application provides the following solutions:

[0006] According to a first aspect, an image segmentation method is provided, characterized in that the method is implemented based on an image segmentation model, and the image segmentation model includes a first encoding network, an image segmentation network, and a second decoding network; the method includes: obtaining an image to be segmented, performing a first block cutting process on the image to be segmented, and obtaining a first image block group; using the first encoding network, respectively performing feature extraction and downsampling on each image block in the first image block group, and obtaining a first feature representation of each image block; using the image segmentation network, performing image segmentation based on the first feature representation of each image block, and obtaining a first segmentation result; performing a second block cutting process on the first segmentation result, and obtaining a second image block group; using the second decoding network, respectively performing upsampling and splicing on each image block in the second image block group, and obtaining a second segmentation result.

[0007] According to an achievable method in an embodiment of the present application, the first encoding network includes a plurality of sequentially connected encoding layers, each encoding layer including a convolutional layer for feature extraction and a pooling layer for downsampling; the second decoding network includes a plurality of sequentially connected convolutional layers and splicing layers, each convolutional layer is used to upsample each input image block, and the splicing layer is used to splice each input image block.

[0008] According to an achievable method in an embodiment of the present application, the image segmentation network includes a Unet model; based on the position of each block in the first image block, the first feature representation of each block is fused to obtain a fused feature representation, and the fused feature representation is input into the Unet model.

[0009] According to an achievable method in an embodiment of the present application, the number of image blocks obtained by the first block slicing process and the second block slicing process is the same, and the upsampling and the downsampling are performed at the same multiple.

[0010] According to an achievable method in an embodiment of the present application, the image to be segmented is a three-dimensional medical image; the first segmentation result and the second segmentation result are segmentation results for a specific organ, body part or lesion.

[0011] According to a second aspect, a training method for an image segmentation model is provided, characterized in that the method comprises: obtaining training data comprising a plurality of training samples, the training samples comprising image samples and their annotated segmentation results; using the training data to train an image segmentation model, wherein the image segmentation model comprises a first encoding network, an image segmentation network and a second decoding network; performing a first block cutting process on the image samples to obtain a first image block group; using the first encoding network, respectively performing feature extraction and downsampling on each image block in the first image block group to obtain a first feature representation of each image block; using the image segmentation network, performing image segmentation based on the first feature representation of each image block to obtain a first segmentation result; performing a second block cutting process on the first segmentation result to obtain a second image block group; using the second decoding network, respectively performing upsampling and splicing on each image block in the second image block group to obtain a second segmentation result; the objectives of the training include: minimizing the difference between the second segmentation result and the annotated segmentation result of the image sample.

[0012] According to an achievable method in an embodiment of the present application, the first encoding network includes a plurality of sequentially connected encoding layers, each encoding layer including a convolutional layer for feature extraction and a pooling layer for downsampling; the second decoding network includes a plurality of sequentially connected convolutional layers and splicing layers, each convolutional layer is used to upsample each input image block, and the splicing layer is used to splice each input image block.

[0013] According to an achievable method in an embodiment of the present application, the image segmentation network includes a Unet model; based on the position of each block in the first image block, the first feature representation of each block is fused to obtain a fused feature representation, and the fused feature representation is input into the Unet model.

[0014] According to an achievable method in an embodiment of the present application, during the training process, based on the loss function value corresponding to the training objective, the model parameters of the image segmentation model are updated using back propagation; wherein the back propagation includes: the second decoding network transmits the loss function value to the first decoding network and the second decoding network transmits the loss function value to the image segmentation network.

[0015] According to an achievable method in an embodiment of the present application, the loss function value is calculated based on the image block, and the loss function value is transferred based on the image block during the back propagation process.

[0016] According to an achievable method in an embodiment of the present application, a gradient checkpoint technology is used for preset key layers in the first encoding network, the image segmentation network, and the second decoding network during the training process.

[0017] According to a third aspect, an image segmentation device is provided, characterized in that the device is implemented based on an image segmentation model, and the image segmentation model includes a first encoding network, an image segmentation network, and a second decoding network; the device includes: a first blocking unit, which obtains an image to be segmented, and performs a first blocking process on the image to be segmented to obtain a first image block group; a first encoding unit, which uses the first encoding network to perform feature extraction and downsampling on each image block in the first image block group to obtain a first feature representation of each image block; a segmentation unit, which uses the image segmentation network to perform image segmentation based on the first feature representation of each image block to obtain a first segmentation result; a second blocking unit, which performs a second blocking process on the first segmentation result to obtain a second image block group; and a second decoding unit, which uses the second decoding network to perform upsampling and splicing on each image block in the second image block group to obtain a second segmentation result.

[0018] According to a fourth aspect, a training device for an image segmentation model is provided, characterized in that the device comprises: a sample acquisition unit, which acquires training data including a plurality of training samples, wherein the training samples include image samples and their annotated segmentation results; a model training unit, which uses the training data to train an image segmentation model, wherein the image segmentation model includes a first encoding network, an image segmentation network, and a second decoding network; the image samples are subjected to a first block processing to obtain a first image block group; the first encoding network is used to perform feature extraction and down-sampling on each image block in the first image block group to obtain a first feature representation of each image block; the image segmentation network is used to perform image segmentation based on the first feature representation of each image block to obtain a first segmentation result; the first segmentation result is subjected to a second block processing to obtain a second image block group; the second decoding network is used to perform up-sampling and splicing on each image block in the second image block group to obtain a second segmentation result; the training objectives include: minimizing the difference between the second segmentation result and the annotated segmentation result of the image sample.

[0019] According to a third aspect, a computer-readable storage medium is provided, on which a computer program is stored, and when the program is executed by a processor, the steps of the method described in any one of the first and second aspects are implemented.

[0020] According to a fourth aspect, there is provided an electronic device, comprising:

[0021] One or more processors; and a memory associated with the one or more processors, the memory being used to store program instructions, and the program instructions, when read and executed by the one or more processors, execute the steps of the method described in any one of the first and second aspects above.

[0022] According to the specific embodiments provided in this application, this application discloses the following technical effects:

[0023] 1) Based on the existing image segmentation method, the present application performs a first block processing on the image to be segmented before segmenting the image, and extracts features and downsamples each image block obtained before providing it to the image segmentation network for image segmentation, thereby reducing the computing resources required by the image segmentation network; after image segmentation, the segmentation result is subjected to a second block processing, and then upsampled and spliced ​​to ensure the high resolution of the image segmentation result. The image segmentation method of the present application realizes the segmentation of high-resolution large-size images and reduces the consumption of memory and computing resources.

[0024] 2) In the first encoding network, the present application performs feature extraction through the convolution layer and down-sampling through the pooling layer; in the second decoding network, up-sampling is performed through the convolution layer, and each input image block is spliced ​​through the splicing layer. This is equivalent to superimposing a small U-shaped network on the image segmentation network, so that the present application can effectively capture image information while maintaining high resolution of the image, improve the accuracy and quality of image segmentation, and reduce the consumption of memory and computing resources overall.

[0025] 3) The image segmentation network of the present application includes a Unet model. By utilizing the symmetry and jump connections of the Unet structure, the present application can effectively fuse features from different blocks to obtain sufficient global context information, thereby enabling accurate segmentation based on the global context and providing a basis for the reconstruction of high-resolution image segmentation results.

[0026] 4) The present application uses the same number of blocks and sampling multiples for the first block cutting and the second block cutting, so that the image can be restored to its original size after the segmentation is completed, thereby improving the clarity and authenticity of the segmentation result.

[0027] 5) In the model training process of the present application, the second decoding network transmits the loss function value to the first decoding network and the image segmentation network respectively, realizing the back propagation of the loss function value in the entire model. And in the back propagation process, the loss function value is transmitted based on the image block, so that the image segmentation model can be effectively trained and iterated.

[0028] 6) This application adopts Checkpoint technology to save only the gradients of key layers during the forward propagation process, reducing memory usage and alleviating problems such as gradient explosion or disappearance.

[0029] Of course, any product implementing the present application does not necessarily need to achieve all of the advantages described above at the same time. BRIEF DESCRIPTION OF THE DRAWINGS

[0030] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0031] Figure 1 A system architecture diagram applicable to the embodiments of the present application;

[0032] Figure 2 A flowchart of an image segmentation method provided in an embodiment of the present application;

[0033] Figure 3A schematic diagram of the principle of the image segmentation method provided in the embodiment of the present application;

[0034] Figure 4 A schematic diagram of the principle of the training method of the image segmentation model provided in the embodiment of the present application;

[0035] Figure 5 A schematic block diagram of an image segmentation device provided in an embodiment of the present application;

[0036] Figure 6 A schematic block diagram of a training device for an image segmentation model provided in an embodiment of the present application;

[0037] Figure 7 A schematic block diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0038] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments in the present application belong to the scope of protection of this application.

[0039] The terms used in the embodiments of the present invention are only for the purpose of describing specific embodiments, and are not intended to limit the present invention. The singular forms "a", "said" and "the" used in the embodiments of the present invention and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings.

[0040] It should be understood that the term "and / or" used in this article is only a description of the association relationship of associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this article generally indicates that the associated objects before and after are in an "or" relationship.

[0041] The word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining" or "in response to detecting", depending on the context. Similarly, the phrases "if it is determined" or "if (stated condition or event) is detected" may be interpreted as "when it is determined" or "in response to determining" or "when detecting (stated condition or event)" or "in response to detecting (stated condition or event)", depending on the context.

[0042] With the development of artificial intelligence technology, there are already some image segmentation technologies, such as Unet network, DeepLab image segmentation model, FCN (Fully Convolutional Network), etc. However, compared with two-dimensional data, image segmentation networks have higher requirements on device computing resources and memory when processing three-dimensional data. To solve this problem, there are currently two main solutions:

[0043] 1) Adjusting the input resolution: By reducing the resolution of the input image, the number of activation values ​​in each layer of the image segmentation network such as Unet is reduced, thereby reducing the amount of computation and memory requirements. However, this method may cause information loss and fail to obtain high-quality image segmentation results.

[0044] 2) Block input: The input image is divided into multiple blocks, and then each block is predicted using an image segmentation network such as Unet, and the results are combined. This method avoids the information loss problem caused by resolution reduction, but it also brings new problems. Since image segmentation networks such as Unet can only see local image blocks, this is a significant disadvantage for tasks that require global information for accurate segmentation.

[0045] In view of this, the present application provides a new idea. In order to facilitate the understanding of the present application, the system architecture on which the present application is based is first described. Figure 1 An exemplary system architecture to which the embodiments of the present application can be applied is shown. Figure 1 As shown in , the system architecture may include: a user device and an image segmentation device, an image segmentation model and a model training device located on the server side.

[0046] The user can send the image to be segmented to the image segmentation device on the server side through the user equipment.

[0047] User devices may include, but are not limited to, smart mobile terminals, smart home devices, wearable devices, PCs (Personal Computers), smart medical devices, etc. Smart mobile devices may include mobile phones, tablet computers, laptops, PDAs (Personal Digital Assistants), Internet cars, etc. Smart home devices may include smart TVs, smart refrigerators, etc. Wearable devices may include smart watches, smart glasses, virtual reality devices, augmented reality devices, mixed reality devices (i.e., devices that can support virtual reality and augmented reality), etc. Smart medical devices may include medical imaging diagnostic aids, surgical aids, medical imaging analysis devices, remote medical diagnostic aids, etc.

[0048] The image segmentation device can use the method provided in the embodiment of the present application to generate an image segmentation result. The image segmentation process of the image segmentation device involves the use of an image segmentation model, which is trained by a model training device.

[0049] The image segmentation device and the model training device can be set up as an independent server, or can be set up in a server group, or can be set up in a cloud server. A cloud server, also known as a cloud computing server or cloud host, is a host product in the cloud computing service system to solve the defects of difficult management and weak service scalability in traditional physical hosts and virtual private servers (VPS). Figure 1 In addition to the shown architecture, the image segmentation device and the model training device can also be set on a computer terminal with strong computing power.

[0050] As one of the achievable methods, the user can input the original image to be segmented through the user device, and the user device sends the image to be segmented to the image segmentation device on the server side through the network. After the image segmentation device generates an image segmentation result for the image to be segmented, it returns the result to the user device through the network.

[0051] It should be understood that Figure 1 The user equipment, image segmentation device, image segmentation model and model training device in the figure are only illustrative. According to the implementation requirements, there may be any number of user equipment, image segmentation device, image segmentation model and model training device.

[0052] Apart from Figure 1 In addition to the system architecture shown, the above-mentioned image segmentation device can also be an application located in the user equipment, or can also be a functional unit such as a plug-in or a software development kit (SDK) set in the application.

[0053] Figure 2 This is a flow chart of the image segmentation method provided in the embodiment of the present application. The method can be performed by Figure 1 The image segmentation device in the system shown in the figure is executed. The method is implemented based on an image segmentation model, which includes a first encoding network, an image segmentation network, and a second decoding network. Figure 2 As shown in , the method may include the following steps:

[0054] Step 201: obtaining an image to be segmented, and performing a first block cutting process on the image to be segmented to obtain a first image block group.

[0055] Step 202: Using the first encoding network, perform feature extraction and down-sampling on each image block in the first image block group to obtain a first feature representation of each image block.

[0056] Step 203: Using an image segmentation network, perform image segmentation based on the first feature representation of each image block to obtain a first segmentation result.

[0057] Step 204: performing a second block segmentation process on the first segmentation result to obtain a second image block group.

[0058] Step 205: using the second decoding network, up-sampling and splicing the image blocks in the second image block group are performed respectively to obtain a second segmentation result.

[0059] It can be seen from the above process that, based on the existing image segmentation method, the present application performs a first block processing on the image to be segmented before segmenting the image, and extracts features and downsamples each image block obtained before providing it to the image segmentation network for image segmentation, thereby reducing the computing resources required by the image segmentation network; after image segmentation, the segmentation result is subjected to a second block processing, and then upsampled and spliced ​​to ensure the high resolution of the image segmentation result. Through the image segmentation method of the present application, the segmentation of large-size images with high resolution is achieved and the consumption of memory and computing resources is reduced.

[0060] The following is a detailed description of each step in the above process and the effects that can be further produced in conjunction with the embodiments. It should be noted that the "first" and "second" limitations involved in the present disclosure do not have limitations in terms of size, order, and quantity, and are only used to distinguish them in name. For example, "first slicing process" and "second slicing process" are used to distinguish the two slicing processes in name.

[0061] Firstly, the above step 201, namely "obtaining an image to be segmented, performing a first block cutting process on the image to be segmented, and obtaining a first image block group" is described in detail in conjunction with the embodiment.

[0062] The present application performs image segmentation operations on the image to be segmented. Image segmentation is an important task in the field of computer vision. Its goal is to separate and identify different objects or regions in an image based on the characteristics of the image, and to divide a digital image into multiple regions or pixel sets with semantic information.

[0063] The image to be segmented in this application is the image to be segmented. The image to be segmented can be an original image obtained by a certain device in certain fields, such as photos of people, scenery, animals, etc. taken by users through cameras and other devices; X-rays, computed tomography (CT) scans, magnetic resonance imaging (MRI), etc. taken by medical equipment for medical diagnosis and research; images of the earth's surface obtained from satellites or aircraft, etc. The image to be segmented can also be an image obtained after the original image is processed by certain image processing techniques, such as images obtained after cropping, rotation, etc. The image to be segmented can be in a variety of picture formats, such as JPEG / JPG, PNG, etc. The image to be segmented can be a two-dimensional image or a three-dimensional image.

[0064] Figure 3 The schematic diagram of the principle of the image segmentation method provided in the embodiment of the present application is as follows: Figure 3 As shown, the image to be segmented is subjected to a first block cutting process, and the blocks obtained by the first block cutting process constitute a first image block group. The union of the image blocks in the first image block group is the image to be segmented. The first block cutting process is a complete cutting of the image to be segmented. The image to be segmented can be segmented into a plurality of image blocks of the same size according to a preset number, or a window of a fixed size can be defined and the blocks can be cut by sliding the window on the image to be segmented.

[0065] The above step 202, i.e., "using the first encoding network to perform feature extraction and down-sampling on each image block in the first image block group to obtain a first feature representation of each image block" is described in detail below in conjunction with the embodiments.

[0066] The first encoding network is used to perform feature extraction and downsampling on each image block in the first image block group. Each image block in the first image block group is input into the first encoding network respectively. The first encoding network performs feature extraction and downsampling operations to obtain a first feature representation of the image block.

[0067] The first encoding network can be implemented in a variety of ways. For example, a pre-trained feature extractor, such as VGG, ResNet, Inception and other models, can be used in combination with downsampling operations such as pooling and difference. The image feature extraction and dimensionality reduction can also be achieved by training an autoencoder to obtain a dense feature representation of the image.

[0068] As a preferred implementation, the first coding network can adopt a small neural network, which is optimized for block input and can include multiple coding layers connected in sequence, each coding layer including a convolution layer for feature extraction and a pooling layer for downsampling. Among them, the number of coding layers can be flexibly set according to the image size and the memory size of the image segmentation device. For example, the first coding network of the present application is provided with 4 coding layers, each coding layer is composed of 2 convolution layers and 1 maximum pooling layer, and the first coding network can perform 4 times dimensionality reduction processing on the first image block group.

[0069] The above step 203, i.e., "using an image segmentation network to perform image segmentation based on the first feature representation of each image block to obtain a first segmentation result", is described in detail below in conjunction with an embodiment.

[0070] The image segmentation network performs image segmentation based on the first feature representation of each tile, wherein the first feature representation of each tile can be directly spliced ​​according to the position of each tile and then input into the image segmentation network, or the position information of each tile and the first feature representation of each tile can be input into the image segmentation network so that the image segmentation network adopts a position-based fusion coding method for the first feature representation.

[0071] Image segmentation network can be implemented by a variety of neural network models, such as Fully Convolutional Network (FCN), Segnet model, etc.

[0072] As an implementable manner, the image segmentation network includes a Unet model. Based on the position of each block in the first image block, the first feature representation of each block is fused to obtain a fused feature representation, and the fused feature representation is input into the Unet model.

[0073] Unet is a deep learning architecture commonly used in image segmentation tasks. It is named after its U-shaped network structure. Unet consists of two symmetrical parts, the left and the right, with connections across different depths in the middle. The left side is the encoder, which is used to capture image features, and the right side is the decoder, which is used to map these features back to the size of the input image. Unet uses skip connections to connect the feature map in the encoder with the corresponding feature map in the decoder, which solves the problem of information loss in traditional convolutional neural networks and helps the network learn more fine-grained features. Unet has achieved great success in fields such as medical image segmentation, and is also widely used in various image segmentation tasks due to its excellent performance, such as road detection, portrait segmentation, satellite image segmentation, etc.

[0074] Since the input to the Unet model is the fused feature representation of the entire image, the Unet model can effectively fuse features from different blocks to obtain sufficient global context information, thereby performing accurate segmentation based on the global context. In the entire image segmentation process, Unet occupies the largest memory and computing resources. If the image to be segmented is directly input into Unet, a large amount of resources will be consumed when processing high-resolution images such as those in the medical field, or even three-dimensional images. However, in this application, after being processed by the first encoding network, the features of each block after downsampling have been obtained, which reduces the amount of data input to Unet, thereby reducing the memory and computing resources consumed by Unet for image segmentation. In view of the fact that Unet is a relatively mature technology in this field, this application will not be described in further detail here.

[0075] The present application obtains a first segmentation result according to the output of the image segmentation network, and the first segmentation result is a preliminary segmentation result for the image to be segmented. According to different image segmentation network structures, the output result of the image segmentation network may be in a variety of data formats, such as pixel-level label maps, probability maps, and bounding boxes. As a preferred embodiment, when the image segmentation network includes a Unet model, the output of the Unet model is a label map of the same size as the input image, in which each pixel is assigned a category label to indicate the object category to which the pixel belongs.

[0076] The above step 204, namely "performing a second block cutting process on the first segmentation result to obtain a second image block group" is described in detail below in conjunction with an embodiment.

[0077] In order to further improve the quality of the segmentation result, the first segmentation result is subjected to a second block cutting process. The second block cutting process divides the first segmentation result into blocks according to pixels. The first segmentation result can be divided into a plurality of image blocks of the same size according to a preset number, or a window of a fixed size can be defined and the blocks can be cut by sliding the window on the first segmentation result. The number of image blocks obtained by the second block cutting process can be the same as the number of image blocks obtained by the first block cutting process, or can be set to a different number according to requirements.

[0078] The above step 205, i.e., "using the second decoding network to upsample and splice each image block in the second image block group to obtain a second segmentation result" is described in detail below in conjunction with the embodiments.

[0079] The second decoding network is used to perform upsampling and splicing on each image block in the second image block group. Upsampling can be implemented in a variety of ways, for example, using interpolation techniques such as bilinear interpolation, nearest neighbor difference, etc. For splicing, each image block can be directly spliced ​​based on position. The second decoding network can perform multiple upsampling and splicing operations, which can be flexibly set according to the size of the image to be segmented and the requirements of segmentation accuracy.

[0080] As a preferred embodiment, the second decoding network includes a plurality of sequentially connected convolutional layers and splicing layers, each convolutional layer is used to upsample each input image block, and the splicing layer is used to splice each input image block. For example, the second decoding network of the present application can be provided with 4 convolutional layers and 1 splicing layer, and the second decoding network can perform 4 times dimensionality increase processing on the second image block group.

[0081] As an implementable manner, when the number of image blocks obtained by the first slicing process and the second slicing process is the same, upsampling and downsampling of the same multiple are performed, and the second segmentation result can maintain the same resolution as the image to be segmented.

[0082] The image segmentation method of the present application is implemented based on an image segmentation model, and the image segmentation model is obtained by pre-training. Figure 4 The schematic diagram of the principle of the training method of the image segmentation model provided in the embodiment of the present application is as follows: Figure 4 As shown, the training method includes:

[0083] Obtain training data including multiple training samples, where the training samples include image samples and their annotated segmentation results. The training data can be obtained from an existing image segmentation dataset or constructed by manual annotation or the like. The image sample is the image before segmentation, and the segmentation result is the pixel-level label map corresponding to the image.

[0084] The image segmentation model is trained using the training data, wherein the image segmentation model includes a first encoding network, an image segmentation network and a second decoding network.

[0085] The image sample is subjected to a first block cutting process to obtain a first image block group. The union of the image blocks in the first image block group is the image sample. The first block cutting process is a complete cutting of the image sample. The image sample can be cut into a plurality of image blocks of the same size according to a preset number, or a fixed-size window can be defined and the block cutting can be performed by sliding the window on the image sample.

[0086] The first coding network is used to perform feature extraction and downsampling on each image block in the first image block group, and the first feature representation of each image block is obtained. The first coding network is used to perform feature extraction and downsampling on each image block in the first image block group. Each image block in the first image block group is sequentially input into the first coding network, and the first coding network performs feature extraction and downsampling operations to obtain a first feature representation of the image block.

[0087] The first encoding network can be implemented in a variety of ways, for example, models such as VGG (Visual Geometry Group), ResNet, Inception, etc., combined with downsampling operations such as pooling and difference; it can also be implemented through an autoencoder to achieve image feature extraction and dimensionality reduction to obtain a dense feature representation of the image.

[0088] As a preferred implementation, the first coding network can adopt a small neural network, which is optimized for block input and can include multiple coding layers connected in sequence, each coding layer including a convolution layer for feature extraction and a pooling layer for downsampling. Among them, the number of coding layers can be flexibly set according to the image size and the memory size of the image segmentation device. For example, the first coding network of the present application is provided with 4 coding layers, each coding layer is composed of 2 convolution layers and 1 maximum pooling layer, and the first coding network can perform 4 times dimensionality reduction processing on the first image block group.

[0089] The image segmentation network is used to perform image segmentation based on the first feature representation of each image block to obtain a first segmentation result.

[0090] The image segmentation network performs image segmentation based on the first feature representation of each tile. The first feature representation of each tile can be directly spliced ​​according to the position of each tile and then input into the image segmentation network. Alternatively, the first feature representation can be calculated by a certain method, such as weighted addition or convolution, according to the position of each tile, and then fused and input into the image segmentation network.

[0091] The image segmentation network can be implemented by a variety of models, such as a fully convolutional network (FCN), a Segnet model, etc. As an implementable method, the image segmentation network includes a Unet model, which fuses the first feature representations of each block based on the position of each block in the first image block to obtain a fused feature representation, and inputs the fused feature representation into the Unet model.

[0092] The present application obtains a first segmentation result according to the output of the image segmentation network, and the first segmentation result is a preliminary segmentation result for the image sample. According to different image segmentation network structures, the output result of the image segmentation network may be in a variety of data formats, such as pixel-level label maps, probability maps, and bounding boxes. As a preferred embodiment, when the image segmentation network includes a Unet model, the output of the Unet model is a label map of the same size as the input image, in which each pixel is assigned a category label to indicate the object category to which the pixel belongs.

[0093] The first segmentation result is subjected to a second block cutting process to obtain a second image block group. The second block cutting process divides the first segmentation result into blocks according to pixels, and the first segmentation result can be divided into a plurality of image blocks of the same size according to a preset number, or a window of a fixed size can be defined and the block cutting can be performed by sliding the window on the first segmentation result. The number of image blocks obtained by the second block cutting process can be the same as the number of image blocks obtained by the first block cutting process, or can be set to a different number according to requirements.

[0094] The second decoding network is used to perform upsampling processing and splicing on each image block in the second image block group to obtain a second segmentation result.

[0095] The second decoding network is used to perform upsampling and splicing on each image block in the second image block group. Upsampling can be implemented in a variety of ways, for example, using interpolation techniques such as bilinear interpolation, nearest neighbor difference, etc. For splicing, each image block can be directly spliced ​​based on position. The second decoding network can perform multiple upsampling and splicing operations, which can be flexibly set according to the size of the image to be segmented and the requirements of segmentation accuracy.

[0096] As a preferred embodiment, the second decoding network includes a plurality of sequentially connected convolutional layers and splicing layers, each convolutional layer is used to upsample each input image block, and the splicing layer is used to splice each input image block. For example, the second decoding network of the present application can be provided with 4 convolutional layers and 1 splicing layer, and the second decoding network can perform 4 times dimensionality increase processing on the second image block group.

[0097] As an implementable manner, when the number of image blocks obtained by the first slicing process and the second slicing process is the same, upsampling and downsampling are performed at the same multiple, so that the second segmentation result can maintain the same resolution as the image sample.

[0098] The above is the forward propagation process of model training. The training objectives of the present application include: minimizing the difference between the second segmentation result and the segmentation result of the image sample being labeled. A loss function can be constructed based on the above training objectives, and the value of the loss function is used in each round of iteration to update the model parameters (i.e., the parameters of the first encoding network, the image segmentation network, and the second decoding network) using methods such as gradient descent until the preset training end conditions are met. The training end conditions may include, for example, the value of the loss function is less than or equal to a preset loss function threshold, the number of iterations reaches a preset number threshold, etc.

[0099] As a preferred embodiment, during the training process, the model parameters of the image segmentation model are updated using back propagation based on the loss function value corresponding to the training target. The back propagation includes: the second decoding network transmits the loss function value to the first decoding network and the second decoding network transmits the loss function value to the image segmentation network.

[0100] More specifically, the present application calculates the loss function value based on the image block, and transmits the loss function value based on the image block during the back propagation process. The image block used to transmit the loss function can be flexibly selected according to the needs, and the loss function calculated based on all the image blocks can be transmitted, or the loss function calculated based on a preset number of image blocks or image blocks at certain specific positions in the image can be transmitted.

[0101] As a preferred embodiment, during the training process, a gradient checkpoint Checkpoint technology is used for the preset key layers in the first encoding network, the image segmentation network, and the second decoding network. Among them, the preset key layer can be selected according to the needs, for example, a layer with a large amount of parameters can be selected as a key layer, or a layer with a large amount of calculation can be selected as a key layer. Gradient checkpoint Checkpoint technology is a method for reducing memory usage in deep learning models. When training a neural network, back propagation needs to save the gradient information of the intermediate layer in order to calculate the gradient of the parameters and update the model. However, as the depth of the model increases, the gradient information that needs to be saved will also increase, resulting in excessive memory (or video memory) usage. Through the gradient Checkpoint technology, we can save only the gradients of the key layers during the forward propagation process, rather than the gradients of all layers. Doing so not only reduces memory usage, but also helps alleviate the problem of gradient explosion or disappearance. In the forward propagation, we will save additional Checkpoint information, which is used to calculate the gradient during back propagation, thereby achieving efficient gradient calculation and weight update. That is to say, when the gradients of other layers (i.e. non-critical layers) are used in the back-propagation process, the gradients of other layers generated in the forward propagation are calculated, which can greatly reduce the memory (or video memory) usage during model training.

[0102] The above method provided by the embodiment of the present application can be applied to a variety of application scenarios, including but not limited to: medical image analysis, autonomous driving, geographic information systems, and security monitoring. When the method provided by the embodiment of the present application is applied in the medical field, it can be used for auxiliary diagnosis and treatment support, such as for tumor detection, organ segmentation, lesion detection, etc. Specifically, the image to be segmented can be a three-dimensional medical image, and the first segmentation result and the second segmentation result obtained by the method provided by the embodiment of the present application are segmentation results for specific organs, body parts or lesions. For example, when the three-dimensional medical image is a bone image of the pelvic area, the method provided by the embodiment of the present application can be used to segment different types of bones such as the hip bone, femur and coccyx in the image.

[0103] The above is a description of a specific embodiment of the specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0104] According to an embodiment of another aspect, an image segmentation apparatus is provided. Figure 5 A schematic block diagram of an image segmentation device according to an embodiment is shown. The device is arranged at Figure 1 The server side of the architecture shown in Figure 1. Figure 5 As shown, the device is implemented based on an image segmentation model, and the image segmentation model includes a first encoding network, an image segmentation network, and a second decoding network; the device 500 includes:

[0105] The first block segmentation unit 501 obtains the image to be segmented, performs a first block segmentation process on the image to be segmented, and obtains a first image block group.

[0106] The first encoding unit 502 uses a first encoding network to perform feature extraction and down-sampling on each image block in the first image block group to obtain a first feature representation of each image block.

[0107] The segmentation unit 503 uses an image segmentation network to perform image segmentation based on the first feature representation of each image block to obtain a first segmentation result.

[0108] The second block cutting unit 504 performs a second block cutting process on the first segmentation result to obtain a second image block group.

[0109] The second decoding unit 505 uses a second decoding network to perform upsampling processing and splicing on each image block in the second image block group to obtain a second segmentation result.

[0110] As one of the implementable methods, the first encoding unit 502 can be configured to include multiple sequentially connected encoding layers, each encoding layer including a convolution layer for feature extraction and a pooling layer for downsampling; the second decoding network 505 can be configured to include multiple sequentially connected convolution layers and splicing layers, each convolution layer is used to upsample each input image block, and the splicing layer is used to splice each input image block.

[0111] As one of the feasible ways, the image segmentation network in the segmentation unit 503 can be configured as follows: including a Unet model; based on the position of each block in the first image block, fusing the first feature representation of each block to obtain a fused feature representation, and inputting the fused feature representation into the Unet model.

[0112] As one achievable manner, the first slicing unit 501 and the second slicing unit 504 may be configured such that the number of image blocks obtained by the first slicing process and the second slicing process is the same, and upsampling and downsampling are performed at the same multiple.

[0113] As one of the feasible ways, the image to be segmented is a three-dimensional medical image; the first segmentation result and the second segmentation result are segmentation results for a specific organ, body part or lesion.

[0114] According to an embodiment of another aspect, an image segmentation model training device is provided. Figure 6 A schematic block diagram of an image segmentation model training device according to an embodiment is shown, wherein the device is arranged at Figure 1 The server side of the architecture shown.

[0115] like Figure 6 As shown, the device 600 includes:

[0116] The sample acquisition unit 601 acquires training data including a plurality of training samples, where the training samples include image samples and their labeled segmentation results.

[0117] The model training unit 602 uses the training data to train the image segmentation model, wherein the image segmentation model includes a first encoding network, an image segmentation network and a second decoding network; performs a first block processing on the image sample to obtain a first image block group; uses the first encoding network to extract features and downsample each image block in the first image block group to obtain a first feature representation of each image block; uses the image segmentation network to perform image segmentation based on the first feature representation of each image block to obtain a first segmentation result; performs a second block processing on the first segmentation result to obtain a second image block group; uses the second decoding network to upsample and splice each image block in the second image block group to obtain a second segmentation result; the training objectives include: minimizing the difference between the second segmentation result and the segmentation result of the image sample being labeled.

[0118] As one of the feasible ways, the model training unit 602 can be configured as a first encoding network including a plurality of encoding layers connected in sequence, each encoding layer including a convolution layer for feature extraction and a pooling layer for downsampling; a second decoding network including a plurality of convolution layers and splicing layers connected in sequence, each convolution layer being used to upsample each input image block, and the splicing layer being used to splice each input image block.

[0119] As one achievable manner, the model training unit 602 may be configured as an image segmentation network including a Unet model. Based on the position of each block in the first image block, the first feature representations of each block are fused to obtain a fused feature representation, and the fused feature representation is input into the Unet model.

[0120] As one of the achievable methods, the model training unit 602 can be configured to update the model parameters of the image segmentation model using back propagation during the training process based on the loss function value corresponding to the training objective; wherein the back propagation includes: the second decoding network transmits the loss function value to the first decoding network and the second decoding network transmits the loss function value to the image segmentation network.

[0121] As one of the implementable ways, the model training unit 602 may be configured to calculate the loss function value based on the image block, and to transfer the loss function value based on the image block during the back propagation process.

[0122] As one of the achievable methods, the model training unit 602 may be configured to use a gradient checkpoint technology for preset key layers in the first encoding network, the image segmentation network, and the second decoding network during the training process.

[0123] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment. The device embodiment described above is only schematic, wherein the unit described as a separate component may or may not be physically separated, and the component displayed as a unit may or may not be a physical unit, that is, it may be located in one place, or it may be distributed on multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative work.

[0124] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of the relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.

[0125] In addition, an embodiment of the present application further provides a computer-readable storage medium on which a computer program is stored, and when the program is executed by a processor, the steps of any one of the methods in the aforementioned method embodiments are implemented.

[0126] And an electronic device, comprising:

[0127] one or more processors; and

[0128] A memory associated with one or more processors, the memory is used to store program instructions, and when the program instructions are read and executed by one or more processors, the steps of any one of the method embodiments described above are executed.

[0129] The present application also provides a computer program product, including a computer program, which implements the steps of any one of the method embodiments described above when executed by a processor.

[0130] in, Figure 7The architecture of the electronic device is shown as an example, which may include a processor 710, a video display adapter 711, a disk drive 712, an input / output interface 713, a network interface 714, and a memory 720. The processor 710, the video display adapter 711, the disk drive 712, the input / output interface 713, the network interface 714, and the memory 720 may be communicatively connected via a communication bus 730.

[0131] Among them, the processor 710 can be implemented by a general-purpose CPU, a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits, etc., to execute relevant programs to implement the technical solutions provided in this application.

[0132] The memory 720 can be implemented in the form of ROM (Read Only Memory), RAM (Random Access Memory), static storage device, dynamic storage device, etc. The memory 720 can store an operating system 721 for controlling the operation of the electronic device 700, and a basic input and output system (BIOS) 722 for controlling the low-level operation of the electronic device 700. In addition, a web browser 723, a data storage management system 724, and an image segmentation device 725, etc. can also be stored. The above-mentioned image segmentation device 725 can be an application program that specifically implements the operations of the aforementioned steps in the embodiment of the present application. In short, when the technical solution provided by the present application is implemented by software or firmware, the relevant program code is stored in the memory 720 and is called and executed by the processor 710.

[0133] The input / output interface 713 is used to connect the input / output module to realize information input and output. The input / output module can be configured in the device as a component (not shown in the figure), or it can be externally connected to the device to provide corresponding functions. The input device may include a keyboard, a mouse, a touch screen, a microphone, various sensors, etc., and the output device may include a display, a speaker, a vibrator, an indicator light, etc.

[0134] The network interface 714 is used to connect to a communication module (not shown) to realize communication interaction between the device and other devices. The communication module can realize communication through a wired mode (such as USB, network cable, etc.) or a wireless mode (such as mobile network, WIFI, Bluetooth, etc.).

[0135] The bus 730 comprises a pathway for transmitting information between the various components of the device (eg, the processor 710, the video display adapter 711, the disk drive 712, the input / output interface 713, the network interface 714, and the memory 720).

[0136] It should be noted that, although the above device only shows a processor 710, a video display adapter 711, a disk drive 712, an input / output interface 713, a network interface 714, a memory 720, a bus 730, etc., in the specific implementation process, the device may also include other components necessary for normal operation. In addition, it can be understood by those skilled in the art that the above device may also only include components necessary for implementing the solution of the present application, and does not necessarily include all the components shown in the figure.

[0137] It can be known from the description of the above implementation methods that those skilled in the art can clearly understand that the present application can be implemented by means of software plus a necessary general hardware platform. Based on such an understanding, the technical solution of the present application can be essentially or partly contributed to the prior art in the form of a computer program product, which can be stored in a storage medium such as ROM / RAM, a magnetic disk, an optical disk, etc., and includes several instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in the various embodiments of the present application or certain parts of the embodiments.

[0138] The technical solution provided by the present application is described in detail above. The principle and implementation method of the present application are described in detail using specific examples. The description of the above embodiments is only used to help understand the method and core idea of ​​the present application. At the same time, for those skilled in the art, according to the idea of ​​the present application, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as limiting the present application.

Claims

1. An image segmentation method, characterized in that: The method is implemented based on an image segmentation model, wherein the image segmentation model includes a first encoding network, an image segmentation network, and a second decoding network; the method includes: Acquire an image to be segmented, and perform a first block cutting process on the image to be segmented to obtain a first image block group; Using the first encoding network, respectively perform feature extraction and downsampling on each image block in the first image block group to obtain a first feature representation of each image block; Using the image segmentation network, performing image segmentation based on the first feature representation of each image block to obtain a first segmentation result; Performing a second block cutting process on the first segmentation result to obtain a second image block group; The second decoding network is used to perform upsampling processing and splicing on each image block in the second image block group to obtain a second segmentation result.

2. The method according to claim 1, characterized in that The first coding network includes a plurality of sequentially connected coding layers, each coding layer including a convolutional layer for feature extraction and a pooling layer for downsampling; The second decoding network includes a plurality of convolutional layers and splicing layers connected in sequence, each convolutional layer is used to perform upsampling processing on each input image block, and the splicing layer is used to perform splicing processing on each input image block.

3. The method according to claim 1, characterized in that The image segmentation network includes a Unet model; Based on the position of each block in the first image block, the first feature representations of each block are fused to obtain a fused feature representation, and the fused feature representation is input into the Unet model.

4. The method according to claim 1, characterized in that: The number of image blocks obtained by the first slicing process and the second slicing process is the same, and the upsampling and the downsampling are performed at the same multiple.

5. The method according to any one of claims 1 to 4, characterized in that The image to be segmented is a three-dimensional medical image; The first segmentation result and the second segmentation result are segmentation results for a specific organ, body part or lesion.

6. A method for training an image segmentation model, characterized in that: The method comprises: Acquire training data including a plurality of training samples, wherein the training samples include image samples and annotated segmentation results thereof; The image segmentation model is trained using the training data, wherein the image segmentation model includes a first encoding network, an image segmentation network, and a second decoding network; the image sample is subjected to a first block processing to obtain a first image block group; the first encoding network is used to perform feature extraction and downsampling on each image block in the first image block group to obtain a first feature representation of each image block; the image segmentation network is used to perform image segmentation based on the first feature representation of each image block to obtain a first segmentation result; the first segmentation result is subjected to a second block processing to obtain a second image block group; the second decoding network is used to perform upsampling and splicing on each image block in the second image block group to obtain a second segmentation result; The training objective includes: minimizing the difference between the second segmentation result and the segmentation result of the labeled image sample.

7. The method according to claim 6, characterized in that The first coding network includes a plurality of sequentially connected coding layers, each coding layer including a convolutional layer for feature extraction and a pooling layer for downsampling; The second decoding network includes a plurality of convolutional layers and splicing layers connected in sequence, each convolutional layer is used to perform upsampling processing on each input image block, and the splicing layer is used to perform splicing processing on each input image block.

8. The method according to claim 6, characterized in that The image segmentation network includes a Unet model; Based on the position of each block in the first image block, the first feature representations of each block are fused to obtain a fused feature representation, and the fused feature representation is input into the Unet model.

9. The method according to any one of claims 6 to 8, characterized in that During the training process, based on the loss function value corresponding to the training objective, the model parameters of the image segmentation model are updated using back propagation; wherein the back propagation includes: the second decoding network transmits the loss function value to the first decoding network and the second decoding network transmits the loss function value to the image segmentation network.

10. The method according to claim 9, characterized in that The loss function value is calculated based on the image block, and the loss function value is transferred based on the image block during the back-propagation process.

11. The method according to any one of claims 6 to 8, characterized in that During the training process, a gradient checkpoint technology is used for preset key layers in the first encoding network, the image segmentation network and the second decoding network.

12. An image segmentation device, characterized in that: The device is implemented based on an image segmentation model, wherein the image segmentation model includes a first encoding network, an image segmentation network, and a second decoding network; the device includes: A first block cutting unit obtains an image to be segmented, performs a first block cutting process on the image to be segmented, and obtains a first image block group; A first encoding unit, using the first encoding network, performs feature extraction and downsampling on each image block in the first image block group to obtain a first feature representation of each image block; a segmentation unit, using the image segmentation network to perform image segmentation based on the first feature representation of each image block to obtain a first segmentation result; A second block cutting unit performs a second block cutting process on the first segmentation result to obtain a second image block group; The second decoding unit uses the second decoding network to upsample and concatenate each image block in the second image block group to obtain a second segmentation result.

13. A training device for an image segmentation model, characterized in that: The device comprises: A sample acquisition unit, which acquires training data including a plurality of training samples, wherein the training samples include image samples and annotated segmentation results thereof; A model training unit uses the training data to train an image segmentation model, wherein the image segmentation model includes a first encoding network, an image segmentation network and a second decoding network; the image sample is subjected to a first block processing to obtain a first image block group; the first encoding network is used to perform feature extraction and down-sampling on each image block in the first image block group to obtain a first feature representation of each image block; the image segmentation network is used to perform image segmentation based on the first feature representation of each image block to obtain a first segmentation result; the first segmentation result is subjected to a second block processing to obtain a second image block group; the second decoding network is used to perform up-sampling and splicing on each image block in the second image block group to obtain a second segmentation result; the training objectives include: minimizing the difference between the second segmentation result and the segmentation result of the image sample being labeled.

14. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the steps of the method according to any one of claims 1 to 11 are implemented.

15. An electronic device, characterized in that: include: one or more processors; as well as A memory associated with the one or more processors, the memory being used to store program instructions, wherein the program instructions, when read and executed by the one or more processors, execute the steps of the method described in any one of claims 1 to 11.

Citation Information

Cited By

  • Large model video memory optimization method and device and storage medium

    CN121478502A

  • A large model memory optimization method and device, and a storage medium

    CN121478502B