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

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

Info

Publication number
WO2021120695A1
WO2021120695A1 PCT/CN2020/113134 CN2020113134W WO2021120695A1 WO 2021120695 A1 WO2021120695 A1 WO 2021120695A1 CN 2020113134 W CN2020113134 W CN 2020113134W WO 2021120695 A1 WO2021120695 A1 WO 2021120695A1
Authority
WO
WIPO (PCT)
Prior art keywords
image
pixel
background
feature map
segmented
Prior art date
Application number
PCT/CN2020/113134
Other languages
French (fr)
Chinese (zh)
Inventor
李林泽
邹晓敏
Original Assignee
北京迈格威科技有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 北京迈格威科技有限公司 filed Critical 北京迈格威科技有限公司
Publication of WO2021120695A1 publication Critical patent/WO2021120695A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V40/00Recognition of biometric, human-related or animal-related patterns in image or video data
    • G06V40/10Human or animal bodies, e.g. vehicle occupants or pedestrians; Body parts, e.g. hands
    • G06V40/12Fingerprints or palmprints
    • G06V40/1347Preprocessing; Feature extraction
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/11Region-based segmentation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/136Segmentation; Edge detection involving thresholding
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/194Segmentation; Edge detection involving foreground-background segmentation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/20Image preprocessing
    • G06V10/26Segmentation of patterns in the image field; Cutting or merging of image elements to establish the pattern region, e.g. clustering-based techniques; Detection of occlusion
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/10Image acquisition modality
    • G06T2207/10004Still image; Photographic image

