WO2022134382A1 - 图像分割方法及装置、电子设备和存储介质、计算机程序 - Google Patents

图像分割方法及装置、电子设备和存储介质、计算机程序 Download PDF

Info

Publication number
WO2022134382A1
WO2022134382A1 PCT/CN2021/086251 CN2021086251W WO2022134382A1 WO 2022134382 A1 WO2022134382 A1 WO 2022134382A1 CN 2021086251 W CN2021086251 W CN 2021086251W WO 2022134382 A1 WO2022134382 A1 WO 2022134382A1
Authority
WO
WIPO (PCT)
Prior art keywords
image
segmented
target object
area
target
Prior art date
Application number
PCT/CN2021/086251
Other languages
English (en)
French (fr)
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 WO2022134382A1 publication Critical patent/WO2022134382A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/11Region-based segmentation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/045Combinations of networks
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/08Learning methods
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/174Segmentation; Edge detection involving the use of two or more images
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20212Image combination
    • G06T2207/20221Image fusion; Image merging
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/30Subject of image; Context of image processing
    • G06T2207/30196Human being; Person
    • G06T2207/30201Face

Definitions

  • the present disclosure relates to the field of computer technology, and in particular, to an image segmentation method and apparatus, an electronic device, a storage medium, and a computer program.
  • Image segmentation is an important application in the current field of computer vision, especially when post-processing and editing portrait images/video content, segmenting the pixel area of the portrait is the most basic step. For multi-person pictures/videos, how to quickly further distinguish the required main characters is an important problem that needs to be solved urgently.
  • the present disclosure provides technical solutions of an image segmentation method and device, an electronic device, a storage medium, and a computer program.
  • an image segmentation method comprising: determining face position information of a target object in an image to be segmented, where the target object is at least one of multiple objects included in the image to be segmented ; According to the face position information of the target object, the to-be-segmented image is segmented to obtain a segmentation result corresponding to the target object.
  • the target object By determining the face position information of the target object and using the face position information as prior information, the target object can be directly segmented from the multiple objects included in the image to be segmented according to the face position information of the target object, while the There is no need to screen the segmentation results corresponding to the target objects after segmenting multiple objects in the image to be segmented, thereby improving the segmentation efficiency of the target objects and reducing time-consuming.
  • the determining the face position information of the target object in the image to be segmented includes: performing face detection on the image to be segmented to obtain multiple face frames; responding to the selected face frame, and the selected face frame is determined as the target face frame corresponding to the target object, and the target face frame is used to indicate the face position information of the target object in the to-be-segmented image.
  • a plurality of face frames are obtained by performing face detection on the image to be segmented, and in response to the selected face frame, the selected face frame can be quickly determined as the target object corresponding to the face prior information for subsequent image segmentation target face frame.
  • the determining the face position information of the target object in the image to be segmented includes: receiving user annotation information on the face region of the target object; determining the The target face frame corresponding to the target object, the target face frame is used to indicate the face position information of the target object in the to-be-segmented image.
  • the target face frame corresponding to the target object as the face prior information of subsequent image segmentation can be quickly determined according to the annotation information.
  • segmenting the to-be-segmented image according to the face position information of the target object to obtain a segmentation result corresponding to the target object includes: according to the target face frame , generate a first mask image corresponding to the target face frame, the first mask image includes a first area and a second area, and the position of the first area in the first mask image is the same as The position of the target face frame in the to-be-segmented image is the same, and the second area is an area other than the first area in the first mask image; based on the first mask image, The to-be-segmented image is segmented to obtain a segmentation result corresponding to the target object.
  • the target object in the to-be-segmented image can be directly segmented based on the first mask image, and the segmentation result corresponding to the target object can be obtained without the need for the segmented image to be segmented.
  • the segmentation results corresponding to the target objects are screened after the multiple objects of the target object are segmented, so that the segmentation efficiency of the target objects can be improved and the time-consuming can be reduced.
  • segmenting the to-be-segmented image based on the first mask image to obtain a segmentation result corresponding to the target object includes: combining the first mask image and the The to-be-segmented images are fused to obtain a fused image; based on the fused image, the trained deep neural network is used to segment the to-be-segmented image to obtain a segmentation result corresponding to the target object.
  • the first mask image is used as the face prior information and the image to be segmented is fused. Since the fused image includes the face prior information of the target object, the trained deep neural network can be used based on the fused image.
  • the target object is directly segmented in the image to be segmented, and a segmentation result corresponding to the target object is obtained.
  • the fusion of the first mask image and the image to be segmented to obtain a fused image includes: normalizing pixel values of pixels in the image to be segmented The normalized image to be segmented is obtained; the first mask image and the normalized image to be segmented are fused to obtain the fused image.
  • the first mask image is a binarized image
  • the pixel values of the pixels in the image to be segmented are first normalized, so that the normalized image to be segmented and the first mask image can be better fused to obtain a fusion post image.
  • using the trained deep neural network to segment the to-be-segmented image based on the fused image to obtain a segmentation result corresponding to the target object includes: based on the fusion After the image, using the trained deep neural network, predict the probability that the pixel in the image to be segmented is the target pixel, and the target pixel is the pixel in the area where the target object is located in the image to be segmented ; Determine the segmentation result corresponding to the target object according to the probability that the pixel point in the image to be segmented is the target pixel point and the preset probability threshold.
  • the probability that the pixel point is the target pixel point and the preset probability threshold value are directly determined to obtain the segmentation result corresponding to the target object, and the direct segmentation of the target object is completed.
  • the method before using the trained deep neural network to segment the to-be-segmented image based on the fused image, the method further includes: combining the sample image and the second mask After the images are fused, the initial deep neural network is input, the second mask image is determined according to the face position information of the object to be segmented in the sample image, and the second mask image includes the third area and the first mask image.
  • the position of the third area in the second mask image is the same as the position of the face frame corresponding to the object to be segmented in the sample image, and the fourth area is the second area
  • the face frame corresponding to the object to be segmented is used to indicate the face position information of the object to be segmented in the sample image; based on the sample image and the For the image after the fusion of the second mask image, use the initial neural network to segment the sample image to obtain the segmentation result corresponding to the object to be segmented; according to the preset label segmentation information corresponding to the object to be segmented, and the segmentation result corresponding to the object to be segmented, to determine the segmentation loss corresponding to the initial deep neural network; according to the segmentation loss, train the initial deep neural network to obtain the trained deep neural network.
  • the initial neural network is trained by using the sample image and the second mask image, so that the trained deep neural network obtained by training can be determined according to the face position information of the target object in the image to be segmented in the subsequent segmentation of the image to be segmented.
  • the mask image is used to directly segment the target object in the image to be segmented, thereby improving the segmentation efficiency of the target object.
  • the segmentation result corresponding to the target object is a third mask image corresponding to the target object
  • the third mask image includes a fifth area and a sixth area
  • the third mask image includes a fifth area and a sixth area.
  • the position of the five regions in the third mask image is the same as the position of the target object in the to-be-segmented image
  • the sixth region is outside the fifth region in the third mask image
  • the method further includes: performing an image processing operation on the to-be-segmented image according to the segmentation result corresponding to the target object, the image processing operation including any one of the following: performing an image processing operation on the image according to the sixth area.
  • pixel-level image processing operations can be performed on the portrait area where the target object is located in the image to be segmented and/or the background area other than the target object according to the segmentation result.
  • an image segmentation apparatus comprising: a determination module configured to determine face position information of a target object in an image to be segmented, where the target object is a plurality of objects included in the image to be segmented at least one of the objects; a segmentation module, configured to segment the to-be-segmented image according to the face position information of the target object to obtain a segmentation result corresponding to the target object.
  • an electronic device comprising: a processor; a memory for storing instructions executable by the processor; wherein the processor is configured to invoke the instructions stored in the memory to execute the above method.
  • a computer-readable storage medium having computer program instructions stored thereon, the computer program instructions implementing the above method when executed by a processor.
  • a computer program comprising computer readable code which, when the computer code is executed in an electronic device, is executed by a processor in the electronic device for implementing the above method.
  • FIG. 1 shows a flowchart of an image segmentation method according to an embodiment of the present disclosure
  • FIG. 2 shows a schematic diagram of an image to be segmented according to an embodiment of the present disclosure
  • FIG. 3 shows a schematic diagram of a target face frame according to an embodiment of the present disclosure
  • FIG. 4 shows a schematic diagram of a first mask image according to an embodiment of the present disclosure
  • FIG. 5 shows a schematic diagram of a second mask image according to an embodiment of the present disclosure
  • FIG. 6 shows a block diagram of an image segmentation apparatus according to an embodiment of the present disclosure
  • FIG. 7 shows a block diagram of an electronic device according to an embodiment of the present disclosure.
  • FIG. 8 shows a block diagram of an electronic device according to an embodiment of the present disclosure.
  • Image segmentation is an important part of the current application in the field of computer vision, especially when it is necessary to perform pixel-level image processing operations on people or backgrounds other than people in the image/video content, it is the most important to segment the pixel area of the people in the image.
  • Basic step When an image processing operation needs to be performed on a target person among a plurality of persons included in the image/video content, the target person needs to be separately segmented from the image/video content.
  • the image segmentation method of the embodiment of the present disclosure can be applied to a scene where pixel-level image processing needs to be performed on a target person (portrait area) and/or a background area other than the target person in an image including a plurality of persons, for example, on the background area Perform bokeh processing, replace the background area, bokeh the portrait area, and deeply fill the portrait area.
  • the target person can be quickly segmented from the image to be segmented to obtain a segmentation result, and then corresponding image processing operations can be performed on the image to be segmented according to the segmentation result.
  • FIG. 1 shows a flowchart of an image segmentation method according to an embodiment of the present disclosure.
  • the method can be executed by electronic equipment such as terminal equipment or server, and the terminal equipment can be user equipment (User Equipment, UE), mobile equipment, user terminal, terminal, cellular phone, cordless phone, personal digital assistant (Personal Digital Assistant, PDA) , handheld device, computing device, vehicle-mounted device, wearable device, etc., the method can be implemented by the processor calling the computer-readable instructions stored in the memory.
  • the method may be performed by a server, and the server may be a local server, a cloud server, or the like.
  • the image segmentation method may include:
  • step S11 face position information of a target object in the image to be segmented is determined, where the target object is at least one of multiple objects included in the image to be segmented.
  • the image to be segmented includes multiple objects
  • in order to directly segment the target object among the multiple objects first determine the face position information of the target object in the image to be segmented.
  • the number of target objects may be one or more, which is not specifically limited in the present disclosure.
  • step S12 the to-be-segmented image is segmented according to the face position information of the target object, and a segmentation result corresponding to the target object is obtained.
  • the face position information is used as prior information to segment the to-be-segmented image, so that the target object is directly segmented from the to-be-segmented image to obtain a segmentation result.
  • the target object by determining the face position information of the target object and using the face position information as the prior information, it is possible to select from the multiple objects included in the image to be segmented according to the face position information of the target object
  • the target object is directly segmented without the need to segment multiple objects in the image to be segmented and then screen the segmentation results corresponding to the target object, thereby improving the segmentation efficiency of the target object and reducing time-consuming.
  • determining the face position information of the target object in the to-be-segmented image includes: performing face detection on the to-be-segmented image to obtain multiple face frames;
  • the face frame is determined as the target face frame corresponding to the target object, and the target face frame is used to indicate the face position information of the target object in the image to be segmented.
  • FIG. 2 shows a schematic diagram of an image to be segmented according to an embodiment of the present disclosure. As shown in Figure 2, the image to be segmented includes two objects. After performing face detection on the to-be-segmented image shown in FIG. 2 , two face frames can be obtained.
  • the target face frame (ie, the face frame corresponding to the target object) is screened out from the multiple face frames according to actual image processing needs. For example, the user selects a face frame corresponding to a target object to be image-processed from multiple face frames, and in response to the selected face frame, determines the selected face frame as the target face frame corresponding to the target object.
  • Fig. 3 shows a schematic diagram of a target face frame according to an embodiment of the present disclosure. As shown in Figure 3, in the multiple face frames obtained after face detection on the image to be segmented, the person on the right is the target object. Therefore, the face frame corresponding to the person on the right is determined as the target face corresponding to the target object. frame.
  • a plurality of face frames are obtained by performing face detection on the image to be segmented, and in response to the selected face frame, the selected face frame can be quickly determined as the target object corresponding to the face prior information for subsequent image segmentation target face frame.
  • determining the face position information of the target object in the image to be segmented includes: receiving user annotation information on the face region of the target object; determining the target face frame corresponding to the target object according to the annotation information , the target face frame is used to indicate the face position information of the target object in the image to be segmented.
  • the target face frame corresponding to the target object as the face prior information for subsequent image segmentation can be quickly determined according to the annotation information.
  • the target face frame corresponding to the target object there is no strict requirement on the target face frame corresponding to the target object, as long as the target face frame can indicate the face position information of the target object in the image to be segmented, and the person who accurately covers the target object is not required.
  • the face area for example, does not require the target face frame to precisely cover every pixel of the target object's face area.
  • segmenting the image to be segmented according to the face position information of the target object to obtain a segmentation result corresponding to the target object including: generating a first mask corresponding to the target face frame according to the target face frame film image, the first mask image includes a first area and a second area, the position of the first area in the first mask image is the same as the position of the target face frame in the image to be segmented, and the second area is the first area The area other than the first area in the mask image; based on the first mask image, the image to be segmented is segmented, and the segmentation result corresponding to the target object is obtained.
  • FIG. 4 shows a schematic diagram of a first mask image according to an embodiment of the present disclosure. As shown in FIG. 4 , the first mask image and the image to be divided shown in FIG.
  • the first mask image includes the first area and the second area
  • the position of the first area in the first mask image is the same as the position of the target face frame in the image to be segmented
  • the pixel value of the pixel in the first area is 1
  • the second area is the first area In areas other than the first area in the mask image, the pixel value of the pixels in the second area is 0.
  • the target object in the to-be-segmented image can be directly segmented based on the first mask image, and the segmentation result corresponding to the target object can be obtained without the need for the segmented image to be segmented.
  • the segmentation results corresponding to the target objects are screened after the multiple objects of the target object are segmented, so that the segmentation efficiency of the target objects can be improved and the time-consuming can be reduced.
  • the to-be-segmented image is segmented to obtain a segmentation result corresponding to the target object, including: fusing the first mask image and the to-be-segmented image to obtain a fused image; Based on the fused image, the trained deep neural network is used to segment the image to be segmented, and the segmentation result corresponding to the target object is obtained.
  • the first mask image is used as the face prior information and the image to be segmented is fused. Since the fused image includes the face prior information of the target object, the trained deep neural network can be used based on the fused image.
  • the target object is directly segmented in the image to be segmented, and a segmentation result corresponding to the target object is obtained.
  • the initial deep neural network In order to directly segment the target object from the image to be segmented, the initial deep neural network needs to be trained before the image to be segmented based on the fused image obtained by fusing the first mask image and the image to be segmented. Get the trained deep neural network.
  • the method before using the trained deep neural network to segment the to-be-segmented image based on the fused image, the method further includes: fuse the sample image and the second mask image and then input the initial deep neural network network, the second mask image is determined according to the face position information of the object to be segmented in the sample image, the second mask image includes a third area and a fourth area, and the third area is in the second mask image.
  • the position is the same as that of the face frame corresponding to the object to be segmented in the sample image
  • the fourth area is the area other than the third area in the second mask image
  • the face frame corresponding to the object to be segmented is used to indicate the sample image to be segmented.
  • the initial neural network uses the initial neural network to segment the sample image to obtain the segmentation result corresponding to the object to be segmented; according to the preset corresponding to the object to be segmented
  • the segmentation information and the segmentation result corresponding to the object to be segmented are marked, and the segmentation loss corresponding to the initial deep neural network is determined; according to the segmentation loss, the initial deep neural network is trained to obtain the trained deep neural network.
  • the initial neural network is trained by using the sample image and the second mask image, so that the trained deep neural network obtained by training can be determined according to the face position information of the target object in the image to be segmented in the subsequent segmentation of the image to be segmented.
  • the mask image is used to directly segment the target object in the image to be segmented, thereby improving the segmentation efficiency of the target object.
  • a training sample set for training a deep neural network is preset, and the training sample set includes a sample image, a second mask image, and preset label segmentation information corresponding to the object to be segmented.
  • the sample image includes multiple objects and requires multiple The image in which at least one target object in the objects is to be segmented, and the second mask image is generated according to the face frame corresponding to the object to be segmented in the sample image.
  • the image after fusion of the sample image and the second mask image is input into the initial segmentation network, and the initial deep neural network is used to segment the sample image to obtain the segmentation result corresponding to the object to be segmented.
  • the training sample set includes the preset corresponding to the object to be segmented Labeling segmentation information, that is, the labeling segmentation result corresponding to the object to be segmented, so that the segmentation loss of the initial segmentation network can be determined according to the segmentation result corresponding to the object to be segmented and the preset labeling segmentation information corresponding to the object to be segmented, and then according to the segmentation loss, Train the initial deep neural network to get the trained deep neural network.
  • the network parameters corresponding to the initial deep neural network are adjusted to obtain an intermediate network, and the same network training method as the above-mentioned training initial deep neural network is used to iteratively train the intermediate network, until it is determined that a trained network that meets the requirements is obtained.
  • Deep Neural Networks Deep Neural Networks.
  • the initial deep neural network is a neural network that can be used for image segmentation, and the specific network structure is not specifically limited in this disclosure.
  • the first mask image and the image to be segmented are fused to obtain a fused image, including: normalizing the pixel values of the pixel points in the image to be segmented to obtain a normalized image to be segmented image; fuse the first mask image and the normalized image to be segmented to obtain a fused image.
  • the first mask image is a binarized image
  • the pixel values of the pixels in the image to be segmented are first normalized, so that the normalized image to be segmented and the first mask image can be better fused to obtain a fusion post image.
  • fusing the first mask image and the normalized image to be segmented to obtain a fused image includes: performing channel stacking of the first mask image and the normalized image to be segmented, Get the fused image.
  • the normalized image to be segmented is also a three-channel image
  • the first mask image is a one-channel binarized image. Therefore, the first mask image and the normalized The to-be-segmented image is transformed into channel stacking to obtain a four-channel fused image.
  • based on the fused image use the trained deep neural network to segment the image to be segmented, and obtain the segmentation result corresponding to the target object, including: based on the fused image, using the trained deep neural network, Predict the probability that the pixel in the image to be segmented is the target pixel, and the target pixel is the pixel in the area where the target object is located in the image to be segmented; according to the probability that the pixel in the image to be segmented is the target pixel and the preset probability threshold, determine The segmentation result corresponding to the target object.
  • the probability that the pixel point is the target pixel point and the preset probability threshold value are directly determined to obtain the segmentation result corresponding to the target object, and the direct segmentation of the target object is completed.
  • the probability that the predicted pixel is the target pixel, and the value range of the probability is [0, 1].
  • the preset probability threshold is 0.8
  • the pixel points with the corresponding probability greater than or equal to 0.8 are determined as the target pixel points, and then according to the target pixel points in the image to be segmented, the segmentation result corresponding to the target object is obtained, that is, the corresponding segmentation result of the target object is obtained.
  • the segmentation result consists of target pixels in the image to be segmented.
  • the image segmentation result is a third mask image corresponding to the target object
  • the third mask image includes a fifth area and a sixth area
  • the position of the fifth area in the third mask image The position of the target object in the to-be-segmented image is the same, and the sixth area is an area other than the fifth area in the third mask image
  • the method further includes: performing an image processing operation on the to-be-segmented image according to the segmentation result corresponding to the target object,
  • the image processing operation includes any one of the following: performing a blurring process on the background region other than the target object in the image to be divided according to the sixth region, performing replacement processing on the background region other than the target object in the image to be divided according to the sixth region, and performing a replacement process according to the fifth region.
  • the region performs blurring processing on the portrait region where the target object is located in the to-be-segmented image, and deeply fills the portrait region where the target object is located in the to-be-segmented image according to the
  • pixel-level image processing operations can be performed on the portrait area where the target object is located in the image to be segmented and/or the background area other than the target object according to the segmentation result.
  • the segmentation result corresponding to the target object may be a third mask image corresponding to the target object.
  • the resolution of the third mask image and the image to be segmented is the same, that is, the size of the third mask image and the image to be segmented is the same, and the third mask image has the same size as the image to be segmented.
  • the film image includes a fifth area and a sixth area
  • the fifth area corresponds to the portrait area where the target object is located in the image to be segmented, that is, the position of the fifth area in the third mask image and the location of the target object in the image to be segmented
  • the pixel value of the pixel in the fifth area is 0
  • the sixth area corresponds to the background area other than the target object in the image to be segmented, that is, the sixth area is the area other than the fifth area in the third mask image, the sixth area
  • the pixel value of the middle pixel is 1. For example, after image segmentation is performed on the image to be segmented shown in FIG. 2 , the segmentation result corresponding to the target object shown in FIG.
  • FIG. 5 shows a schematic diagram of a third mask image according to an embodiment of the present disclosure.
  • the third mask image includes a fifth area corresponding to the portrait area where the target object is located, and a sixth area corresponding to the background area other than the target object.
  • pixel-level image processing operations can be performed on the portrait area where the target object is located in the image to be segmented and/or the background area other than the target object, for example, blurring the background area, replacing the background area Processing, blurring the portrait area, and filling in depth in the portrait area (for example, in the case where depth information is lost in the portrait area because the target object's clothing is dark, deep filling in the portrait area), etc.
  • the image processing operation may also include other pixel-level image processing operations, which are not specifically limited in the present disclosure.
  • the present disclosure also provides image segmentation devices, electronic devices, computer-readable storage media, and programs, all of which can be used to implement any image segmentation method provided by the present disclosure.
  • image segmentation devices electronic devices, computer-readable storage media, and programs, all of which can be used to implement any image segmentation method provided by the present disclosure.
  • FIG. 6 shows a block diagram of an image segmentation apparatus according to an embodiment of the present disclosure.
  • the image segmentation device includes:
  • the determination module 61 is used to determine the face position information of the target object in the image to be segmented, and the target object is at least one of the multiple objects included in the image to be segmented;
  • the segmentation module 62 is configured to segment the image to be segmented according to the face position information of the target object to obtain a segmentation result corresponding to the target object.
  • the determining module 61 includes:
  • the face detection sub-module is used to perform face detection on the image to be segmented to obtain multiple face frames
  • the first determination submodule is used to determine the selected face frame as the target face frame corresponding to the target object in response to the selected face frame, and the target face frame is used to indicate the person of the target object in the image to be segmented. face location information.
  • the determining module 61 includes:
  • a receiving sub-module used for receiving the user's annotation information on the face area of the target object
  • the second determination submodule is used for determining the target face frame corresponding to the target object according to the label information, and the target face frame is used to indicate the face position information of the target object in the image to be segmented.
  • the segmentation module 62 includes:
  • the third determination submodule is used to generate a first mask image corresponding to the target face frame according to the target face frame, the first mask image includes a first area and a second area, and the first area is in the first mask The position in the image is the same as the position of the target face frame in the image to be segmented, and the second area is an area other than the first area in the first mask image;
  • the segmentation sub-module is used to segment the image to be segmented based on the first mask image to obtain segmentation results corresponding to the target object.
  • sub-modules are divided, including:
  • a first image fusion unit configured to fuse the first mask image and the to-be-segmented image to obtain a fused image
  • the first segmentation unit is used to segment the image to be segmented by using the trained deep neural network based on the fused image to obtain segmentation results corresponding to the target object.
  • the first image fusion unit is specifically used for:
  • the first mask image and the normalized image to be segmented are fused to obtain a fused image.
  • the first dividing unit is specifically used for:
  • the trained deep neural network is used to predict the probability that the pixel in the image to be segmented is the target pixel, and the target pixel is the pixel in the area where the target object is located in the image to be segmented;
  • the segmentation result corresponding to the target object is determined according to the probability that the pixel in the image to be segmented is the target pixel and the preset probability threshold.
  • the image segmentation apparatus 60 further includes:
  • the second image fusion unit is used to fuse the sample image and the second mask image and then input the initial deep neural network into the initial deep neural network before using the trained deep neural network to segment the image to be segmented based on the fused image.
  • the image is determined according to the face position information of the object to be segmented in the sample image, the second mask image includes a third area and a fourth area, and the position of the third area in the second mask image corresponds to the object to be segmented
  • the position of the face frame is the same in the sample image, the fourth area is the area other than the third area in the second mask image, and the face frame corresponding to the object to be segmented is used to indicate the face position of the object to be segmented in the sample image. information;
  • the second segmentation unit is used to segment the sample image based on the image after fusion of the sample image and the second mask image, and obtain the segmentation result corresponding to the object to be segmented by using the initial neural network;
  • a segmentation loss determination unit configured to determine the segmentation loss corresponding to the initial deep neural network according to the preset label segmentation information corresponding to the object to be segmented and the segmentation result corresponding to the object to be segmented;
  • the training unit is used to train the initial deep neural network according to the segmentation loss to obtain the trained deep neural network.
  • the segmentation result corresponding to the target object is a third mask image corresponding to the target object
  • the third mask image includes a fifth area and a sixth area
  • the fifth area is in the third mask image
  • the position in is the same as the position of the target object in the image to be segmented
  • the sixth area is the area other than the fifth area in the third mask image
  • the image segmentation device 60 also includes:
  • the image processing module is configured to perform an image processing operation on the image to be segmented according to the segmentation result corresponding to the target object, and the image processing operation includes any one of the following: performing blurring processing on the background area other than the target object in the image to be segmented according to the sixth area , carry out replacement processing according to the background area other than the target object in the segmented image according to the sixth area, carry out blurring processing according to the fifth area to treat the portrait area where the target object in the segmented image is located, and treat the area where the target object is located in the segmented image according to the fifth area.
  • the portrait area is deeply filled.
  • the functions or modules included in the apparatuses provided in the embodiments of the present disclosure may be used to execute the methods described in the above method embodiments.
  • Embodiments of the present disclosure further provide a computer-readable storage medium, on which computer program instructions are stored, and when the computer program instructions are executed by a processor, the foregoing method is implemented.
  • the computer-readable storage medium may be a non-volatile computer-readable storage medium.
  • An embodiment of the present disclosure further provides an electronic device, including: a processor; a memory for storing instructions executable by the processor; wherein the processor is configured to invoke the instructions stored in the memory to execute the above method.
  • Embodiments of the present disclosure also provide a computer program product, including computer-readable codes.
  • a processor in the device executes a method for implementing the image segmentation method provided by any of the above embodiments. instruction.
  • Embodiments of the present disclosure further provide another computer program product for storing computer-readable instructions, which, when executed, cause the computer to perform the operations of the image segmentation method provided by any of the foregoing embodiments.
  • the electronic device may be provided as a terminal, server or other form of device.
  • FIG. 7 shows a block diagram of an electronic device according to an embodiment of the present disclosure.
  • the electronic device 800 may be a mobile phone, a computer, a digital broadcasting terminal, a messaging device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, and other terminals.
  • an electronic device 800 may include one or more of the following components: a processing component 802, a memory 804, a power supply component 806, a multimedia component 808, an audio component 810, an input/output (I/O) interface 812, a sensor component 814 , and the communication component 816 .
  • the processing component 802 generally controls the overall operation of the electronic device 800, such as operations associated with display, phone calls, data communications, camera operations, and recording operations.
  • the processing component 802 can include one or more processors 820 to execute instructions to perform all or some of the steps of the methods described above.
  • processing component 802 may include one or more modules that facilitate interaction between processing component 802 and other components.
  • processing component 802 may include a multimedia module to facilitate interaction between multimedia component 808 and processing component 802.
  • Memory 804 is configured to store various types of data to support operation at electronic device 800 . Examples of such data include instructions for any application or method operating on electronic device 800, contact data, phonebook data, messages, pictures, videos, and the like. Memory 804 may be implemented by any type of volatile or nonvolatile storage device or combination thereof, such as static random access memory (SRAM), electrically erasable programmable read only memory (EEPROM), erasable Programmable Read Only Memory (EPROM), Programmable Read Only Memory (PROM), Read Only Memory (ROM), Magnetic Memory, Flash Memory, Magnetic or Optical Disk.
  • SRAM static random access memory
  • EEPROM electrically erasable programmable read only memory
  • EPROM erasable Programmable Read Only Memory
  • PROM Programmable Read Only Memory
  • ROM Read Only Memory
  • Magnetic Memory Flash Memory
  • Magnetic or Optical Disk Magnetic Disk
  • Power supply assembly 806 provides power to various components of electronic device 800 .
  • Power supply components 806 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to electronic device 800 .
  • Multimedia component 808 includes a screen that provides an output interface between the electronic device 800 and the user.
  • the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from a user.
  • the touch panel includes one or more touch sensors to sense touch, swipe, and gestures on the touch panel. The touch sensor may not only sense the boundaries of a touch or swipe action, but also detect the duration and pressure associated with the touch or swipe action.
  • multimedia component 808 includes a front-facing camera and/or a rear-facing camera. When the electronic device 800 is in an operation mode, such as a shooting mode or a video mode, the front camera and/or the rear camera may receive external multimedia data. Each of the front and rear cameras can be a fixed optical lens system or have focal length and optical zoom capability.
  • Audio component 810 is configured to output and/or input audio signals.
  • audio component 810 includes a microphone (MIC) that is configured to receive external audio signals when electronic device 800 is in operating modes, such as calling mode, recording mode, and voice recognition mode.
  • the received audio signal may be further stored in memory 804 or transmitted via communication component 816 .
  • audio component 810 also includes a speaker for outputting audio signals.
  • the I/O interface 812 provides an interface between the processing component 802 and a peripheral interface module, which may be a keyboard, a click wheel, a button, or the like. These buttons may include, but are not limited to: home button, volume buttons, start button, and lock button.
  • Sensor assembly 814 includes one or more sensors for providing status assessment of various aspects of electronic device 800 .
  • the sensor assembly 814 can detect the on/off state of the electronic device 800, the relative positioning of the components, such as the display and the keypad of the electronic device 800, the sensor assembly 814 can also detect the electronic device 800 or one of the electronic device 800 Changes in the position of components, presence or absence of user contact with the electronic device 800 , orientation or acceleration/deceleration of the electronic device 800 and changes in the temperature of the electronic device 800 .
  • Sensor assembly 814 may include a proximity sensor configured to detect the presence of nearby objects in the absence of any physical contact.
  • Sensor assembly 814 may also include a light sensor, such as a complementary metal oxide semiconductor (CMOS) or charge coupled device (CCD) image sensor, for use in imaging applications.
  • CMOS complementary metal oxide semiconductor
  • CCD charge coupled device
  • the sensor assembly 814 may also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
  • Communication component 816 is configured to facilitate wired or wireless communication between electronic device 800 and other devices.
  • the electronic device 800 may access a wireless network based on a communication standard, such as wireless network (WiFi), second generation mobile communication technology (2G) or third generation mobile communication technology (3G), or a combination thereof.
  • the communication component 816 receives broadcast signals or broadcast related information from an external broadcast management system via a broadcast channel.
  • the communication component 816 also includes a near field communication (NFC) module to facilitate short-range communication.
  • the NFC module may be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.
  • RFID radio frequency identification
  • IrDA infrared data association
  • UWB ultra-wideband
  • Bluetooth Bluetooth
  • electronic device 800 may be implemented by one or more application specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable A programmed gate array (FPGA), controller, microcontroller, microprocessor or other electronic component implementation is used to perform the above method.
  • ASICs application specific integrated circuits
  • DSPs digital signal processors
  • DSPDs digital signal processing devices
  • PLDs programmable logic devices
  • FPGA field programmable A programmed gate array
  • controller microcontroller, microprocessor or other electronic component implementation is used to perform the above method.
  • a non-volatile computer-readable storage medium such as a memory 804 comprising computer program instructions executable by the processor 820 of the electronic device 800 to perform the above method is also provided.
  • FIG. 8 shows a block diagram of an electronic device according to an embodiment of the present disclosure.
  • the electronic device 1900 may be provided as a server.
  • electronic device 1900 includes processing component 1922, which further includes one or more processors, and a memory resource represented by memory 1932 for storing instructions executable by processing component 1922, such as applications.
  • An application program stored in memory 1932 may include one or more modules, each corresponding to a set of instructions.
  • the processing component 1922 is configured to execute instructions to perform the above-described methods.
  • the electronic device 1900 may also include a power supply assembly 1926 configured to perform power management of the electronic device 1900, a wired or wireless network interface 1950 configured to connect the electronic device 1900 to a network, and an input output (I/O) interface 1958 .
  • the electronic device 1900 can operate based on an operating system stored in the memory 1932, such as a Microsoft server operating system (Windows Server TM ), a graphical user interface based operating system (Mac OS X TM ) introduced by Apple, a multi-user multi-process computer operating system (Unix TM ), Free and Open Source Unix-like Operating System (Linux TM ), Open Source Unix-like Operating System (FreeBSD TM ) or the like.
  • Microsoft server operating system Windows Server TM
  • Mac OS X TM graphical user interface based operating system
  • Uniix TM multi-user multi-process computer operating system
  • Free and Open Source Unix-like Operating System Linux TM
  • FreeBSD TM Open Source Unix-like Operating System
  • a non-volatile computer-readable storage medium such as memory 1932 comprising computer program instructions executable by processing component 1922 of electronic device 1900 to perform the above-described method.
  • the present disclosure may be a system, method and/or computer program product.
  • the computer program product may include a computer-readable storage medium having computer-readable program instructions loaded thereon for causing a processor to implement various aspects of the present disclosure.
  • a computer-readable storage medium may be a tangible device that can hold and store instructions for use by the instruction execution device.
  • the computer-readable storage medium may be a volatile storage medium or a non-volatile storage medium.
  • the computer-readable storage medium may be, for example, but not limited to, an electrical storage device, a magnetic storage device, an optical storage device, an electromagnetic storage device, a semiconductor storage device, or any suitable combination of the foregoing.
  • Non-exhaustive list of computer readable storage media include: portable computer disks, hard disks, random access memory (RAM), read only memory (ROM), erasable programmable read only memory (EPROM) or flash memory), static random access memory (SRAM), portable compact disk read only memory (CD-ROM), digital versatile disk (DVD), memory sticks, floppy disks, mechanically coded devices, such as printers with instructions stored thereon Hole cards or raised structures in grooves, and any suitable combination of the above.
  • RAM random access memory
  • ROM read only memory
  • EPROM erasable programmable read only memory
  • flash memory static random access memory
  • SRAM static random access memory
  • CD-ROM compact disk read only memory
  • DVD digital versatile disk
  • memory sticks floppy disks
  • mechanically coded devices such as printers with instructions stored thereon Hole cards or raised structures in grooves, and any suitable combination of the above.
  • Computer-readable storage media are not to be construed as transient signals per se, such as radio waves or other freely propagating electromagnetic waves, electromagnetic waves propagating through waveguides or other transmission media (eg, light pulses through fiber optic cables), or through electrical wires transmitted electrical signals.
  • the computer readable program instructions described herein may be downloaded to various computing/processing devices from a computer readable storage medium, or to an external computer or external storage device over a network such as the Internet, a local area network, a wide area network, and/or a wireless network.
  • the network may include copper transmission cables, fiber optic transmission, wireless transmission, routers, firewalls, switches, gateway computers, and/or edge servers.
  • a network adapter card or network interface in each computing/processing device receives computer-readable program instructions from a network and forwards the computer-readable program instructions for storage in a computer-readable storage medium in each computing/processing device .
  • Computer program instructions for carrying out operations of the present disclosure may be assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine-dependent instructions, microcode, firmware instructions, state setting data, or instructions in one or more programming languages.
  • Source or object code written in any combination, including object-oriented programming languages, such as Smalltalk, C++, etc., and conventional procedural programming languages, such as the "C" language or similar programming languages.
  • the computer readable program instructions may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer, or entirely on the remote computer or server implement.
  • the remote computer may be connected to the user's computer through any kind of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (eg, using an Internet service provider through the Internet connect).
  • LAN local area network
  • WAN wide area network
  • custom electronic circuits such as programmable logic circuits, field programmable gate arrays (FPGAs), or programmable logic arrays (PLAs) can be personalized by utilizing state information of computer readable program instructions.
  • Computer readable program instructions are executed to implement various aspects of the present disclosure.
  • These computer readable program instructions may be provided to a processor of a general purpose computer, special purpose computer or other programmable data processing apparatus to produce a machine that causes the instructions when executed by the processor of the computer or other programmable data processing apparatus , resulting in means for implementing the functions/acts specified in one or more blocks of the flowchart and/or block diagrams.
  • These computer readable program instructions can also be stored in a computer readable storage medium, these instructions cause a computer, programmable data processing apparatus and/or other equipment to operate in a specific manner, so that the computer readable medium on which the instructions are stored includes An article of manufacture comprising instructions for implementing various aspects of the functions/acts specified in one or more blocks of the flowchart and/or block diagrams.
  • Computer readable program instructions can also be loaded onto a computer, other programmable data processing apparatus, or other equipment to cause a series of operational steps to be performed on the computer, other programmable data processing apparatus, or other equipment to produce a computer-implemented process , thereby causing instructions executing on a computer, other programmable data processing apparatus, or other device to implement the functions/acts specified in one or more blocks of the flowcharts and/or block diagrams.
  • each block in the flowchart or block diagrams may represent a module, segment, or portion of instructions, which comprises one or more functions for implementing the specified logical function(s) executable instructions.
  • the functions noted in the blocks may occur out of the order noted in the figures. For example, two blocks in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved.
  • each block of the block diagrams and/or flowchart illustrations, and combinations of blocks in the block diagrams and/or flowchart illustrations can be implemented in dedicated hardware-based systems that perform the specified functions or actions , or can be implemented in a combination of dedicated hardware and computer instructions.
  • the computer program product can be specifically implemented by hardware, software or a combination thereof.
  • the computer program product is embodied as a computer storage medium, and in another optional embodiment, the computer program product is embodied as a software product, such as a software development kit (Software Development Kit, SDK), etc. Wait.
  • a software development kit Software Development Kit, SDK

