Image segmentation method, device, electronic device and storage medium
By introducing a full-scale connection module and a parallel residual network module into the image segmentation network model, and using the multi-scale atrous convolution mechanism, the problem of poor performance of traditional methods in laminated battery image segmentation is solved, and higher segmentation accuracy is achieved. sex and efficiency.
Patent Information
- Application Number
- CN202410882275.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-03
- Publication Date
- 2024-10-18
- Estimated Expiration
- 2044-07-03
AI Technical Summary
In industrial X-ray non-destructive testing, the irregular geometric shape of the laminated battery and the distribution of tiny positive and negative electrode tips cause traditional edge detection and threshold segmentation methods to be ineffective and unable to accurately segment areas such as positive poles and negative poles.
The image segmentation network model is adopted, including the backbone network, full-scale connection module and parallel residual network module. Through the skip connection and multi-scale atrous convolution mechanism, the recognition ability of the target area and edge details is enhanced, and the quality of image segmentation is improved.
The accuracy and calculation efficiency of image segmentation are improved, and the positive pole and negative pole areas of the laminated battery can be segmented more accurately, thereby improving the image segmentation quality.
Smart Images

Figure CN118429649B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image segmentation, and in particular to an image segmentation method, device, electronic equipment and storage medium. Background Art
[0002] The main goal of image segmentation technology is to accurately and meaningfully divide the image content, that is, to divide the image into multiple non-overlapping regions, each of which represents a different object or a specific background part in the image. The advancement of image segmentation technology has also greatly promoted the understanding of image content and subsequent image analysis operations, including object detection, tracking, behavior recognition, and 3D modeling, and has important application prospects in the fields of industry, military, medicine, and public security.
[0003] In recent years, with the development of XRAY technology, there are more and more industrial XRAY image processing tasks, such as the detection of defects such as cold solder joints, bubbles and cracks in precision products such as semiconductors, IC components, castings and new energy batteries, or the need to detect and identify the position of chips in circuit boards, measure distances, etc.
[0004] At present, in industrial X-ray non-destructive testing tasks, due to the irregular geometric shape of laminated batteries and the tiny and uneven distribution of the positive and negative pole tips of the batteries, traditional edge detection and threshold segmentation methods are less effective and often cannot accurately segment areas such as the positive and negative poles. Summary of the invention
[0005] The present invention provides an image segmentation method, device, electronic equipment and storage medium to improve the image segmentation quality.
[0006] According to one aspect of the present invention, there is provided an image segmentation method, comprising:
[0007] Acquire an image to be segmented, and load an image segmentation network model matching the image to be segmented; the image segmentation network model includes a backbone network, multiple full-scale connection modules and a parallel residual network module, the backbone network includes an encoder and a decoder; the encoder and the decoder are jump-connected through multiple full-scale connection modules for feature fusion; the parallel residual network module includes multiple levels of residual blocks connected in sequence; each residual block in the parallel residual network module is respectively connected to a corresponding decoder layer in the decoder;
[0008] Inputting the image to be segmented into the image segmentation network model for image segmentation to obtain a first segmentation mask and a second segmentation mask; the first segmentation mask is output by the decoder, and the second segmentation mask is output by the parallel residual network module;
[0009] A segmentation result of the image to be segmented is determined based on the first segmentation mask and the second segmentation mask.
[0010] According to another aspect of the present invention, there is provided an image segmentation device, comprising:
[0011] An image segmentation network model loading module is used to obtain an image to be segmented and load an image segmentation network model that matches the image to be segmented; the image segmentation network model includes a backbone network, multiple full-scale connection modules and a parallel residual network module, the backbone network includes an encoder and a decoder; the encoder and the decoder are connected by a jump connection of multiple full-scale connection modules to perform feature fusion; the parallel residual network module includes multiple levels of residual blocks connected in sequence; each residual block in the parallel residual network module is respectively connected to a corresponding decoder layer in the decoder;
[0012] An image segmentation module, used for inputting the image to be segmented into the image segmentation network model to perform image segmentation, and obtaining a first segmentation mask and a second segmentation mask; the first segmentation mask is output by the decoder, and the second segmentation mask is output by the parallel residual network module;
[0013] The image segmentation result determination module is used to determine the segmentation result of the image to be segmented based on the first segmentation mask and the second segmentation mask.
[0014] According to another aspect of the present invention, an electronic device is provided, the electronic device comprising:
[0015] at least one processor; and,
[0016] a memory communicatively connected to the at least one processor; wherein,
[0017] The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can perform the image segmentation method described in any embodiment of the present invention.
[0018] According to another aspect of the present invention, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the image segmentation method described in any embodiment of the present invention when executed.
[0019] The technical solution of the embodiment of the present invention introduces an all-scale connection module into the image segmentation network model. Through the all-scale connection module, the model can learn hierarchical representations at different scales, enhance the recognition ability of the target area and its edge details, improve the image segmentation quality, and also reduce the network parameters to improve the computational efficiency. In addition, by designing a parallel residual network module in the network structure of the image segmentation network model, using multi-scale hole convolution and residual learning mechanism, the network's ability to extract and fuse multi-scale features is effectively improved, and the effective receptive field area of the model is expanded to extract features in different spatial ranges. The present invention determines the image segmentation result based on the first segmentation mask output by the decoder of the image segmentation network model and the second segmentation mask output by the parallel residual network module, thereby further improving the image segmentation quality.
[0020] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present invention, nor are they intended to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0022] Figure 1 This is a flowchart of an image segmentation method provided in Example 1 of the present invention.
[0023] Figure 2 It is a structural diagram of an image segmentation network model provided in Example 1 of the present invention.
[0024] Figure 3 It is a structural schematic diagram of a full-scale connection module provided in Example 1 of the present invention.
[0025] Figure 4 It is a structural schematic diagram of a residual block provided in Embodiment 1 of the present invention.
[0026] Figure 5 It is a flowchart of a training method for an image segmentation network model provided in Embodiment 2 of the present invention.
[0027] Figure 6 It is a structural schematic diagram of an image segmentation device provided in Embodiment 3 of the present invention.
[0028] Figure 7 It is a structural schematic diagram of an electronic device provided in Embodiment 4 of the present invention. DETAILED DESCRIPTION
[0029] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0030] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0031] Embodiment 1
[0032] Figure 1 This is a flow chart of an image segmentation method provided in the first embodiment of the present invention. This embodiment is applicable to the case of image segmentation of industrial X-ray laminated battery images. The method can be executed by an image segmentation device, which can be implemented in the form of hardware and / or software. The image segmentation device can be configured in an electronic device such as a server or personal computer for image segmentation. Figure 1 As shown, the method includes:
[0033] S110, obtaining an image to be segmented, and loading an image segmentation network model matching the image to be segmented; the image segmentation network model includes a backbone network, multiple full-scale connection modules and a parallel residual network module, the backbone network includes an encoder and a decoder; the encoder and the decoder are jump-connected through multiple full-scale connection modules for feature fusion; the parallel residual network module includes multiple levels of residual blocks connected in sequence; each residual block in the parallel residual network module is respectively connected to the corresponding decoder layer in the decoder.
[0034] The image to be segmented refers to an image to be segmented. Specifically, the image to be segmented includes but is not limited to an X-ray laminated battery image, which is not limited here. In this embodiment, the image to be segmented is obtained, and an image segmentation network model matching the image to be segmented is loaded. The image segmentation network model is a convolutional neural network model trained on the same type of image as the image to be segmented.
[0035] The image segmentation network model includes a backbone network, multiple full-scale connection modules and a parallel residual network module; specifically, Figure 2 is a structural diagram of an image segmentation network model provided by the first embodiment of the present invention, such as Figure 2 As shown, the backbone network is a U-shaped convolutional neural network, which includes an encoder and a decoder; the encoder and the decoder are connected by multiple full-scale connection modules for feature fusion; the parallel residual network module includes multiple levels of residual blocks connected in sequence, and each residual block in the parallel residual network module is connected to the corresponding decoder layer in the decoder. Exemplarily, the convolution kernel size of the backbone network is 3×3.
[0036] On the basis of the above embodiment, optionally, any of the full-scale connection modules is connected to at least part of the encoder layers in the encoder, and is connected to a corresponding decoder layer in the decoder; wherein the i-th full-scale connection module is connected to i+n encoder layers in the encoder, and is connected to i+m decoder layers in the encoder; the full-scale connection module is used to scale feature maps of different scales output by at least part of the encoder layers in the encoder connected to the full-scale connection module to obtain feature maps of unified scale, perform feature fusion on the feature maps of unified scale based on a feature fusion mechanism to generate a new feature map, and input the new feature map into the decoder layer corresponding to the full-scale connection module.
[0037] like Figure 2 As shown, any full-scale connection module is connected to at least part of the encoder layers in the encoder, and is connected to a corresponding decoder layer in the decoder; wherein, full-scale connection module 1 is connected to three encoder layers, namely, encoder layer 1, encoder layer 2 and encoder layer 3, and is connected to decoder layer 2; full-scale connection module 2 is connected to four encoder layers, namely, encoder layer 1, encoder layer 2, encoder layer 3 and encoder layer 4, and is connected to decoder layer 3; full-scale connection module 3 is connected to five encoder layers, namely, encoder layer 1, encoder layer 2, encoder layer 3, encoder layer 4 and encoder layer 5, and is connected to decoder layer 4. It can be seen that, as Figure 2 In the connection relationship between the full-scale connection module and the decoder layer and the encoder in the image segmentation network model shown, n is 2 and m is 1; it should be noted that n and m are set by technicians in this field according to needs and are not limited here.
[0038] In this embodiment, the full-scale connection module performs a resizing operation on the feature maps of different scales output by at least part of the encoder layers in the encoder connected to the full-scale connection module to obtain feature maps of uniform size. Specifically, the feature maps of different scales are reduced by maximum pooling or enlarged by bilinear difference, and the feature maps are adjusted to feature maps of the same size as the input of the decoder layer. Figure 2 As shown, the input of the full-scale connection module 1 consists of feature maps X of different scales E1 , X E2 and X E3 In order to integrate the features of each level and realize cross-level information interaction, the sizes of the feature maps of the three different scales mentioned above need to be adjusted to be consistent. Specifically, X E1 Need to be reduced by 2 times, X E3 It needs to be enlarged by 2 times so that all feature maps have the same size; the input of the full-scale connection module 2 consists of feature maps of different scales X E1 , X E2 , X E3 and X E4 and composition, specifically, X E1 Need to be reduced by 4 times, X E2 Need to be reduced by 2 times, X E4 It needs to be enlarged by 2 times so that all feature maps have the same size; the input of the full-scale connection module 3 consists of feature maps of different scales X E1 , X E2 , X E3 , X E4 and X E5 Composition, specifically, X E1 Need to be reduced by 8 times, X E2 Need to be reduced by 4 times, X E3 Need to be reduced by 2 times, X E5 It needs to be enlarged by 2 times so that all feature maps have the same size. E1 , X E2 , X E3 , X E4 and X E5 These are the feature maps output by encoder layer 1, encoder layer 2, encoder layer 3, encoder layer 4, and encoder layer 5, respectively.
[0039] For example, Figure 3 is a schematic diagram of the structure of a full-scale connection module provided in the first embodiment of the present invention, such as Figure 3 As shown, X E1 , X E2 , X E3 , X E4 and X E5Feature maps of different scales are transformed into feature maps of unified scale.
[0040] Furthermore, feature fusion is performed on the feature maps of the same scale based on the feature fusion mechanism to generate a new feature map, and the new feature map is input into the decoder layer corresponding to the full-scale connection module.
[0041] It should be noted that the scale of the feature map after the full-scale connection module is unified is the same as the size of the decoder layer input feature map corresponding to the full-scale connection module.
[0042] This embodiment applies a full-scale connection module in the image segmentation network model, and combines high-level semantic information with low-level semantic information through skip connections. It can effectively combine features from different deep network layers, enhance the recognition ability of target areas and their edge details, improve the accuracy of segmentation results, and also reduce the amount of network parameters to improve computational efficiency.
[0043] On the basis of the above embodiment, optionally, the feature fusion mechanism includes multiple 3×3 convolution kernels, a 3×3 convolution layer and an activation function. Specifically, the feature map of uniform scale is convolved element by element through multiple 3×3 convolution kernels to fuse the features of different depth networks. Further, a 3×3 convolution layer and an activation function are used to generate a new feature map. Exemplarily, the number of 3×3 convolution kernels can be 64, and the specific number is set by technicians in this field according to needs, which is not limited here; activation functions include but are not limited to ReLU (Rectified Linear Unit) function, LeakyReLU, Sigmoid function, etc., which are not limited here.
[0044] In some embodiments, optionally, the full-scale connection module is further used to perform a channel rearrangement operation on the feature map after the scale transformation. Figure 3 As shown in the figure, after each feature map is converted into a feature map of uniform scale through scale transformation, the channel reordering operation is performed on the feature map after scale transformation to disrupt the channel order of the feature map, thereby increasing the feature interaction capability. This allows the model to extract richer global context information without significantly increasing the computational cost, thereby improving the accuracy of image segmentation.
[0045] On the basis of the above embodiment, optionally, each of the residual blocks includes multiple hole convolution branches, a residual connection branch and a merging layer; the residual block is used to fuse the feature map output by the decoder layer of the current level and the feature map output by the residual block of the next level to obtain a feature map to be processed, input the feature map to be processed into each branch, merge the feature maps output by the multiple hole convolution branches based on the merging layer, and add them element by element with the feature map output by the residual connection branch to obtain a target feature map, and output the target feature map to the residual block of the previous level.
[0046] Among them, the feature map to be processed is a feature map obtained by fusing the feature map output by the decoder layer of the current level and the feature map output by the residual block of the next level. Specifically, the feature map output by the decoder layer of the current level and the feature map output by the residual block of the next level are added element by element to obtain the feature map to be processed; it should be noted that if the residual block does not have a residual block of the next level, the feature map to be processed is the feature map output by the decoder layer of the current level; Figure 2 As shown, residual block 4 has no residual block of the next level, and the input of residual block 4 is only the feature map output by the decoder layer of the current level. Therefore, the feature map to be processed of residual block 4 is the feature map output by the decoder layer of the current level, that is, the feature map output by decoder layer 4.
[0047] In this embodiment, the feature map to be processed is input to each branch, and the feature maps output by multiple dilated convolution branches are merged based on the merging layer, and are element-wise added to the feature maps output by the residual connection branch to obtain a target feature map, which is then output to the residual block of the previous level. The target feature map is the feature map of the residual block input to the residual block of the previous level.
[0048] For example, Figure 4 is a schematic diagram of the structure of a residual block provided in the first embodiment of the present invention, such as Figure 4 As shown in the figure, the feature maps to be processed pass through three dilated convolution branches respectively. The first branch consists of 3×3 dilated convolutions with dilation rates of 2 and 3 respectively; the second branch consists of 3×3 dilated convolutions with a dilation rate of 3 and 1×1 standard convolutions; the third branch consists of dilated convolutions with a dilation rate of 5. The feature maps output by the above three dilated convolution branches are merged through the Concat layer (i.e., the merging layer) and added element-by-element with the feature maps output by the residual connection branch to obtain the target feature map, which is finally output to the residual block of the previous layer.
[0049] This embodiment introduces a parallel residual network module into the image segmentation network model, and utilizes multi-scale hole convolution and residual learning mechanism to effectively improve the network's ability to extract and fuse multi-scale features. Parallel convolution layers with different expansion rates can expand the network's receptive field and extract features in different spatial ranges.
[0050] S120. Input the image to be segmented into the image segmentation network model for image segmentation to obtain a first segmentation mask and a second segmentation mask; the first segmentation mask is output by the decoder, and the second segmentation mask is output by the parallel residual network module.
[0051] The first segmentation mask refers to the multi-level upsampling output of the decoder using the deconvolution operation, and the second segmentation mask is output by the parallel residual network module. Specifically, the segmentation mask can be a segmented image or probability map of the same size as the image to be segmented. In this embodiment, the image to be segmented is input into the image segmentation network model for image segmentation to obtain the first segmentation mask output by the decoder and the second segmentation mask output by the parallel residual network module.
[0052] S130: Determine a segmentation result of the image to be segmented based on the first segmentation mask and the second segmentation mask.
[0053] In this embodiment, the first segmentation mask and the second segmentation mask are combined to obtain a combined mask; specifically, the first segmentation mask and the second segmentation mask can be combined through a Boolean algorithm to obtain a combined mask; or the average value of each corresponding pixel in the first segmentation mask and the second segmentation mask can be calculated to obtain a combined mask. Further, the segmentation area in the image to be segmented is determined according to the combined mask. Specifically, the pixel values in the combined mask are thresholded to obtain the segmentation area in the image to be segmented. The segmentation result of the image to be segmented is determined according to the segmentation area in the image to be segmented. Among them, the image segmentation result can be a new image file, or it can be directly marked or modified on the image to be segmented.
[0054] The technical solution of this embodiment introduces an all-scale connection module into the image segmentation network model. Through the all-scale connection module, the model can learn hierarchical representations at different scales, enhance the recognition ability of the target area and its edge details, improve the image segmentation quality, and also reduce the network parameters to improve the computational efficiency. In addition, by designing a parallel residual network module in the network structure of the image segmentation network model, using multi-scale hole convolution and residual learning mechanism, the network's ability to extract and fuse multi-scale features is effectively improved, and the effective receptive field area of the model is expanded to extract features within different spatial ranges. The present invention determines the image segmentation result based on the first segmentation mask output by the decoder of the image segmentation network model and the second segmentation mask output by the parallel residual network module, thereby further improving the image segmentation quality.
[0055] Embodiment 2
[0056] Figure 5 This is a flowchart of a training method for an image segmentation network model provided by Embodiment 2 of the present invention. This embodiment provides a training method for an image segmentation network model for an X-ray laminated battery image based on the above embodiments. The explanations of the terms that are the same or corresponding to the above embodiments are not repeated here.
[0057] like Figure 5 As shown, the method includes:
[0058] S510, acquiring the X-ray laminated battery image, and forming a data set based on the X-ray laminated battery image.
[0059] In this embodiment, an X-ray laminated battery image is obtained, and a data set is formed based on the X-ray laminated battery image, wherein the data set includes a training set and a test set, and the ratio of the training set to the test set is 4:1, which is not limited here.
[0060] S520, performing deviation correction and grayscale normalization on each of the X-ray laminated battery images in the data set to obtain a standard data set.
[0061] Before model training, the images in the data set need to be preprocessed. Specifically, the image affine transformation technology is used to correct the deviation of each X-ray laminated battery image in the data set to maintain the flatness and parallelism of the image and reduce the non-uniformity or noise in the image. Furthermore, the grayscale normalization method is used to normalize each X-ray laminated battery image in the deviation-corrected data set to obtain a standard data set. Among them, the standard data set refers to a data set in which each X-ray laminated battery image in the data set is converted into a standard form of X-ray laminated battery image with similar contrast and brightness.
[0062] Among them, the grayscale normalization method specifically divides the grayscale value of the image according to a preset percentage, and sets the pixel value exceeding the preset percentile as the maximum grayscale value, and the pixel value below the preset percentile as the minimum grayscale value, and the remaining part is mapped proportionally, so that the image has a uniform grayscale range and better contrast, which is convenient for subsequent image analysis and feature extraction. It can be understood that the preset percentage and preset percentile are set by those skilled in the art according to needs and are not limited here.
[0063] In some embodiments, optionally, the images in the annotated standard data set are standardized and normalized. Specifically, the standardization and normalization method is as follows:
[0064]
[0065] in, is the mean of the image tensor, X represents the image tensor, represents the standard deviation of the image tensor, max represents the maximum value of the image tensor, min represents the minimum value of the image tensor, X1 represents the standardized image tensor, X 0 Represents the normalized image tensor.
[0066] S530, establishing a convolutional neural network model, and iteratively training the convolutional neural network model based on the labeled standard data set to obtain an image segmentation network model for the X-ray laminated battery image.
[0067] Specifically, the established convolutional neural network model includes a backbone network, multiple full-scale connection modules and a parallel residual network module. The backbone network includes an encoder and a decoder. The encoder and the decoder are connected by multiple full-scale connection modules for feature fusion. The parallel residual network module includes multiple levels of residual blocks connected in sequence. Each residual block in the parallel residual network module is connected to the corresponding decoder layer in the decoder. Among them, each convolution layer in the convolutional neural network model contains a series of nonlinear transformations, including convolution operations, batch normalization and activation functions (ReLU, Rectified Linear Unit).
[0068] The convolution operation formula is as follows:
[0069]
[0070] Among them, N is the size of the original image, S is the stride size, and M is the size of the convolution kernel.
[0071] Batch normalization: transform the input image of each layer into a normal distribution with a mean of 0 and a variance of 1 to obtain a standardized result. The formula is as follows:
[0072]
[0073] Among them, Xi represents the i-th image of the input, μ B is the characteristic mean, σ B 2 is the variance of the feature, γ and β are introduced parameters, and ϵ is a constant added to the variance of the minimum batch.
[0074] It is understandable that batch normalization operations can speed up the convergence of the network and greatly speed up the training; the ReLU activation function is used to add nonlinear factors, which can enhance the learning ability of the model without the problem of gradient disappearance.
[0075] The technical solution of this embodiment is to train the convolutional neural network model introducing the full-scale connection module and the parallel residual network module through the data set of the X-ray laminated battery image to obtain the image segmentation network model of the X-ray laminated battery image, wherein a full-scale connection module is introduced into the image segmentation network model, through which the model can learn the hierarchical representation at different scales, enhance the recognition ability of the target area and its edge details, improve the image segmentation quality, and also reduce the network parameter amount to improve the computational efficiency. Since the size and shape of the positive pole and the negative pole in the X-ray laminated battery image may vary significantly in different image volumes, the image segmentation network model of the X-ray laminated battery image can make full use of the low-level spatial detail information and the high-level semantic information to accurately segment the X-ray laminated battery image. In addition, by designing a parallel residual network module in the network structure of the image segmentation network model, using multi-scale hole convolution and residual learning mechanism, the ability of the network to extract and fuse multi-scale features is effectively improved, and the effective receptive field area of the model is expanded, and features in different spatial ranges are extracted, further improving the image segmentation quality.
[0076] Embodiment 3
[0077] Figure 6 FIG. 1 is a schematic diagram of the structure of an image segmentation device provided by Embodiment 3 of the present invention. Figure 6 As shown, the device comprises:
[0078] The image segmentation network model loading module 610 is used to obtain an image to be segmented and load an image segmentation network model matching the image to be segmented; the image segmentation network model includes a backbone network, multiple full-scale connection modules and a parallel residual network module, the backbone network includes an encoder and a decoder; the encoder and the decoder are jump-connected through multiple full-scale connection modules for feature fusion; the parallel residual network module includes multiple levels of residual blocks connected in sequence; each residual block in the parallel residual network module is respectively connected to the corresponding decoder layer in the decoder;
[0079] An image segmentation module 620 is used to input the image to be segmented into the image segmentation network model to perform image segmentation to obtain a first segmentation mask and a second segmentation mask; the first segmentation mask is output by the decoder, and the second segmentation mask is output by the parallel residual network module;
[0080] The image segmentation result determination module 630 is used to determine the segmentation result of the image to be segmented based on the first segmentation mask and the second segmentation mask.
[0081] The technical solution of this embodiment introduces an all-scale connection module into the image segmentation network model. Through the all-scale connection module, the model can learn hierarchical representations at different scales, enhance the recognition ability of the target area and its edge details, improve the image segmentation quality, and also reduce the network parameters to improve the computational efficiency. In addition, by designing a parallel residual network module in the network structure of the image segmentation network model, using multi-scale hole convolution and residual learning mechanism, the network's ability to extract and fuse multi-scale features is effectively improved, and the effective receptive field area of the model is expanded to extract features within different spatial ranges. The present invention determines the image segmentation result based on the first segmentation mask output by the decoder of the image segmentation network model and the second segmentation mask output by the parallel residual network module, thereby further improving the image segmentation quality.
[0082] On the basis of the above embodiment, optionally, any of the full-scale connection modules is connected to at least part of the encoder layers in the encoder, and is connected to a corresponding decoder layer in the decoder; wherein the i-th full-scale connection module is connected to i+n encoder layers in the encoder, and is connected to i+m decoder layers in the encoder; the full-scale connection module is used to scale feature maps of different scales output by at least part of the encoder layers in the encoder connected to the full-scale connection module to obtain feature maps of unified scale, perform feature fusion on the feature maps of unified scale based on a feature fusion mechanism to generate a new feature map, and input the new feature map into the decoder layer corresponding to the full-scale connection module.
[0083] Based on the above embodiment, optionally, the feature fusion mechanism includes multiple 3×3 convolution kernels, a 3×3 convolution layer and an activation function.
[0084] Based on the above embodiment, optionally, the full-scale connection module is further used to perform a channel rearrangement operation on the feature map after scale transformation.
[0085] On the basis of the above embodiment, optionally, each of the residual blocks includes multiple hole convolution branches, a residual connection branch and a merging layer; the residual block is used to fuse the feature map output by the decoder layer of the current level and the feature map output by the residual block of the next level to obtain a feature map to be processed, input the feature map to be processed into each branch, merge the feature maps output by the multiple hole convolution branches based on the merging layer, and add them element by element with the feature map output by the residual connection branch to obtain a target feature map, and output the target feature map to the residual block of the previous level.
[0086] Based on the above embodiment, optionally, the image to be segmented includes an X-ray laminated battery image.
[0087] Based on the above embodiment, optionally, the device also includes a training module of an image segmentation network model, which is used to obtain the X-ray laminated battery image and form a data set based on the X-ray laminated battery image; perform deviation correction and grayscale normalization on each of the X-ray laminated battery images in the data set to obtain a standard data set; establish a convolutional neural network model, and iteratively train the convolutional neural network model based on the labeled standard data set to obtain an image segmentation network model.
[0088] The image segmentation device provided in the embodiment of the present invention can execute the image segmentation method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.
[0089] Embodiment 4
[0090] Figure 7 1 is a schematic diagram of the structure of an electronic device provided in Embodiment 4 of the present invention. The electronic device 10 is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or required herein.
[0091] like Figure 7 As shown, the electronic device 10 includes at least one processor 11, and a memory connected to the at least one processor 11, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., wherein the memory stores a computer program that can be executed by at least one processor, and the processor 11 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 12 or the computer program loaded from the storage unit 18 to the random access memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 can also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other through a bus 14. The input / output (I / O) interface 15 is also connected to the bus 14.
[0092] A number of components in the electronic device 10 are connected to the I / O interface 15, including: an input unit 16, such as a keyboard, a mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a disk, an optical disk, etc.; and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0093] The processor 11 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The processor 11 performs the various methods and processes described above, such as an image segmentation method.
[0094] In some embodiments, the image segmentation method may be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 10 via the ROM 12 and / or the communication unit 19. When the computer program is loaded into the RAM 13 and executed by the processor 11, one or more steps of the image segmentation method described above may be performed. Alternatively, in other embodiments, the processor 11 may be configured to perform the image segmentation method in any other appropriate manner (e.g., by means of firmware).
[0095] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0096] The computer program for implementing the image segmentation method of the present invention can be written in any combination of one or more programming languages. These computer programs can be provided to a processor of a general-purpose computer, a special-purpose computer or other programmable data processing device, so that when the computer program is executed by the processor, the functions / operations specified in the flow chart and / or block diagram are implemented. The computer program can be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0097] Embodiment 5
[0098] Embodiment 5 of the present invention further provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to execute an image segmentation method, the method comprising:
[0099] Obtain an image to be segmented, and load an image segmentation network model that matches the image to be segmented; the image segmentation network model includes a backbone network, multiple full-scale connection modules and a parallel residual network module, the backbone network includes an encoder and a decoder; the encoder and the decoder are jump-connected through multiple full-scale connection modules for feature fusion; the parallel residual network module includes multiple levels of residual blocks connected in sequence; each residual block in the parallel residual network module is respectively connected to the corresponding decoder layer in the decoder;
[0100] The image to be segmented is input into the image segmentation network model for image segmentation to obtain a first segmentation mask and a second segmentation mask; the first segmentation mask is output by the decoder, and the second segmentation mask is output by the parallel residual network module;
[0101] A segmentation result of the image to be segmented is determined based on the first segmentation mask and the second segmentation mask.
[0102] In the context of the present invention, a computer-readable storage medium may be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, device, or equipment. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices, or equipment, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0103] To provide interaction with a user, the systems and techniques described herein may be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).
[0104] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.
[0105] A computing system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The client and server relationship is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services.
[0106] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of the present invention can be achieved, and this document does not limit this.
[0107] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims
1. An image segmentation method, characterized in that: include: Acquire an image to be segmented, and load an image segmentation network model matching the image to be segmented; the image segmentation network model includes a backbone network, multiple full-scale connection modules and a parallel residual network module, the backbone network includes an encoder and a decoder; the encoder and the decoder are jump-connected through multiple full-scale connection modules to perform feature fusion; the parallel residual network module includes multiple levels of residual blocks connected in sequence; Each residual block in the parallel residual network module is respectively connected to a corresponding decoder layer in the decoder; Inputting the image to be segmented into the image segmentation network model for image segmentation to obtain a first segmentation mask and a second segmentation mask; the first segmentation mask is output by the decoder, and the second segmentation mask is output by the parallel residual network module; Determining a segmentation result of the image to be segmented based on the first segmentation mask and the second segmentation mask; Each of the residual blocks includes a plurality of dilated convolution branches, a residual connection branch and a merging layer; The residual block is used to fuse the feature map output by the decoder layer of the current level and the feature map output by the residual block of the next level to obtain a feature map to be processed, input the feature map to be processed into each branch, merge the feature maps output by the multiple hole convolution branches based on the merging layer, and add them element by element with the feature map output by the residual connection branch to obtain a target feature map, and output the target feature map to the residual block of the previous level.
2. The method according to claim 1, characterized in that Any of the full-scale connection modules is connected to at least part of the encoder layers in the encoder and to a corresponding decoder layer in the decoder; wherein the i-th full-scale connection module is connected to the i+n encoder layers in the encoder and to the i+m-th decoder layer in the encoder; The full-scale connection module is used to scale feature maps of different scales output by at least part of the encoder layers in the encoder connected to the full-scale connection module to obtain feature maps of unified scale, perform feature fusion on the feature maps of unified scale based on a feature fusion mechanism to generate new feature maps, and input the new feature maps into the decoder layer corresponding to the full-scale connection module.
3. The method according to claim 2, characterized in that The feature fusion mechanism includes multiple 3×3 convolution kernels, a 3×3 convolution layer and an activation function.
4. The method according to claim 2, characterized in that: The full-scale connection module is also used to perform channel rearrangement operations on the feature map after scale transformation.
5. The method according to claim 1, characterized in that The image to be segmented includes an X-ray laminated battery image.
6. The method according to claim 5, characterized in that The training method of the image segmentation network model includes: Acquire the X-ray laminated battery image, and form a data set based on the X-ray laminated battery image; Performing deviation correction and grayscale normalization on each of the X-ray laminated battery images in the data set to obtain a standard data set; A convolutional neural network model is established, and the convolutional neural network model is iteratively trained based on the labeled standard data set to obtain an image segmentation network model for the X-ray laminated battery image.
7. An image segmentation device, characterized in that: include: An image segmentation network model loading module is used to obtain an image to be segmented and load an image segmentation network model that matches the image to be segmented; the image segmentation network model includes a backbone network, multiple full-scale connection modules and a parallel residual network module, the backbone network includes an encoder and a decoder; the encoder and the decoder are jump-connected through multiple full-scale connection modules for feature fusion; the parallel residual network module includes multiple levels of residual blocks connected in sequence; each residual block in the parallel residual network module is respectively connected to the corresponding decoder layer in the decoder; each residual block includes multiple hole convolution branches, a residual connection branch and a merging layer; The residual block is used to fuse the feature map output by the decoder layer of the current level and the feature map output by the residual block of the next level to obtain a feature map to be processed, input the feature map to be processed to each branch, merge the feature maps output by the multiple hole convolution branches based on the merging layer, and add them element by element with the feature map output by the residual connection branch to obtain a target feature map, and output the target feature map to the residual block of the previous level; An image segmentation module, used for inputting the image to be segmented into the image segmentation network model to perform image segmentation, and obtaining a first segmentation mask and a second segmentation mask; the first segmentation mask is output by the decoder, and the second segmentation mask is output by the parallel residual network module; The image segmentation result determination module is used to determine the segmentation result of the image to be segmented based on the first segmentation mask and the second segmentation mask.
8. An electronic device, characterized in that: The electronic device comprises: at least one processor; and a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can perform the image segmentation method according to any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the image segmentation method according to any one of claims 1 to 6 when executed.
Citation Information
Patent Citations
Photographing method and device, storage medium and electronic equipment
CN110661970A
Dermatoscope image segmentation method and system
CN114419060A