Definitions

  • the embodiments of the present application relate to the field of computer vision technology, and in particular, to an image segmentation method, device, electronic device, and readable storage medium.
  • human biological characteristics include, but are not limited to: fingerprints, palm prints, hand shapes, human faces, iris, auricles, and so on.
  • fingerprints as a biological feature of the human body as an example, it is first necessary to obtain the original image of the fingerprint by the fingerprint acquisition device, then it is necessary to segment the fingerprint area from the original image, and finally perform key point extraction, fingerprint alignment, and comparison of the segmented fingerprint area.
  • Recognition and other processes the success of fingerprint region segmentation and the accuracy of fingerprint region segmentation directly affect the subsequent process, and affect the final unlocking result, authentication result, criminal investigation result or target tracking result, etc.
  • the embodiments of the present application provide an image segmentation method, device, device, and storage medium, aiming to improve the accuracy of image segmentation.
  • the first aspect of the embodiments of the present application provides an image segmentation method, the method including:
  • Each pixel in the foreground feature map corresponds to each pixel in the image to be segmented
  • the foreground feature map Characterization of the pixel value of each pixel in the image to be segmented the possibility that the pixel corresponding to the pixel in the image to be segmented belongs to the target area
  • each pixel in the background feature map is related to the pixel in the image to be segmented.
  • Each pixel has a one-to-one correspondence, and the pixel value of each pixel in the background feature map represents the possibility that the pixel corresponding to the pixel in the image to be segmented belongs to the background area;
  • each pixel in the mask image represents: the probability that the pixel corresponding to the pixel in the image to be segmented belongs to the target area
  • the pixel of each pixel in the background area mask image Value represents: the probability that the pixel corresponding to the pixel in the image to be segmented belongs to the background area
  • the image to be divided is segmented according to the target area mask image and the background area mask image.
  • a second aspect of the embodiments of the present application provides an image segmentation device, the device including:
  • the feature extraction module is used to perform feature extraction on the image to be segmented to obtain the image features of the image to be segmented;
  • the up-sampling module is used to perform an up-sampling operation on the image features to obtain a foreground feature map and a background feature map, each pixel in the foreground feature map corresponds to each pixel in the image to be segmented one-to-one,
  • the pixel value of each pixel in the foreground feature map is characterized by the possibility that the pixel corresponding to the pixel in the image to be segmented belongs to the target area, and each pixel in the background feature map is related to all the pixels in the background feature map.
  • Each pixel in the image to be segmented corresponds one-to-one, and the pixel value of each pixel in the background feature map represents: the possibility that the pixel corresponding to the pixel in the image to be segmented belongs to the background area ;
  • the normalization module is used to normalize the pixel value of each pixel of the foreground feature map and the pixel value of each pixel of the background feature map to obtain a target area mask image and a background area mask image ,
  • the pixel value of each pixel in the target area mask image represents: the probability that the pixel corresponding to the pixel in the image to be segmented belongs to the target area, and the background area mask image
  • the pixel value of each pixel in represents: the probability that the pixel corresponding to the pixel in the image to be segmented belongs to the background area;
  • the segmentation module is configured to segment the image to be segmented according to the target area mask image and the background area mask image.
  • a third aspect of the embodiments of the present application provides a readable storage medium on which a computer program is stored.
  • the computer program is executed by a processor, the steps in the image segmentation method as described in the first aspect of the present application are implemented.
  • the fourth aspect of the embodiments of the present application provides an electronic device including a memory, a processor, and a computer program stored in the memory and capable of running on the processor.
  • the processor executes the computer program, the first The steps of the image segmentation method described in the aspect.
  • the fifth aspect of the embodiments of the present application provides a computer program, including computer-readable code, which when the computer-readable code runs on a computing processing device, causes the computing processing device to execute the image segmentation method described above.
  • image segmentation method Using the image segmentation method provided in this application, feature extraction is performed on the image to be segmented to obtain the image features of the image to be segmented; then the image features are up-sampled to obtain the foreground feature map and the background feature map; and then the foreground feature map and The pixel value of each pixel of the background feature map is normalized to obtain the target area mask image and the background area mask image; finally, the image to be segmented is segmented according to the target area mask image and the background area mask image.
  • each pixel of the foreground feature map corresponds to each pixel of the image to be segmented
  • the pixel value of each pixel in the foreground feature map represents: the pixel corresponding to the pixel in the image to be segmented Possibility of belonging to the target area
  • each pixel of the background feature map corresponds to each pixel of the image to be segmented
  • the pixel value of each pixel in the background feature map represents: the pixel corresponding to the pixel in the image to be segmented belongs to the background Possibility of the area.
  • the obtained pixel value of each pixel in the target area mask image indicates:
  • the corresponding pixel point belongs to the probability of the target area
  • the pixel value of each pixel point in the background area mask image represents the probability that the pixel point corresponding to the pixel point in the image to be segmented belongs to the background area.
  • the image to be segmented is segmented based on the probability that each pixel belongs to the target area and/or the background area, so as to obtain a more accurate segmentation result.
  • Fig. 1 is a flowchart of an image segmentation method proposed in an embodiment of the present application
  • Fig. 2 is a schematic diagram of an image segmentation method proposed in an embodiment of the present application.
  • FIG. 3 is a schematic diagram of fingerprint image area division proposed by an embodiment of the present application.
  • FIG. 4 is a schematic diagram of a network structure corresponding to several upsampling methods proposed in an embodiment of the present application
  • FIG. 5 is a schematic diagram of normalization proposed by an embodiment of the present application.
  • Fig. 6 is a segmentation effect diagram of the image segmentation method proposed by an embodiment of the present application.
  • FIG. 7 is a flowchart of an image segmentation method proposed by another embodiment of the present application.
  • FIG. 8 is a schematic diagram of an image segmentation method proposed by another embodiment of the present application.
  • FIG. 9 is a schematic diagram of feature map fusion proposed by an embodiment of the present application.
  • Fig. 10 is a flow chart of model training proposed in an embodiment of the present application.
  • FIG. 11 is a schematic diagram of an image segmentation device proposed in an embodiment of the present application.
  • human biological characteristics include, but are not limited to: fingerprints, palm prints, hand shapes, human faces, iris, auricles, and so on.
  • fingerprints as a biological feature of the human body as an example, it is first necessary to obtain the original image of the fingerprint by the fingerprint acquisition device, then it is necessary to segment the fingerprint area from the original image, and finally perform key point extraction, fingerprint alignment, and comparison of the segmented fingerprint area. Recognition and other processes.
  • the contrast and direction consistency of the fingerprint area are usually obtained from the original image, and then combined with artificial induction rules to segment the fingerprint area from the original image.
  • FIG. 1 is a flowchart of an image segmentation method proposed in an embodiment of the present application. As shown in Figure 1, the method includes the following steps:
  • Step S11 Perform feature extraction on the image to be segmented to obtain image features of the image to be segmented.
  • the image to be segmented is an image including biological characteristics of the human body.
  • the image to be segmented may be: a fingerprint image, a palmprint image, a face image, or an iris image, etc.
  • the fingerprint identification system performs feature extraction on the fingerprint image when performing step S11.
  • the face recognition system performs feature extraction on the face image when the face recognition system executes step S11.
  • the feature extraction module CNN can be used to perform feature extraction on the image to be recognized.
  • FIG. 2 is a schematic diagram of an image segmentation method proposed by an embodiment of the present application. As shown in Figure 2, taking the image to be segmented is a fingerprint image as an example, the fingerprint image of N ⁇ H ⁇ W is input to the feature extraction module CNN to obtain the feature map of N' ⁇ H' ⁇ W', that is, the image feature.
  • N represents the number of image channels of the fingerprint image
  • H represents the height of the fingerprint image
  • W represents the width of the fingerprint image
  • the specific structure of the feature extraction module CNN can be VGG, ResNet (Residual Network), or ShuffleNet and other network backbone structures.
  • the feature extraction module CNN Before using the feature extraction module CNN to perform feature extraction on the image to be recognized, the feature extraction module CNN can be established in advance, and then the sample image is used to train it, and finally the trained feature extraction module CNN is used to perform feature extraction on the image to be recognized to obtain Corresponding image characteristics. For specific training methods, please see below.
  • Step S12 Perform an up-sampling operation on the image feature to obtain a foreground feature map and a background feature map.
  • Each pixel in the foreground feature map corresponds to each pixel in the image to be segmented, and the foreground
  • the pixel value of each pixel in the feature map represents the possibility that the pixel corresponding to the pixel in the image to be segmented belongs to the target area
  • each pixel in the background feature map is related to the pixel to be segmented.
  • Each pixel in the image has a one-to-one correspondence
  • the pixel value of each pixel in the background feature map represents the possibility that the pixel corresponding to the pixel in the image to be segmented belongs to the background area.
  • step S12 the image features are up-sampled to obtain the foreground feature map and the background feature map whose resolution is consistent with the resolution of the image to be segmented.
  • each pixel of the foreground feature map can be compared with each pixel of the image to be segmented.
  • There is one-to-one correspondence and each pixel of the background feature map can be one-to-one corresponding to each pixel of the image to be segmented.
  • FIG. 3 is a schematic diagram of fingerprint image area division proposed by an embodiment of the present application. As shown in Figure 3, taking a fingerprint image as an example, the area within the dashed frame is the effective area of the fingerprint, that is, the target area, and the area outside the dashed frame is the background area.
  • the foreground feature map includes multiple pixels, and the multiple pixels correspond to their respective pixel values. For each pixel in the foreground feature map, the larger the pixel value of the pixel, the more likely the pixel at the same position in the image to be segmented belongs to the target area.
  • the background feature map includes multiple pixels, and the multiple pixels correspond to respective pixel values. For each pixel in the background feature map, the larger the pixel value of the pixel, the more likely the pixel at the same position in the image to be segmented belongs to the background area.
  • an image segmentation module may be used to up-sample the image features.
  • taking the image to be segmented is a fingerprint image as an example, input the feature map of N' ⁇ H' ⁇ W' into the image segmentation module to obtain the segmentation result of 2 ⁇ H ⁇ W, namely the foreground feature map and the background feature
  • the resolutions of the foreground feature map and the background feature map are both H ⁇ W.
  • the up-sampling methods adopted by the image segmentation module include but are not limited to: deconvolution up-sampling, picture scaling up-sampling, and sub-pixel convolution up-sampling.
  • the up-sampling method of the image segmentation module determines the network structure of the image segmentation module.
  • FIG. 4 is a schematic diagram of a network structure corresponding to each of the several upsampling methods proposed in an embodiment of the present application.
  • the network structure corresponding to deconvolution and upsampling includes deconvolution network deconvolution;
  • the network structure corresponding to image scaling and upsampling includes: convolutional neural network CNN and image scaling module; sub-pixel convolutional upsampling corresponds to
  • the network structure includes: convolutional neural network CNN (optional) and sub-pixel convolution module sub-pixel convolution.
  • the image segmentation module Before using the above-mentioned image segmentation module to up-sampling the image features, the image segmentation module can be established in advance, and then the sample image is used to train it, and finally the trained image segmentation module is used to up-sample the image features to obtain the corresponding foreground Feature map and background feature map.
  • the trained image segmentation module is used to up-sample the image features to obtain the corresponding foreground Feature map and background feature map.
  • Step S13 Normalize the pixel value of each pixel of the foreground feature map and the pixel value of each pixel of the background feature map to obtain a target area mask map and a background area mask map, wherein
  • the pixel value of each pixel in the target area mask image represents: the probability that the pixel corresponding to the pixel in the image to be segmented belongs to the target area, and each pixel in the background area mask image
  • the pixel value of the point represents: the probability that the pixel point corresponding to the pixel point in the image to be segmented belongs to the background area.
  • FIG. 5 is a normalized schematic diagram proposed by an embodiment of the present application.
  • the pixel value of the pixel point A1 in the foreground feature map is 7, and the pixel value of the pixel point A2 at the same position in the background feature map is 2.
  • the softmax function can be used to normalize the pixel value of the pixel A1 and the pixel value of the pixel A2.
  • the pixel value of pixel A1' is equal to e 7 /(e 7 +e 2 ), which is approximately equal to 1.
  • the pixel value The pixel value of A2' is equal to e 2 /(e 7 +e 2 ), that is, approximately equal to zero. In this way, the pixel A located at the same position in the image to be segmented is likely to belong to the target area, but it is almost impossible to belong to the background area.
  • the pixel value of the pixel point B1 in the foreground feature map is 3, and the pixel value of the pixel point B2 at the same position in the background feature map is 5.
  • the softmax function can be used to normalize the pixel value of the pixel point B1 and the pixel value of the pixel point B2.
  • the pixel value of pixel point B1' is equal to e 3 /(e 3 +e 5 ), which is equal to 0.12; in the normalized background area mask image, pixel point B2
  • the pixel value of ' is equal to e 5 /(e 3 +e 5 ), which is approximately equal to 0.88. In this way, the probability that the pixel B located at the same position in the image to be segmented belongs to the target area is 0.12, and the probability that it belongs to the background area is 0.88.
  • Step S14 segment the image to be segmented according to the target area mask image and the background area mask image.
  • the target area can be segmented from the image to be segmented according to the pixel value of each pixel in the target area mask image;
  • the background can be segmented from the image to be segmented according to the pixel value of each pixel in the background area mask image area.
  • step S14 may specifically include the following sub-steps:
  • Sub-step S14-1 For each pixel in the target area mask image, if the pixel value of the pixel is greater than the first preset threshold, compare the pixel in the image to be segmented The corresponding pixel is determined to belong to the target area, and the pixel of the target area is segmented from the image to be segmented;
  • And/or sub-step S14-2 For each pixel in the background area mask image, if the pixel value of the pixel is greater than a second preset threshold, combine the image to be divided with the The pixel point corresponding to the pixel point is determined to belong to the background area; and the pixel point of the background area is segmented from the image to be segmented.
  • the product of pixel values corresponding to pixels in the background area in the image to be segmented is equal to 0, and the product of pixel values corresponding to pixels in the target area is equal to the original pixel value, thereby segmenting the target area from the image to be segmented.
  • a pixel with a pixel value of 1 corresponds to the background area in the image to be divided
  • a pixel with a pixel value of 0 in the figure corresponds to the target area in the image to be divided.
  • the pixel value of each pixel in the updated background area mask image is one-to-one with the pixel value of the corresponding pixel in the image to be divided Multiply together.
  • the product of pixel values corresponding to pixels in the background area in the image to be segmented is equal to the original pixel value
  • the product of pixel values corresponding to pixels in the target area is equal to 0, thereby segmenting the background area from the image to be segmented.
  • each pixel of the foreground feature map corresponds to each pixel of the image to be segmented, and the pixel value of each pixel in the foreground feature map represents: the pixel corresponding to the pixel in the image to be segmented belongs to the target Possibility of the area.
  • each pixel of the background feature map corresponds to each pixel of the image to be segmented, and the pixel value of each pixel in the background feature map represents: the pixel corresponding to the pixel in the image to be segmented belongs to the background Possibility of the area.
  • the obtained pixel value of each pixel in the target area mask image indicates:
  • the corresponding pixel point belongs to the probability of the target area
  • the pixel value of each pixel point in the background area mask image represents the probability that the pixel point corresponding to the pixel point in the image to be segmented belongs to the background area.
  • the image to be segmented is segmented based on the probability that each pixel belongs to the target area and/or the background area, so as to obtain a more accurate segmentation result and improve the image segmentation recall rate.
  • FIG. 6 is a segmentation effect diagram of the image segmentation method proposed by an embodiment of the present application.
  • the top three fingerprint images are the three images to be segmented
  • the bottom three fingerprint images are the segmentation result images after segmentation
  • the dashed frame area in each of the three segmentation result images is the segmentation. Fingerprint area.
  • each image to be segmented is accurately segmented into fingerprint regions.
  • FIG. 7 is a flowchart of an image segmentation method proposed by another embodiment of the present application. As shown in Figure 7, the method includes the following steps:
  • Step S71 Perform feature extraction operations of multiple scales on the image to be segmented to obtain multiple image features of different scales of the image to be segmented.
  • Step S72 Perform an up-sampling operation on the multiple image features of different scales, respectively, to obtain a foreground feature map and a background feature map corresponding to each of the multiple image features.
  • step S71 is used as a specific implementation of the above step S11
  • step S72 is used as a specific implementation of the above step S12.
  • the image to be segmented can be input to multiple convolutional neural networks CNN, and the number of convolutional layers included in each convolutional neural network CNN Different from each other. The more the number of convolutional layers of a convolutional neural network CNN, the deeper the scale of the feature extraction operation of the convolutional neural network CNN to be segmented, and the deeper the scale of the image features output by the convolutional neural network CNN .
  • FIG. 8 is a schematic diagram of an image segmentation method proposed by another embodiment of the present application.
  • the convolutional neural network CNN1 performs feature extraction on the image to be segmented N ⁇ H ⁇ W, to obtain the image feature N′ ⁇ H′ ⁇ W′.
  • the image feature N' ⁇ H' ⁇ W' can be input to the image segmentation module 1 to perform an up-sampling operation to obtain a segmentation result of 2 ⁇ H ⁇ W, that is, a foreground feature map and a background feature map.
  • the image feature N' ⁇ H' ⁇ W' can be input into the convolutional neural network CNN2.
  • the convolutional neural network CNN2 After the convolutional neural network CNN2 performs further feature extraction on the image feature N' ⁇ H' ⁇ W' to obtain the image feature N” ⁇ H” ⁇ W”.
  • the W" input image segmentation module 2 performs an up-sampling operation to obtain a segmentation result of 2 ⁇ H ⁇ W, that is, a foreground feature map and a background feature map.
  • the image feature N” ⁇ H” ⁇ W” can be input into the convolutional neural network CNN3.
  • multiple image features of different scales of the image to be segmented can be obtained, and an up-sampling operation is performed on the multiple image features to obtain the foreground feature map and the background feature map corresponding to each of the multiple image features.
  • the scale of' ⁇ H”' ⁇ W”' increases in order.
  • This application obtains multiple image features of different scales of the image to be segmented, and performs subsequent up-sampling, fusion, and normalization processes based on the image features of various scales, thereby increasing the complexity of image features and enabling image features to be Including features with richer scales will further improve the accuracy of image segmentation.
  • the above-mentioned steps S71 and S72 are executed using the model shown in FIG. 8, the structure of the model is richer, and it has stronger learning ability during training, which is also conducive to further improving the accuracy of image segmentation.
  • the image segmentation method may further include the following steps:
  • Step S73-1 Fusion of the foreground feature maps corresponding to multiple image features to obtain a fused foreground feature map, and fusion of the background feature maps corresponding to each of the multiple image features to obtain a fused background feature map Figure.
  • Step S73-2 Normalize the pixel value of each pixel of the fused foreground feature map and the pixel value of each pixel of the fused background feature map to obtain the target area mask image and background Area mask map.
  • step S73-1 and step S73-2 are used as a specific implementation of the above step S13.
  • the multiple foreground feature maps can be superimposed first according to the feature depth order of the multiple foreground feature maps; then the superimposed multiple foreground feature maps are convolved to obtain a fused foreground feature map .
  • the multiple background feature maps can be superimposed first according to the feature depth order of the multiple background feature maps; then, the superimposed multiple background feature maps can be convolved to obtain a fused background feature map.
  • FIG. 9 is a schematic diagram of feature map fusion proposed by an embodiment of the present application.
  • the 2M ⁇ H ⁇ W image features are divided into M ⁇ H ⁇ W foreground feature maps and M ⁇ H ⁇ W background feature maps.
  • the image features of 2M ⁇ H ⁇ W correspond to foreground feature maps of M scales and background feature maps of M scales.
  • step S71 feature extraction operations of M scales are performed on the image to be segmented.
  • the M ⁇ H ⁇ W foreground feature map is formed by sequentially superimposing M 1 ⁇ H ⁇ W foreground feature maps in the order of feature depth.
  • the M ⁇ H ⁇ W background feature map is formed by sequentially superimposing M 1 ⁇ H ⁇ W background feature maps in the order of feature depth.
  • the single-layer convolutional neural network CNN1 is used to convolve the M ⁇ H ⁇ W foreground feature map to obtain a 1 ⁇ H ⁇ W fused foreground feature map.
  • a single-layer convolutional neural network CNN2 is used to convolve the M ⁇ H ⁇ W background feature map to obtain a 1 ⁇ H ⁇ W fused background feature map.
  • the fused foreground feature map and the fused background feature map are superimposed to obtain a 2 ⁇ H ⁇ W fusion feature map.
  • the network structure shown in FIG. 9 is the segmentation result fusion module in FIG. 8.
  • step S73-2 When performing step S73-2, reference may be made to the explanation of step S13 above and the content shown in FIG. 5, which is not repeated in this application.
  • the image segmentation method may further include the following steps:
  • Step S74 segment the image to be segmented according to the target area mask image and the background area mask image.
  • step S74 When performing step S74, reference may be made to the above-mentioned explanation of step S14, which will not be repeated in this application.
  • multiple methods of upsampling operations can be simultaneously performed on the image features obtained in the above step S11, thereby integrating the advantages of multiple upsampling methods, and thereby improving the accuracy of image segmentation.
  • the image features are respectively up-sampled through multiple up-sampling paths to obtain a foreground feature map and a background feature map output by each up-sampling path.
  • the image feature may be input to an image segmentation module that includes multiple upsampling paths, so that the image features are individually upsampled through each upsampling path in the image segmentation module , Respectively obtain a foreground feature map and a background feature map output by each up-sampling path, wherein the up-sampling modes corresponding to each of the multiple up-sampling paths are different from each other.
  • the image segmentation module includes three up-sampling paths.
  • the network structures of the three up-sampling paths are shown in Figure 4.
  • the three up-sampling paths implement deconvolution and up-sampling of image features, image scaling up-sampling, and Sub-pixel convolutional upsampling. After the image segmentation module is used to up-sampling the image features, the foreground image features and background image features output by each up-sampling path are obtained.
  • the multiple foreground feature maps output by the multiple upsampling paths are merged to obtain a fused foreground feature map, and the multiple upsampling paths output Fusion of multiple background feature maps to obtain a fused background feature map; then the pixel value of each pixel of the fused foreground feature map and the pixel value of each pixel of the fused background feature map are performed Normalize to obtain the target area mask image and the background area mask image.
  • the image feature can be up-sampling in multiple ways at the same time, thereby integrating multiple up-sampling The advantages of the method, and then improve the accuracy of image segmentation.
  • this application has introduced the application process of the image segmentation method through the embodiments.
  • the application process of the image segmentation method involves the feature extraction module CNN and the image segmentation module.
  • the present application introduces the training process of each module through embodiments. It should be understood that the implementation of the above-mentioned image segmentation module does not necessarily depend on the above-mentioned various modules, and the application of the above-mentioned various modules should not be understood as a limitation of the present application.
  • FIG. 10 is a flow chart of model training proposed in an embodiment of the present application. As shown in Figure 10, the training process includes the following steps:
  • Step S10-1 Obtain a sample image, the sample image carries a target area mask annotation map and a background area mask annotation map, and the pixel value of the pixel point of the target area in the target area mask annotation map is the first pixel value ,
  • the pixel value of the pixel in the background area is the second pixel value
  • the pixel value of the pixel in the target area in the background area mask annotation map is the second pixel value
  • the pixel value of the pixel in the background area is The first pixel value.
  • the first pixel value is different from the second pixel value.
  • the first pixel has a value of 1
  • the second pixel has a value of zero.
  • the target area mask annotation map and the background area mask annotation map of the sample fingerprint image are generated according to the fingerprint area and the background area in the sample fingerprint image.
  • the pixel value of the pixel in the fingerprint area in the target area mask annotation map is 1, and the pixel value of the pixel in the background area is 0.
  • the pixel value of the pixel in the fingerprint area in the background area mask annotation map is 0, and the pixel value of the pixel in the background area is 1.
  • multiple sample fingerprint images can come from multiple scenes. Examples include: sample fingerprint images collected in cold weather, sample fingerprint images collected when fingertips are wet, and sample fingerprint images collected when fingertips are stained with inkpad.
  • the sample fingerprint image can be cropped. For example, crop the original sample fingerprint image with the resolution of H ⁇ W into H/2 ⁇ W/2 sample fingerprint image, and then generate H/2 ⁇ W/2 sample fingerprint image for the H/2 ⁇ W/2 sample fingerprint image
  • the target area mask annotated map and the background area mask annotated map.
  • Step S10-2 Input the sample image into a preset model to perform feature extraction on the sample image through the preset model to obtain image features, and upload the image features through the preset model Sampling operation to obtain foreground prediction feature maps and background prediction feature maps.
  • the structure of the preset model can refer to the network structure shown in FIG. 2 or FIG. 8.
  • the image segmentation module may include one or more up-sampling paths. If the image segmentation module includes multiple up-sampling paths, the up-sampling paths are different from each other.
  • Step S10-3 Perform a normalization operation on the respective pixel values of the foreground prediction feature map and the background prediction feature map to obtain a target region mask prediction map and a background region mask prediction map.
  • Step S10-4 Update the preset model according to the target area mask prediction map, the background area mask prediction map, the target area mask annotation map, and the background area mask annotation map.
  • the cross entropy loss of the target area mask prediction map and the target area mask annotation map can be calculated, and then the cross entropy loss can be used to update each module of the preset model.
  • the cross entropy loss of the background area mask prediction map and the background area mask annotation map can be calculated, and then the cross entropy loss can be used to update each module of the preset model.
  • the parameters of the preset model can be changed from floating point to integer to achieve model quantification. Then the quantized preset model is used as the teacher model, and the quantized preset model is used as the student model, and the loss function is established in the output layer of the two models, and then the quantized preset model is retrained.
  • FIG. 11 is a schematic diagram of an image segmentation device proposed in an embodiment of the present application. As shown in Figure 11, the device includes:
  • the feature extraction module 1101 is configured to perform feature extraction on the image to be segmented to obtain image features of the image to be segmented;
  • the up-sampling module 1102 is used to perform an up-sampling operation on the image features to obtain a foreground feature map and a background feature map, each pixel in the foreground feature map corresponds to each pixel in the image to be segmented one-to-one ,
  • the pixel value of each pixel in the foreground feature map represents the possibility that the pixel corresponding to the pixel in the image to be segmented belongs to the target area
  • each pixel in the background feature map is Each pixel in the image to be segmented corresponds one-to-one, and the pixel value of each pixel in the background feature map represents the possibility that the pixel corresponding to the pixel in the image to be segmented belongs to the background area Sex
  • the normalization module 1103 is used to normalize the pixel value of each pixel of the foreground feature map and the pixel value of each pixel of the background feature map to obtain a target area mask image and a background area mask
  • the pixel value of each pixel in the target area mask image represents: the probability that the pixel corresponding to the pixel in the image to be segmented belongs to the target area
  • the background area mask image represents: the probability that the pixel corresponding to the pixel in the image to be segmented belongs to the background area;
  • the segmentation module 1104 is configured to segment the image to be segmented according to the target area mask map and the background area mask map.
  • the feature extraction module is specifically configured to: perform feature extraction operations of multiple scales on the image to be segmented to obtain multiple image features of different scales of the image to be segmented;
  • the up-sampling module is specifically configured to perform an up-sampling operation on the multiple image features of different scales respectively, to obtain a foreground feature map and a background feature map corresponding to each of the multiple image features.
  • the normalization module includes:
  • the feature map fusion sub-module is used to fuse the respective foreground feature maps of multiple image features to obtain a fused foreground feature map, and to fuse the background feature maps corresponding to each of the multiple image features to obtain a fusion Background feature map;
  • the normalization sub-module is used to normalize the pixel value of each pixel of the fused foreground feature map and the pixel value of each pixel of the fused background feature map to obtain the target area mask Figure and background area mask map.
  • the feature map fusion sub-module includes:
  • the first feature map superimposing subunit is used to superimpose multiple foreground feature maps according to the feature depth sequence of the multiple foreground feature maps;
  • the first feature map convolution subunit is used to convolve multiple superimposed foreground feature maps to obtain the merged foreground feature map;
  • the second feature map superimposing subunit is used to superimpose multiple background feature maps according to the feature depth sequence of the multiple background feature maps
  • the second feature map convolution subunit is used to convolve multiple background feature maps after superimposition to obtain the fused background feature map.
  • the up-sampling module is specifically configured to: perform up-sampling processing on the image features through multiple up-sampling paths, respectively, to obtain a foreground feature map and a background feature map output by each up-sampling path. , Where the corresponding up-sampling modes of the multiple up-sampling paths are different from each other;
  • the normalization module includes:
  • the feature map fusion sub-module is used to fuse multiple foreground feature maps output by multiple upsampling paths to obtain a fused foreground feature map, and to fuse multiple background feature maps output from multiple upsampling paths, Obtain a fused background feature map;
  • the normalization sub-module is used to normalize the pixel value of each pixel of the fused foreground feature map and the pixel value of each pixel of the fused background feature map to obtain the target area mask Figure and background area mask map.
  • the segmentation module includes:
  • the target area segmentation sub-module is used to, for each pixel in the target area mask image, if the pixel value of the pixel is greater than the first preset threshold, compare the pixel in the image to be segmented The pixel point corresponding to the point is determined to belong to the target area, and the pixel point of the target area is segmented from the image to be segmented;
  • the background region segmentation sub-module for each pixel in the background region mask image, if the pixel value of the pixel is greater than a second preset threshold, the image to be segmented
  • the pixel point corresponding to the pixel point is determined to belong to the background area; and the pixel point of the background area is segmented from the image to be segmented.
  • the device further includes:
  • the sample image obtaining module is used to obtain a sample image, the sample image carries a target area mask annotated map and a background area mask annotated map, and the pixel value of the pixel point of the target area in the target area mask annotated map is the first Pixel value, the pixel value of the pixel in the background area is the second pixel value, the pixel value of the pixel in the target area in the background area mask annotation map is the second pixel value, and the pixel value of the pixel in the background area Is the first pixel value;
  • the prediction feature map obtaining module is used to perform feature extraction on the sample image through the preset model to obtain image features, and perform an up-sampling operation on the image features through the preset model to obtain foreground prediction features Map and background prediction feature map;
  • a mask prediction map obtaining module configured to perform a normalization operation on the respective pixel values of the foreground prediction feature map and the background prediction feature map to obtain a target region mask prediction map and a background region mask prediction map;
  • the model update module is used to update the preset model according to the target area mask prediction map, the background area mask prediction map, the target area mask annotation map, and the background area mask annotation map.
  • image segmentation device Using the image segmentation device provided in this application, feature extraction is performed on the image to be segmented to obtain the image features of the image to be segmented; then the image features are up-sampled to obtain the foreground feature map and the background feature map; and then the foreground feature map and The pixel value of each pixel of the background feature map is normalized to obtain the target area mask image and the background area mask image; finally, the image to be segmented is segmented according to the target area mask image and the background area mask image, so that
  • the image segmentation device provided by this application has at least the following advantages:
  • each pixel of the foreground feature map corresponds to each pixel of the image to be segmented
  • the pixel value of each pixel in the foreground feature map represents: the pixel corresponding to the pixel in the image to be segmented Possibility of belonging to the target area
  • each pixel of the background feature map corresponds to each pixel of the image to be segmented
  • the pixel value of each pixel in the background feature map represents: the pixel corresponding to the pixel in the image to be segmented belongs to the background Possibility of the area.
  • the obtained pixel value of each pixel in the target area mask image indicates:
  • the corresponding pixel point belongs to the probability of the target area
  • the pixel value of each pixel point in the background area mask image represents the probability that the pixel point corresponding to the pixel point in the image to be segmented belongs to the background area.
  • the image to be segmented is segmented based on the probability that each pixel belongs to the target area and/or the background area, so as to obtain a more accurate segmentation result.
  • another embodiment of the present application provides a readable storage medium on which a computer program is stored.
  • the program is executed by a processor, the image segmentation method described in any of the foregoing embodiments of the present application is implemented step.
  • the computer-readable storage medium includes, but is not limited to, any type of disk (including floppy disk, hard disk, optical disk, CD-ROM, and magneto-optical disk), ROM (Read-Only Memory), RAM ( Random Access Memory), EPROM (Erasable Programmable Read-Only Memory), EEPROM (Electrically Erasable Programmable Read-Only Memory), flash memory, magnetic Card or light card. That is, a readable storage medium includes any medium that stores or transmits information in a readable form by a device (for example, a computer).
  • another embodiment of the present application provides an electronic device, including a memory, a processor, and a computer program stored in the memory and capable of running on the processor. The steps in the image segmentation method described in the embodiment.
  • the description is relatively simple, and for related parts, please refer to the part of the description of the method embodiment.
  • the embodiments of the embodiments of the present application may be provided as methods, devices, or computer program products. Therefore, the embodiments of the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the embodiments of the present application may adopt the form of computer program products implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.
  • computer-usable storage media including but not limited to disk storage, CD-ROM, optical storage, etc.
  • an embodiment of the present application further provides a computer program, including computer-readable code, when the computer-readable code runs on a computing processing device, it can cause the computing processing device to execute the explanation in any one of the embodiments of this application.
  • a computer program including computer-readable code
  • the computer-readable code runs on a computing processing device, it can cause the computing processing device to execute the explanation in any one of the embodiments of this application.
  • Any of the image segmentation methods can be provided to the processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing terminal equipment to generate a machine, so that the processor of the computer or other programmable data processing terminal equipment
  • the executed instructions generate means for realizing the functions specified in one process or multiple processes in the flowchart and/or one block or multiple blocks in the block diagram.
  • These computer program instructions can also be stored in a computer-readable memory that can guide a computer or other programmable data processing terminal equipment to work in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture including the instruction device.
  • the instruction device implements the functions specified in one process or multiple processes in the flowchart and/or one block or multiple blocks in the block diagram.
  • These computer program instructions can also be loaded on a computer or other programmable data processing terminal equipment, so that a series of operation steps are executed on the computer or other programmable terminal equipment to produce computer-implemented processing, so that the computer or other programmable terminal equipment
  • the instructions executed above provide steps for implementing functions specified in a flow or multiple flows in the flowchart and/or a block or multiple blocks in the block diagram.

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Multimedia (AREA)
  • Human Computer Interaction (AREA)
  • Image Analysis (AREA)

