[go: up one dir, main page]

CN115713779A - Portrait segmentation method, apparatus, device and medium - Google Patents

Portrait segmentation method, apparatus, device and medium Download PDF

Info

Publication number
CN115713779A
CN115713779A CN202110955311.3A CN202110955311A CN115713779A CN 115713779 A CN115713779 A CN 115713779A CN 202110955311 A CN202110955311 A CN 202110955311A CN 115713779 A CN115713779 A CN 115713779A
Authority
CN
China
Prior art keywords
image
pixel point
target
portrait
determining
Prior art date
Legal status (The legal status 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 status listed.)
Pending
Application number
CN202110955311.3A
Other languages
Chinese (zh)
Inventor
陈维强
高雪松
孙萁浩
张振铎
顾庆涛
翟世平
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hisense Group Holding Co Ltd
Original Assignee
Hisense Group Holding Co Ltd
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 Hisense Group Holding Co Ltd filed Critical Hisense Group Holding Co Ltd
Priority to CN202110955311.3A priority Critical patent/CN115713779A/en
Publication of CN115713779A publication Critical patent/CN115713779A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Image Analysis (AREA)
  • Image Processing (AREA)

Abstract

The embodiment of the application provides a portrait segmentation method, a portrait segmentation device, portrait segmentation equipment and a portrait segmentation medium, wherein the first image marked with a target portrait is downsampled for a preset number of times, an edge pixel point corresponding to the target portrait in an obtained second image is processed, whether the target pixel point in the first image corresponding to the edge pixel point belongs to the pixel point of the target portrait is determined, the attribution of the pixel point at the edge of the target portrait is further divided, the pixel point corresponding to the target portrait is more accurately determined in the first image, and the accuracy of portrait segmentation is improved.

Description