Abstract

一种图像分割方法及装置、电子设备和存储介质、计算机程序,所述方法包括:确定待分割图像中目标对象的人脸位置信息,所述目标对象是所述待分割图像中包括的多个对象中的至少一个(S11);根据所述目标对象的人脸位置信息,对所述待分割图像进行分割,得到所述目标对象对应的分割结果(S12)。

Description

图像分割方法及装置、电子设备和存储介质、计算机程序
本申请要求在2020年12月22日提交中国专利局、申请号为202011531478.9、申请名称为“图像分割方法及装置、电子设备和存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本公开涉及计算机技术领域,尤其涉及一种图像分割方法及装置、电子设备和存储介质、计算机程序。
背景技术
图像分割是当前计算机视觉领域的一个重要应用,特别是对人像图片/视频内容进行后处理编辑时,把人像像素区域分割出来是最基本的一步。对于多人图片/视频,如何快速把需要的主体人物进一步区分出来是一个亟需解决的重要问题。
发明内容
本公开提出了一种图像分割方法及装置、电子设备和存储介质、计算机程序的技术方案。
根据本公开的一方面,提供了一种图像分割方法,包括:确定待分割图像中目标对象的人脸位置信息,所述目标对象是所述待分割图像中包括的多个对象中的至少一个;根据所述目标对象的人脸位置信息,对所述待分割图像进行分割,得到所述目标对象对应的分割结果。
通过确定目标对象的人脸位置信息,以及将人脸位置信息作为先验信息,使得可以根据目标对象的人脸位置信息,从待分割图像中包括的多个对象中直接分割出目标对象,而无需对待分割图像中的多个对象都进行分割之后再对目标对象对应的分割结果进行筛选,从而可以提高对目标对象的分割效率,降低耗时。
在一种可能的实现方式中,所述确定待分割图像中目标对象的人脸位置信息,包括:对所述待分割图像进行人脸检测,得到多个人脸框;响应于被选中的人脸框,将所述被选中的人脸框确定为所述目标对象对应的目标人脸框,所述目标人脸框用于指示所述待分割图像中所述目标对象的人脸位置信息。
通过对待分割图像进行人脸检测得到多个人脸框,以及响应于被选中的人脸框,可以快速将被选中的人脸框确定为,作为后续图像分割的人脸先验信息的目标对象对应的目标人脸框。
在一种可能的实现方式中,所述确定待分割图像中目标对象的人脸位置信息,包括:接收用户对所述目标对象的人脸区域的标注信息;根据所述标注信息,确定所述目标对象对应的目标人脸框,所述目标人脸框用于指示所述待分割图像中所述目标对象的人脸位置信息。
通过接收用户对目标对象的人脸区域的标注信息,从而可以根据标注信息,快速确 定出作为后续图像分割的人脸先验信息的目标对象对应的目标人脸框。
在一种可能的实现方式中,所述根据所述目标对象的人脸位置信息,对所述待分割图像进行分割,得到所述目标对象对应的分割结果,包括:根据所述目标人脸框,生成所述目标人脸框对应的第一掩膜图像,所述第一掩膜图像中包括第一区域和第二区域,所述第一区域在所述第一掩膜图像中的位置与所述目标人脸框在所述待分割图像中的位置相同,所述第二区域为所述第一掩膜图像中所述第一区域以外的区域;基于所述第一掩膜图像,对所述待分割图像进行分割,得到所述目标对象对应的分割结果。
根据目标对象对应的目标人脸框生成第一掩膜图像之后,使得可以基于第一掩膜图像对待分割图像中的目标对象进行直接分割,得到目标对象对应的分割结果,而无需对待分割图像中的多个对象都进行分割之后再对目标对象对应的分割结果进行筛选,从而可以提高对目标对象的分割效率,降低耗时。
在一种可能的实现方式中,所述基于所述第一掩膜图像,对所述待分割图像进行分割,得到所述目标对象对应的分割结果,包括:将所述第一掩膜图像和所述待分割图像进行融合,得到融合后图像;基于所述融合后图像,利用训练好的深度神经网络对所述待分割图像进行分割,得到所述目标对象对应的分割结果。
将第一掩膜图像作为人脸先验信息与待分割图像进行融合,由于融合后图像中包括目标对象的人脸先验信息,从而可以基于融合后图像,利用训练好的深度神经网络,从待分割图像中直接对目标对象进行分割,得到目标对象对应的分割结果。
在一种可能的实现方式中,所述将所述第一掩膜图像和所述待分割图像进行融合,得到融合后图像,包括:对所述待分割图像中像素点的像素值进行归一化处理,得到归一化待分割图像;将所述第一掩膜图像和所述归一化待分割图像进行融合,得到所述融合后图像。
由于第一掩膜图像为二值化图像,首先对待分割图像中像素点的像素值进行归一化处理,使得归一化待分割图像和第一掩膜图像可以更好地进行融合,得到融合后图像。
在一种可能的实现方式中,所述基于所述融合后图像,利用训练好的深度神经网络对所述待分割图像进行分割,得到所述目标对象对应的分割结果,包括:基于所述融合后图像,利用所述训练好的深度神经网络,预测所述待分割图像中像素点为目标像素点的概率,所述目标像素点为所述待分割图像中所述目标对象所在区域的像素点;根据所述待分割图像中像素点为目标像素点的概率以及预设概率阈值,确定所述目标对象对应的分割结果。
将融合后图像输入训练好的深度神经网络,训练好的深度神经网络对待分割图像中的像素点进行预测,预测像素点为目标对象所在区域的目标像素点的概率,从而可以根据待分割图像中像素点为目标像素点的概率以及预设概率阈值,直接确定得到目标对象对应的分割结果,完成对目标对象的直接分割。
在一种可能的实现方式中,在基于所述融合后图像,利用所述训练好的深度神经网络对所述待分割图像进行分割之前,所述方法还包括:将样本图像和第二掩膜图像进行 融合后输入初始深度神经网络,所述第二掩膜图像是根据所述样本图像中待分割对象的人脸位置信息确定得到的,所述第二掩膜图像中包括第三区域和第四区域,所述第三区域在所述第二掩膜图像中的位置与所述待分割对象对应的人脸框在所述样本图像中的位置相同,所述第四区域为所述第二掩膜图像中所述第三区域以外的区域,所述待分割对象对应的人脸框用于指示所述样本图像中所述待分割对象的人脸位置信息;基于所述样本图像和所述第二掩膜图像进行融合后的图像,利用所述初始神经网络对所述样本图像进行分割,得到所述待分割对象对应的分割结果;根据所述待分割对象对应的预设标注分割信息,以及所述待分割对象对应的分割结果,确定所述初始深度神经网络对应的分割损失;根据所述分割损失,训练所述初始深度神经网络,以得到所述训练后的深度神经网络。
利用样本图像和第二掩膜图像对初始神经网络进行训练,使得训练得到的训练后的深度神经网络能够在后续对待分割图像的分割中,可以根据待分割图像中目标对象的人脸位置信息确定的掩膜图像,对待分割图像中的目标对象进行直接分割,从而提高了对目标对象的分割效率。
在一种可能的实现方式中,所述目标对象对应的分割结果为所述目标对象对应的第三掩膜图像,所述第三掩膜图像中包括第五区域和第六区域,所述第五区域在所述第三掩膜图像中的位置与所述目标对象在所述待分割图像中的位置相同,所述第六区域为所述第三掩膜图像中所述第五区域以外的区域;所述方法还包括:根据所述目标对象对应的分割结果,对所述待分割图像进行图像处理操作,所述图像处理操作包括以下中的任意一个:根据所述第六区域对所述待分割图像中所述目标对象以外的背景区域进行虚化处理、根据所述第六区域对所述待分割图像中所述目标对象以外的背景区域进行替换处理、根据所述第五区域对所述待分割图像中所述目标对象所在的人像区域进行虚化处理、根据所述第五区域对所述待分割图像中所述目标对象所在的人像区域进行深度填充。
通过确定目标对象对应的分割结果,从而可以根据该分割结果,实现对待分割图像中的目标对象所在的人像区域和/或目标对象以外的背景区域进行像素级别的图像处理操作。
根据本公开的一方面,提供了一种图像分割装置,包括:确定模块,用于确定待分割图像中目标对象的人脸位置信息,所述目标对象是所述待分割图像中包括的多个对象中的至少一个;分割模块,用于根据所述目标对象的人脸位置信息,对所述待分割图像进行分割,得到所述目标对象对应的分割结果。
根据本公开的一方面,提供了一种电子设备,包括:处理器;用于存储处理器可执行指令的存储器;其中,所述处理器被配置为调用所述存储器存储的指令,以执行上述方法。
根据本公开的一方面,提供了一种计算机可读存储介质,其上存储有计算机程序指令,所述计算机程序指令被处理器执行时实现上述方法。
根据本公开的一方面,提供了一种计算机程序,包括计算机可读代码,当所述计算 机代码在电子设备中运行时,所述电子设备中的处理器执行用于实现上述方法。
应当理解的是,以上的一般描述和后文的细节描述仅是示例性和解释性的,而非限制本公开。根据下面参考附图对示例性实施例的详细说明,本公开的其它特征及方面将变得清楚。
附图说明
此处的附图被并入说明书中并构成本说明书的一部分,这些附图示出了符合本公开的实施例,并与说明书一起用于说明本公开的技术方案。
图1示出根据本公开实施例的一种图像分割方法的流程图;
图2示出根据本公开实施例的待分割图像的示意图;
图3示出根据本公开实施例的目标人脸框的示意图;
图4示出根据本公开实施例的第一掩膜图像的示意图;
图5示出根据本公开实施例的第二掩膜图像的示意图;
图6示出根据本公开实施例的一种图像分割装置的框图;
图7示出根据本公开实施例的一种电子设备的框图;
图8示出根据本公开实施例的一种电子设备的框图。
具体实施方式
以下将参考附图详细说明本公开的各种示例性实施例、特征和方面。附图中相同的附图标记表示功能相同或相似的元件。尽管在附图中示出了实施例的各种方面,但是除非特别指出,不必按比例绘制附图。
在这里专用的词“示例性”意为“用作例子、实施例或说明性”。这里作为“示例性”所说明的任何实施例不必解释为优于或好于其它实施例。
本文中术语“和/或”,仅仅是一种描述关联对象的关联关系,表示可以存在三种关系,例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B这三种情况。另外,本文中术语“至少一种”表示多种中的任意一种或多种中的至少两种的任意组合,例如,包括A、B、C中的至少一种,可以表示包括从A、B和C构成的集合中选择的任意一个或多个元素。
另外,为了更好地说明本公开,在下文的具体实施方式中给出了众多的具体细节。本领域技术人员应当理解,没有某些具体细节,本公开同样可以实施。在一些实例中,对于本领域技术人员熟知的方法、手段、元件和电路未作详细描述,以便于凸显本公开的主旨。
图像分割是当前计算机视觉领域应用的一个重要组成部分,特别是需要对图像/视频内容中的人物或人物以外的背景进行像素级别的图像处理操作时,把图像中人物的像素区域分割出来是最基本的一步。当需要对图像/视频内容中包括的多个人物中的目标人物进行图像处理操作时,需要将目标人物从图像/视频内容中单独分割出来。本公开实施例 的图像分割方法可以应用于需要对包括多个人物的图像中的目标人物(人像区域)和/或目标人物以外的背景区域进行像素级别的图像处理的场景,例如,对背景区域进行虚化处理、对背景区域进行替换处理、对人像区域进行虚化处理、对人像区域进行深度填充等。根据本公开实施例的图像分割方法,可以将目标人物快速从待分割图像中分割出来,得到分割结果,进而可以根据分割结果,对待分割图像进行相应的图像处理操作。
下面对根据本公开实施例的图像分割方法进行详细说明。
图1示出根据本公开实施例的一种图像分割方法的流程图。该方法可以由终端设备或服务器等电子设备执行,终端设备可以为用户设备(User Equipment,UE)、移动设备、用户终端、终端、蜂窝电话、无绳电话、个人数字处理(Personal Digital Assistant,PDA)、手持设备、计算设备、车载设备、可穿戴设备等,该方法可以通过处理器调用存储器中存储的计算机可读指令的方式来实现。或者,可通过服务器执行所述方法,服务器可以为本地服务器、云端服务器等。如图1所示,该图像分割方法可以包括:
在步骤S11中,确定待分割图像中目标对象的人脸位置信息,目标对象是待分割图像中包括的多个对象中的至少一个。
在待分割图像中包括多个对象的情况下,为了将多个对象中的目标对象直接分割出来,首先确定待分割图像中目标对象的人脸位置信息。目标对象的个数可以是一个,也可以是多个,本公开对此不做具体限定。
在步骤S12中,根据目标对象的人脸位置信息,对待分割图像进行分割,得到目标对象对应的分割结果。
在确定待分割图像中目标对象的人脸位置信息之后,将人脸位置信息作为先验信息,对待分割图像进行分割,从而将目标对象从待分割图像中直接分割出来,得到分割结果。
在本公开实施例中,通过确定目标对象的人脸位置信息,以及将人脸位置信息作为先验信息,使得可以根据目标对象的人脸位置信息,从待分割图像中包括的多个对象中直接分割出目标对象,而无需对待分割图像中的多个对象都进行分割之后再对目标对象对应的分割结果进行筛选,从而可以提高对目标对象的分割效率,降低耗时。
在一种可能的实现方式中,确定待分割图像中目标对象的人脸位置信息,包括:对待分割图像进行人脸检测,得到多个人脸框;响应于被选中的人脸框,将被选中的人脸框确定为目标对象对应的目标人脸框,目标人脸框用于指示待分割图像中目标对象的人脸位置信息。
由于待分割图像中包括多个对象,因此,对待分割图像进行人脸检测,可以得到多个人脸框。图2示出根据本公开实施例的待分割图像的示意图。如图2所示,待分割图像中包括两个对象。对图2所示的待分割图像进行人脸检测之后,可以得到两个人脸框。
在对待分割图像进行人脸检测,得到多个人脸框之后,根据实际图像处理需要,从多个人脸框中筛选出目标人脸框(即目标对象对应的人脸框)。例如,用户在多个人脸框中选择需要进行图像处理的目标对象对应的人脸框,响应于被选中的人脸框,将被选中的人脸框确定为目标对象对应的目标人脸框。图3示出根据本公开实施例的目标人脸框的 示意图。如图3所示,将对待分割图像进行人脸检测后得到的多个人脸框中,右侧人物为目标对象,因此,将右侧人物对应的人脸框确定为目标对象对应的目标人脸框。
通过对待分割图像进行人脸检测得到多个人脸框,以及响应于被选中的人脸框,可以快速将被选中的人脸框确定为,作为后续图像分割的人脸先验信息的目标对象对应的目标人脸框。
在一种可能的实现方式中,确定待分割图像中目标对象的人脸位置信息,包括:接收用户对目标对象的人脸区域的标注信息;根据标注信息,确定目标对象对应的目标人脸框,目标人脸框用于指示待分割图像中所述目标对象的人脸位置信息。
通过接收用户对目标对象的人脸区域的标注信息,从而可以根据标注信息,快速确定出作为后续图像分割的人脸先验信息的目标对象对应的目标人脸框。
确定待分割图像中目标对象的人脸位置信息的方式除了可以采用上述两种方式以外,还可以根据实际情况采用其它方式,本公开对此不做具体限定。
本公开实施例中,对目标对象对应的目标人脸框没有严格的要求,只要该目标人脸框能够指示待分割图像中目标对象的人脸位置信息即可,不要求精确覆盖目标对象的人脸区域,例如,不要求目标人脸框精确覆盖目标对象的人脸区域的每个像素点。
在一种可能的实现方式中,根据目标对象的人脸位置信息,对待分割图像进行分割,得到目标对象对应的分割结果,包括:根据目标人脸框,生成目标人脸框对应的第一掩膜图像,第一掩膜图像中包括第一区域和第二区域,第一区域在第一掩膜图像中的位置与目标人脸框在待分割图像中的位置相同,第二区域为第一掩膜图像中第一区域以外的区域;基于第一掩膜图像,对待分割图像进行分割,得到目标对象对应的分割结果。
在确定目标对象对应的目标人脸框之后,根据目标人脸框,生成目标人脸框对应的第一掩膜图像。其中,第一掩膜图像为二值化图像。例如,根据图3中所示的目标人脸框,可以生成图4中所示的第一掩膜图像。图4示出根据本公开实施例的第一掩膜图像的示意图。如图4所示,第一掩膜图像和图2所示的待分割图像具有相同的分辨率,即第一掩膜图像和待分割图像的尺寸大小相同,第一掩膜图像中包括第一区域和第二区域,第一区域在第一掩膜图像中的位置与目标人脸框在待分割图像中的位置相同,第一区域中像素点的像素值为1,第二区域为第一掩膜图像中第一区域以外的区域,第二区域中像素点的像素值为0。
根据目标对象对应的目标人脸框生成第一掩膜图像之后,使得可以基于第一掩膜图像对待分割图像中的目标对象进行直接分割,得到目标对象对应的分割结果,而无需对待分割图像中的多个对象都进行分割之后再对目标对象对应的分割结果进行筛选,从而可以提高对目标对象的分割效率,降低耗时。
在一种可能的实现方式中,基于第一掩膜图像,对待分割图像进行分割,得到目标对象对应的分割结果,包括:将第一掩膜图像和待分割图像进行融合,得到融合后图像;基于融合后图像,利用训练好的深度神经网络对待分割图像进行分割,得到目标对象对应的分割结果。
将第一掩膜图像作为人脸先验信息与待分割图像进行融合,由于融合后图像中包括目标对象的人脸先验信息,从而可以基于融合后图像,利用训练好的深度神经网络,从待分割图像中直接对目标对象进行分割,得到目标对象对应的分割结果。
为了实现从待分割图像中直接对目标对象进行分割,在基于第一掩膜图像和待分割图像融合后得到的融合后图像,对待分割图像进行分割之前,需要对初始深度神经网络进行训练,以得到该训练好的深度神经网络。
在一种可能的实现方式中,在基于融合后图像,利用训练好的深度神经网络对待分割图像进行分割之前,该方法还包括:将样本图像和第二掩膜图像进行融合后输入初始深度神经网络,第二掩膜图像是根据样本图像中待分割对象的人脸位置信息确定得到的,第二掩膜图像中包括第三区域和第四区域,第三区域在第二掩膜图像中的位置与待分割对象对应的人脸框在样本图像中的位置相同,第四区域为第二掩膜图像中第三区域以外的区域,待分割对象对应的人脸框用于指示样本图像中待分割对象的人脸位置信息;基于样本图像和第二掩膜图像进行融合后的图像,利用初始神经网络对样本图像进行分割,得到待分割对象对应的分割结果;根据待分割对象对应的预设标注分割信息,以及待分割对象对应的分割结果,确定初始深度神经网络对应的分割损失;根据分割损失,训练初始深度神经网络,以得到训练后的深度神经网络。
利用样本图像和第二掩膜图像对初始神经网络进行训练,使得训练得到的训练后的深度神经网络能够在后续对待分割图像的分割中,可以根据待分割图像中目标对象的人脸位置信息确定的掩膜图像,对待分割图像中的目标对象进行直接分割,从而提高了对目标对象的分割效率。
预设设置对深度神经网络进行训练的训练样本集,该训练样本集中包括样本图像、第二掩膜图像以及待分割对象对应的预设标注分割信息,样本图像为包括多个对象且需要多个对象中的至少一个目标对象进行分割的图像,第二掩膜图像是根据样本图像中待分割对象对应的人脸框生成的。
将样本图像和第二掩膜图像融合后的图像输入初始分割网络,利用初始深度神经网络对样本图像进行分割,得到待分割对象对应的分割结果,由于训练样本集中包括待分割对象对应的预设标注分割信息,即待分割对象对应的标注分割结果,使得可以根据待分割对象对应的分割结果以及待分割对象对应的预设标注分割信息,确定得到初始分割网络的分割损失,进而根据分割损失,训练初始深度神经网络,以得到训练后的深度神经网络。
例如,根据分割损失,调整初始深度神经网络对应的网络参数,得到中间网络,并采用与上述训练初始深度神经网络相同的网络训练方法对中间网络进行迭代训练,直至确定得到符合要求的训练后的深度神经网络。
本公开实施例中,初始深度神经网络为可以用于图像分割的神经网络,具体网络结构本公开不做具体限定。
在一种可能的实现方式中,将第一掩膜图像和待分割图像进行融合,得到融合后图 像,包括:对待分割图像中像素点的像素值进行归一化处理,得到归一化待分割图像;将第一掩膜图像和归一化待分割图像进行融合,得到融合后图像。
由于第一掩膜图像为二值化图像,首先对待分割图像中像素点的像素值进行归一化处理,使得归一化待分割图像和第一掩膜图像可以更好地进行融合,得到融合后图像。
在一种可能的实现方式中,将第一掩膜图像和归一化待分割图像进行融合,得到融合后图像,包括:将第一掩膜图像和归一化待分割图像的进行通道叠加,得到融合后图像。
例如,待分割图像为三通道的RGB图像,则归一化待分割图像也为三通道图像,第一掩膜图像为一通道的二值化图像,因此,将第一掩膜图像和归一化待分割图像进行通道叠加,得到四通道的融合后图像。
在一种可能的实现方式中,基于融合后图像,利用训练好的深度神经网络对待分割图像进行分割,得到目标对象对应的分割结果,包括:基于融合后图像,利用训练好的深度神经网络,预测待分割图像中像素点为目标像素点的概率,目标像素点为待分割图像中目标对象所在区域的像素点;根据待分割图像中像素点为目标像素点的概率以及预设概率阈值,确定目标对象对应的分割结果。
将融合后图像输入训练好的深度神经网络,训练好的深度神经网络对待分割图像中的像素点进行预测,预测像素点为目标对象所在区域的目标像素点的概率,从而可以根据待分割图像中像素点为目标像素点的概率以及预设概率阈值,直接确定得到目标对象对应的分割结果,完成对目标对象的直接分割。
例如,针对待分割图像中像素点,预测像素点为目标像素点的概率,该概率的取值值域为[0,1]。假设预设概率阈值为0.8,则将对应的概率大于或等于0.8的像素点确定为目标像素点,进而根据待分割图像中的目标像素点,得到目标对象对应的分割结果,即目标对象对应的分割结果由待分割图像中的目标像素点构成。
在一种可能的实现方式中,图像分割结果为目标对象对应的第三掩膜图像,第三掩膜图像中包括第五区域和第六区域,第五区域在第三掩膜图像中的位置与目标对象在待分割图像中的位置相同,第六区域为第三掩膜图像中第五区域以外的区域;该方法还包括:根据目标对象对应的分割结果,对待分割图像进行图像处理操作,图像处理操作包括以下中的任意一个:根据第六区域对待分割图像中目标对象以外的背景区域进行虚化处理、根据第六区域对待分割图像中目标对象以外的背景区域进行替换处理、根据第五区域对待分割图像中目标对象所在的人像区域进行虚化处理、根据第五区域对待分割图像中目标对象所在的人像区域进行深度填充。
通过确定目标对象对应的分割结果,从而可以根据该分割结果,实现对待分割图像中的目标对象所在的人像区域和/或目标对象以外的背景区域进行像素级别的图像处理操作。
目标对象对应的分割结果可以是目标对象对应的第三掩膜图像,第三掩膜图像与待分割图像的分辨率相同,即第三掩膜图像与待分割图像的尺寸大小相同,第三掩膜图像 中包括第五区域和第六区域,第五区域对应待分割图像中目标对象所在的人像区域,即第五区域在第三掩膜图像中的位置与目标对象在待分割图像中的位置相同,第五区域中像素点的像素值为0;第六区域对应待分割图像中目标对象以外的背景区域,即第六区域为第三掩膜图像中第五区域以外的区域,第六区域中像素点的像素值为1。例如,对图2所示的待分割图像进行图像分割之后,得到图5所示的目标对象对应的分割结果,目标对象对应的分割结果为目标对象对应的第三掩膜图像。图5示出根据本公开实施例的第三掩膜图像的示意图。如图5所示,第三掩膜图像中包括对应目标对象所在的人像区域的第五区域,以及对应目标对象以外的背景区域的第六区域。
根据第三掩膜图像,可以对待分割图像中目标对象所在的人像区域和/或目标对象以外的背景区域进行像素级别的图像处理操作,例如,对背景区域进行虚化处理、对背景区域进行替换处理、对人像区域进行虚化处理、对人像区域进行深度填充(例如,由于目标对象的服装为深色导致人像区域丢失深度信息的情况下,对人像区域进行深度填充)等。图像处理操作除了包括上述记载以外,还可以包括其它像素级别的图像处理操作,本公开对此不做具体限定。
可以理解,本公开提及的上述各个方法实施例,在不违背原理逻辑的情况下,均可以彼此相互结合形成结合后的实施例,限于篇幅,本公开不再赘述。本领域技术人员可以理解,在具体实施方式的上述方法中,各步骤的具体执行顺序应当以其功能和可能的内在逻辑确定。
此外,本公开还提供了图像分割装置、电子设备、计算机可读存储介质、程序,上述均可用来实现本公开提供的任一种图像分割方法,相应技术方案和描述和参见方法部分的相应记载,不再赘述。
图6示出根据本公开实施例的一种图像分割装置的框图。如图6所示,图像分割装置包括:
确定模块61,用于确定待分割图像中目标对象的人脸位置信息,目标对象是待分割图像中包括的多个对象中的至少一个;
分割模块62,用于根据目标对象的人脸位置信息,对待分割图像进行分割,得到目标对象对应的分割结果。
在一种可能的实现方式中,确定模块61,包括:
人脸检测子模块,用于对待分割图像进行人脸检测,得到多个人脸框;
第一确定子模块,用于响应于被选中的人脸框,将被选中的人脸框确定为目标对象对应的目标人脸框,目标人脸框用于指示待分割图像中目标对象的人脸位置信息。
在一种可能的实现方式中,确定模块61,包括:
接收子模块,用于接收用户对目标对象的人脸区域的标注信息;
第二确定子模块,用于根据标注信息,确定目标对象对应的目标人脸框,目标人脸框用于指示待分割图像中目标对象的人脸位置信息。
在一种可能的实现方式中,分割模块62,包括:
第三确定子模块,用于根据目标人脸框,生成目标人脸框对应的第一掩膜图像,第一掩膜图像中包括第一区域和第二区域,第一区域在第一掩膜图像中的位置与目标人脸框在待分割图像中的位置相同,第二区域为第一掩膜图像中第一区域以外的区域;
分割子模块,用于基于第一掩膜图像,对待分割图像进行分割,得到目标对象对应的分割结果。
在一种可能的实现方式中,分割子模块,包括:
第一图像融合单元,用于将第一掩膜图像和待分割图像进行融合,得到融合后图像;
第一分割单元,用于基于融合后图像,利用训练好的深度神经网络对待分割图像进行分割,得到目标对象对应的分割结果。
在一种可能的实现方式中,第一图像融合单元,具体用于:
对待分割图像中像素点的像素值进行归一化处理,得到归一化待分割图像;
将第一掩膜图像和归一化待分割图像进行融合,得到融合后图像。
在一种可能的实现方式中,第一分割单元,具体用于:
基于融合后图像,利用训练好的深度神经网络,预测待分割图像中像素点为目标像素点的概率,目标像素点为待分割图像中目标对象所在区域的像素点;
根据待分割图像中像素点为目标像素点的概率以及预设概率阈值,确定目标对象对应的分割结果。
在一种可能的实现方式中,图像分割装置60还包括:
第二图像融合单元,用于在基于融合后图像,利用训练好的深度神经网络对待分割图像进行分割之前,将样本图像和第二掩膜图像进行融合后输入初始深度神经网络,第二掩膜图像是根据样本图像中待分割对象的人脸位置信息确定得到的,第二掩膜图像中包括第三区域和第四区域,第三区域在第二掩膜图像中的位置与待分割对象对应的人脸框在样本图像中的位置相同,第四区域为第二掩膜图像中第三区域以外的区域,待分割对象对应的人脸框用于指示样本图像中待分割对象的人脸位置信息;
第二分割单元,用于基于样本图像和第二掩膜图像进行融合后的图像,利用初始神经网络对样本图像进行分割,得到待分割对象对应的分割结果;
分割损失确定单元,用于根据待分割对象对应的预设标注分割信息,以及待分割对象对应的分割结果,确定初始深度神经网络对应的分割损失;
训练单元,用于根据分割损失,训练初始深度神经网络,以得到训练后的深度神经网络。
在一种可能的实现方式中,目标对象对应的分割结果为目标对象对应的第三掩膜图像,第三掩膜图像中包括第五区域和第六区域,第五区域在第三掩膜图像中的位置与目标对象在待分割图像中的位置相同,第六区域为第三掩膜图像中第五区域以外的区域;
图像分割装置60还包括:
图像处理模块,用于根据目标对象对应的分割结果,对待分割图像进行图像处理操作,图像处理操作包括以下中的任意一个:根据第六区域对待分割图像中目标对象以外 的背景区域进行虚化处理、根据第六区域对待分割图像中目标对象以外的背景区域进行替换处理、根据第五区域对待分割图像中目标对象所在的人像区域进行虚化处理、根据第五区域对待分割图像中目标对象所在的人像区域进行深度填充。
在一些实施例中,本公开实施例提供的装置具有的功能或包含的模块可以用于执行上文方法实施例描述的方法,其具体实现可以参照上文方法实施例的描述,为了简洁,这里不再赘述。
本公开实施例还提出一种计算机可读存储介质,其上存储有计算机程序指令,所述计算机程序指令被处理器执行时实现上述方法。计算机可读存储介质可以是非易失性计算机可读存储介质。
本公开实施例还提出一种电子设备,包括:处理器;用于存储处理器可执行指令的存储器;其中,所述处理器被配置为调用所述存储器存储的指令,以执行上述方法。
本公开实施例还提供了一种计算机程序产品,包括计算机可读代码,当计算机可读代码在设备上运行时,设备中的处理器执行用于实现如上任一实施例提供的图像分割方法的指令。
本公开实施例还提供了另一种计算机程序产品,用于存储计算机可读指令,指令被执行时使得计算机执行上述任一实施例提供的图像分割方法的操作。
电子设备可以被提供为终端、服务器或其它形态的设备。
图7示出根据本公开实施例的一种电子设备的框图。如图7所示,电子设备800可以是移动电话,计算机,数字广播终端,消息收发设备,游戏控制台,平板设备,医疗设备,健身设备,个人数字助理等终端。
参照图7,电子设备800可以包括以下一个或多个组件:处理组件802,存储器804,电源组件806,多媒体组件808,音频组件810,输入/输出(I/O)的接口812,传感器组件814,以及通信组件816。
处理组件802通常控制电子设备800的整体操作,诸如与显示,电话呼叫,数据通信,相机操作和记录操作相关联的操作。处理组件802可以包括一个或多个处理器820来执行指令,以完成上述的方法的全部或部分步骤。此外,处理组件802可以包括一个或多个模块,便于处理组件802和其他组件之间的交互。例如,处理组件802可以包括多媒体模块,以方便多媒体组件808和处理组件802之间的交互。
存储器804被配置为存储各种类型的数据以支持在电子设备800的操作。这些数据的示例包括用于在电子设备800上操作的任何应用程序或方法的指令,联系人数据,电话簿数据,消息,图片,视频等。存储器804可以由任何类型的易失性或非易失性存储设备或者它们的组合实现,如静态随机存取存储器(SRAM),电可擦除可编程只读存储器(EEPROM),可擦除可编程只读存储器(EPROM),可编程只读存储器(PROM),只读存储器(ROM),磁存储器,快闪存储器,磁盘或光盘。
电源组件806为电子设备800的各种组件提供电力。电源组件806可以包括电源管理系统,一个或多个电源,及其他与为电子设备800生成、管理和分配电力相关联的组件。
多媒体组件808包括在所述电子设备800和用户之间的提供一个输出接口的屏幕。在一些实施例中,屏幕可以包括液晶显示器(LCD)和触摸面板(TP)。如果屏幕包括触摸面板,屏幕可以被实现为触摸屏,以接收来自用户的输入信号。触摸面板包括一个或多个触摸传感器以感测触摸、滑动和触摸面板上的手势。所述触摸传感器可以不仅感测触摸或滑动动作的边界,而且还检测与所述触摸或滑动操作相关的持续时间和压力。在一些实施例中,多媒体组件808包括一个前置摄像头和/或后置摄像头。当电子设备800处于操作模式,如拍摄模式或视频模式时,前置摄像头和/或后置摄像头可以接收外部的多媒体数据。每个前置摄像头和后置摄像头可以是一个固定的光学透镜系统或具有焦距和光学变焦能力。
音频组件810被配置为输出和/或输入音频信号。例如,音频组件810包括一个麦克风(MIC),当电子设备800处于操作模式,如呼叫模式、记录模式和语音识别模式时,麦克风被配置为接收外部音频信号。所接收的音频信号可以被进一步存储在存储器804或经由通信组件816发送。在一些实施例中,音频组件810还包括一个扬声器,用于输出音频信号。
I/O接口812为处理组件802和外围接口模块之间提供接口,上述外围接口模块可以是键盘,点击轮,按钮等。这些按钮可包括但不限于:主页按钮、音量按钮、启动按钮和锁定按钮。
传感器组件814包括一个或多个传感器,用于为电子设备800提供各个方面的状态评估。例如,传感器组件814可以检测到电子设备800的打开/关闭状态,组件的相对定位,例如所述组件为电子设备800的显示器和小键盘,传感器组件814还可以检测电子设备800或电子设备800一个组件的位置改变,用户与电子设备800接触的存在或不存在,电子设备800方位或加速/减速和电子设备800的温度变化。传感器组件814可以包括接近传感器,被配置用来在没有任何的物理接触时检测附近物体的存在。传感器组件814还可以包括光传感器,如互补金属氧化物半导体(CMOS)或电荷耦合装置(CCD)图像传感器,用于在成像应用中使用。在一些实施例中,该传感器组件814还可以包括加速度传感器,陀螺仪传感器,磁传感器,压力传感器或温度传感器。
通信组件816被配置为便于电子设备800和其他设备之间有线或无线方式的通信。电子设备800可以接入基于通信标准的无线网络,如无线网络(WiFi),第二代移动通信技术(2G)或第三代移动通信技术(3G),或它们的组合。在一个示例性实施例中,通信组件816经由广播信道接收来自外部广播管理系统的广播信号或广播相关信息。在一个示例性实施例中,所述通信组件816还包括近场通信(NFC)模块,以促进短程通信。例如,在NFC模块可基于射频识别(RFID)技术,红外数据协会(IrDA)技术,超宽带(UWB)技术,蓝牙(BT)技术和其他技术来实现。
在示例性实施例中,电子设备800可以被一个或多个应用专用集成电路(ASIC)、数字信号处理器(DSP)、数字信号处理设备(DSPD)、可编程逻辑器件(PLD)、现场可编程门阵列(FPGA)、控制器、微控制器、微处理器或其他电子元件实现,用于执行上 述方法。
在示例性实施例中,还提供了一种非易失性计算机可读存储介质,例如包括计算机程序指令的存储器804,上述计算机程序指令可由电子设备800的处理器820执行以完成上述方法。
图8示出根据本公开实施例的一种电子设备的框图。如图8所示,电子设备1900可以被提供为一服务器。参照图8,电子设备1900包括处理组件1922,其进一步包括一个或多个处理器,以及由存储器1932所代表的存储器资源,用于存储可由处理组件1922的执行的指令,例如应用程序。存储器1932中存储的应用程序可以包括一个或一个以上的每一个对应于一组指令的模块。此外,处理组件1922被配置为执行指令,以执行上述方法。
电子设备1900还可以包括一个电源组件1926被配置为执行电子设备1900的电源管理,一个有线或无线网络接口1950被配置为将电子设备1900连接到网络,和一个输入输出(I/O)接口1958。电子设备1900可以操作基于存储在存储器1932的操作系统,例如微软服务器操作系统(Windows Server TM),苹果公司推出的基于图形用户界面操作系统(Mac OS X TM),多用户多进程的计算机操作系统(Unix TM),自由和开放原代码的类Unix操作系统(Linux TM),开放原代码的类Unix操作系统(FreeBSD TM)或类似。
在示例性实施例中,还提供了一种非易失性计算机可读存储介质,例如包括计算机程序指令的存储器1932,上述计算机程序指令可由电子设备1900的处理组件1922执行以完成上述方法。
本公开可以是系统、方法和/或计算机程序产品。计算机程序产品可以包括计算机可读存储介质,其上载有用于使处理器实现本公开的各个方面的计算机可读程序指令。
计算机可读存储介质可以是可以保持和存储由指令执行设备使用的指令的有形设备。计算机可读存储介质可以是易失性存储介质,也可以是非易失性存储介质。计算机可读存储介质例如可以是(但不限于)电存储设备、磁存储设备、光存储设备、电磁存储设备、半导体存储设备或者上述的任意合适的组合。计算机可读存储介质的更具体的例子(非穷举的列表)包括:便携式计算机盘、硬盘、随机存取存储器(RAM)、只读存储器(ROM)、可擦式可编程只读存储器(EPROM或闪存)、静态随机存取存储器(SRAM)、便携式压缩盘只读存储器(CD-ROM)、数字多功能盘(DVD)、记忆棒、软盘、机械编码设备、例如其上存储有指令的打孔卡或凹槽内凸起结构、以及上述的任意合适的组合。这里所使用的计算机可读存储介质不被解释为瞬时信号本身,诸如无线电波或者其他自由传播的电磁波、通过波导或其他传输媒介传播的电磁波(例如,通过光纤电缆的光脉冲)、或者通过电线传输的电信号。
这里所描述的计算机可读程序指令可以从计算机可读存储介质下载到各个计算/处理设备,或者通过网络、例如因特网、局域网、广域网和/或无线网下载到外部计算机或外部存储设备。网络可以包括铜传输电缆、光纤传输、无线传输、路由器、防火墙、交换机、网关计算机和/或边缘服务器。每个计算/处理设备中的网络适配卡或者网络接口从网络接收计算机可读程序指令,并转发该计算机可读程序指令,以供存储在各个计算/处 理设备中的计算机可读存储介质中。
用于执行本公开操作的计算机程序指令可以是汇编指令、指令集架构(ISA)指令、机器指令、机器相关指令、微代码、固件指令、状态设置数据、或者以一种或多种编程语言的任意组合编写的源代码或目标代码,所述编程语言包括面向对象的编程语言—诸如Smalltalk、C++等,以及常规的过程式编程语言—诸如“C”语言或类似的编程语言。计算机可读程序指令可以完全地在用户计算机上执行、部分地在用户计算机上执行、作为一个独立的软件包执行、部分在用户计算机上部分在远程计算机上执行、或者完全在远程计算机或服务器上执行。在涉及远程计算机的情形中,远程计算机可以通过任意种类的网络—包括局域网(LAN)或广域网(WAN)—连接到用户计算机,或者,可以连接到外部计算机(例如利用因特网服务提供商来通过因特网连接)。在一些实施例中,通过利用计算机可读程序指令的状态信息来个性化定制电子电路,例如可编程逻辑电路、现场可编程门阵列(FPGA)或可编程逻辑阵列(PLA),该电子电路可以执行计算机可读程序指令,从而实现本公开的各个方面。
这里参照根据本公开实施例的方法、装置(系统)和计算机程序产品的流程图和/或框图描述了本公开的各个方面。应当理解,流程图和/或框图的每个方框以及流程图和/或框图中各方框的组合,都可以由计算机可读程序指令实现。
这些计算机可读程序指令可以提供给通用计算机、专用计算机或其它可编程数据处理装置的处理器,从而生产出一种机器,使得这些指令在通过计算机或其它可编程数据处理装置的处理器执行时,产生了实现流程图和/或框图中的一个或多个方框中规定的功能/动作的装置。也可以把这些计算机可读程序指令存储在计算机可读存储介质中,这些指令使得计算机、可编程数据处理装置和/或其他设备以特定方式工作,从而,存储有指令的计算机可读介质则包括一个制造品,其包括实现流程图和/或框图中的一个或多个方框中规定的功能/动作的各个方面的指令。
也可以把计算机可读程序指令加载到计算机、其它可编程数据处理装置、或其它设备上,使得在计算机、其它可编程数据处理装置或其它设备上执行一系列操作步骤,以产生计算机实现的过程,从而使得在计算机、其它可编程数据处理装置、或其它设备上执行的指令实现流程图和/或框图中的一个或多个方框中规定的功能/动作。
附图中的流程图和框图显示了根据本公开的多个实施例的系统、方法和计算机程序产品的可能实现的体系架构、功能和操作。在这点上,流程图或框图中的每个方框可以代表一个模块、程序段或指令的一部分,所述模块、程序段或指令的一部分包含一个或多个用于实现规定的逻辑功能的可执行指令。在有些作为替换的实现中,方框中所标注的功能也可以以不同于附图中所标注的顺序发生。例如,两个连续的方框实际上可以基本并行地执行,它们有时也可以按相反的顺序执行,这依所涉及的功能而定。也要注意的是,框图和/或流程图中的每个方框、以及框图和/或流程图中的方框的组合,可以用执行规定的功能或动作的专用的基于硬件的系统来实现,或者可以用专用硬件与计算机指令的组合来实现。
该计算机程序产品可以具体通过硬件、软件或其结合的方式实现。在一个可选实施例中,所述计算机程序产品具体体现为计算机存储介质,在另一个可选实施例中,计算机程序产品具体体现为软件产品,例如软件开发包(Software Development Kit,SDK)等等。
以上已经描述了本公开的各实施例,上述说明是示例性的,并非穷尽性的,并且也不限于所披露的各实施例。在不偏离所说明的各实施例的范围和精神的情况下,对于本技术领域的普通技术人员来说许多修改和变更都是显而易见的。本文中所用术语的选择,旨在最好地解释各实施例的原理、实际应用或对市场中的技术的改进,或者使本技术领域的其它普通技术人员能理解本文披露的各实施例。