Abstract

An image segmentation method and apparatus, a device and a storage medium, which aim to improve the accuracy of image segmentation. The method comprises: obtaining image features of an image to be segmented (S11); performing an up-sampling operation on the image features to obtain a foreground feature map and a background feature map (S12); normalizing pixel values of pixel points of the foreground feature map and pixel values of pixel points of the background feature map to obtain a target region mask map and a background region mask map, wherein the pixel value of each pixel point in the target region mask map represents the probability of a pixel point that corresponds to the pixel point in the image belonging to a target region, and the pixel value of each pixel point in the background region mask map represents the probability of a pixel point that corresponds to the pixel point in the image belonging to a background region (S13); and according to the target region mask map and the background region mask map, segmenting the image (S14).

Description

图像分割方法、装置、电子设备及可读存储介质Image segmentation method, device, electronic equipment and readable storage medium
本申请要求在2019年12月20日提交中国专利局、申请号为201911331052.6、发明名称为“图像分割方法、装置、电子设备及可读存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims the priority of a Chinese patent application filed with the Chinese Patent Office, the application number is 201911331052.6, and the invention title is "Image Segmentation Method, Apparatus, Electronic Equipment, and Readable Storage Medium" on December 20, 2019. The entire content of the application is approved The reference is incorporated in this application.
技术领域Technical field
本申请实施例涉及计算机视觉技术领域,具体而言,涉及一种图像分割方法、装置、电子设备及可读存储介质。The embodiments of the present application relate to the field of computer vision technology, and in particular, to an image segmentation method, device, electronic device, and readable storage medium.
背景技术Background technique
随着计算机视觉技术的发展,越来越多的应用场景将计算机视觉技术和人体生物特征相结合,以执行解锁、认证、刑侦或目标追踪等任务。其中,人体生物特征包括但不限于:指纹、掌纹、手形、人脸、虹膜、耳廓等等。在执行上述任务期间,通常需要采集包括人体生物特征的原始图像,然后将人体生物特征的区域从原始图像中分割出,再针对分割出的人体生物特征区域进行关键点提取、特征比对等流程,最终实现对上述各种任务的执行。With the development of computer vision technology, more and more application scenarios combine computer vision technology with human biological characteristics to perform tasks such as unlocking, authentication, criminal investigation, or target tracking. Among them, human biological characteristics include, but are not limited to: fingerprints, palm prints, hand shapes, human faces, iris, auricles, and so on. During the execution of the above tasks, it is usually necessary to collect the original image including the biological characteristics of the human body, and then segment the area of the biological characteristics of the human body from the original image, and then perform the key point extraction and feature comparison processes for the segmented human biological feature area , And finally realize the execution of the above-mentioned various tasks.
以指纹这一人体生物特征为例,首先需要利用指纹采集设备获得指纹的原始图像,然后需要从该原始图像中分割出指纹区域,最后针对分割出的指纹区域进行关键点提取、指纹对齐、比对识别等流程。其中,指纹区域分割的成功与否以及指纹区域分割的准确性,直接影响后续流程,并影响最终的解锁结果、认证结果、刑侦结果或目标追踪结果等等。Taking fingerprints as a biological feature of the human body as an example, it is first necessary to obtain the original image of the fingerprint by the fingerprint acquisition device, then it is necessary to segment the fingerprint area from the original image, and finally perform key point extraction, fingerprint alignment, and comparison of the segmented fingerprint area. Recognition and other processes. Among them, the success of fingerprint region segmentation and the accuracy of fingerprint region segmentation directly affect the subsequent process, and affect the final unlocking result, authentication result, criminal investigation result or target tracking result, etc.
相关技术中,为了从原始图像中分割出指纹等人体生物特征的所在区域,通常是从原始图像中获取指纹区域的对比度、方向一致性等特征,然后结合人工归纳的规则从原始图像中分割出指纹区域。但是在原始图像中存在复杂背景的情况下,利用上述方式进行指纹区域分割时,难以成功分割出较准确的指纹区域。In related technologies, in order to segment the area where the fingerprints and other human biological features are located from the original image, it is usually to obtain the contrast, direction consistency and other characteristics of the fingerprint area from the original image, and then combine the rules of artificial induction to segment the original image Fingerprint area. However, when there is a complex background in the original image, it is difficult to successfully segment a more accurate fingerprint area when the fingerprint area is segmented using the above method.
发明内容Summary of the invention
本申请实施例提供一种图像分割方法、装置、设备及存储介质,旨在提高图像分割的准确性。The embodiments of the present application provide an image segmentation method, device, device, and storage medium, aiming to improve the accuracy of image segmentation.
本申请实施例第一方面提供一种图像分割方法,所述方法包括:The first aspect of the embodiments of the present application provides an image segmentation method, the method including:
对待分割图像进行特征提取,获得所述待分割图像的图像特征;Performing feature extraction on the image to be segmented to obtain image features of the image to be segmented;
对所述图像特征进行上采样操作,获得前景特征图和背景特征图,所述前景特征图中的各个像素点与所述待分割图像中的各个像素点一一对应,所述前景特征图中的每个像素点的像素值表征:所述待分割图像中与该像素点相对应的像素点属于目标区域的可能性,所述背景特征图中的各个像素点与所述待分割图像中的各个像素点一一对应,所述背景特征图中的每个像素点的像素值表征:所述待分割图像中与该像素点相对应的像素点属于背景区域的可能性;Perform an up-sampling operation on the image feature to obtain a foreground feature map and a background feature map. Each pixel in the foreground feature map corresponds to each pixel in the image to be segmented, and the foreground feature map Characterization of the pixel value of each pixel in the image to be segmented: the possibility that the pixel corresponding to the pixel in the image to be segmented belongs to the target area, and each pixel in the background feature map is related to the pixel in the image to be segmented. Each pixel has a one-to-one correspondence, and the pixel value of each pixel in the background feature map represents the possibility that the pixel corresponding to the pixel in the image to be segmented belongs to the background area;
对所述前景特征图的各个像素点的像素值和所述背景特征图的各个像素点的像素值进行归一化,获得目标区域掩模图和背景区域掩模图,其中,所述目标区域掩模图中的每个像素点的像素值表示:所述待分割图像中与该像素点相对应的像素点属于目标区域的概率,所述背景区域掩模图中的每个像素点的像素值表示:所述待分割图像中与该像素点相对应的像素点属于背景区域的概率;Normalize the pixel value of each pixel of the foreground feature map and the pixel value of each pixel of the background feature map to obtain a target area mask map and a background area mask map, wherein the target area The pixel value of each pixel in the mask image represents: the probability that the pixel corresponding to the pixel in the image to be segmented belongs to the target area, and the pixel of each pixel in the background area mask image Value represents: the probability that the pixel corresponding to the pixel in the image to be segmented belongs to the background area;
根据所述目标区域掩模图和所述背景区域掩模图,对所述待分割图像进行分割。The image to be divided is segmented according to the target area mask image and the background area mask image.
本申请实施例第二方面提供一种图像分割装置,所述装置包括:A second aspect of the embodiments of the present application provides an image segmentation device, the device including:
特征提取模块,用于对待分割图像进行特征提取,获得所述待分割图像的图像特征;The feature extraction module is used to perform feature extraction on the image to be segmented to obtain the image features of the image to be segmented;
上采样模块,用于对所述图像特征进行上采样操作,获得前景特征图和背景特征图,所述前景特征图中的各个像素点与所述待分割图像中的各个像素点一一对应,所述前景特征图中的每个像素点的像素值表征:所述待分割图像中与该像素点相对应的像素点属于目标区域的可能性,所述背景特征图中的各个像素点与所述待分割图像中的各个像素点一一对应,所述背景特征 图中的每个像素点的像素值表征:所述待分割图像中与该像素点相对应的像素点属于背景区域的可能性;The up-sampling module is used to perform an up-sampling operation on the image features to obtain a foreground feature map and a background feature map, each pixel in the foreground feature map corresponds to each pixel in the image to be segmented one-to-one, The pixel value of each pixel in the foreground feature map is characterized by the possibility that the pixel corresponding to the pixel in the image to be segmented belongs to the target area, and each pixel in the background feature map is related to all the pixels in the background feature map. Each pixel in the image to be segmented corresponds one-to-one, and the pixel value of each pixel in the background feature map represents: the possibility that the pixel corresponding to the pixel in the image to be segmented belongs to the background area ;
归一化模块,用于对所述前景特征图的各个像素点的像素值和所述背景特征图的各个像素点的像素值进行归一化,获得目标区域掩模图和背景区域掩模图,其中,所述目标区域掩模图中的每个像素点的像素值表示:所述待分割图像中与该像素点相对应的像素点属于目标区域的概率,所述背景区域掩模图中的每个像素点的像素值表示:所述待分割图像中与该像素点相对应的像素点属于背景区域的概率;The normalization module is used to normalize the pixel value of each pixel of the foreground feature map and the pixel value of each pixel of the background feature map to obtain a target area mask image and a background area mask image , Wherein the pixel value of each pixel in the target area mask image represents: the probability that the pixel corresponding to the pixel in the image to be segmented belongs to the target area, and the background area mask image The pixel value of each pixel in, represents: the probability that the pixel corresponding to the pixel in the image to be segmented belongs to the background area;
分割模块,用于根据所述目标区域掩模图和所述背景区域掩模图,对所述待分割图像进行分割。The segmentation module is configured to segment the image to be segmented according to the target area mask image and the background area mask image.
本申请实施例第三方面提供一种可读存储介质,其上存储有计算机程序,该计算机程序被处理器执行时,实现如本申请第一方面所述的图像分割方法中的步骤。A third aspect of the embodiments of the present application provides a readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the steps in the image segmentation method as described in the first aspect of the present application are implemented.
本申请实施例第四方面提供一种电子设备,包括存储器、处理器及存储在存储器上并可在处理器上运行的计算机程序,所述处理器执行所述计算机程序时,实现本申请第一方面所述的图像分割方法的步骤。The fourth aspect of the embodiments of the present application provides an electronic device including a memory, a processor, and a computer program stored in the memory and capable of running on the processor. When the processor executes the computer program, the first The steps of the image segmentation method described in the aspect.
本申请实施例第五方面提供一种计算机程序,包括计算机可读代码,当所述计算机可读代码在计算处理设备上运行时,导致所述计算处理设备执行上述所述的图像分割方法。The fifth aspect of the embodiments of the present application provides a computer program, including computer-readable code, which when the computer-readable code runs on a computing processing device, causes the computing processing device to execute the image segmentation method described above.
上述说明仅是本发明技术方案的概述,为了能够更清楚了解本发明的技术手段,而可依照说明书的内容予以实施,并且为了让本发明的上述和其它目的、特征和优点能够更明显易懂,以下特举本发明的具体实施方式。The above description is only an overview of the technical solution of the present invention. In order to understand the technical means of the present invention more clearly, it can be implemented in accordance with the content of the specification, and in order to make the above and other objectives, features and advantages of the present invention more obvious and understandable. In the following, specific embodiments of the present invention are specifically cited.
采用本申请提供的图像分割方法,对待分割图像进行特征提取,以获得待分割图像的图像特征;然后对图像特征进行上采样操作,从而获得前景特征图和背景特征图;再对前景特征图和背景特征图的各个像素点的像素值进行归一化操作,获得目标区域掩模图和背景区域掩模图;最后根据目标区域掩模图和背景区域掩模图,对待分割图像进行分割。Using the image segmentation method provided in this application, feature extraction is performed on the image to be segmented to obtain the image features of the image to be segmented; then the image features are up-sampled to obtain the foreground feature map and the background feature map; and then the foreground feature map and The pixel value of each pixel of the background feature map is normalized to obtain the target area mask image and the background area mask image; finally, the image to be segmented is segmented according to the target area mask image and the background area mask image.
其中,由于前景特征图的各个像素点与待分割图像的各个像素点一一对应,且前景特征图中的每个像素点的像素值表征:待分割图像中与该像素点相对应的像素点属于目标区域的可能性。同时背景特征图的各个像素点与待分割图像的各个像素点一一对应,且背景特征图中的每个像素点的像素值表征:待分割图像中与该像素点相对应的像素点属于背景区域的可能性。因此在对前景特征图和背景特征图的各个像素点的像素值进行归一化操作后,得到的目标区域掩模图中的每个像素点的像素值表示:待分割图像中与该像素点相对应的像素点属于目标区域的概率,背景区域掩模图中的每个像素点的像素值表示:待分割图像中与该像素点相对应的像素点属于背景区域的概率。Among them, because each pixel of the foreground feature map corresponds to each pixel of the image to be segmented, and the pixel value of each pixel in the foreground feature map represents: the pixel corresponding to the pixel in the image to be segmented Possibility of belonging to the target area. At the same time, each pixel of the background feature map corresponds to each pixel of the image to be segmented, and the pixel value of each pixel in the background feature map represents: the pixel corresponding to the pixel in the image to be segmented belongs to the background Possibility of the area. Therefore, after normalizing the pixel value of each pixel in the foreground feature map and the background feature map, the obtained pixel value of each pixel in the target area mask image indicates: The corresponding pixel point belongs to the probability of the target area, and the pixel value of each pixel point in the background area mask image represents the probability that the pixel point corresponding to the pixel point in the image to be segmented belongs to the background area.
如此,根据目标区域掩模图和背景区域掩模图,基于各个像素点属于目标区域和/或背景区域的概率,对待分割图像进行分割,从而获得更准确的分割结果。In this way, according to the target area mask map and the background area mask map, the image to be segmented is segmented based on the probability that each pixel belongs to the target area and/or the background area, so as to obtain a more accurate segmentation result.
附图说明Description of the drawings
为了更清楚地说明本申请实施例的技术方案,下面将对本申请实施例的描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。In order to explain the technical solutions of the embodiments of the present application more clearly, the following will briefly introduce the drawings that need to be used in the description of the embodiments of the present application. Obviously, the drawings in the following description are only some embodiments of the present application. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative labor.
图1是本申请一实施例提出的图像分割方法的流程图;Fig. 1 is a flowchart of an image segmentation method proposed in an embodiment of the present application;
图2是本申请一实施例提出的图像分割方法的示意图;Fig. 2 is a schematic diagram of an image segmentation method proposed in an embodiment of the present application;
图3是本申请一实施例提出的指纹图像区域划分示意图;FIG. 3 is a schematic diagram of fingerprint image area division proposed by an embodiment of the present application;
图4是本申请一实施例提出的几种上采样方式各自对应的网络结构示意图;FIG. 4 is a schematic diagram of a network structure corresponding to several upsampling methods proposed in an embodiment of the present application;
图5是本申请一实施例提出的归一化示意图;FIG. 5 is a schematic diagram of normalization proposed by an embodiment of the present application;
图6是本申请一实施例提出的图像分割方法的分割效果图;Fig. 6 is a segmentation effect diagram of the image segmentation method proposed by an embodiment of the present application;
图7是本申请另一实施例提出的图像分割方法的流程图;FIG. 7 is a flowchart of an image segmentation method proposed by another embodiment of the present application;
图8是本申请另一实施例提出的图像分割方法的示意图;FIG. 8 is a schematic diagram of an image segmentation method proposed by another embodiment of the present application;
图9是本申请一实施例提出的特征图融合示意图;FIG. 9 is a schematic diagram of feature map fusion proposed by an embodiment of the present application;
图10是本申请一实施例提出的模型训练流程图;Fig. 10 is a flow chart of model training proposed in an embodiment of the present application;
图11是本申请一实施例提出的图像分割装置的示意图。FIG. 11 is a schematic diagram of an image segmentation device proposed in an embodiment of the present application.
具体实施方式Detailed ways
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。The technical solutions in the embodiments of the present application will be described clearly and completely in conjunction with the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all of them. Based on the embodiments in this application, all other embodiments obtained by those of ordinary skill in the art without creative work shall fall within the protection scope of this application.
相关技术中,越来越多的应用场景将计算机视觉技术和人体生物特征相结合,以执行解锁、认证、刑侦或目标追踪等任务。其中,人体生物特征包括但不限于:指纹、掌纹、手形、人脸、虹膜、耳廓等等。在执行上述任务期间,通常需要采集包括人体生物特征的原始图像,然后将人体生物特征的区域从原始图像中分割出,再针对分割出的人体生物特征区域进行关键点提取、特征比对等流程,最终实现对上述各种任务的执行。In related technologies, more and more application scenarios combine computer vision technology with human biological characteristics to perform tasks such as unlocking, authentication, criminal investigation, or target tracking. Among them, human biological characteristics include, but are not limited to: fingerprints, palm prints, hand shapes, human faces, iris, auricles, and so on. During the execution of the above tasks, it is usually necessary to collect the original image including the biological characteristics of the human body, and then segment the area of the biological characteristics of the human body from the original image, and then perform the key point extraction and feature comparison processes for the segmented human biological feature area , And finally realize the execution of the above-mentioned various tasks.
以指纹这一人体生物特征为例,首先需要利用指纹采集设备获得指纹的原始图像,然后需要从该原始图像中分割出指纹区域,最后针对分割出的指纹区域进行关键点提取、指纹对齐、比对识别等流程。为了从原始图像中分割出指纹等人体生物特征的所在区域,目前通常是从原始图像中获取指纹区域的对比度、方向一致性等特征,然后结合人工归纳的规则从原始图像中分割出指纹区域。但是在原始图像中存在复杂背景的情况下,利用上述方式进行指纹区域分割时,难以成功分割出较准确的指纹区域。Taking fingerprints as a biological feature of the human body as an example, it is first necessary to obtain the original image of the fingerprint by the fingerprint acquisition device, then it is necessary to segment the fingerprint area from the original image, and finally perform key point extraction, fingerprint alignment, and comparison of the segmented fingerprint area. Recognition and other processes. In order to segment the area where the fingerprints and other human biological features are located from the original image, currently, the contrast and direction consistency of the fingerprint area are usually obtained from the original image, and then combined with artificial induction rules to segment the fingerprint area from the original image. However, when there is a complex background in the original image, it is difficult to successfully segment a more accurate fingerprint area when the fingerprint area is segmented using the above method.
为此,本申请部分实施例提出图像分割方法,旨在提高图像分割的准确性。参考图1,图1是本申请一实施例提出的图像分割方法的流程图。如图1所示,该方法包括以下步骤:To this end, some embodiments of the present application propose image segmentation methods, aiming to improve the accuracy of image segmentation. Referring to FIG. 1, FIG. 1 is a flowchart of an image segmentation method proposed in an embodiment of the present application. As shown in Figure 1, the method includes the following steps:
步骤S11:对待分割图像进行特征提取,获得所述待分割图像的图像特征。Step S11: Perform feature extraction on the image to be segmented to obtain image features of the image to be segmented.
其中,待分割图像是包括人体生物特征的图像,例如待分割图像可以是:指纹图像、掌纹图像、人脸图像或虹膜图像等等。示例地,将本申请的图像分割方法应用于指纹识别系统后,该指纹识别系统在执行步骤S11时,对指纹图像进行特征提取。或者示例地,将本申请的图像分割方法应用于人脸识 别系统后,该人脸识别系统在执行步骤S11时,对人脸图像进行特征提取。Wherein, the image to be segmented is an image including biological characteristics of the human body. For example, the image to be segmented may be: a fingerprint image, a palmprint image, a face image, or an iris image, etc. For example, after the image segmentation method of the present application is applied to a fingerprint identification system, the fingerprint identification system performs feature extraction on the fingerprint image when performing step S11. Or as an example, after the image segmentation method of the present application is applied to a face recognition system, the face recognition system performs feature extraction on the face image when the face recognition system executes step S11.
为了实现对待分割图像的特征提取,在某些实施例中,可以利用特征提取模块CNN对待识别图像进行特征提取。参考图2,图2是本申请一实施例提出的图像分割方法的示意图。如图2所示,以待分割图像是指纹图像为例,将N×H×W的指纹图像输入特征提取模块CNN,获得N'×H'×W'的特征图,即图像特征。其中,N表示指纹图像的图像通道数,H表示指纹图像的高,W表示指纹图像的宽,N'表示图像特征的通道数,H'表示图像特征的高,W'表示图像特征的宽。通常,H'小于H,W'小于W。图2中,特征提取模块CNN的具体结构可选用VGG、ResNet(Residual Network)、或者ShuffleNet等网络的骨干结构backbone。In order to realize the feature extraction of the image to be segmented, in some embodiments, the feature extraction module CNN can be used to perform feature extraction on the image to be recognized. Referring to FIG. 2, FIG. 2 is a schematic diagram of an image segmentation method proposed by an embodiment of the present application. As shown in Figure 2, taking the image to be segmented is a fingerprint image as an example, the fingerprint image of N×H×W is input to the feature extraction module CNN to obtain the feature map of N'×H'×W', that is, the image feature. Among them, N represents the number of image channels of the fingerprint image, H represents the height of the fingerprint image, W represents the width of the fingerprint image, N'represents the number of channels of the image feature, H'represents the height of the image feature, and W'represents the width of the image feature. Generally, H'is less than H, and W'is less than W. In Figure 2, the specific structure of the feature extraction module CNN can be VGG, ResNet (Residual Network), or ShuffleNet and other network backbone structures.
在利用上述特征提取模块CNN对待识别图像进行特征提取之前,可以预先建立特征提取模块CNN,然后利用样本图像对其进行训练,最后利用训练完毕的特征提取模块CNN对待识别图像进行特征提取,以获得相应的图像特征。对于具体的训练方式,请参见下文。Before using the feature extraction module CNN to perform feature extraction on the image to be recognized, the feature extraction module CNN can be established in advance, and then the sample image is used to train it, and finally the trained feature extraction module CNN is used to perform feature extraction on the image to be recognized to obtain Corresponding image characteristics. For specific training methods, please see below.
步骤S12:对所述图像特征进行上采样操作,获得前景特征图和背景特征图,所述前景特征图中的各个像素点与所述待分割图像中的各个像素点一一对应,所述前景特征图中的每个像素点的像素值表征:所述待分割图像中与该像素点相对应的像素点属于目标区域的可能性,所述背景特征图中的各个像素点与所述待分割图像中的各个像素点一一对应,所述背景特征图中的每个像素点的像素值表征:所述待分割图像中与该像素点相对应的像素点属于背景区域的可能性。Step S12: Perform an up-sampling operation on the image feature to obtain a foreground feature map and a background feature map. Each pixel in the foreground feature map corresponds to each pixel in the image to be segmented, and the foreground The pixel value of each pixel in the feature map represents the possibility that the pixel corresponding to the pixel in the image to be segmented belongs to the target area, and each pixel in the background feature map is related to the pixel to be segmented. Each pixel in the image has a one-to-one correspondence, and the pixel value of each pixel in the background feature map represents the possibility that the pixel corresponding to the pixel in the image to be segmented belongs to the background area.
通过执行步骤S12,对图像特征进行上采样,从而获得分辨率与待分割图像的分辨率一致的前景特征图和背景特征图,如此,前景特征图的各个像素点可以与待分割图像的各个像素点一一对应,背景特征图的各个像素点可以与待分割图像的各个像素点一一对应。By performing step S12, the image features are up-sampled to obtain the foreground feature map and the background feature map whose resolution is consistent with the resolution of the image to be segmented. In this way, each pixel of the foreground feature map can be compared with each pixel of the image to be segmented. There is one-to-one correspondence, and each pixel of the background feature map can be one-to-one corresponding to each pixel of the image to be segmented.
其中,目标区域是指准备从待分割图像中分割出的区域,背景区域是指待分割图像中除目标区域以外的区域。参考图3,图3是本申请一实施例提出的指纹图像区域划分示意图。如图3所示,以指纹图像为例,虚线框以内 的区域是指纹的有效区域,即目标区域,虚线框以外的区域是背景区域。Among them, the target area refers to the area to be segmented from the image to be segmented, and the background area refers to the area other than the target area in the image to be segmented. Referring to FIG. 3, FIG. 3 is a schematic diagram of fingerprint image area division proposed by an embodiment of the present application. As shown in Figure 3, taking a fingerprint image as an example, the area within the dashed frame is the effective area of the fingerprint, that is, the target area, and the area outside the dashed frame is the background area.
如上所述,在前景特征图中,包括多个像素点,多个像素点对应各自的像素值。针对前景特征图中的每个像素点,该像素点的像素值越大,在待分割图像中位于相同位置的像素点越可能属于目标区域。As described above, the foreground feature map includes multiple pixels, and the multiple pixels correspond to their respective pixel values. For each pixel in the foreground feature map, the larger the pixel value of the pixel, the more likely the pixel at the same position in the image to be segmented belongs to the target area.
如上所述,在背景特征图中,包括多个像素点,多个像素点对应各自的像素值。针对背景特征图中的每个像素点,该像素点的像素值越大,在待分割图像中位于相同位置的像素点越可能属于背景区域。As described above, the background feature map includes multiple pixels, and the multiple pixels correspond to respective pixel values. For each pixel in the background feature map, the larger the pixel value of the pixel, the more likely the pixel at the same position in the image to be segmented belongs to the background area.
为了实现对图像特征的上采样操作,在某些实施例中,可以利用图像分割模块对图像特征进行上采样。如图2所示,以待分割图像是指纹图像为例,将N'×H'×W'的特征图输入图像分割模块,获得2×H×W的分割结果,即前景特征图和背景特征图,其中前景特征图和背景特征图的分辨率均为H×W。图2中,图像分割模块采用的上采样方式包括但不限于:反卷积上采样、图片缩放上采样、子像素卷积上采样。图像分割模块的上采样方式决定了图像分割模块的网络结构。In order to implement an up-sampling operation on image features, in some embodiments, an image segmentation module may be used to up-sample the image features. As shown in Figure 2, taking the image to be segmented is a fingerprint image as an example, input the feature map of N'×H'×W' into the image segmentation module to obtain the segmentation result of 2×H×W, namely the foreground feature map and the background feature The resolutions of the foreground feature map and the background feature map are both H×W. In Figure 2, the up-sampling methods adopted by the image segmentation module include but are not limited to: deconvolution up-sampling, picture scaling up-sampling, and sub-pixel convolution up-sampling. The up-sampling method of the image segmentation module determines the network structure of the image segmentation module.
参考图4,图4是本申请一实施例提出的几种上采样方式各自对应的网络结构示意图。如图4所示,反卷积上采样对应的网络结构包括反卷积网络deconvolution;图片缩放上采样对应的网络结构包括:卷积神经网络CNN和图片缩放模块;子像素卷积上采样对应的网络结构包括:卷积神经网络CNN(可选的)和子像素卷积模块sub-pixel convolution。Referring to FIG. 4, FIG. 4 is a schematic diagram of a network structure corresponding to each of the several upsampling methods proposed in an embodiment of the present application. As shown in Figure 4, the network structure corresponding to deconvolution and upsampling includes deconvolution network deconvolution; the network structure corresponding to image scaling and upsampling includes: convolutional neural network CNN and image scaling module; sub-pixel convolutional upsampling corresponds to The network structure includes: convolutional neural network CNN (optional) and sub-pixel convolution module sub-pixel convolution.
在利用上述图像分割模块对图像特征进行上采样之前,可以预先建立图像分割模块,然后利用样本图像对其进行训练,最后利用训练完毕的图像分割模块对图像特征进行上采样,以获得相应的前景特征图和背景特征图。对于具体的训练方式,请参见下文。Before using the above-mentioned image segmentation module to up-sampling the image features, the image segmentation module can be established in advance, and then the sample image is used to train it, and finally the trained image segmentation module is used to up-sample the image features to obtain the corresponding foreground Feature map and background feature map. For specific training methods, please see below.
步骤S13:对所述前景特征图的各个像素点的像素值和所述背景特征图的各个像素点的像素值进行归一化,获得目标区域掩模图和背景区域掩模图,其中,所述目标区域掩模图中的每个像素点的像素值表示:所述待分割图像中与该像素点相对应的像素点属于目标区域的概率,所述背景区域掩模图中的每个像素点的像素值表示:所述待分割图像中与该像素点相对应的像素点 属于背景区域的概率。Step S13: Normalize the pixel value of each pixel of the foreground feature map and the pixel value of each pixel of the background feature map to obtain a target area mask map and a background area mask map, wherein The pixel value of each pixel in the target area mask image represents: the probability that the pixel corresponding to the pixel in the image to be segmented belongs to the target area, and each pixel in the background area mask image The pixel value of the point represents: the probability that the pixel point corresponding to the pixel point in the image to be segmented belongs to the background area.
示例地,参考图5,图5是本申请一实施例提出的归一化示意图。如图5所示,前景特征图中的像素点A1的像素值为7,背景特征图中位于相同位置的像素点A2的像素值为2。如图2所示,可以利用softmax函数对像素点A1的像素值和像素点A2的像素值进行归一化。归一化后的目标区域掩模图中,像素点A1'的像素值等于e 7/(e 7+e 2),即约等于1;归一化后的背景区域掩模图中,像素点A2'的像素值等于e 2/(e 7+e 2),即约等于0。如此,待分割图像中位于相同位置的像素点A很可能属于目标区域,而几乎不可能属于背景区域。 For example, referring to FIG. 5, FIG. 5 is a normalized schematic diagram proposed by an embodiment of the present application. As shown in FIG. 5, the pixel value of the pixel point A1 in the foreground feature map is 7, and the pixel value of the pixel point A2 at the same position in the background feature map is 2. As shown in Figure 2, the softmax function can be used to normalize the pixel value of the pixel A1 and the pixel value of the pixel A2. In the normalized target area mask image, the pixel value of pixel A1' is equal to e 7 /(e 7 +e 2 ), which is approximately equal to 1. In the normalized background area mask image, the pixel value The pixel value of A2' is equal to e 2 /(e 7 +e 2 ), that is, approximately equal to zero. In this way, the pixel A located at the same position in the image to be segmented is likely to belong to the target area, but it is almost impossible to belong to the background area.
继续如图5所示,前景特征图中的像素点B1的像素值为3,背景特征图中位于相同位置的像素点B2的像素值为5。可以利用softmax函数对像素点B1的像素值和像素点B2的像素值进行归一化。归一化后的目标区域掩模图中,像素点B1'的像素值等于e 3/(e 3+e 5),即等于0.12;归一化后的背景区域掩模图中,像素点B2'的像素值等于e 5/(e 3+e 5),即约等于0.88。如此,待分割图像中位于相同位置的像素点B属于目标区域的概率为0.12,属于背景区域的概率为0.88。 Continuing as shown in FIG. 5, the pixel value of the pixel point B1 in the foreground feature map is 3, and the pixel value of the pixel point B2 at the same position in the background feature map is 5. The softmax function can be used to normalize the pixel value of the pixel point B1 and the pixel value of the pixel point B2. In the normalized target area mask image, the pixel value of pixel point B1' is equal to e 3 /(e 3 +e 5 ), which is equal to 0.12; in the normalized background area mask image, pixel point B2 The pixel value of 'is equal to e 5 /(e 3 +e 5 ), which is approximately equal to 0.88. In this way, the probability that the pixel B located at the same position in the image to be segmented belongs to the target area is 0.12, and the probability that it belongs to the background area is 0.88.
步骤S14:根据所述目标区域掩模图和所述背景区域掩模图,对所述待分割图像进行分割。Step S14: segment the image to be segmented according to the target area mask image and the background area mask image.
具体地,可以根据目标区域掩模图中各个像素点的像素值,从待分割图像中分割出目标区域;根据背景区域掩模图中各个像素点的像素值,从待分割图像中分割出背景区域。Specifically, the target area can be segmented from the image to be segmented according to the pixel value of each pixel in the target area mask image; the background can be segmented from the image to be segmented according to the pixel value of each pixel in the background area mask image area.
在某些实施例中,上述步骤S14可具体包括以下子步骤:In some embodiments, the above step S14 may specifically include the following sub-steps:
子步骤S14-1:针对所述目标区域掩模图中的每个像素点,在该像素点的像素值大于第一预设阈值的情况下,将所述待分割图像中与该像素点相对应的像素点确定为属于目标区域,并从所述待分割图像中分割出所述目标区域的像素点;Sub-step S14-1: For each pixel in the target area mask image, if the pixel value of the pixel is greater than the first preset threshold, compare the pixel in the image to be segmented The corresponding pixel is determined to belong to the target area, and the pixel of the target area is segmented from the image to be segmented;
和/或子步骤S14-2:针对所述背景区域掩模图中的每个像素点,在该像素点的像素值大于第二预设阈值的情况下,将所述待分割图像中与该像素点 相对应的像素点确定为属于背景区域;并从所述待分割图像中分割出所述背景区域的像素点。And/or sub-step S14-2: For each pixel in the background area mask image, if the pixel value of the pixel is greater than a second preset threshold, combine the image to be divided with the The pixel point corresponding to the pixel point is determined to belong to the background area; and the pixel point of the background area is segmented from the image to be segmented.
示例地,以第一预设阈值等于0.5为例,针对目标区域掩模图中的每个像素点,在该像素点的像素值大于0.5的情况下,将该像素点的像素值更新为1,否则更新为0。如此,得到更新后的目标区域掩模图,图中像素值为1的像素点对应待分割图像中的目标区域,图中像素值为0的像素点对应待分割图像中的背景区域。然后将更新后的目标区域掩模图与待分割图像相乘,换言之,将更新后的目标区域掩模图中各个像素点的像素值,与待分割图像中对应像素点的像素值一对一地相乘。如此,待分割图像中背景区域的像素点对应的像素值乘积等于0,目标区域的像素点对应的像素值乘积等于原像素值,从而将目标区域从待分割图像中分割出来。For example, taking the first preset threshold equal to 0.5 as an example, for each pixel in the target area mask image, if the pixel value of the pixel is greater than 0.5, the pixel value of the pixel is updated to 1. , Otherwise update to 0. In this way, an updated target area mask image is obtained, in which pixels with a pixel value of 1 correspond to the target area in the image to be divided, and pixels with a pixel value of 0 in the figure correspond to the background area in the image to be divided. Then multiply the updated target area mask image with the image to be segmented, in other words, the pixel value of each pixel in the updated target area mask image is one-to-one with the pixel value of the corresponding pixel in the image to be segmented Multiply together. In this way, the product of pixel values corresponding to pixels in the background area in the image to be segmented is equal to 0, and the product of pixel values corresponding to pixels in the target area is equal to the original pixel value, thereby segmenting the target area from the image to be segmented.
以第二预设阈值等于0.5为例,针对背景区域掩模图中的每个像素点,在该像素点的像素值大于0.5的情况下,将该像素点的像素值更新为1,否则更新为0。如此,得到更新后的背景区域掩模图,图中像素值为1的像素点对应待分割图像中的背景区域,图中像素值为0的像素点对应待分割图像中的目标区域。然后将更新后的背景区域掩模图与待分割图像相乘,换言之,将更新后的背景区域掩模图中各个像素点的像素值,与待分割图像中对应像素点的像素值一对一地相乘。如此,待分割图像中背景区域的像素点对应的像素值乘积等于原像素值,目标区域的像素点对应的像素值乘积等于0,从而将背景区域从待分割图像中分割出来。Taking the second preset threshold equal to 0.5 as an example, for each pixel in the mask image of the background area, if the pixel value of the pixel is greater than 0.5, the pixel value of the pixel is updated to 1, otherwise it is updated Is 0. In this way, an updated background area mask image is obtained. In the figure, a pixel with a pixel value of 1 corresponds to the background area in the image to be divided, and a pixel with a pixel value of 0 in the figure corresponds to the target area in the image to be divided. Then multiply the updated background area mask image with the image to be divided, in other words, the pixel value of each pixel in the updated background area mask image is one-to-one with the pixel value of the corresponding pixel in the image to be divided Multiply together. In this way, the product of pixel values corresponding to pixels in the background area in the image to be segmented is equal to the original pixel value, and the product of pixel values corresponding to pixels in the target area is equal to 0, thereby segmenting the background area from the image to be segmented.
通过执行上述包括步骤S11至步骤S14的图像分割方法,与现有技术相比,至少具有以下优点:Compared with the prior art, by executing the above-mentioned image segmentation method including steps S11 to S14, it has at least the following advantages:
由于前景特征图的各个像素点与待分割图像的各个像素点一一对应,且前景特征图中的每个像素点的像素值表征:待分割图像中与该像素点相对应的像素点属于目标区域的可能性。同时背景特征图的各个像素点与待分割图像的各个像素点一一对应,且背景特征图中的每个像素点的像素值表征:待分割图像中与该像素点相对应的像素点属于背景区域的可能性。因此在对前景特征图和背景特征图的各个像素点的像素值进行归一化操作后,得到的目 标区域掩模图中的每个像素点的像素值表示:待分割图像中与该像素点相对应的像素点属于目标区域的概率,背景区域掩模图中的每个像素点的像素值表示:待分割图像中与该像素点相对应的像素点属于背景区域的概率。Since each pixel of the foreground feature map corresponds to each pixel of the image to be segmented, and the pixel value of each pixel in the foreground feature map represents: the pixel corresponding to the pixel in the image to be segmented belongs to the target Possibility of the area. At the same time, each pixel of the background feature map corresponds to each pixel of the image to be segmented, and the pixel value of each pixel in the background feature map represents: the pixel corresponding to the pixel in the image to be segmented belongs to the background Possibility of the area. Therefore, after normalizing the pixel value of each pixel in the foreground feature map and the background feature map, the obtained pixel value of each pixel in the target area mask image indicates: The corresponding pixel point belongs to the probability of the target area, and the pixel value of each pixel point in the background area mask image represents the probability that the pixel point corresponding to the pixel point in the image to be segmented belongs to the background area.
如此,根据目标区域掩模图和背景区域掩模图,基于各个像素点属于目标区域和/或背景区域的概率,对待分割图像进行分割,从而获得更准确的分割结果,提高图像分割召回率。In this way, according to the target area mask map and the background area mask map, the image to be segmented is segmented based on the probability that each pixel belongs to the target area and/or the background area, so as to obtain a more accurate segmentation result and improve the image segmentation recall rate.
参考图6,图6是本申请一实施例提出的图像分割方法的分割效果图。如图6所示,居上的三个指纹图像为三个待分割图像,居下的三个指纹图像为分割后的分割结果图,三个分割结果图中各自的虚线框区域即是分割出的指纹区域。如图6所示,每个待分割图像均被准确地分割出指纹区域。Referring to FIG. 6, FIG. 6 is a segmentation effect diagram of the image segmentation method proposed by an embodiment of the present application. As shown in Figure 6, the top three fingerprint images are the three images to be segmented, the bottom three fingerprint images are the segmentation result images after segmentation, and the dashed frame area in each of the three segmentation result images is the segmentation. Fingerprint area. As shown in Figure 6, each image to be segmented is accurately segmented into fingerprint regions.
参考图7,图7是本申请另一实施例提出的图像分割方法的流程图。如图7所示,该方法包括以下步骤:Referring to FIG. 7, FIG. 7 is a flowchart of an image segmentation method proposed by another embodiment of the present application. As shown in Figure 7, the method includes the following steps:
步骤S71:对所述待分割图像进行多种尺度的特征提取操作,获得所述待分割图像的多个不同尺度的图像特征。Step S71: Perform feature extraction operations of multiple scales on the image to be segmented to obtain multiple image features of different scales of the image to be segmented.
步骤S72:针对所述多个不同尺度的图像特征分别进行上采样操作,获得多个图像特征各自对应的前景特征图和背景特征图。Step S72: Perform an up-sampling operation on the multiple image features of different scales, respectively, to obtain a foreground feature map and a background feature map corresponding to each of the multiple image features.
其中,步骤S71作为上述步骤S11的一种具体实施方式,步骤S72作为上述步骤S12的一种具体实施方式。Among them, step S71 is used as a specific implementation of the above step S11, and step S72 is used as a specific implementation of the above step S12.
为了对待分割图像进行多种尺度的特征提取操作,在某些实施例中,可以将待分割图像分别输入多个卷积神经网络CNN,每个卷积神经网络CNN包括的卷积层的层数互不相同。一个卷积神经网络CNN的卷积层的层数越多,该卷积神经网络CNN对待分割图像进行的特征提取操作的尺度越深,该卷积神经网络CNN输出的图像特征的尺度也越深。In order to perform multi-scale feature extraction operations on the image to be segmented, in some embodiments, the image to be segmented can be input to multiple convolutional neural networks CNN, and the number of convolutional layers included in each convolutional neural network CNN Different from each other. The more the number of convolutional layers of a convolutional neural network CNN, the deeper the scale of the feature extraction operation of the convolutional neural network CNN to be segmented, and the deeper the scale of the image features output by the convolutional neural network CNN .
参考图8,图8是本申请另一实施例提出的图像分割方法的示意图。在另一些实施例中,如图8所示,在卷积神经网络CNN1对待分割图像N×H×W进行特征提取,以获得图像特征N'×H'×W'之后。一方面,可以将该图像特征N'×H'×W'输入图像分割模块1进行上采样操作,获得2×H×W的分割结果,即一张前景特征图和一张背景特征图。另一方面,可以将该图像特征 N'×H'×W'输入卷积神经网络CNN2。Referring to FIG. 8, FIG. 8 is a schematic diagram of an image segmentation method proposed by another embodiment of the present application. In other embodiments, as shown in FIG. 8, after the convolutional neural network CNN1 performs feature extraction on the image to be segmented N×H×W, to obtain the image feature N′×H′×W′. On the one hand, the image feature N'×H'×W' can be input to the image segmentation module 1 to perform an up-sampling operation to obtain a segmentation result of 2×H×W, that is, a foreground feature map and a background feature map. On the other hand, the image feature N'×H'×W' can be input into the convolutional neural network CNN2.
在卷积神经网络CNN2对图像特征N'×H'×W'进行进一步特征提取,以获得图像特征N”×H”×W”之后。一方面,可以将该图像特征N”×H”×W”输入图像分割模块2进行上采样操作,获得2×H×W的分割结果,即一张前景特征图和一张背景特征图。另一方面,可以将该图像特征N”×H”×W”输入卷积神经网络CNN3。After the convolutional neural network CNN2 performs further feature extraction on the image feature N'×H'×W' to obtain the image feature N”×H”×W”. On the one hand, the image feature N”×H”× The W" input image segmentation module 2 performs an up-sampling operation to obtain a segmentation result of 2×H×W, that is, a foreground feature map and a background feature map. On the other hand, the image feature N”×H”×W” can be input into the convolutional neural network CNN3.
依次类推,可以获得待分割图像的多个不同尺度的图像特征,并针对多个图像特征分别进行上采样操作,以获得多个图像特征各自对应的前景特征图和背景特征图。图8中,H”'<H”<H'<H,W”'<W”<W'<W,图像特征N'×H'×W'、N”×H”×W”以及N”'×H”'×W”'的尺度依次递增。By analogy, multiple image features of different scales of the image to be segmented can be obtained, and an up-sampling operation is performed on the multiple image features to obtain the foreground feature map and the background feature map corresponding to each of the multiple image features. In Figure 8, H"'<H"<H'<H, W"'<W"<W'<W, image features N'×H'×W', N”×H”×W” and N” The scale of'×H”'×W”' increases in order.
本申请通过获得待分割图像的多种不同尺度的图像特征,并基于各种尺度的图像特征执行后续的上采样、融合、归一化流程,从而提升了图像特征的复杂度,使得图像特征能包括尺度更丰富的特征,进而有利于进一步提高图像分割准确性。此外,利用如图8所示的模型执行上述步骤S71和步骤S72,该模型的结构更丰富,在训练期间具有更强的学习能力,因此也有利于进一步提高图像分割准确性。This application obtains multiple image features of different scales of the image to be segmented, and performs subsequent up-sampling, fusion, and normalization processes based on the image features of various scales, thereby increasing the complexity of image features and enabling image features to be Including features with richer scales will further improve the accuracy of image segmentation. In addition, the above-mentioned steps S71 and S72 are executed using the model shown in FIG. 8, the structure of the model is richer, and it has stronger learning ability during training, which is also conducive to further improving the accuracy of image segmentation.
如图7所示,该图像分割方法还可以包括以下步骤:As shown in Fig. 7, the image segmentation method may further include the following steps:
步骤S73-1:对多个图像特征各自对应的前景特征图进行融合,获得一张融合的前景特征图,以及对多个图像特征各自对应的背景特征图进行融合,获得一张融合的背景特征图。Step S73-1: Fusion of the foreground feature maps corresponding to multiple image features to obtain a fused foreground feature map, and fusion of the background feature maps corresponding to each of the multiple image features to obtain a fused background feature map Figure.
步骤S73-2:对所述融合的前景特征图的各个像素点的像素值和所述融合的背景特征图的各个像素点的像素值进行归一化,获得所述目标区域掩模图和背景区域掩模图。Step S73-2: Normalize the pixel value of each pixel of the fused foreground feature map and the pixel value of each pixel of the fused background feature map to obtain the target area mask image and background Area mask map.
其中,步骤S73-1和步骤S73-2作为上述步骤S13的一种具体实施方式。Among them, step S73-1 and step S73-2 are used as a specific implementation of the above step S13.
在执行步骤S73-1时,可以首先根据多个前景特征图的特征深度顺序,对多个前景特征图进行叠加;然后对叠加后的多个前景特征图进行卷积,获得融合的前景特征图。同样地,可以首先根据多个背景特征图的特征深度顺序,对多个背景特征图进行叠加;然后对叠加后的多个背景特征图进行卷积, 获得融合的背景特征图。When performing step S73-1, the multiple foreground feature maps can be superimposed first according to the feature depth order of the multiple foreground feature maps; then the superimposed multiple foreground feature maps are convolved to obtain a fused foreground feature map . Similarly, the multiple background feature maps can be superimposed first according to the feature depth order of the multiple background feature maps; then, the superimposed multiple background feature maps can be convolved to obtain a fused background feature map.
示例地,参考图9,图9是本申请一实施例提出的特征图融合示意图。如图9所示,将2M×H×W的图像特征分为M×H×W的前景特征图和M×H×W的背景特征图。其中,2M×H×W的图像特征对应M种尺度的前景特征图和M种尺度的背景特征图,换言之,在上述步骤S71中,对待分割图像进行了M种尺度的特征提取操作。其中,M×H×W的前景特征图是:M个1×H×W的前景特征图按照特征深度顺序依次叠加后形成的。M×H×W的背景特征图是:M个1×H×W的背景特征图按照特征深度顺序依次叠加后形成的。For example, referring to FIG. 9, FIG. 9 is a schematic diagram of feature map fusion proposed by an embodiment of the present application. As shown in FIG. 9, the 2M×H×W image features are divided into M×H×W foreground feature maps and M×H×W background feature maps. Among them, the image features of 2M×H×W correspond to foreground feature maps of M scales and background feature maps of M scales. In other words, in step S71, feature extraction operations of M scales are performed on the image to be segmented. Among them, the M×H×W foreground feature map is formed by sequentially superimposing M 1×H×W foreground feature maps in the order of feature depth. The M×H×W background feature map is formed by sequentially superimposing M 1×H×W background feature maps in the order of feature depth.
如图9所示,利用单层卷积神经网络CNN1对M×H×W的前景特征图进行卷积,获得1×H×W的融合的前景特征图。利用单层卷积神经网络CNN2对M×H×W的背景特征图进行卷积,获得1×H×W的融合的背景特征图。最后将融合的前景特征图和融合的背景特征图进行叠加,获得2×H×W的融合特征图。其中,图9所示的网络结构即是图8中的分割结果融合模块。As shown in Figure 9, the single-layer convolutional neural network CNN1 is used to convolve the M×H×W foreground feature map to obtain a 1×H×W fused foreground feature map. A single-layer convolutional neural network CNN2 is used to convolve the M×H×W background feature map to obtain a 1×H×W fused background feature map. Finally, the fused foreground feature map and the fused background feature map are superimposed to obtain a 2×H×W fusion feature map. Among them, the network structure shown in FIG. 9 is the segmentation result fusion module in FIG. 8.
在执行步骤S73-2时,可参考针对上述步骤S13的解释以及参考附图5所示内容,本申请在此不做赘述。When performing step S73-2, reference may be made to the explanation of step S13 above and the content shown in FIG. 5, which is not repeated in this application.
如图7所示,该图像分割方法还可以包括以下步骤:As shown in Fig. 7, the image segmentation method may further include the following steps:
步骤S74:根据所述目标区域掩模图和所述背景区域掩模图,对所述待分割图像进行分割。Step S74: segment the image to be segmented according to the target area mask image and the background area mask image.
在执行步骤S74时,可参考上述针对步骤S14的解释,本申请在此不做赘述。When performing step S74, reference may be made to the above-mentioned explanation of step S14, which will not be repeated in this application.
此外,在执行上述步骤S12,可以针对上述步骤S11所获得的图像特征同时进行多种方式的上采样操作,从而综合多种上采样方式的优点,进而提高图像分割的准确性。In addition, after performing the above step S12, multiple methods of upsampling operations can be simultaneously performed on the image features obtained in the above step S11, thereby integrating the advantages of multiple upsampling methods, and thereby improving the accuracy of image segmentation.
具体地,针对上述步骤S11所获得的图像特征,通过多个上采样路径对该图像特征分别进行上采样处理,分别获得每个上采样路径输出的一张前景特征图和一张背景特征图。在一种可能的实施方式中,可以将该图像特征输入包括多个上采样路径的图像分割模块,以通过所述图像分割模块中的每个上采样路径对所述图像特征分别进行上采样处理,分别获得每个上采样路径 输出的一张前景特征图和一张背景特征图,其中,多个上采样路径各自对应的上采样方式互不相同。Specifically, for the image features obtained in step S11, the image features are respectively up-sampled through multiple up-sampling paths to obtain a foreground feature map and a background feature map output by each up-sampling path. In a possible implementation manner, the image feature may be input to an image segmentation module that includes multiple upsampling paths, so that the image features are individually upsampled through each upsampling path in the image segmentation module , Respectively obtain a foreground feature map and a background feature map output by each up-sampling path, wherein the up-sampling modes corresponding to each of the multiple up-sampling paths are different from each other.
例如,图像分割模块包括三个上采样路径,三个上采样路径的网络结构分别如图4所示,三个上采样路径分别实现对图像特征的反卷积上采样、图片缩放上采样、以及子像素卷积上采样。利用该图像分割模块对图像特征进行上采样后,分别获得各个上采样路径输出的前景图像特征和背景图像特征。For example, the image segmentation module includes three up-sampling paths. The network structures of the three up-sampling paths are shown in Figure 4. The three up-sampling paths implement deconvolution and up-sampling of image features, image scaling up-sampling, and Sub-pixel convolutional upsampling. After the image segmentation module is used to up-sampling the image features, the foreground image features and background image features output by each up-sampling path are obtained.
然后在执行上述步骤S13时,可参考图9所示内容,首先对多个上采样路径输出的多张前景特征图进行融合,获得一张融合的前景特征图,以及对多个上采样路径输出的多张背景特征图进行融合,获得一张融合的背景特征图;然后对所述融合的前景特征图的各个像素点的像素值和所述融合的背景特征图的各个像素点的像素值进行归一化,获得所述目标区域掩模图和背景区域掩模图。Then when performing the above step S13, you can refer to the content shown in Figure 9. First, the multiple foreground feature maps output by the multiple upsampling paths are merged to obtain a fused foreground feature map, and the multiple upsampling paths output Fusion of multiple background feature maps to obtain a fused background feature map; then the pixel value of each pixel of the fused foreground feature map and the pixel value of each pixel of the fused background feature map are performed Normalize to obtain the target area mask image and the background area mask image.
或者在执行上述步骤S72时,可以针对上述步骤S71所获得的多个不同尺度的图像特征中的每个图像特征,对该图像特征同时进行多种方式的上采样操作,从而综合多种上采样方式的优点,进而提高图像分割的准确性。Or when performing the above step S72, for each of the multiple image features of different scales obtained in the above step S71, the image feature can be up-sampling in multiple ways at the same time, thereby integrating multiple up-sampling The advantages of the method, and then improve the accuracy of image segmentation.
以上,本申请通过实施例介绍了图像分割方法的应用过程,在某些实施例中,图像分割方法的应用过程中涉及到特征提取模块CNN和图像分割模块。以下,本申请通过实施例介绍各个模块的训练过程。应当理解的,上述图像分割模块的实施并非必须依赖于上述各个模块,上述各个模块的应用不应理解为对本申请的限定。Above, this application has introduced the application process of the image segmentation method through the embodiments. In some embodiments, the application process of the image segmentation method involves the feature extraction module CNN and the image segmentation module. In the following, the present application introduces the training process of each module through embodiments. It should be understood that the implementation of the above-mentioned image segmentation module does not necessarily depend on the above-mentioned various modules, and the application of the above-mentioned various modules should not be understood as a limitation of the present application.
参考图10,图10是本申请一实施例提出的模型训练流程图。如图10所示,该训练流程包括以下步骤:Refer to FIG. 10, which is a flow chart of model training proposed in an embodiment of the present application. As shown in Figure 10, the training process includes the following steps:
步骤S10-1:获得样本图像,所述样本图像携带目标区域掩模标注图和背景区域掩模标注图,所述目标区域掩模标注图中目标区域的像素点的像素值为第一像素值,背景区域的像素点的像素值为第二像素值,所述背景区域掩模标注图中目标区域的像素点的像素值为所述第二像素值,背景区域的像素点的像素值为所述第一像素值。Step S10-1: Obtain a sample image, the sample image carries a target area mask annotation map and a background area mask annotation map, and the pixel value of the pixel point of the target area in the target area mask annotation map is the first pixel value , The pixel value of the pixel in the background area is the second pixel value, the pixel value of the pixel in the target area in the background area mask annotation map is the second pixel value, and the pixel value of the pixel in the background area is The first pixel value.
其中,第一像素值和第二像素值不同。在一种可能的实施方式中,第一 像素值为1,第二像素值为0。Wherein, the first pixel value is different from the second pixel value. In a possible implementation, the first pixel has a value of 1, and the second pixel has a value of zero.
示例地,获得多张样本指纹图像,针对每张样本指纹图像,根据该样本指纹图像中的指纹区域和背景区域,生成该样本指纹图像的目标区域掩模标注图和背景区域掩模标注图。其中,目标区域掩模标注图中指纹区域的像素点的像素值为1,背景区域的像素点的像素值为0。背景区域掩模标注图中指纹区域的像素点的像素值为0,背景区域的像素点的像素值为1。For example, multiple sample fingerprint images are obtained, and for each sample fingerprint image, the target area mask annotation map and the background area mask annotation map of the sample fingerprint image are generated according to the fingerprint area and the background area in the sample fingerprint image. Among them, the pixel value of the pixel in the fingerprint area in the target area mask annotation map is 1, and the pixel value of the pixel in the background area is 0. The pixel value of the pixel in the fingerprint area in the background area mask annotation map is 0, and the pixel value of the pixel in the background area is 1.
为了进一步提高模型的适用范围,多张样本指纹图像可以来自于多种场景。例如包括:寒冷天气情况下采集的样本指纹图像、指尖沾水情况下采集的样本指纹图像、指尖沾有印泥情况下采集的样本指纹图像。In order to further improve the applicable scope of the model, multiple sample fingerprint images can come from multiple scenes. Examples include: sample fingerprint images collected in cold weather, sample fingerprint images collected when fingertips are wet, and sample fingerprint images collected when fingertips are stained with inkpad.
获得为了使得模型可应用于手机、平板电脑等终端设备,考虑到手机、平板电脑等终端设备上预留的指纹采集区域较小,通常小于手指尖的面积。为此,可以对样本指纹图像进行剪裁处理。例如将分辨率为H×W的原始样本指纹图像剪裁为H/2×W/2样本指纹图像,然后再针对该H/2×W/2样本指纹图像,生成H/2×W/2的目标区域掩模标注图和背景区域掩模标注图。In order to make the model applicable to terminal devices such as mobile phones and tablet computers, considering that the fingerprint collection area reserved on terminal devices such as mobile phones and tablet computers is small, usually smaller than the area of a fingertip. To this end, the sample fingerprint image can be cropped. For example, crop the original sample fingerprint image with the resolution of H×W into H/2×W/2 sample fingerprint image, and then generate H/2×W/2 sample fingerprint image for the H/2×W/2 sample fingerprint image The target area mask annotated map and the background area mask annotated map.
步骤S10-2:将所述样本图像输入预设模型,以通过所述预设模型对所述样本图像进行特征提取,以获得图像特征,并通过所述预设模型对所述图像特征进行上采样操作,以获得前景预测特征图和背景预测特征图。Step S10-2: Input the sample image into a preset model to perform feature extraction on the sample image through the preset model to obtain image features, and upload the image features through the preset model Sampling operation to obtain foreground prediction feature maps and background prediction feature maps.
示例地,预设模型的结构可参考图2或图8所示的网络结构。其中,图像分割模块可包括1个或多个上采样路径。如果图像分割模块包括多个上采样路径,各个上采样路径互不相同。For example, the structure of the preset model can refer to the network structure shown in FIG. 2 or FIG. 8. Among them, the image segmentation module may include one or more up-sampling paths. If the image segmentation module includes multiple up-sampling paths, the up-sampling paths are different from each other.
步骤S10-3:对所述前景预测特征图和背景预测特征图各自的像素值进行归一化操作,获得目标区域掩模预测图和背景区域掩模预测图。Step S10-3: Perform a normalization operation on the respective pixel values of the foreground prediction feature map and the background prediction feature map to obtain a target region mask prediction map and a background region mask prediction map.
其中,对于归一化操作的具体方式,可以参考针对上述步骤S13的解释以及参考附图5所示内容,本申请在此不做赘述。For the specific manner of the normalization operation, reference can be made to the explanation of the above step S13 and the content shown in FIG. 5, which is not repeated in this application.
步骤S10-4:根据所述目标区域掩模预测图、背景区域掩模预测图、目标区域掩模标注图以及背景区域掩模标注图,对所述预设模型进行更新。Step S10-4: Update the preset model according to the target area mask prediction map, the background area mask prediction map, the target area mask annotation map, and the background area mask annotation map.
示例地,可以计算目标区域掩模预测图和目标区域掩模标注图的交叉熵损失,然后利用该交叉熵损失对预设模型的各个模块进行更新。或者,可以 计算背景区域掩模预测图和背景区域掩模标注图的交叉熵损失,然后利用该交叉熵损失对预设模型的各个模块进行更新。或者可以计算目标区域掩模预测图和目标区域掩模标注图的交叉熵损失,同时计算背景区域掩模预测图和背景区域掩模标注图的交叉熵损失,最后计算两个交叉熵损失的平均损失值,利用该平均损失值对预设模型的各个模块进行更新。For example, the cross entropy loss of the target area mask prediction map and the target area mask annotation map can be calculated, and then the cross entropy loss can be used to update each module of the preset model. Alternatively, the cross entropy loss of the background area mask prediction map and the background area mask annotation map can be calculated, and then the cross entropy loss can be used to update each module of the preset model. Or you can calculate the cross entropy loss of the target area mask prediction map and the target area mask annotation map, and calculate the cross entropy loss of the background area mask prediction map and the background area mask annotation map, and finally calculate the average of the two cross entropy losses Loss value, using the average loss value to update each module of the preset model.
此外,为了简化预设模型,使得该预设模型能在手机、考勤机等计算能力有限的设备上部署,可以将该预设模型的参数由浮点型变更为整型,以实现模型量化。然后将量化前的预设模型作为teacher模型,将量化后的预设模型作为student模型,在两个模型的输出层建立损失函数,进而重新对量化后的预设模型进行训练。In addition, in order to simplify the preset model so that the preset model can be deployed on devices with limited computing capabilities such as mobile phones and attendance machines, the parameters of the preset model can be changed from floating point to integer to achieve model quantification. Then the quantized preset model is used as the teacher model, and the quantized preset model is used as the student model, and the loss function is established in the output layer of the two models, and then the quantized preset model is retrained.
基于同一发明构思,本申请一实施例提供一种图像分割装置。参考图11,图11是本申请一实施例提出的图像分割装置的示意图。如图11所示,该装置包括:Based on the same inventive concept, an embodiment of the present application provides an image segmentation device. Referring to FIG. 11, FIG. 11 is a schematic diagram of an image segmentation device proposed in an embodiment of the present application. As shown in Figure 11, the device includes:
特征提取模块1101,用于对待分割图像进行特征提取,获得所述待分割图像的图像特征;The feature extraction module 1101 is configured to perform feature extraction on the image to be segmented to obtain image features of the image to be segmented;
上采样模块1102,用于对所述图像特征进行上采样操作,获得前景特征图和背景特征图,所述前景特征图中的各个像素点与所述待分割图像中的各个像素点一一对应,所述前景特征图中的每个像素点的像素值表征:所述待分割图像中与该像素点相对应的像素点属于目标区域的可能性,所述背景特征图中的各个像素点与所述待分割图像中的各个像素点一一对应,所述背景特征图中的每个像素点的像素值表征:所述待分割图像中与该像素点相对应的像素点属于背景区域的可能性;The up-sampling module 1102 is used to perform an up-sampling operation on the image features to obtain a foreground feature map and a background feature map, each pixel in the foreground feature map corresponds to each pixel in the image to be segmented one-to-one , The pixel value of each pixel in the foreground feature map represents the possibility that the pixel corresponding to the pixel in the image to be segmented belongs to the target area, and each pixel in the background feature map is Each pixel in the image to be segmented corresponds one-to-one, and the pixel value of each pixel in the background feature map represents the possibility that the pixel corresponding to the pixel in the image to be segmented belongs to the background area Sex
归一化模块1103,用于对所述前景特征图的各个像素点的像素值和所述背景特征图的各个像素点的像素值进行归一化,获得目标区域掩模图和背景区域掩模图,其中,所述目标区域掩模图中的每个像素点的像素值表示:所述待分割图像中与该像素点相对应的像素点属于目标区域的概率,所述背景区域掩模图中的每个像素点的像素值表示:所述待分割图像中与该像素点相对应的像素点属于背景区域的概率;The normalization module 1103 is used to normalize the pixel value of each pixel of the foreground feature map and the pixel value of each pixel of the background feature map to obtain a target area mask image and a background area mask Where the pixel value of each pixel in the target area mask image represents: the probability that the pixel corresponding to the pixel in the image to be segmented belongs to the target area, and the background area mask image The pixel value of each pixel in represents: the probability that the pixel corresponding to the pixel in the image to be segmented belongs to the background area;
分割模块1104,用于根据所述目标区域掩模图和所述背景区域掩模图,对所述待分割图像进行分割。The segmentation module 1104 is configured to segment the image to be segmented according to the target area mask map and the background area mask map.
可选地,所述特征提取模块具体用于:对所述待分割图像进行多种尺度的特征提取操作,获得所述待分割图像的多个不同尺度的图像特征;Optionally, the feature extraction module is specifically configured to: perform feature extraction operations of multiple scales on the image to be segmented to obtain multiple image features of different scales of the image to be segmented;
所述上采样模块具体用于:针对所述多个不同尺度的图像特征分别进行上采样操作,获得多个图像特征各自对应的前景特征图和背景特征图。The up-sampling module is specifically configured to perform an up-sampling operation on the multiple image features of different scales respectively, to obtain a foreground feature map and a background feature map corresponding to each of the multiple image features.
可选地,所述归一化模块包括:Optionally, the normalization module includes:
特征图融合子模块,用于对多个图像特征各自对应的前景特征图进行融合,获得一张融合的前景特征图,以及对多个图像特征各自对应的背景特征图进行融合,获得一张融合的背景特征图;The feature map fusion sub-module is used to fuse the respective foreground feature maps of multiple image features to obtain a fused foreground feature map, and to fuse the background feature maps corresponding to each of the multiple image features to obtain a fusion Background feature map;
归一化子模块,用于对所述融合的前景特征图的各个像素点的像素值和所述融合的背景特征图的各个像素点的像素值进行归一化,获得所述目标区域掩模图和背景区域掩模图。The normalization sub-module is used to normalize the pixel value of each pixel of the fused foreground feature map and the pixel value of each pixel of the fused background feature map to obtain the target area mask Figure and background area mask map.
可选地,所述特征图融合子模块包括:Optionally, the feature map fusion sub-module includes:
第一特征图叠加子单元,用于根据多个前景特征图的特征深度顺序,对多个前景特征图进行叠加;The first feature map superimposing subunit is used to superimpose multiple foreground feature maps according to the feature depth sequence of the multiple foreground feature maps;
第一特征图卷积子单元,用于对叠加后的多个前景特征图进行卷积,获得所述融合的前景特征图;The first feature map convolution subunit is used to convolve multiple superimposed foreground feature maps to obtain the merged foreground feature map;
第二特征图叠加子单元,用于根据多个背景特征图的特征深度顺序,对多个背景特征图进行叠加;The second feature map superimposing subunit is used to superimpose multiple background feature maps according to the feature depth sequence of the multiple background feature maps;
第二特征图卷积子单元,用于对叠加后的多个背景特征图进行卷积,获得所述融合的背景特征图。The second feature map convolution subunit is used to convolve multiple background feature maps after superimposition to obtain the fused background feature map.
可选地,所述上采样模块具体用于:通过多个上采样路径对所述图像特征分别进行上采样处理,分别获得每个上采样路径输出的一张前景特征图和一张背景特征图,其中,多个上采样路径各自对应的上采样方式互不相同;Optionally, the up-sampling module is specifically configured to: perform up-sampling processing on the image features through multiple up-sampling paths, respectively, to obtain a foreground feature map and a background feature map output by each up-sampling path. , Where the corresponding up-sampling modes of the multiple up-sampling paths are different from each other;
所述归一化模块包括:The normalization module includes:
特征图融合子模块,用于对多个上采样路径输出的多张前景特征图进行融合,获得一张融合的前景特征图,以及对多个上采样路径输出的多张背景 特征图进行融合,获得一张融合的背景特征图;The feature map fusion sub-module is used to fuse multiple foreground feature maps output by multiple upsampling paths to obtain a fused foreground feature map, and to fuse multiple background feature maps output from multiple upsampling paths, Obtain a fused background feature map;
归一化子模块,用于对所述融合的前景特征图的各个像素点的像素值和所述融合的背景特征图的各个像素点的像素值进行归一化,获得所述目标区域掩模图和背景区域掩模图。The normalization sub-module is used to normalize the pixel value of each pixel of the fused foreground feature map and the pixel value of each pixel of the fused background feature map to obtain the target area mask Figure and background area mask map.
所述分割模块包括:The segmentation module includes:
目标区域分割子模块,用于针对所述目标区域掩模图中的每个像素点,在该像素点的像素值大于第一预设阈值的情况下,将所述待分割图像中与该像素点相对应的像素点确定为属于目标区域,并从所述待分割图像中分割出所述目标区域的像素点;The target area segmentation sub-module is used to, for each pixel in the target area mask image, if the pixel value of the pixel is greater than the first preset threshold, compare the pixel in the image to be segmented The pixel point corresponding to the point is determined to belong to the target area, and the pixel point of the target area is segmented from the image to be segmented;
和/或背景区域分割子模块,用于针对所述背景区域掩模图中的每个像素点,在该像素点的像素值大于第二预设阈值的情况下,将所述待分割图像中与该像素点相对应的像素点确定为属于背景区域;并从所述待分割图像中分割出所述背景区域的像素点。And/or the background region segmentation sub-module, for each pixel in the background region mask image, if the pixel value of the pixel is greater than a second preset threshold, the image to be segmented The pixel point corresponding to the pixel point is determined to belong to the background area; and the pixel point of the background area is segmented from the image to be segmented.
可选地,所述装置还包括:Optionally, the device further includes:
样本图像获得模块,用于获得样本图像,所述样本图像携带目标区域掩模标注图和背景区域掩模标注图,所述目标区域掩模标注图中目标区域的像素点的像素值为第一像素值,背景区域的像素点的像素值为第二像素值,所述背景区域掩模标注图中目标区域的像素点的像素值为所述第二像素值,背景区域的像素点的像素值为所述第一像素值;The sample image obtaining module is used to obtain a sample image, the sample image carries a target area mask annotated map and a background area mask annotated map, and the pixel value of the pixel point of the target area in the target area mask annotated map is the first Pixel value, the pixel value of the pixel in the background area is the second pixel value, the pixel value of the pixel in the target area in the background area mask annotation map is the second pixel value, and the pixel value of the pixel in the background area Is the first pixel value;
预测特征图获得模块,用于通过所述预设模型对所述样本图像进行特征提取,以获得图像特征,并通过所述预设模型对所述图像特征进行上采样操作,以获得前景预测特征图和背景预测特征图;The prediction feature map obtaining module is used to perform feature extraction on the sample image through the preset model to obtain image features, and perform an up-sampling operation on the image features through the preset model to obtain foreground prediction features Map and background prediction feature map;
掩模预测图获得模块,用于对所述前景预测特征图和背景预测特征图各自的像素值进行归一化操作,获得目标区域掩模预测图和背景区域掩模预测图;A mask prediction map obtaining module, configured to perform a normalization operation on the respective pixel values of the foreground prediction feature map and the background prediction feature map to obtain a target region mask prediction map and a background region mask prediction map;
模型更新模块,用于根据所述目标区域掩模预测图、背景区域掩模预测图、目标区域掩模标注图以及背景区域掩模标注图,对所述预设模型进行更新。The model update module is used to update the preset model according to the target area mask prediction map, the background area mask prediction map, the target area mask annotation map, and the background area mask annotation map.
采用本申请提供的图像分割装置,对待分割图像进行特征提取,以获得待分割图像的图像特征;然后对图像特征进行上采样操作,从而获得前景特征图和背景特征图;再对前景特征图和背景特征图的各个像素点的像素值进行归一化操作,获得目标区域掩模图和背景区域掩模图;最后根据目标区域掩模图和背景区域掩模图,对待分割图像进行分割,使得本申请提供的图像分割装置至少具有以下优点:Using the image segmentation device provided in this application, feature extraction is performed on the image to be segmented to obtain the image features of the image to be segmented; then the image features are up-sampled to obtain the foreground feature map and the background feature map; and then the foreground feature map and The pixel value of each pixel of the background feature map is normalized to obtain the target area mask image and the background area mask image; finally, the image to be segmented is segmented according to the target area mask image and the background area mask image, so that The image segmentation device provided by this application has at least the following advantages:
其中,由于前景特征图的各个像素点与待分割图像的各个像素点一一对应,且前景特征图中的每个像素点的像素值表征:待分割图像中与该像素点相对应的像素点属于目标区域的可能性。同时背景特征图的各个像素点与待分割图像的各个像素点一一对应,且背景特征图中的每个像素点的像素值表征:待分割图像中与该像素点相对应的像素点属于背景区域的可能性。因此在对前景特征图和背景特征图的各个像素点的像素值进行归一化操作后,得到的目标区域掩模图中的每个像素点的像素值表示:待分割图像中与该像素点相对应的像素点属于目标区域的概率,背景区域掩模图中的每个像素点的像素值表示:待分割图像中与该像素点相对应的像素点属于背景区域的概率。Among them, because each pixel of the foreground feature map corresponds to each pixel of the image to be segmented, and the pixel value of each pixel in the foreground feature map represents: the pixel corresponding to the pixel in the image to be segmented Possibility of belonging to the target area. At the same time, each pixel of the background feature map corresponds to each pixel of the image to be segmented, and the pixel value of each pixel in the background feature map represents: the pixel corresponding to the pixel in the image to be segmented belongs to the background Possibility of the area. Therefore, after normalizing the pixel value of each pixel in the foreground feature map and the background feature map, the obtained pixel value of each pixel in the target area mask image indicates: The corresponding pixel point belongs to the probability of the target area, and the pixel value of each pixel point in the background area mask image represents the probability that the pixel point corresponding to the pixel point in the image to be segmented belongs to the background area.
如此,根据目标区域掩模图和背景区域掩模图,基于各个像素点属于目标区域和/或背景区域的概率,对待分割图像进行分割,从而获得更准确的分割结果。In this way, according to the target area mask map and the background area mask map, the image to be segmented is segmented based on the probability that each pixel belongs to the target area and/or the background area, so as to obtain a more accurate segmentation result.
基于同一发明构思,本申请另一实施例提供一种可读存储介质,其上存储有计算机程序,该程序被处理器执行时实现如本申请上述任一实施例所述的图像分割方法中的步骤。Based on the same inventive concept, another embodiment of the present application provides a readable storage medium on which a computer program is stored. When the program is executed by a processor, the image segmentation method described in any of the foregoing embodiments of the present application is implemented step.
本申请实施例提供的计算机可读存储介质包括但不限于任何类型的盘(包括软盘、硬盘、光盘、CD-ROM、和磁光盘)、ROM(Read-Only Memory,只读存储器)、RAM(Random Access Memory,随即存储器)、EPROM(Erasable Programmable Read-Only Memory,可擦写可编程只读存储器)、EEPROM(Electrically Erasable Programmable Read-Only Memory,电可擦可编程只读存储器)、闪存、磁性卡片或光线卡片。也就是,可读存储介质包 括由设备(例如,计算机)以能够读的形式存储或传输信息的任何介质。The computer-readable storage medium provided by the embodiments of this application includes, but is not limited to, any type of disk (including floppy disk, hard disk, optical disk, CD-ROM, and magneto-optical disk), ROM (Read-Only Memory), RAM ( Random Access Memory), EPROM (Erasable Programmable Read-Only Memory), EEPROM (Electrically Erasable Programmable Read-Only Memory), flash memory, magnetic Card or light card. That is, a readable storage medium includes any medium that stores or transmits information in a readable form by a device (for example, a computer).
基于同一发明构思,本申请另一实施例提供一种电子设备,包括存储器、处理器及存储在存储器上并可在处理器上运行的计算机程序,所述处理器执行时实现本申请上述任一实施例所述的图像分割方法中的步骤。Based on the same inventive concept, another embodiment of the present application provides an electronic device, including a memory, a processor, and a computer program stored in the memory and capable of running on the processor. The steps in the image segmentation method described in the embodiment.
对于装置实施例而言,由于其与方法实施例基本相似,所以描述的比较简单,相关之处参见方法实施例的部分说明即可。As for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and for related parts, please refer to the part of the description of the method embodiment.
本说明书中的各个实施例均采用递进的方式描述,每个实施例重点说明的都是与其他实施例的不同之处,各个实施例之间相同相似的部分互相参见即可。The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments, and the same or similar parts between the various embodiments can be referred to each other.
本领域内的技术人员应明白,本申请实施例的实施例可提供为方法、装置、或计算机程序产品。因此,本申请实施例可采用完全硬件实施例、完全软件实施例、或结合软件和硬件方面的实施例的形式。而且,本申请实施例可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储介质(包括但不限于磁盘存储器、CD-ROM、光学存储器等)上实施的计算机程序产品的形式。Those skilled in the art should understand that the embodiments of the embodiments of the present application may be provided as methods, devices, or computer program products. Therefore, the embodiments of the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the embodiments of the present application may adopt the form of computer program products implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.
本申请实施例是参照根据本申请实施例的方法、终端设备(系统)、和计算机程序产品的流程图和/或方框图来描述的。应理解可由计算机程序指令实现流程图和/或方框图中的每一流程和/或方框、以及流程图和/或方框图中的流程和/或方框的结合。The embodiments of this application are described with reference to the flowcharts and/or block diagrams of the methods, terminal devices (systems), and computer program products according to the embodiments of this application. It should be understood that each process and/or block in the flowchart and/or block diagram, and the combination of processes and/or blocks in the flowchart and/or block diagram can be realized by computer program instructions.
因此,本申请实施例还提供一种计算机程序,包括计算机可读代码,当所述计算机可读代码在计算处理设备上运行时,可以导致所述计算处理设备执行本申请任意一个实施例所阐释的任意一种图像分割方法。具体地,可提供这些计算机程序指令到通用计算机、专用计算机、嵌入式处理机或其他可编程数据处理终端设备的处理器以产生一个机器,使得通过计算机或其他可编程数据处理终端设备的处理器执行的指令产生用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的装置。Therefore, an embodiment of the present application further provides a computer program, including computer-readable code, when the computer-readable code runs on a computing processing device, it can cause the computing processing device to execute the explanation in any one of the embodiments of this application. Any of the image segmentation methods. Specifically, these computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing terminal equipment to generate a machine, so that the processor of the computer or other programmable data processing terminal equipment The executed instructions generate means for realizing the functions specified in one process or multiple processes in the flowchart and/or one block or multiple blocks in the block diagram.
这些计算机程序指令也可存储在能引导计算机或其他可编程数据处理终端设备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读 存储器中的指令产生包括指令装置的制造品,该指令装置实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能。These computer program instructions can also be stored in a computer-readable memory that can guide a computer or other programmable data processing terminal equipment to work in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture including the instruction device. The instruction device implements the functions specified in one process or multiple processes in the flowchart and/or one block or multiple blocks in the block diagram.
这些计算机程序指令也可装载到计算机或其他可编程数据处理终端设备上,使得在计算机或其他可编程终端设备上执行一系列操作步骤以产生计算机实现的处理,从而在计算机或其他可编程终端设备上执行的指令提供用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的步骤。These computer program instructions can also be loaded on a computer or other programmable data processing terminal equipment, so that a series of operation steps are executed on the computer or other programmable terminal equipment to produce computer-implemented processing, so that the computer or other programmable terminal equipment The instructions executed above provide steps for implementing functions specified in a flow or multiple flows in the flowchart and/or a block or multiple blocks in the block diagram.
尽管已描述了本申请实施例的优选实施例,但本领域内的技术人员一旦得知了基本创造性概念,则可对这些实施例做出另外的变更和修改。所以,所附权利要求意欲解释为包括优选实施例以及落入本申请实施例范围的所有变更和修改。Although the preferred embodiments of the embodiments of the present application have been described, those skilled in the art can make additional changes and modifications to these embodiments once they learn the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications falling within the scope of the embodiments of the present application.
最后,还需要说明的是,在本文中,诸如第一和第二等之类的关系术语仅仅用来将一个实体或者操作与另一个实体或操作区分开来,而不一定要求或者暗示这些实体或操作之间存在任何这种实际的关系或者顺序。而且,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者终端设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者终端设备所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括所述要素的过程、方法、物品或者终端设备中还存在另外的相同要素。Finally, it should be noted that in this article, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply these entities. Or there is any such actual relationship or sequence between operations. Moreover, the terms "including", "including" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or terminal device including a series of elements not only includes those elements, but also includes those elements that are not explicitly listed. Other elements listed, or also include elements inherent to this process, method, article, or terminal device. If there are no more restrictions, the element defined by the sentence "including a..." does not exclude the existence of other same elements in the process, method, article, or terminal device that includes the element.
本技术领域技术人员可以理解,本申请中已经讨论过的各种操作、方法、流程中的步骤、措施、方案可以被交替、更改、组合或删除。进一步地,具有本申请中已经讨论过的各种操作、方法、流程中的其他步骤、措施、方案也可以被交替、更改、重排、分解、组合或删除。进一步地,现有技术中的具有与本申请中公开的各种操作、方法、流程中的步骤、措施、方案也可以被交替、更改、重排、分解、组合或删除。Those skilled in the art can understand that the various operations, methods, and steps, measures, and solutions in the process that have been discussed in this application can be alternated, changed, combined, or deleted. Further, various operations, methods, and other steps, measures, and solutions in the process that have been discussed in this application can also be alternated, changed, rearranged, decomposed, combined, or deleted. Further, the steps, measures, and solutions in the various operations, methods, and procedures in the prior art that have the same operations, methods, and procedures disclosed in this application can also be alternated, changed, rearranged, decomposed, combined, or deleted.
以上对本申请所提供的一种图像分割方法、装置、电子设备及可读存储介质,进行了详细介绍,本文中应用了具体个例对本申请的原理及实施方式 进行了阐述,以上实施例的说明只是用于帮助理解本申请的方法及其核心思想;同时,对于本领域的一般技术人员,依据本申请的思想,在具体实施方式及应用范围上均会有改变之处,综上所述,本说明书内容不应理解为对本申请的限制。本领域技术人员在不脱离本公开的精神和范围的前提下,可进行各种变更与修改,这些变更与修改均将落入本发明的保护范围。The image segmentation method, device, electronic equipment, and readable storage medium provided by this application are described in detail above. Specific examples are used in this article to illustrate the principles and implementations of this application. The description of the above embodiments It is only used to help understand the methods and core ideas of this application; at the same time, for those skilled in the art, according to the ideas of this application, there will be changes in the specific implementation and scope of application. In summary, The content of this manual should not be construed as a limitation on this application. Those skilled in the art can make various changes and modifications without departing from the spirit and scope of the present disclosure, and these changes and modifications will fall within the protection scope of the present invention.