Portrait segmentation method, apparatus, device and medium
Technical Field
The present application relates to the field of security technologies, and in particular, to a method, an apparatus, a device, and a medium for portrait segmentation.
Background
With the development of technology, people have higher and higher technical requirements on image processing. There are more and more means for segmenting a portrait from an image and applying the segmented portrait to scenes such as entertainment, portrait beautification, portrait background replacement, and the like. When segmenting a portrait from an image, the adopted technology mainly comprises the following steps: a portrait semantic segmentation technique and a portrait instance generation technique.
Specifically, a portrait semantic segmentation technology is adopted to segment a portrait region and a background region from an image, and a portrait example generation technology is adopted to segment a portrait from the segmented portrait region, so that portrait example segmentation is performed on the image. However, in an actual application process, a portrait may appear in any size or any posture in an image, which causes that the attribution type of edge pixel points of the portrait divided by the prior art is easy to be wrong, so that the accuracy requirement of portrait division cannot be met.
Disclosure of Invention
The application provides a portrait segmentation method, a portrait segmentation device, portrait segmentation equipment and a portrait segmentation medium, which are used for solving the problems that in the prior art, due to the posture or size problem of the portrait in an image, the attribution type of edge pixel points of the portrait is easy to be wrong, and the portrait segmentation precision is low.
In a first aspect, the present application provides a method for portrait segmentation, the method including:
the method comprises the steps of carrying out downsampling on a first image marked with a target portrait for preset times to obtain a second image, and determining edge pixel points corresponding to the target portrait in the second image;
performing convolution processing on the second image to determine a first characteristic value corresponding to the edge pixel point, determining a target pixel point corresponding to the edge pixel point in the first image, performing convolution processing on the first image to determine a second characteristic value corresponding to the target pixel point, and determining a characteristic vector corresponding to the target pixel point according to the first characteristic value and the second characteristic value; inputting the feature vector into a multilayer perceptron, and acquiring a probability value output by the multilayer perceptron; and if the probability value exceeds a preset probability threshold value, determining the target pixel point as a pixel point belonging to the target portrait.
In a second aspect, the present application further provides a portrait segmentation apparatus, which includes:
the determining module is used for carrying out downsampling on a first image marked with a target portrait for a preset number of times to obtain a second image and determining edge pixel points corresponding to the target portrait in the second image;
the processing module is used for performing convolution processing on the second image to determine a first characteristic value corresponding to the edge pixel point, determining a target pixel point corresponding to the edge pixel point in the first image, performing convolution processing on the first image to determine a second characteristic value corresponding to the target pixel point, and determining a characteristic vector corresponding to the target pixel point according to the first characteristic value and the second characteristic value; inputting the feature vector into a multilayer perceptron, and acquiring a probability value output by the multilayer perceptron; and if the probability value exceeds a preset probability threshold value, determining the target pixel point as a pixel point belonging to the target portrait.
In a third aspect, the present application further provides an electronic device, which at least includes a processor and a memory, where the processor is configured to implement the steps of the portrait segmentation method when executing the computer program stored in the memory.
In a fourth aspect, the present application further provides a computer-readable storage medium storing a computer program, which when executed by a processor, implements the steps of any of the portrait segmentation methods described above.
In the application, a first image marked with a target portrait is downsampled for a preset number of times to obtain a second image, an edge pixel point corresponding to the target portrait in the second image is determined, convolution processing is carried out on the edge pixel point in the second image to obtain a first characteristic value, a target pixel point corresponding to the edge pixel point is determined in the first image, convolution processing is carried out on the target pixel point in the first image to obtain a second characteristic value, and a characteristic vector corresponding to the target pixel point is determined according to the first characteristic value and the second characteristic value; inputting the feature vector into a multilayer perceptron, and acquiring a probability value output by the multilayer perceptron; and if the probability value exceeds a preset probability threshold value, determining the target pixel point as a pixel point belonging to the target portrait. According to the method and the device, the first image marked with the target portrait is downsampled for the preset times, the edge pixel points corresponding to the target portrait in the second image are processed, whether the target pixel points in the first image corresponding to the edge pixel points belong to the pixel points of the target portrait or not is determined, the attribution of the pixel points at the edge of the target portrait is further divided, the pixel points corresponding to the target portrait are more accurately determined in the first image, and the accuracy of portrait segmentation is improved.
Drawings
In order to more clearly illustrate the technical solutions of the present application, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings without creative efforts.
FIG. 1 is a schematic representation of a human image segmentation process provided in some embodiments of the present application; .
FIG. 2 is a schematic diagram of an example of portrait segmentation provided herein;
FIG. 3 is a schematic flow chart of the portrait segmentation provided in the present application;
fig. 4 is a schematic structural diagram of a portrait splitting apparatus provided in the present application;
fig. 5 is a schematic structural diagram of an electronic device provided in the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application clearer, the present application will be described in further detail with reference to the accompanying drawings, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
In the application, a first image marked with a target portrait is downsampled for a preset number of times to obtain a second image, an edge pixel point corresponding to the target portrait in the second image is determined, convolution processing is carried out on the edge pixel point in the second image to obtain a first characteristic value, a target pixel point corresponding to the edge pixel point is determined in the first image, convolution processing is carried out on the target pixel point in the first image to obtain a second characteristic value, and a characteristic vector of the edge pixel point is determined according to the first characteristic value and the second characteristic value; inputting the feature vector into a multilayer perceptron, and acquiring a probability value output by the multilayer perceptron; and if the probability value exceeds a preset probability threshold value, determining the target pixel point as a pixel point belonging to the target portrait.
In order to improve the accuracy of portrait segmentation without being affected by the posture or size of a portrait in an image when the portrait segmentation is performed, embodiments of the present application provide a portrait segmentation method, apparatus, device and medium.
Fig. 1 is a schematic diagram of a human image segmentation process provided in some embodiments of the present application, where the process includes:
s101: the method comprises the steps of conducting downsampling on a first image marked with a target portrait for preset times to obtain a second image, and determining edge pixel points corresponding to the target portrait in the second image.
The portrait segmentation method is applied to electronic equipment which can be a computer, terminal equipment and the like.
In this application, the electronic device receives a first image identified with a target portrait, where the first image may be any one of the captured images, or may be any one of the video frames, and is not limited in this application. The process of identifying the target portrait in the first image is the prior art, and specifically, the first image is input into a preset semantic segmentation model, the first image is processed through the semantic segmentation model, the target portrait and a background area are segmented in the first image, the first image identified with the target portrait and the background area is output, then the first image identified with the target portrait and the background area is input into an example generation model, and the example generation model processes the first image identified with the target portrait and the background area to obtain the first image identified with the target portrait.
Specifically, in the present application, a semantic segmentation model is constructed by using a Residual Neural Network (ResNet), such as ResNet50, and a Feature Pyramid Network (FPN) is also used in the semantic segmentation model, so that images at different scales are processed. The example generation model is constructed by adopting an SOLOV2 model and at least comprises a category branch and a mask branch, and the example generation model is used for segmenting a target portrait and a background area in an image to obtain a mask image of the target portrait and the background area, namely the first image marked with the target portrait.
In the application, after the first image with the target portrait marked is obtained, there may be pixel points that should belong to the target portrait in the first image, but the pixel points that should belong to the background region in the first image, or the pixel points that should belong to the background region are attributed to the target portrait in the first image, so in the application, the attribution type of the edge pixel points in the edge region of the target portrait in the first image is determined again, and the target portrait is determined more accurately in the first image.
Specifically, the distribution of the pixel points corresponding to the target portrait and the pixel points corresponding to the background in the first image is not uniform, and under the condition of the distribution of the pixel points, when the target portrait is identified in the first image by using the semantic segmentation model and the instance generation model, accurate prediction may not be made, so that the pixel points with wrong category attribution may appear in the first image. Therefore, in the application, the dimensionality of the features of each pixel point in the first image is reduced through downsampling, effective information is reserved, and overfitting is avoided to a certain extent. And the second image after down sampling can be compressed more easily, and the information of the original image can not be lost too much. In the present application, when the first image is downsampled by s times, the image in the s × s matrix of the first image is changed into the average value of the pixel values of all the pixels in the matrix. In the present application, the number of times the first image is downsampled is set in advance, and may be, for example, one or two times.
After the second image is obtained, determining edge pixel points corresponding to the target portrait based on the second image, wherein the edge pixel points can be all pixel points in a preset range of the edge of the target portrait, and can also be pixel points with high possibility of being attributed with errors according to the difference value of pixel values of the pixel points and pixel points contained in a set neighborhood of the pixel points from all the pixel points in the preset range of the edge of the target portrait.
S102: performing convolution processing on the second image to determine a first characteristic value corresponding to the edge pixel point, determining a target pixel point corresponding to the edge pixel point in the first image, performing convolution processing on the first image to determine a second characteristic value corresponding to the target pixel point, and determining a characteristic vector corresponding to the target pixel point according to the first characteristic value and the second characteristic value; inputting the feature vector into a multilayer perceptron, and acquiring a probability value output by the multilayer perceptron; and if the probability value exceeds a preset probability threshold value, determining the target pixel point as a pixel point belonging to the target portrait.
For each edge pixel point, in order to determine whether the edge pixel point is a pixel point with a category which is attributed incorrectly, in the present application, a target pixel point corresponding to each edge pixel point in the first image may be determined according to the coordinate of each edge pixel point in the second image and the number of times of down-sampling performed on the second image. And performing convolution processing on the second image, and determining a first characteristic value corresponding to the edge pixel point according to the value of the edge pixel point at the corresponding position in the second characteristic image according to the second characteristic image obtained after the convolution processing. And performing convolution processing on the first image, determining a value of a corresponding position of a target pixel point in the first characteristic graph as a second characteristic value corresponding to the target pixel point according to the first characteristic graph obtained after the convolution processing, and processing the first characteristic value and the second characteristic value to obtain a characteristic vector corresponding to the target pixel point. In the present application, the process of performing convolution processing on an image belongs to the prior art.
Inputting the characteristic vector into a pre-trained multilayer perceptron, outputting the probability value of the pixel point of a target pixel point corresponding to the characteristic vector belonging to the target portrait by the multilayer perceptron, and determining the pixel point of the target pixel point belonging to the target portrait if the probability value exceeds a preset probability threshold.
In the application, the training process of the multilayer perceptron is specifically that a pre-designed sample feature vector is input into the multilayer perceptron, the multilayer perceptron outputs a predicted probability value of pixel points of a target pixel point corresponding to the sample feature vector belonging to a portrait, a loss value of the multilayer perceptron is determined according to whether the target pixel point corresponding to the sample feature vector is a pixel point belonging to the target portrait, and if the sample amount of which the loss value is smaller than a threshold meets requirements or the number of times of iteration of the multilayer perceptron reaches a maximum value, the training of the multilayer perceptron is considered to be completed.
According to the method and the device, the first image marked with the target portrait is downsampled for the preset times, the edge pixel points corresponding to the target portrait in the second image are processed, whether the target pixel points in the first image corresponding to the edge pixel points belong to the pixel points of the target portrait or not is determined, the attribution of the pixel points at the edge of the target portrait is further divided, the pixel points corresponding to the target portrait are more accurately determined in the first image, and the accuracy of portrait segmentation is improved.
In order to avoid re-identifying the attribution type of all the pixel points at the edge of the target portrait and improve the speed of portrait segmentation, on the basis of the above embodiment, in the present application, the determining the edge pixel point corresponding to the target portrait in the second image includes:
and aiming at each pixel point in the target portrait marginal area, if the difference value of the pixel point and the pixel value mean value of the pixel points contained in the set neighborhood exceeds a preset threshold value, determining the pixel point as the marginal pixel point.
When the target portrait is identified in the first image, the attribution type of the edge pixel point of the target portrait may be wrongly attributed, which causes mistakes during portrait segmentation, and reduces the accuracy of portrait segmentation. Therefore, in the present application, before the portrait is segmented according to the identified target portrait, the attribution type of the pixel points in the edge area of the target portrait in the second image is identified again, because the pixel points with the wrong attribution type are only a small part of the pixel points in the edge area of the target portrait, if all the pixel points in the edge area of the target portrait are identified, the load pressure of the server is increased, and meanwhile, the speed of portrait segmentation is reduced. Therefore, in the application, the attribution type is re-identified only for the edge pixel points with higher probability of attribution error of the attribution type in the edge region of the target portrait.
In the present application, the pixel value of the edge pixel point with higher probability of belonging category being attributed to the error in the second image is obviously different from the pixel value of the pixel point in the set field, so in the present application, the edge pixel point to be reclassified can be selected according to the pixel value of the pixel point, that is, the edge pixel point with higher probability of belonging category being attributed to the error.
Specifically, in the present application, for each pixel point in the edge region of the target portrait, if the difference between the pixel point and the average of the pixel values of the pixel points included in the set neighborhood of the pixel point exceeds a preset threshold, the pixel point is determined as an edge pixel point. The edge pixel point in the second image may be a pixel point belonging to the target portrait, or a pixel point belonging to the background area.
In addition, for each pixel point in the target portrait border area, a coefficient and a bias can be added to the pixel point according to the difference value of the pixel value mean value of the pixel point and the pixel points contained in the set neighborhood. Specifically, the corresponding relationship between the coefficient and the difference and the corresponding relationship between the offset and the difference are preset, and after the difference between the pixel and the mean value of the pixel values of the pixels included in the set neighborhood is calculated for any pixel, the coefficient and the offset corresponding to the pixel are determined according to the preset corresponding relationship between the coefficient and the difference and the corresponding relationship between the offset and the difference. And then, according to the coefficient and the offset corresponding to each pixel point, selecting the pixel points with the coefficients and the offsets exceeding a preset threshold value as edge pixel points.
In order to determine the feature vector of the edge pixel, and implement determining the category of the edge pixel based on the feature vector, on the basis of the foregoing embodiments, in this application, the determining the feature vector of the target pixel according to the first feature value and the second feature value includes:
performing convolution processing on the first characteristic value to obtain a first characteristic vector, and performing convolution processing on the second characteristic value to obtain a second characteristic vector; and combining the first feature vector and the second feature vector according to a set sequence to obtain the feature vector of the target pixel point.
In order to determine whether a target pixel point in the first image belongs to a target portrait based on the second image, in the present application, information of the target pixel point in the first image and information of an edge pixel point corresponding to the target pixel point in the second image are combined, and based on the combined information, a determination is made as to a category to which the target pixel point belongs, where the information of the target pixel point in the first image is represented by a second feature vector corresponding to a second feature value, and the information of the edge pixel point in the second image is represented by a first feature vector corresponding to the first feature value.
Specifically, the first feature value is subjected to convolution processing to obtain a first feature vector, the second feature value is subjected to convolution processing to obtain a second feature vector, and the first feature vector and the second feature vector are combined together to obtain the feature vector of the edge pixel point. Wherein, when the first feature vector and the second feature vector are combined together, the second feature vector is placed at the front side, and the first feature vector is placed at the back side.
In order to obtain the second image and determine the attribution type of the edge pixel point based on the second image, on the basis of the foregoing embodiments, in the present application, the downsampling the first image with the target portrait identified by the preset number of times to obtain the second image includes:
and performing down-sampling on the first image for a first set number of times to obtain a third image, and performing up-sampling on the third image for a second set number of times to obtain a second image.
Under the condition of the distribution of the pixel points corresponding to the target portrait and the pixel points corresponding to the background area in the first image, when the target portrait is determined by using a model, accurate prediction can not be made, so that the pixel points with wrong category attribution can possibly appear in the first image. Therefore, in the application, the dimensionality of the features of each pixel point in the first image is reduced through downsampling, effective information is reserved, and overfitting is avoided to a certain extent. And the second image after down sampling can be compressed more easily, and the information of the original image can not be lost too much.
In addition, in order to realize the fusion of the features in the multi-scale image corresponding to the first image and improve the accuracy of edge pixel point classification, in the present application, an upsampling operation is also performed in the process of performing a downsampling operation on the first image. Specifically, in the present application, a first image is downsampled for a first set number of times to obtain a third image, and the third image is upsampled for a second set number of times to obtain a second image.
Fig. 2 is a schematic diagram of an example of portrait segmentation provided in the present application, where a target portrait is identified in a map a, an area 1 in the map a is an area where the target portrait is located, an area 2 is an edge area of the target portrait, and an area 3 is a background area; and then downsampling the graph a for a preset number of times to obtain a graph b, selecting 23 edge pixel points in the graph c, judging the category of each edge pixel point, and updating the pixel value of each edge pixel point according to the judgment result to obtain the graph c.
In order to better identify the category of the edge pixel point of the target portrait, on the basis of the above embodiments, in the present application, the first set number of times is two, and the second set number of times is one or two.
In this application, when a first image is downsampled for a first preset number of times, the first preset number of times is two times, a third image is obtained, and when the third image is upsampled for a second preset number of times, the second preset number of times may be one time or two times. In other words, in the application, the first image is down-sampled twice and up-sampled once again to obtain the second image, and the categories of the edge pixel points of the target portrait are classified based on the second image. Then, the second image is subjected to primary up-sampling to obtain a fourth image, and the categories of the edge pixel points of the target portrait are classified based on the fourth image.
In the application, because the sizes of the images obtained by the downsampling of different times are different, the corresponding target pixel points of the edge pixel points in the first image in the image obtained by the downsampling of the number of times are different every time.
In order to determine a target pixel point corresponding to an edge pixel point in a first image, on the basis of the foregoing embodiment, in this application, the determining, in the first image, a target pixel point corresponding to the edge pixel point includes:
and determining target pixel points corresponding to the edge pixel points in the first image through an ROI (region of interest) alignment region feature aggregation algorithm according to the coordinate information of the edge pixel points in the second image.
In the application, after the first image is downsampled for the preset times to obtain the second image and the edge pixel point corresponding to the target portrait is determined in the second image, the edge pixel point can have the corresponding target pixel point in the first image. In the application, the coordinate information of the edge pixel point can be determined in the second image, and then the target pixel point corresponding to the edge pixel point is determined in the first image through a Region of Interest (ROI Align) algorithm according to the coordinate information.
Specifically, coordinate information of an edge pixel point in a second image, the size of the second image and the size of a first image are determined, a first corresponding relation between the abscissa of the edge pixel point in the second image and the size of the second image is determined, a first corresponding relation between the ordinate of the edge pixel point in the second image and the size of the second image is determined, according to the first corresponding relation, the second corresponding relation and the size of the first image, coordinate information is determined in the first image, and a pixel point corresponding to the coordinate information is determined as a target pixel point corresponding to the edge pixel point.
Fig. 3 is a schematic flowchart of the portrait segmentation provided in the present application, and as shown in fig. 3, the process includes:
s301: and inputting the image to be processed into a semantic segmentation model.
S302: and inputting the received image output by the semantic segmentation model into an instance generation model, and acquiring a first image marked with a target portrait.
S303: and performing down-sampling on the first image twice to obtain a third image, and performing up-sampling on the third image once to obtain a second image.
S304: and determining edge pixel points corresponding to the target portrait in the second image.
S305: and performing convolution processing on the second image to determine and obtain a first characteristic value of the edge pixel point.
S306: and determining a target pixel point corresponding to the edge pixel point in the first image, performing convolution processing on the first image, and determining a second characteristic value of the target pixel point.
S307: and determining the characteristic vector of the target pixel point according to the first characteristic value and the second characteristic value.
S308: and inputting the feature vector into a multilayer perceptron, and acquiring a probability value output by the multilayer perceptron.
S309: and if the probability value exceeds a preset probability threshold value, determining the target pixel point as a pixel point belonging to the target portrait.
Fig. 4 is a schematic structural diagram of a portrait splitting apparatus provided in the present application, and as shown in fig. 4, the apparatus includes:
a determining module 401, configured to perform downsampling on a first image identified with a target portrait for a preset number of times to obtain a second image, and determine an edge pixel point corresponding to the target portrait in the second image;
a processing module 402, configured to perform convolution processing on the second image to determine a first feature value corresponding to the edge pixel point, determine a target pixel point corresponding to the edge pixel point in the first image, perform convolution processing on the first image to determine a second feature value corresponding to the target pixel point, and determine a feature vector corresponding to the target pixel point according to the first feature value and the second feature value; inputting the feature vector into a multilayer perceptron, and acquiring a probability value output by the multilayer perceptron; and if the probability value exceeds a preset probability threshold value, determining the target pixel point as a pixel point belonging to the target portrait.
In a possible implementation manner, the determining module 401 is specifically configured to, for each pixel point in the edge region of the target portrait, determine the pixel point as the edge pixel point if a difference between the pixel point and a mean value of pixel values of pixel points included in a set neighborhood of the pixel point exceeds a preset threshold.
In a possible implementation manner, the processing module 402 is specifically configured to perform convolution processing on the first feature value to obtain a first feature vector, and perform convolution processing on the second feature value to obtain a second feature vector; and combining the first characteristic vector and the second characteristic vector according to a set sequence to obtain the characteristic vector corresponding to the target pixel point.
In a possible implementation manner, the determining module 401 is specifically configured to perform downsampling on the first image for a first set number of times to obtain a third image, and perform upsampling on the third image for a second set number of times to obtain a second image.
In one possible embodiment, the first set number of times is two, and the second set number of times is one or two.
In a possible implementation manner, the processing module 402 is specifically configured to determine, according to coordinate information of the edge pixel point in the second image, a target pixel point corresponding to the edge pixel point in the first image through a region-of-interest calibration ROI Align algorithm.
Fig. 5 is a schematic structural diagram of an electronic device provided in the present application, and on the basis of the foregoing embodiments, the present application further provides an electronic device, as shown in fig. 5, including: the system comprises a processor 501, a communication interface 502, a memory 503 and a communication bus 504, wherein the processor 501, the communication interface 502 and the memory 503 are communicated with each other through the communication bus 504;
the memory 503 has stored therein a computer program which, when executed by the processor 501, causes the processor 501 to perform the steps of:
the method comprises the steps of carrying out downsampling on a first image marked with a target portrait for preset times to obtain a second image, and determining edge pixel points corresponding to the target portrait in the second image;
performing convolution processing on the second image to determine a first characteristic value corresponding to the edge pixel point, determining a target pixel point corresponding to the edge pixel point in the first image, performing convolution processing on the first image to determine a second characteristic value corresponding to the target pixel point, and determining a characteristic vector corresponding to the target pixel point according to the first characteristic value and the second characteristic value; inputting the feature vector into a multilayer perceptron, and acquiring a probability value output by the multilayer perceptron; and if the probability value exceeds a preset probability threshold value, determining the target pixel point as a pixel point belonging to the target portrait.
In a possible implementation manner, the determining edge pixel points corresponding to the target portrait in the second image includes:
and aiming at each pixel point in the target portrait marginal area, if the difference value of the pixel point and the pixel value mean value of the pixel points contained in the set neighborhood exceeds a preset threshold value, determining the pixel point as the marginal pixel point.
In a possible implementation manner, the determining, according to the first feature value and the second feature value, the feature vector corresponding to the target pixel point includes:
performing convolution processing on the first characteristic value to obtain a first characteristic vector, and performing convolution processing on the second characteristic value to obtain a second characteristic vector; and combining the first characteristic vector and the second characteristic vector according to a set sequence to obtain the characteristic vector corresponding to the target pixel point.
In one possible embodiment, the down-sampling the first image identified with the target portrait a preset number of times to obtain the second image comprises:
and performing down-sampling on the first image for a first set number of times to obtain a third image, and performing up-sampling on the third image for a second set number of times to obtain a second image.
In one possible embodiment, the first set number of times is two, and the second set number of times is one or two.
In a possible embodiment, the determining, in the first image, a target pixel point corresponding to the edge pixel point includes:
and according to the coordinate information of the edge pixel points in the second image, determining target pixel points corresponding to the edge pixel points in the first image through a region-of-interest (ROI) alignment algorithm.
Since the principle of the electronic device for solving the problem is similar to the portrait segmentation method, the electronic device may be implemented in the above embodiments, and repeated details are not repeated.
The communication bus mentioned in the electronic device may be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The communication bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is shown, but this does not mean that there is only one bus or one type of bus. The communication interface 502 is used for communication between the above-described electronic apparatus and other apparatuses. The Memory may include a Random Access Memory (RAM) or a Non-Volatile Memory (NVM), such as at least one disk Memory. Alternatively, the memory may be at least one memory device located remotely from the aforementioned processor. The Processor may be a general-purpose Processor, including a central processing unit, a Network Processor (NP), and the like; but may also be a Digital instruction processor (DSP), an application specific integrated circuit, a field programmable gate array or other programmable logic device, discrete gate or transistor logic, discrete hardware components, or the like.
On the basis of the foregoing embodiments, the present application further provides a computer-readable storage medium, in which a computer program executable by a processor is stored, and when the program is run on the processor, the processor is caused to execute the following steps:
the method comprises the steps of carrying out downsampling on a first image marked with a target portrait for preset times to obtain a second image, and determining edge pixel points corresponding to the target portrait in the second image;
performing convolution processing on the second image to determine a first characteristic value corresponding to the edge pixel point, determining a target pixel point corresponding to the edge pixel point in the first image, performing convolution processing on the first image to determine a second characteristic value corresponding to the target pixel point, and determining a characteristic vector corresponding to the target pixel point according to the first characteristic value and the second characteristic value; inputting the feature vector into a multilayer perceptron, and acquiring a probability value output by the multilayer perceptron; and if the probability value exceeds a preset probability threshold value, determining the target pixel point as a pixel point belonging to the target portrait.
In a possible implementation manner, the determining an edge pixel point corresponding to the target portrait in the second image includes:
and aiming at each pixel point in the target portrait marginal area, if the difference value of the pixel point and the pixel value mean value of the pixel points contained in the set neighborhood exceeds a preset threshold value, determining the pixel point as the marginal pixel point.
In a possible implementation manner, the determining, according to the first feature value and the second feature value, the feature vector corresponding to the target pixel point includes:
performing convolution processing on the first characteristic value to obtain a first characteristic vector, and performing convolution processing on the second characteristic value to obtain a second characteristic vector; and combining the first characteristic vector and the second characteristic vector according to a set sequence to obtain the characteristic vector corresponding to the target pixel point.
In one possible embodiment, the down-sampling the first image identified with the target portrait a preset number of times to obtain the second image comprises:
and performing down-sampling on the first image for a first set number of times to obtain a third image, and performing up-sampling on the third image for a second set number of times to obtain a second image.
In one possible embodiment, the first set number of times is two, and the second set number of times is one or two.
In a possible embodiment, the determining, in the first image, a target pixel point corresponding to the edge pixel point includes:
and according to the coordinate information of the edge pixel points in the second image, determining target pixel points corresponding to the edge pixel points in the first image through a region-of-interest (ROI) alignment algorithm.
Since the principle of solving the problems of the computer-readable medium is similar to that of the portrait segmentation method, after the processor executes the computer program in the computer-readable medium, the steps implemented may refer to the above embodiments, and repeated parts are not described again.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to the application. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
It will be apparent to those skilled in the art that various changes and modifications may be made in the present application without departing from the spirit and scope of the application. Thus, if such modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is intended to include such modifications and variations as well.