Claims (13)

  1. 一种图像分割方法,包括:
    确定待分割图像中目标对象的人脸位置信息,所述目标对象是所述待分割图像中包括的多个对象中的至少一个;
    根据所述目标对象的人脸位置信息,对所述待分割图像进行分割,得到所述目标对象对应的分割结果。
  2. 根据权利要求1所述的方法,其中,所述确定待分割图像中目标对象的人脸位置信息,包括:
    对所述待分割图像进行人脸检测,得到多个人脸框;
    响应于被选中的人脸框,将所述被选中的人脸框确定为所述目标对象对应的目标人脸框,所述目标人脸框用于指示所述待分割图像中所述目标对象的人脸位置信息。
  3. 根据权利要求1所述的方法,其中,所述确定待分割图像中目标对象的人脸位置信息,包括:
    接收用户对所述目标对象的人脸区域的标注信息;
    根据所述标注信息,确定所述目标对象对应的目标人脸框,所述目标人脸框用于指示所述待分割图像中所述目标对象的人脸位置信息。
  4. 根据权利要求2或3所述的方法,其中,所述根据所述目标对象的人脸位置信息,对所述待分割图像进行分割,得到所述目标对象对应的分割结果,包括:
    根据所述目标人脸框,生成所述目标人脸框对应的第一掩膜图像,所述第一掩膜图像中包括第一区域和第二区域,所述第一区域在所述第一掩膜图像中的位置与所述目标人脸框在所述待分割图像中的位置相同,所述第二区域为所述第一掩膜图像中所述第一区域以外的区域;
    基于所述第一掩膜图像,对所述待分割图像进行分割,得到所述目标对象对应的分割结果。
  5. 根据权利要求4所述的方法,其中,所述基于所述第一掩膜图像,对所述待分割图像进行分割,得到所述目标对象对应的分割结果,包括:
    将所述第一掩膜图像和所述待分割图像进行融合,得到融合后图像;
    基于所述融合后图像,利用训练好的深度神经网络对所述待分割图像进行分割,得到所述目标对象对应的分割结果。
  6. 根据权利要求5所述的方法,其中,所述将所述第一掩膜图像和所述待分割图像进行融合,得到融合后图像,包括:
    对所述待分割图像中像素点的像素值进行归一化处理,得到归一化待分割图像;
    将所述第一掩膜图像和所述归一化待分割图像进行融合,得到所述融合后图像。
  7. 根据权利要求5或6所述的方法,其中,所述基于所述融合后图像,利用训练好的深度神经网络对所述待分割图像进行分割,得到所述目标对象对应的分割结果,包括:
    基于所述融合后图像,利用所述训练好的深度神经网络,预测所述待分割图像中像素点为目标像素点的概率,所述目标像素点为所述待分割图像中所述目标对象所在区域 的像素点;
    根据所述待分割图像中像素点为目标像素点的概率以及预设概率阈值,确定所述目标对象对应的分割结果。
  8. 根据权利要求5至7中任意一项所述的方法,其中,在基于所述融合后图像,利用所述训练好的深度神经网络对所述待分割图像进行分割之前,所述方法还包括:
    将样本图像和第二掩膜图像进行融合后输入初始深度神经网络,所述第二掩膜图像是根据所述样本图像中待分割对象的人脸位置信息确定得到的,所述第二掩膜图像中包括第三区域和第四区域,所述第三区域在所述第二掩膜图像中的位置与所述待分割对象对应的人脸框在所述样本图像中的位置相同,所述第四区域为所述第二掩膜图像中所述第三区域以外的区域,所述待分割对象对应的人脸框用于指示所述样本图像中所述待分割对象的人脸位置信息;
    基于所述样本图像和所述第二掩膜图像进行融合后的图像,利用所述初始神经网络对所述样本图像进行分割,得到所述待分割对象对应的分割结果;
    根据所述待分割对象对应的预设标注分割信息,以及所述待分割对象对应的分割结果,确定所述初始深度神经网络对应的分割损失;
    根据所述分割损失,训练所述初始深度神经网络,以得到所述训练后的深度神经网络。
  9. 根据权利要求1至8中任意一项所述的方法,其中,所述目标对象对应的分割结果为所述目标对象对应的第三掩膜图像,所述第三掩膜图像中包括第五区域和第六区域,所述第五区域在所述第三掩膜图像中的位置与所述目标对象在所述待分割图像中的位置相同,所述第六区域为所述第三掩膜图像中所述第五区域以外的区域;
    所述方法还包括:
    根据所述目标对象对应的分割结果,对所述待分割图像进行图像处理操作,所述图像处理操作包括以下中的任意一个:根据所述第六区域对所述待分割图像中所述目标对象以外的背景区域进行虚化处理、根据所述第六区域对所述待分割图像中所述目标对象以外的背景区域进行替换处理、根据所述第五区域对所述待分割图像中所述目标对象所在的人像区域进行虚化处理、根据所述第五区域对所述待分割图像中所述目标对象所在的人像区域进行深度填充。
  10. 一种图像分割装置,包括:
    确定模块,用于确定待分割图像中目标对象的人脸位置信息,所述目标对象是所述待分割图像中包括的多个对象中的至少一个;
    分割模块,用于根据所述目标对象的人脸位置信息,对所述待分割图像进行分割,得到所述目标对象对应的分割结果。
  11. 一种电子设备,包括:
    处理器;
    用于存储处理器可执行指令的存储器;
    其中,所述处理器被配置为调用所述存储器存储的指令,以执行权利要求1至9中任意一项所述的方法。
  12. 一种计算机可读存储介质,其上存储有计算机程序指令,所述计算机程序指令被处理器执行时实现权利要求1至9中任意一项所述的方法。
  13. 一种计算机程序,包括计算机可读代码,当所述计算机代码在电子设备中运行时,所述电子设备中的处理器执行用于实现权利要求1至9中任意一项所述的方法。
PCT/CN2021/086251 2020-12-22 2021-04-09 图像分割方法及装置、电子设备和存储介质、计算机程序 WO2022134382A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202011531478.9A CN112465843A (zh) 2020-12-22 2020-12-22 图像分割方法及装置、电子设备和存储介质
CN202011531478.9 2020-12-22

Publications (1)

Publication Number Publication Date
WO2022134382A1 true WO2022134382A1 (zh) 2022-06-30

Family

ID=74803167

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/086251 WO2022134382A1 (zh) 2020-12-22 2021-04-09 图像分割方法及装置、电子设备和存储介质、计算机程序

Country Status (2)

Country Link
CN (1) CN112465843A (zh)
WO (1) WO2022134382A1 (zh)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116109828A (zh) * 2023-03-23 2023-05-12 荣耀终端有限公司 图像处理方法和电子设备
CN116452600A (zh) * 2023-06-15 2023-07-18 上海蜜度信息技术有限公司 实例分割方法、系统、模型训练方法、介质及电子设备
CN116612269A (zh) * 2023-07-17 2023-08-18 深圳思谋信息科技有限公司 交互式分割标注方法、装置、计算机设备及存储介质
CN117237397A (zh) * 2023-07-13 2023-12-15 天翼爱音乐文化科技有限公司 基于特征融合的人像分割方法、系统、设备及存储介质

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112465843A (zh) * 2020-12-22 2021-03-09 深圳市慧鲤科技有限公司 图像分割方法及装置、电子设备和存储介质
CN112819841B (zh) * 2021-03-19 2021-09-28 广东众聚人工智能科技有限公司 人脸区域分割方法、装置、计算机设备及存储介质
CN113192139A (zh) * 2021-05-14 2021-07-30 浙江商汤科技开发有限公司 定位方法及装置、电子设备和存储介质
CN113240696B (zh) * 2021-05-20 2022-02-08 推想医疗科技股份有限公司 图像处理方法及装置,模型的训练方法及装置,电子设备
CN113486962A (zh) * 2021-07-12 2021-10-08 深圳市慧鲤科技有限公司 图像生成方法及装置、电子设备和存储介质
CN114092364B (zh) * 2021-08-12 2023-10-03 荣耀终端有限公司 图像处理方法及其相关设备

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109117760A (zh) * 2018-07-27 2019-01-01 北京旷视科技有限公司 图像处理方法、装置、电子设备和计算机可读介质
CN109948494A (zh) * 2019-03-11 2019-06-28 深圳市商汤科技有限公司 图像处理方法及装置、电子设备和存储介质
US10593043B2 (en) * 2016-03-31 2020-03-17 Adobe Inc. Utilizing deep learning for boundary-aware image segmentation
CN111696176A (zh) * 2020-06-08 2020-09-22 北京有竹居网络技术有限公司 图像处理方法、装置、电子设备及计算机可读介质
CN111754528A (zh) * 2020-06-24 2020-10-09 Oppo广东移动通信有限公司 人像分割方法、装置、电子设备和计算机可读存储介质
CN112465843A (zh) * 2020-12-22 2021-03-09 深圳市慧鲤科技有限公司 图像分割方法及装置、电子设备和存储介质

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109741338A (zh) * 2018-12-13 2019-05-10 北京爱奇艺科技有限公司 一种人脸分割方法、装置及设备
CN110660066B (zh) * 2019-09-29 2023-08-04 Oppo广东移动通信有限公司 网络的训练方法、图像处理方法、网络、终端设备及介质
CN111178211B (zh) * 2019-12-20 2024-01-12 天津极豪科技有限公司 图像分割方法、装置、电子设备及可读存储介质
CN111292337B (zh) * 2020-01-21 2024-03-01 广州虎牙科技有限公司 图像背景替换方法、装置、设备及存储介质

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10593043B2 (en) * 2016-03-31 2020-03-17 Adobe Inc. Utilizing deep learning for boundary-aware image segmentation
CN109117760A (zh) * 2018-07-27 2019-01-01 北京旷视科技有限公司 图像处理方法、装置、电子设备和计算机可读介质
CN109948494A (zh) * 2019-03-11 2019-06-28 深圳市商汤科技有限公司 图像处理方法及装置、电子设备和存储介质
CN111696176A (zh) * 2020-06-08 2020-09-22 北京有竹居网络技术有限公司 图像处理方法、装置、电子设备及计算机可读介质
CN111754528A (zh) * 2020-06-24 2020-10-09 Oppo广东移动通信有限公司 人像分割方法、装置、电子设备和计算机可读存储介质
CN112465843A (zh) * 2020-12-22 2021-03-09 深圳市慧鲤科技有限公司 图像分割方法及装置、电子设备和存储介质

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116109828A (zh) * 2023-03-23 2023-05-12 荣耀终端有限公司 图像处理方法和电子设备
CN116109828B (zh) * 2023-03-23 2023-08-18 荣耀终端有限公司 图像处理方法和电子设备
CN116452600A (zh) * 2023-06-15 2023-07-18 上海蜜度信息技术有限公司 实例分割方法、系统、模型训练方法、介质及电子设备
CN116452600B (zh) * 2023-06-15 2023-10-03 上海蜜度信息技术有限公司 实例分割方法、系统、模型训练方法、介质及电子设备
CN117237397A (zh) * 2023-07-13 2023-12-15 天翼爱音乐文化科技有限公司 基于特征融合的人像分割方法、系统、设备及存储介质
CN116612269A (zh) * 2023-07-17 2023-08-18 深圳思谋信息科技有限公司 交互式分割标注方法、装置、计算机设备及存储介质
CN116612269B (zh) * 2023-07-17 2023-11-03 深圳思谋信息科技有限公司 交互式分割标注方法、装置、计算机设备及存储介质

Also Published As

Publication number Publication date
CN112465843A (zh) 2021-03-09

Similar Documents

Publication Publication Date Title
WO2022134382A1 (zh) 图像分割方法及装置、电子设备和存储介质、计算机程序
US9674395B2 (en) Methods and apparatuses for generating photograph
US10452890B2 (en) Fingerprint template input method, device and medium
CN109257645B (zh) 视频封面生成方法及装置
CN107692997B (zh) 心率检测方法及装置
CN109801270B (zh) 锚点确定方法及装置、电子设备和存储介质
CN111553864B (zh) 图像修复方法及装置、电子设备和存储介质
US20210097715A1 (en) Image generation method and device, electronic device and storage medium
WO2016192325A1 (zh) 视频文件的标识处理方法及装置
US20200007944A1 (en) Method and apparatus for displaying interactive attributes during multimedia playback
EP3147802B1 (en) Method and apparatus for processing information
CN110990801B (zh) 信息校验方法及装置、电子设备和存储介质
US11574415B2 (en) Method and apparatus for determining an icon position
US20220188982A1 (en) Image reconstruction method and device, electronic device, and storage medium
CN111680646B (zh) 动作检测方法及装置、电子设备和存储介质
CN112184787A (zh) 图像配准方法及装置、电子设备和存储介质
WO2022134390A1 (zh) 标注方法及装置、电子设备和存储介质
WO2022021932A1 (zh) 降噪方法及装置、电子设备、存储介质和计算机程序产品
WO2022141969A1 (zh) 图像分割方法及装置、电子设备、存储介质和程序
CN109756783B (zh) 海报的生成方法及装置
WO2023045185A1 (zh) 对象检测方法及装置、电子设备和存储介质
CN110969569A (zh) 试镜视频的生成方法及装置
CN110858921A (zh) 节目视频的处理方法及装置
CN111275191B (zh) 检测细胞的方法及装置、电子设备和存储介质
CN110896492B (zh) 图像处理方法、装置及存储介质

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: 21908394

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 02.11.2023)