Claims (11)

  1. 一种图像分割方法,其特征在于,所述方法包括:An image segmentation method, characterized in that the method includes:
    对待分割图像进行特征提取,获得所述待分割图像的图像特征;Performing feature extraction on the image to be segmented to obtain image features of the image to be segmented;
    对所述图像特征进行上采样操作,获得前景特征图和背景特征图,所述前景特征图中的各个像素点与所述待分割图像中的各个像素点一一对应,所述前景特征图中的每个像素点的像素值表征:所述待分割图像中与该像素点相对应的像素点属于目标区域的可能性,所述背景特征图中的各个像素点与所述待分割图像中的各个像素点一一对应,所述背景特征图中的每个像素点的像素值表征:所述待分割图像中与该像素点相对应的像素点属于背景区域的可能性;Perform an up-sampling operation on the image feature to obtain a foreground feature map and a background feature map. Each pixel in the foreground feature map corresponds to each pixel in the image to be segmented, and the foreground feature map Characterization of the pixel value of each pixel in the image to be segmented: the possibility that the pixel corresponding to the pixel in the image to be segmented belongs to the target area, and each pixel in the background feature map is related to the pixel in the image to be segmented. Each pixel has a one-to-one correspondence, and the pixel value of each pixel in the background feature map represents the possibility that the pixel corresponding to the pixel in the image to be segmented belongs to the background area;
    对所述前景特征图的各个像素点的像素值和所述背景特征图的各个像素点的像素值进行归一化,获得目标区域掩模图和背景区域掩模图,其中,所述目标区域掩模图中的每个像素点的像素值表示:所述待分割图像中与该像素点相对应的像素点属于目标区域的概率,所述背景区域掩模图中的每个像素点的像素值表示:所述待分割图像中与该像素点相对应的像素点属于背景区域的概率;Normalize the pixel value of each pixel of the foreground feature map and the pixel value of each pixel of the background feature map to obtain a target area mask map and a background area mask map, wherein the target area The pixel value of each pixel in the mask image represents: the probability that the pixel corresponding to the pixel in the image to be segmented belongs to the target area, and the pixel of each pixel in the background area mask image Value represents: the probability that the pixel corresponding to the pixel in the image to be segmented belongs to the background area;
    根据所述目标区域掩模图和所述背景区域掩模图,对所述待分割图像进行分割。The image to be divided is segmented according to the target area mask image and the background area mask image.
  2. 根据权利要求1所述的方法,其特征在于,所述对待分割图像进行特征提取,获得所述待分割图像的图像特征,包括:The method according to claim 1, wherein the performing feature extraction on the image to be segmented to obtain the image features of the image to be segmented comprises:
    对所述待分割图像进行多种尺度的特征提取操作,获得所述待分割图像的多个不同尺度的图像特征;Performing feature extraction operations of multiple scales on the image to be segmented to obtain image features of multiple scales of the image to be segmented;
    所述对所述图像特征进行上采样操作,获得前景特征图和背景特征图,包括:The performing an up-sampling operation on the image features to obtain a foreground feature map and a background feature map includes:
    针对所述多个不同尺度的图像特征分别进行上采样操作,获得多个图像特征各自对应的前景特征图和背景特征图。Up-sampling operations are performed on the multiple image features of different scales, respectively, to obtain a foreground feature map and a background feature map corresponding to each of the multiple image features.
  3. 根据权利要求2所述的方法,其特征在于,所述对所述前景特征图的各个像素点的像素值和所述背景特征图的各个像素点的像素值进行归一 化,获得目标区域掩模图和背景区域掩模图,包括:The method according to claim 2, wherein said normalizing the pixel value of each pixel of the foreground feature map and the pixel value of each pixel of the background feature map to obtain a target area mask The mask map and background area mask map, including:
    对多个图像特征各自对应的前景特征图进行融合,获得一张融合的前景特征图,以及对多个图像特征各自对应的背景特征图进行融合,获得一张融合的背景特征图;Fuse the respective foreground feature maps of multiple image features to obtain a fused foreground feature map, and fuse the background feature maps corresponding to each of the multiple image features to obtain a fused background feature map;
    对所述融合的前景特征图的各个像素点的像素值和所述融合的背景特征图的各个像素点的像素值进行归一化,获得所述目标区域掩模图和背景区域掩模图。The pixel value of each pixel of the fused foreground feature map and the pixel value of each pixel of the fused background feature map are normalized to obtain the target area mask map and the background area mask map.
  4. 根据权利要求3所述的方法,其特征在于,所述对多个图像特征各自对应的前景特征图进行融合,获得一张融合的前景特征图,包括:The method according to claim 3, wherein the fusing the foreground feature maps corresponding to each of the multiple image features to obtain a fused foreground feature map comprises:
    根据多个前景特征图的特征深度顺序,对多个前景特征图进行叠加;Superimpose multiple foreground feature maps according to the feature depth sequence of multiple foreground feature maps;
    对叠加后的多个前景特征图进行卷积,获得所述融合的前景特征图;Convolve the superimposed multiple foreground feature maps to obtain the merged foreground feature map;
    所述对多个图像特征各自对应的背景特征图进行融合,获得一张融合的背景特征图,包括:The fusion of the background feature maps corresponding to each of the multiple image features to obtain a fused background feature map includes:
    根据多个背景特征图的特征深度顺序,对多个背景特征图进行叠加;Superimpose multiple background feature maps according to the feature depth sequence of multiple background feature maps;
    对叠加后的多个背景特征图进行卷积,获得所述融合的背景特征图。Perform convolution on the multiple background feature maps that are superimposed to obtain the fused background feature map.
  5. 根据权利要求1所述的方法,其特征在于,所述对所述图像特征进行上采样操作,获得前景特征图和背景特征图,包括:The method according to claim 1, wherein the performing an up-sampling operation on the image features to obtain a foreground feature map and a background feature map comprises:
    通过多个上采样路径对所述图像特征分别进行上采样处理,分别获得每个上采样路径输出的一张前景特征图和一张背景特征图,其中,多个上采样路径各自对应的上采样方式互不相同;The image features are respectively up-sampled through multiple up-sampling paths, and a foreground feature map and a background feature map output by each up-sampling path are obtained respectively, wherein each of the multiple up-sampling paths corresponds to the up-sampling Different ways;
    所述对所述前景特征图的各个像素点的像素值和所述背景特征图的各个像素点的像素值进行归一化,获得目标区域掩模图和背景区域掩模图,包括:The normalizing the pixel value of each pixel of the foreground feature map and the pixel value of each pixel of the background feature map to obtain a target area mask image and a background area mask image includes:
    对多个上采样路径输出的多张前景特征图进行融合,获得一张融合的前景特征图,以及对多个上采样路径输出的多张背景特征图进行融合,获得一张融合的背景特征图;Fusion of multiple foreground feature maps output by multiple upsampling paths to obtain a fused foreground feature map, and multiple background feature maps output by multiple upsampling paths to obtain a fused background feature map ;
    对所述融合的前景特征图的各个像素点的像素值和所述融合的背景特征图的各个像素点的像素值进行归一化,获得所述目标区域掩模图和背景区 域掩模图。The pixel value of each pixel of the fused foreground feature map and the pixel value of each pixel of the fused background feature map are normalized to obtain the target area mask image and the background area mask image.
  6. 根据权利要求1所述的方法,其特征在于,所述根据所述目标区域掩模图和所述背景区域掩模图,对所述待分割图像进行分割,包括:The method according to claim 1, wherein the segmenting the image to be segmented according to the target area mask map and the background area mask map comprises:
    针对所述目标区域掩模图中的每个像素点,在该像素点的像素值大于第一预设阈值的情况下,将所述待分割图像中与该像素点相对应的像素点确定为属于目标区域,并从所述待分割图像中分割出所述目标区域的像素点;For each pixel in the target area mask image, if the pixel value of the pixel is greater than the first preset threshold, the pixel corresponding to the pixel in the image to be divided is determined as Belong to the target area, and segment the pixels of the target area from the image to be segmented;
    和/或,针对所述背景区域掩模图中的每个像素点,在该像素点的像素值大于第二预设阈值的情况下,将所述待分割图像中与该像素点相对应的像素点确定为属于背景区域;并从所述待分割图像中分割出所述背景区域的像素点。And/or, for each pixel in the background area mask image, if the pixel value of the pixel is greater than a second preset threshold, the image corresponding to the pixel in the image to be divided is The pixels are determined to belong to the background area; and the pixels of the background area are segmented from the image to be segmented.
  7. 根据权利要求1所述的方法,其特征在于,在对待分割图像进行特征提取,获得所述待分割图像的图像特征之前,所述方法还包括:The method according to claim 1, characterized in that, before performing feature extraction on the image to be segmented to obtain the image features of the image to be segmented, the method further comprises:
    获得样本图像,所述样本图像携带目标区域掩模标注图和背景区域掩模标注图,所述目标区域掩模标注图中目标区域的像素点的像素值为第一像素值,背景区域的像素点的像素值为第二像素值,所述背景区域掩模标注图中目标区域的像素点的像素值为所述第二像素值,背景区域的像素点的像素值为所述第一像素值;Obtain a sample image, the sample image carries the target area mask annotation map and the background area mask annotation map, the pixel value of the pixel point in the target area in the target area mask annotation map is the first pixel value, and the pixel in the background area The pixel value of the point is the second pixel value, the pixel value of the pixel point of the target area in the background area mask annotation map is the second pixel value, and the pixel value of the pixel point in the background area is the first pixel value ;
    将所述样本图像输入预设模型,以通过所述预设模型对所述样本图像进行特征提取,以获得图像特征,并通过所述预设模型对所述图像特征进行上采样操作,以获得前景预测特征图和背景预测特征图;Input the sample image into a preset model to perform feature extraction on the sample image through the preset model to obtain image features, and perform an up-sampling operation on the image features through the preset model to obtain Foreground prediction feature map and background prediction feature map;
    对所述前景预测特征图和背景预测特征图各自的像素值进行归一化操作,获得目标区域掩模预测图和背景区域掩模预测图;Normalizing the respective pixel values of the foreground prediction feature map and the background prediction feature map to obtain a target region mask prediction map and a background region mask prediction map;
    根据所述目标区域掩模预测图、背景区域掩模预测图、目标区域掩模标注图以及背景区域掩模标注图,对所述预设模型进行更新。The preset model is updated according to the target area mask prediction map, the background area mask prediction map, the target area mask annotation map, and the background area mask annotation map.
  8. 一种图像分割装置,其特征在于,所述装置包括:An image segmentation device, characterized in that the device includes:
    特征提取模块,用于对待分割图像进行特征提取,获得所述待分割图像的图像特征;The feature extraction module is used to perform feature extraction on the image to be segmented to obtain the image features of the image to be segmented;
    上采样模块,用于对所述图像特征进行上采样操作,获得前景特征图和 背景特征图,所述前景特征图中的各个像素点与所述待分割图像中的各个像素点一一对应,所述前景特征图中的每个像素点的像素值表征:所述待分割图像中与该像素点相对应的像素点属于目标区域的可能性,所述背景特征图中的各个像素点与所述待分割图像中的各个像素点一一对应,所述背景特征图中的每个像素点的像素值表征:所述待分割图像中与该像素点相对应的像素点属于背景区域的可能性;The up-sampling module is used to perform an up-sampling operation on the image features to obtain a foreground feature map and a background feature map, each pixel in the foreground feature map corresponds to each pixel in the image to be segmented one-to-one, The pixel value of each pixel in the foreground feature map is characterized by the possibility that the pixel corresponding to the pixel in the image to be segmented belongs to the target area, and each pixel in the background feature map is related to all the pixels in the background feature map. Each pixel in the image to be segmented corresponds one-to-one, and the pixel value of each pixel in the background feature map represents the possibility that the pixel corresponding to the pixel in the image to be segmented belongs to the background area ;
    归一化模块,用于对所述前景特征图的各个像素点的像素值和所述背景特征图的各个像素点的像素值进行归一化,获得目标区域掩模图和背景区域掩模图,其中,所述目标区域掩模图中的每个像素点的像素值表示:所述待分割图像中与该像素点相对应的像素点属于目标区域的概率,所述背景区域掩模图中的每个像素点的像素值表示:所述待分割图像中与该像素点相对应的像素点属于背景区域的概率;The normalization module is used to normalize the pixel value of each pixel of the foreground feature map and the pixel value of each pixel of the background feature map to obtain a target area mask image and a background area mask image , Wherein the pixel value of each pixel in the target area mask image represents: the probability that the pixel corresponding to the pixel in the image to be segmented belongs to the target area, and the background area mask image The pixel value of each pixel in, represents: the probability that the pixel corresponding to the pixel in the image to be segmented belongs to the background area;
    分割模块,用于根据所述目标区域掩模图和所述背景区域掩模图,对所述待分割图像进行分割。The segmentation module is configured to segment the image to be segmented according to the target area mask image and the background area mask image.
  9. 一种计算机可读存储介质,其上存储有计算机程序,其特征在于,该计算机程序被处理器执行时,实现如权利要求1至7任一所述的图像分割方法中的步骤。A computer-readable storage medium with a computer program stored thereon, wherein the computer program implements the steps in the image segmentation method according to any one of claims 1 to 7 when the computer program is executed by a processor.
  10. 一种电子设备,包括存储器、处理器及存储在存储器上并可在处理器上运行的计算机程序,其特征在于,所述处理器执行时实现如权利要求1至7任一所述的图像分割方法的步骤。An electronic device, comprising a memory, a processor, and a computer program stored on the memory and running on the processor, wherein the processor implements the image segmentation according to any one of claims 1 to 7 when executed Method steps.
  11. 一种计算机程序,包括计算机可读代码,当所述计算机可读代码在计算处理设备上运行时,导致所述计算处理设备执行根据权利要求1至7中任一项所述的图像分割方法。A computer program comprising computer readable code, when the computer readable code runs on a computing processing device, causes the computing processing device to execute the image segmentation method according to any one of claims 1 to 7.
PCT/CN2020/113134 2019-12-20 2020-09-03 Image segmentation method and apparatus, electronic device and readable storage medium WO2021120695A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201911331052.6 2019-12-20
CN201911331052.6A CN111178211B (en) 2019-12-20 2019-12-20 Image segmentation method, device, electronic equipment and readable storage medium

Publications (1)

Publication Number Publication Date
WO2021120695A1 true WO2021120695A1 (en) 2021-06-24

Family

ID=70652108

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/113134 WO2021120695A1 (en) 2019-12-20 2020-09-03 Image segmentation method and apparatus, electronic device and readable storage medium

Country Status (2)

Country Link
CN (1) CN111178211B (en)
WO (1) WO2021120695A1 (en)

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113744280A (en) * 2021-07-20 2021-12-03 北京旷视科技有限公司 Image processing method, apparatus, device and medium
CN113781505A (en) * 2021-11-08 2021-12-10 深圳市瑞图生物技术有限公司 Chromosome segmentation method, chromosome analyzer, and storage medium
CN114219951A (en) * 2021-11-05 2022-03-22 安徽省配天机器人集团有限公司 Shape matching method, device, computer equipment and storage device
CN114445426A (en) * 2022-01-28 2022-05-06 深圳大学 Method and device for segmenting polyp region in endoscope image and related assembly
CN114581433A (en) * 2022-03-22 2022-06-03 中国工程物理研究院流体物理研究所 Method and system for obtaining metal ball cavity inner surface appearance detection image
CN114612971A (en) * 2022-03-04 2022-06-10 北京百度网讯科技有限公司 Face detection method, model training method, electronic device, and program product
WO2023143178A1 (en) * 2022-01-28 2023-08-03 北京字跳网络技术有限公司 Object segmentation method and apparatus, device and storage medium

Families Citing this family (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111178211B (en) * 2019-12-20 2024-01-12 天津极豪科技有限公司 Image segmentation method, device, electronic equipment and readable storage medium
CN111723934B (en) * 2020-06-24 2022-11-01 北京紫光展锐通信技术有限公司 Image processing method and system, electronic device and storage medium
CN113420769A (en) * 2020-11-12 2021-09-21 阿里巴巴集团控股有限公司 Image mask recognition, matting and model training method and device and electronic equipment
CN112465843A (en) * 2020-12-22 2021-03-09 深圳市慧鲤科技有限公司 Image segmentation method and device, electronic equipment and storage medium
CN112651959B (en) * 2020-12-31 2023-08-15 众阳健康科技集团有限公司 CT intracranial hemorrhage detection system based on dynamic map loss neural network
CN113240699B (en) * 2021-05-20 2022-02-08 推想医疗科技股份有限公司 Image processing method and device, model training method and device, and electronic equipment
CN113240696B (en) * 2021-05-20 2022-02-08 推想医疗科技股份有限公司 Image processing method and device, model training method and device, and electronic equipment
CN113379762A (en) * 2021-05-28 2021-09-10 上海商汤智能科技有限公司 Image segmentation method and device, electronic equipment and storage medium
CN113643304B (en) * 2021-08-05 2024-09-06 应急管理部天津消防研究所 Real-time smoke segmentation method integrating multi-resolution characterization
CN113888537B (en) * 2021-12-03 2022-04-12 深圳市网旭科技有限公司 Mask extraction method, device, equipment and storage medium
CN114445447A (en) * 2021-12-27 2022-05-06 天翼云科技有限公司 Image segmentation method, device, equipment and medium
CN115345895B (en) * 2022-10-19 2023-01-06 深圳市壹倍科技有限公司 Image segmentation method and device for visual detection, computer equipment and medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106447721A (en) * 2016-09-12 2017-02-22 北京旷视科技有限公司 Image shadow detection method and device
CN109446951A (en) * 2018-10-16 2019-03-08 腾讯科技(深圳)有限公司 Semantic segmentation method, apparatus, equipment and the storage medium of 3-D image
CN110163910A (en) * 2019-03-22 2019-08-23 腾讯科技(深圳)有限公司 Subject localization method, device, computer equipment and storage medium
CN111178211A (en) * 2019-12-20 2020-05-19 北京迈格威科技有限公司 Image segmentation method and device, electronic equipment and readable storage medium
CN111260666A (en) * 2020-01-19 2020-06-09 上海商汤临港智能科技有限公司 Image processing method and device, electronic equipment and computer readable storage medium

Family Cites Families (14)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
ES2209041T3 (en) * 1997-12-03 2004-06-16 Fuji Photo Film Co., Ltd. PROCEDURE AND APPARATUS FOR THE INTERPOLATION OF IMAGE SIGNALS.
EP2669865A1 (en) * 2012-05-31 2013-12-04 Thomson Licensing Segmentation of a foreground object in a 3D scene
CN107808111B (en) * 2016-09-08 2021-07-09 北京旷视科技有限公司 Method and apparatus for pedestrian detection and attitude estimation
KR102070956B1 (en) * 2016-12-20 2020-01-29 서울대학교산학협력단 Apparatus and method for processing image
CN109034162B (en) * 2018-07-13 2022-07-26 南京邮电大学 Image semantic segmentation method
CN109190626A (en) * 2018-07-27 2019-01-11 国家新闻出版广电总局广播科学研究院 A kind of semantic segmentation method of the multipath Fusion Features based on deep learning
CN109242869B (en) * 2018-09-21 2021-02-02 安徽科大讯飞医疗信息技术有限公司 Image instance segmentation method, device, equipment and storage medium
CN109492638A (en) * 2018-11-07 2019-03-19 北京旷视科技有限公司 Method for text detection, device and electronic equipment
CN109493350B (en) * 2018-11-09 2020-09-22 重庆中科云从科技有限公司 Portrait segmentation method and device
CN109977793B (en) * 2019-03-04 2022-03-04 东南大学 Roadside image pedestrian segmentation method based on variable-scale multi-feature fusion convolutional network
CN110163878A (en) * 2019-05-28 2019-08-23 四川智盈科技有限公司 A kind of image, semantic dividing method based on dual multiple dimensioned attention mechanism
CN110349167A (en) * 2019-07-10 2019-10-18 北京悉见科技有限公司 A kind of image instance dividing method and device
CN110517267B (en) * 2019-08-02 2022-05-10 Oppo广东移动通信有限公司 Image segmentation method and device and storage medium
CN110569731B (en) * 2019-08-07 2023-04-14 北京旷视科技有限公司 Face recognition method and device and electronic equipment

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106447721A (en) * 2016-09-12 2017-02-22 北京旷视科技有限公司 Image shadow detection method and device
CN109446951A (en) * 2018-10-16 2019-03-08 腾讯科技(深圳)有限公司 Semantic segmentation method, apparatus, equipment and the storage medium of 3-D image
CN110163910A (en) * 2019-03-22 2019-08-23 腾讯科技(深圳)有限公司 Subject localization method, device, computer equipment and storage medium
CN111178211A (en) * 2019-12-20 2020-05-19 北京迈格威科技有限公司 Image segmentation method and device, electronic equipment and readable storage medium
CN111260666A (en) * 2020-01-19 2020-06-09 上海商汤临港智能科技有限公司 Image processing method and device, electronic equipment and computer readable storage medium

Cited By (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113744280A (en) * 2021-07-20 2021-12-03 北京旷视科技有限公司 Image processing method, apparatus, device and medium
CN114219951A (en) * 2021-11-05 2022-03-22 安徽省配天机器人集团有限公司 Shape matching method, device, computer equipment and storage device
CN113781505A (en) * 2021-11-08 2021-12-10 深圳市瑞图生物技术有限公司 Chromosome segmentation method, chromosome analyzer, and storage medium
CN113781505B (en) * 2021-11-08 2022-11-18 深圳市瑞图生物技术有限公司 Chromosome segmentation method, chromosome analyzer, and storage medium
CN114445426A (en) * 2022-01-28 2022-05-06 深圳大学 Method and device for segmenting polyp region in endoscope image and related assembly
CN114445426B (en) * 2022-01-28 2022-08-26 深圳大学 Method and device for segmenting polyp region in endoscope image and related assembly
WO2023143178A1 (en) * 2022-01-28 2023-08-03 北京字跳网络技术有限公司 Object segmentation method and apparatus, device and storage medium
CN114612971A (en) * 2022-03-04 2022-06-10 北京百度网讯科技有限公司 Face detection method, model training method, electronic device, and program product
CN114581433A (en) * 2022-03-22 2022-06-03 中国工程物理研究院流体物理研究所 Method and system for obtaining metal ball cavity inner surface appearance detection image
CN114581433B (en) * 2022-03-22 2023-09-19 中国工程物理研究院流体物理研究所 Method and system for acquiring surface morphology detection image in metal ball cavity

Also Published As

Publication number Publication date
CN111178211A (en) 2020-05-19
CN111178211B (en) 2024-01-12

Similar Documents

Publication Publication Date Title
WO2021120695A1 (en) Image segmentation method and apparatus, electronic device and readable storage medium
CN110517278B (en) Image segmentation and training method and device of image segmentation network and computer equipment
US20220189142A1 (en) Ai-based object classification method and apparatus, and medical imaging device and storage medium
US11830230B2 (en) Living body detection method based on facial recognition, and electronic device and storage medium
JP2022534337A (en) Video target tracking method and apparatus, computer apparatus, program
US11475681B2 (en) Image processing method, apparatus, electronic device and computer readable storage medium
CN108345892B (en) Method, device and equipment for detecting significance of stereo image and storage medium
CN111275034B (en) Method, device, equipment and storage medium for extracting text region from image
JP7246104B2 (en) License plate identification method based on text line identification
CN110610526B (en) Method for segmenting monocular image and rendering depth of field based on WNET
CN107633237B (en) Image background segmentation method, device, equipment and medium
CN110781980B (en) Training method of target detection model, target detection method and device
WO2023284182A1 (en) Training method for recognizing moving target, method and device for recognizing moving target
CN112836625A (en) Face living body detection method and device and electronic equipment
CN111382647B (en) Picture processing method, device, equipment and storage medium
CN112101262A (en) Multi-feature fusion sign language recognition method and network model
CN113344000A (en) Certificate copying and recognizing method and device, computer equipment and storage medium
CN112001285B (en) Method, device, terminal and medium for processing beauty images
CN112417947B (en) Method and device for optimizing key point detection model and detecting face key points
CN115115552B (en) Image correction model training method, image correction device and computer equipment
CN113034514A (en) Sky region segmentation method and device, computer equipment and storage medium
CN110991412A (en) Face recognition method and device, storage medium and electronic equipment
CN112766028B (en) Face fuzzy processing method and device, electronic equipment and storage medium
CN114821736A (en) Multi-modal face recognition method, device, equipment and medium based on contrast learning
CN112712468B (en) Iris image super-resolution reconstruction method and computing device

Legal Events

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

Ref document number: 20901405

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 20901405

Country of ref document: EP

Kind code of ref document: A1