Claims (10)

1. A method of face segmentation, the method comprising:
the method comprises the steps of carrying out downsampling on a first image marked with a target portrait for preset times to obtain a second image, and determining edge pixel points corresponding to the target portrait in the second image;
performing convolution processing on the second image to determine a first characteristic value corresponding to the edge pixel point, determining a target pixel point corresponding to the edge pixel point in the first image, performing convolution processing on the first image to determine a second characteristic value corresponding to the target pixel point, and determining a characteristic vector corresponding to the target pixel point according to the first characteristic value and the second characteristic value; inputting the feature vector into a multilayer perceptron, and acquiring a probability value output by the multilayer perceptron; and if the probability value exceeds a preset probability threshold value, determining the target pixel point as a pixel point belonging to the target portrait.
2. The method of claim 1, wherein the determining edge pixel points corresponding to the target portrait in the second image comprises:
and aiming at each pixel point in the target portrait border area, if the difference value of the pixel point and the mean value of the pixel values of the pixel points contained in the set neighborhood exceeds a preset threshold value, determining the pixel point as the border pixel point.
3. The method according to claim 1, wherein the determining the feature vector corresponding to the target pixel point according to the first feature value and the second feature value comprises:
performing convolution processing on the first characteristic value to obtain a first characteristic vector, and performing convolution processing on the second characteristic value to obtain a second characteristic vector; and combining the first characteristic vector and the second characteristic vector according to a set sequence to obtain the characteristic vector corresponding to the target pixel point.
4. The method of any of claims 1-3, wherein downsampling the first image with the identified target portrait a predetermined number of times to obtain the second image comprises:
and performing down-sampling on the first image for a first set number of times to obtain a third image, and performing up-sampling on the third image for a second set number of times to obtain a second image.
5. A method according to any of claims 1-3, wherein said first set number of times is two and said second set number of times is one or two.
6. The method of claim 1, wherein determining the target pixel point corresponding to the edge pixel point in the first image comprises:
and according to the coordinate information of the edge pixel points in the second image, determining target pixel points corresponding to the edge pixel points in the first image through an interested area calibration ROIAlign algorithm.
7. A portrait segmentation apparatus, characterized in that the apparatus comprises:
the determining module is used for carrying out downsampling on a first image marked with a target portrait for preset times to obtain a second image and determining edge pixel points corresponding to the target portrait in the second image;
the processing module is used for performing convolution processing on the second image to determine a first characteristic value corresponding to the edge pixel point, determining a target pixel point corresponding to the edge pixel point in the first image, performing convolution processing on the first image to determine a second characteristic value corresponding to the target pixel point, and determining a characteristic vector corresponding to the target pixel point according to the first characteristic value and the second characteristic value; inputting the feature vector into a multilayer perceptron, and acquiring a probability value output by the multilayer perceptron; and if the probability value exceeds a preset probability threshold value, determining the target pixel point as a pixel point belonging to the target portrait.
8. The apparatus according to claim 7, wherein the determining module is specifically configured to, for each pixel point in the edge region of the target portrait, determine the pixel point as the edge pixel point if a difference between a mean value of pixel values of the pixel point and pixel points included in a set neighborhood of the pixel point exceeds a preset threshold.
9. An electronic device, characterized in that the electronic device comprises at least a processor and a memory, the processor being adapted to carry out the steps of the portrait segmentation method of any one of claims 1-6 when executing a computer program stored in the memory.
10. A computer-readable storage medium, characterized in that it stores a computer program which, when being executed by a processor, carries out the steps of the portrait segmentation method according to any one of claims 1 to 6.
CN202110955311.3A 2021-08-19 2021-08-19 Portrait segmentation method, apparatus, device and medium Pending CN115713779A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110955311.3A CN115713779A (en) 2021-08-19 2021-08-19 Portrait segmentation method, apparatus, device and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110955311.3A CN115713779A (en) 2021-08-19 2021-08-19 Portrait segmentation method, apparatus, device and medium

Publications (1)

Publication Number Publication Date
CN115713779A true CN115713779A (en) 2023-02-24

Family

ID=85230089

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110955311.3A Pending CN115713779A (en) 2021-08-19 2021-08-19 Portrait segmentation method, apparatus, device and medium

Country Status (1)

Country Link
CN (1) CN115713779A (en)

Similar Documents

Publication Publication Date Title
CN111369545B (en) Edge defect detection method, device, model, equipment and readable storage medium
CN108009543B (en) License plate recognition method and device
CN110675407B (en) Image instance segmentation method and device, electronic equipment and storage medium
CN109840477B (en) Method and device for recognizing shielded face based on feature transformation
CN111582021A (en) Method and device for detecting text in scene image and computer equipment
CN111080660A (en) Image segmentation method and device, terminal equipment and storage medium
CN111681273A (en) Image segmentation method and device, electronic equipment and readable storage medium
CN112906794A (en) Target detection method, device, storage medium and terminal
CN110969046B (en) Face recognition method, face recognition device and computer-readable storage medium
CN110136052B (en) Image processing method and device and electronic equipment
US12165290B1 (en) Image processing method and apparatus
CN113643260A (en) Method, apparatus, apparatus, medium and product for detecting image quality
CN109685805B (en) Image segmentation method and device
CN111914668A (en) Pedestrian re-identification method, device and system based on image enhancement technology
CN115631112B (en) Building contour correction method and device based on deep learning
CN110969602B (en) Image definition detection method and device
CN110210314B (en) Face detection method, device, computer equipment and storage medium
CN111178200A (en) Identification method of instrument panel indicator lamp and computing equipment
CN112766028A (en) Face fuzzy processing method and device, electronic equipment and storage medium
JP7294275B2 (en) Image processing device, image processing program and image processing method
CN118506154A (en) Small target detection model training method, device and electronic equipment
CN115713779A (en) Portrait segmentation method, apparatus, device and medium
CN113255700B (en) Image feature map processing method and device, storage medium and terminal
CN112950652B (en) Robot and hand image segmentation method and device thereof
CN116051378A (en) Image processing method, device, equipment and medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination