Server and portrait segmentation method
By performing hand recognition and region determination on the original image through the server, and combining a segmentation network trained with multi-scale edge supervision, the problem of missing fingers in the existing technology is solved, and higher-precision portrait segmentation is achieved.
Patent Information
- Application Number
- CN202210895761.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-07-27
- Publication Date
- 2026-03-03
- Estimated Expiration
- 2042-07-27
AI Technical Summary
Existing facial segmentation technology is prone to missing parts when segmenting fingers, which affects the user's overall experience.
The server performs hand recognition on the original image to determine whether a hand region exists. Based on the overlap between the hand region and the human body region, it selectively uses a human image segmentation network and a hand segmentation network for segmentation. Combined with a multi-scale edge supervision training network, the accuracy of finger segmentation is improved.
It improves the completeness and accuracy of portrait segmentation, enhancing the overall user experience.
Smart Images

Figure CN115272368B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of Internet technology, and in particular to a server and a method for human image segmentation. Background Technology
[0002] Human face segmentation refers to identifying human body regions in an image, segmenting the human face within the image, and separating the human face from the background to achieve functions such as background blurring or background replacement. For example, background blurring in video calls and virtual backgrounds in video conferencing both utilize human face segmentation technology.
[0003] Currently, the solution for portrait segmentation is a binary classification method based on deep learning. This involves inputting the image to be segmented into a segmentation network, which outputs a mask with a foreground portrait pixel value of 255 and a background pixel value of 0. The segmented portrait is then obtained based on the mask and the original image. However, this segmentation process is relatively coarse for the fingers, easily resulting in missing fingers and affecting the user's overall experience. Summary of the Invention
[0004] This application provides a server and a human face segmentation method to solve the technical problem that existing human face segmentation technologies easily cause missing fingers, reducing the overall user experience.
[0005] Firstly, this application provides a server configured to:
[0006] Hand recognition is performed on the collected raw images;
[0007] When there is no hand region in the original image, the original image is input into the pre-trained human face segmentation network to obtain the first human face mask image. The training process of the human face segmentation network utilizes multi-scale edge supervision.
[0008] When a hand region exists in the original image, if the hand region overlaps with the human body region, the original image is input into the human body segmentation network to obtain a first human body mask. If the hand region does not overlap with the human body region, a hand image is copied from the original image based on the hand region, and the hand image is input into the pre-trained hand segmentation network to obtain a hand mask. The original image is then input into the human body segmentation network to obtain a second human body mask. The hand mask replaces the area containing the hand image in the second human body mask to obtain a third human body mask.
[0009] The human figure portion is segmented from the original image based on the first or third human figure mask.
[0010] Secondly, this application provides a portrait segmentation method, the method comprising:
[0011] Hand recognition is performed on the collected raw images;
[0012] When there is no hand region in the original image, the original image is input into the pre-trained human face segmentation network to obtain the first human face mask image. The training process of the human face segmentation network utilizes multi-scale edge supervision.
[0013] When a hand region exists in the original image, if the hand region overlaps with the human body region, the original image is input into the human body segmentation network to obtain a first human body mask. If the hand region does not overlap with the human body region, a hand image is copied from the original image based on the hand region, and the hand image is input into the pre-trained hand segmentation network to obtain a hand mask. The original image is then input into the human body segmentation network to obtain a second human body mask. The hand mask replaces the area containing the hand image in the second human body mask to obtain a third human body mask.
[0014] The human figure portion is segmented from the original image based on the first or third human figure mask.
[0015] Compared with the prior art, the beneficial effects of this application are as follows:
[0016] This application provides a server and a portrait segmentation method. After obtaining the original image to be segmented, the server first performs hand recognition to determine whether a hand region exists in the original image. The portrait segmentation method used by the server differs depending on whether a hand region exists in the original image. If no hand region exists in the original image, the original image can be directly input into a pre-trained portrait segmentation network to obtain a first portrait mask. If a hand region exists in the original image, the server needs to further determine whether the hand region overlaps with the human body region. When the hand region does not overlap with the human body region, a copy of the hand image is made based on the position of the hand region in the original image. This copy is then input into the pre-trained hand segmentation network to obtain a mask image of the hand image, i.e., the hand mask. Simultaneously, the original image is input into the portrait segmentation network to obtain a second portrait mask. In the second portrait mask, the region containing the hand image is replaced with the hand mask image to obtain a third portrait mask. Finally, the server can segment the portrait based on either the first or third portrait mask image. In this application, the server uses multi-scale edge supervision to train the portrait segmentation network, which improves the image edge segmentation effect. In addition, the server adds a hand segmentation network to process hand images separately, which improves the segmentation accuracy of the finger part in portrait segmentation, improves the integrity of portrait segmentation, and enhances the overall user experience. Attached Figure Description
[0017] To more clearly illustrate the technical solution of this application, the drawings used in the embodiments will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0018] Figure 1a The diagram illustrates a portrait mask image according to some embodiments;
[0019] Figure 1b The diagram illustrates, exemplarily, the use of the human face mask in FIG1 according to some embodiments;
[0020] Figure 2 The diagram illustrates, by way of example, the training process of a human face segmentation network according to some embodiments;
[0021] Figure 3 The diagram illustrates a basic flow chart of an initial module according to some embodiments;
[0022] Figure 4 The diagram above exemplifies a basic flowchart of a residual module with a step size of 1 according to some embodiments;
[0023] Figure 5 The diagram above exemplifies a basic flowchart of a residual module with a step size of 2 according to some embodiments;
[0024] Figure 6 The diagram above illustrates a basic flow chart of an adjustment module according to some embodiments;
[0025] Figure 7 The diagram above illustrates a basic flowchart of a residual convolution module according to some embodiments;
[0026] Figure 8 The diagram illustrates an edge acquisition according to some embodiments;
[0027] Figure 9 The diagram above illustrates a training process for a hand segmentation network according to some embodiments.
[0028] Figure 10 The diagram illustrates a flowchart of a portrait segmentation method according to some embodiments.
[0029] Figure 11 The diagram illustrates, by way of example, a human body recognition frame and a hand recognition frame according to some embodiments;
[0030] Figure 12 The diagram illustrates, exemplarily, another human body recognition frame and hand recognition frame according to some embodiments. Detailed Implementation
[0031] To make the objectives and implementation methods of this application clearer, the exemplary implementation methods of this application will be clearly and completely described below with reference to the accompanying drawings of the exemplary embodiments of this application. Obviously, the exemplary embodiments described are only some embodiments of this application, and not all embodiments.
[0032] It should be noted that the brief descriptions of terms in this application are only for the convenience of understanding the embodiments described below, and are not intended to limit the embodiments of this application. Unless otherwise stated, these terms should be understood in their ordinary and common meaning.
[0033] The terms "first," "second," "third," etc., used in the specification, claims, and accompanying drawings of this application are used to distinguish similar or related objects or entities, and do not necessarily imply a specific order or sequence, unless otherwise specified. It should be understood that such terms are interchangeable where appropriate.
[0034] The terms “comprising” and “having”, and any variations thereof, are intended to cover but not exclude inclusion, for example, a product or device that includes a range of components is not necessarily limited to all of the components that are clearly listed, but may include other components that are not clearly listed or that are inherent to such product or device.
[0035] The term "module" refers to any known or subsequently developed hardware, software, firmware, artificial intelligence, fuzzy logic, or combination of hardware and / or software code that is capable of performing the functions associated with that element.
[0036] Currently, human face segmentation technology is used in scenarios such as background blurring in video calls and virtual backgrounds in video conferencing. Figure 1a The diagram illustrates a portrait mask image according to some embodiments. Figure 1a As shown, when performing portrait segmentation, the image to be segmented is usually input into the segmentation network, which outputs a mask with a foreground portrait pixel value of 255 and a background pixel value of 0. Then, the segmented portrait is obtained based on the mask and the original image. Figure 1b The diagram illustrates, exemplarily, the use of the human face mask in Figure 1 according to some embodiments. For example... Figure 1bAs shown, after segmenting the human figure from the original image, its background 101 can be modified, such as by virtualizing the background 101 or adding a mosaic effect. The segmentation process in related technologies is relatively coarse for the human finger portion. When capturing images, if the distance between the person and the camera is slightly far, the fingers may be missing, affecting the user's overall experience. To solve the above problems, this application provides a server configured to execute the human figure segmentation method. The human figure segmentation process is described below with reference to the accompanying drawings.
[0037] In some embodiments, the human face segmentation process performed by the server can be executed on another device. The following examples will use server execution.
[0038] In some embodiments, a human face segmentation network and a hand segmentation network can be trained before performing human face segmentation.
[0039] The training process of the human image segmentation network is described below with reference to the attached diagram.
[0040] Figure 2 The diagram illustrates, for example, a training process diagram of a human face segmentation network according to some embodiments. Combined with... Figure 2 As shown, the server acquires the original image. In practical applications, the server can acquire images captured in real-time by a camera or images of consecutive frames obtained from video. The server uses bilinear interpolation to reduce the size of the original image to fit the specified size of the input human face segmentation network.
[0041] In some embodiments, the server inputs the downsized original image into the initial module for downsampling and increases the number of output channels to obtain output feature information. Figure 3 The diagram illustrates a basic flow chart of an initial module according to some embodiments, where the original image is input to... Figure 3 In the initial module shown, after 3x3 convolution, layer normalization, and the activation function leaky_relu, the output data has 8 channels and is downsampled by 0.5 times.
[0042] In some embodiments, the output feature information is input to several residual modules for feature learning and downsampling, and feature information from the original image is extracted by an adjustment module. The residual modules include residual modules with a step size of 1 or 2.
[0043] Figure 4 The diagram illustrates a basic flowchart of a residual module with a step size of 1 according to some embodiments. Combined with... Figure 4The input data undergoes 1x1 convolution calculation, leaky_relu activation function, 5x5 depthwise separable convolution with stride of 1, leaky_relu activation function, 1x1 convolution calculation, and layer normalization to obtain normalized data. The normalized data is then summed with the input data to obtain the output data.
[0044] Figure 5 The diagram illustrates a basic flow chart of a residual module with a step size of 2 according to some embodiments. Figure 5 As shown, the input data is downsampled by 0.5 times after 1x1 convolution, leaky_relu activation function, and 5x5 depthwise separable convolution with stride of 2. After that, it is normalized by leaky_relu activation function, 1x1 convolution, and layer normalization to obtain the normalized output data.
[0045] Figure 6 The diagram illustrates a basic flow chart of an adjustment module according to some embodiments. Figure 6 As shown, the adjustment module here is the adjustment module between downsampling and upsampling. The input data is processed by a 5x5 depthwise separable convolution with a stride of 1, a 1x1 convolution, the activation function leaky_relu, a 5x5 depthwise separable convolution with a stride of 1, and then two more leaky_relu activation functions and a 1x1 convolution to obtain the output data.
[0046] The server inputs the feature information from the original image into the upsampling module for upsampling, obtaining upscaled feature information. The server then adds this upscaled feature information to the downsampling feature information of the same scale using a fusion and residual convolution module, obtaining optimized feature information. Here, the server employs a fusion approach during upsampling to improve the accuracy of the human image segmentation network. Figure 7 The diagram illustrates a basic flowchart of a residual convolution module according to some embodiments. Figure 7 The input data undergoes 1x1 convolution, leaky_relu activation, 5x5 depthwise separable convolution with stride of 1, leaky_relu activation, 1x1 convolution, and layer normalization to obtain normalized data. The number of channels in the input data is adjusted by the right-hand 1x1 convolution to match the number of channels in the normalized data. The normalized data is then summed with the data whose channel number has been adjusted by the 1x1 convolution to obtain the output data.
[0047] The server inputs the optimized feature information into the convolution module, which then modifies the final number of channels in the image output. After changing the final number of channels in the image output, multi-scale edge supervision is used to obtain the network output.
[0048] The following section introduces the process of using multi-scale edge supervision in human image segmentation networks.
[0049] In some embodiments, in the step of obtaining the network output using full-scale edge supervision, the server calculates the loss value for full-scale supervision using Dice-Loss supervision and calculates the loss value for edge supervision at full scale using root mean square error. The loss value obtained through full-scale supervision is added to the loss value for edge supervision to obtain the total loss value. During the training process of the human segmentation network, the total loss value is gradually reduced so that the predicted value approaches the true value.
[0050] Here, the formula for calculating Dice-Loss supervision is as follows:
[0051]
[0052] The formula for calculating the root mean square error is as follows:
[0053]
[0054] In the formula, y true If y is the true value, then y pred These are predicted values.
[0055] In some embodiments, in the step of obtaining the network output using quarter-scale or half-scale edge supervision, the server calculates the loss value of the quarter-scale or half-scale supervision using the cross-entropy loss function, and calculates the loss value of the edge supervision at the quarter-scale or half-scale using the root mean square error. The server adds the loss value of the quarter-scale or half-scale supervision to the corresponding edge supervision loss value to obtain the total loss value. During the training process of the human segmentation network, the total loss value is gradually reduced so that the predicted value approaches the true value.
[0056] Here, the formula for calculating the cross-entropy loss function is as follows:
[0057]
[0058] In the formula, y true If y is the true value, then y pred These are predicted values.
[0059] Figure 8 The diagram illustrates an edge acquisition schematic according to some embodiments. Figure 8 The edge detection process involves obtaining the original image and then eroding it. This process reduces and thins the highlighted or white areas of the original image to remove jagged edges around the human figure. The difference between the original image and the eroded image is then used to obtain the ground truth edge map.
[0060] In some embodiments, a hand segmentation network is trained separately on the server to better process the hand region in the original image. Figure 9 The diagram illustrates, for example, a training process diagram of a hand segmentation network according to some embodiments. Figure 9 The segmentation network shown is trained on images where most of the original image is a hand. This network is relatively... Figure 2 The human image segmentation network shown is smaller in terms of computation and model size, meaning that its process is smaller in network structure compared to the human image segmentation network. The training process of the hand segmentation network can also adopt full-scale, half-scale, quarter-scale, and edge supervision.
[0061] The process of human image segmentation is explained below with reference to the attached diagram.
[0062] Figure 10 The diagram illustrates a flowchart of a portrait segmentation method according to some embodiments. Figure 10 As shown, the portrait segmentation process is as follows:
[0063] In some embodiments, the server acquires the original image, performs hand recognition on the original image, and determines whether a hand region exists in the original image based on the recognition result. For example, the server uses a machine learning module in computer vision to identify the hand region in the original image and draws the corresponding hand recognition box, that is, draws the hand region within the recognition box. Here, the machine learning module can be trained on a large number of images with already drawn hand recognition boxes, so that during use, when the original image input to the machine learning module contains a hand region, the machine learning module can draw the hand recognition box in the original image.
[0064] In some embodiments, when the hand region is absent in the original image (e.g., the hands are behind the back), the hand region should not be visible in the image. In this case, the server reduces the size of the original image using bilinear interpolation and inputs the reduced image into a pre-trained portrait segmentation network to obtain a first portrait mask. The server then restores the first portrait mask to its original size for portrait segmentation.
[0065] In some embodiments, when a hand region exists in the original image, the server needs to further determine whether the hand region overlaps with the human body region.
[0066] Figure 11 The diagram illustrates, exemplarily, human body recognition frames and hand recognition frames according to some embodiments. See also Figure 11The server marks a human body recognition box 1102 in the original image based on the human body region. The human body region is the area extracted centered on the human figure in the original image, excluding the arm portion. The human body recognition box can be a recognition box with the smallest area covering the human body region. The server calculates the intersection area of the human body recognition box 1102 and the hand recognition box 1101, where the hand recognition box 1101 is the recognition box drawn by the server based on the hand region during hand recognition.
[0067] Since different machine recognition modules have different parameters, the size of the recognition box drawn should be different. If the overlap between the hand area and the human body area can be determined simply by the intersection area between the human body recognition box 1102 and the hand recognition box 1101, it will increase the amount of unnecessary calculation. Figure 12 The diagram illustrates, exemplarily, another human body recognition frame and a hand recognition frame according to some embodiments. Figure 12 As shown, although the human body recognition frame 1102 and the hand recognition frame 1101 have an overlapping area, the hand area and the human body area do not overlap.
[0068] In some embodiments, when the intersection area of the human body recognition frame 1102 and the hand recognition frame 1101 is greater than or equal to a preset threshold, the server determines that the hand region coincides with the human body region. When the intersection area of the human body recognition frame 1102 and the hand recognition frame 1101 is less than the preset threshold, the server determines that the hand region does not coincide with the human body region.
[0069] In some embodiments, if the hand region overlaps with the body region—that is, the hand region may largely overlap with the body region, or the hand region may completely overlap with the body region—for example, when the segmentation scenario is a video interview, the interviewee is close to the camera, and the original image captured is mostly of the upper body with the hands inside the body edge, i.e., in front of the body. Therefore, the hand region overlaps with the body region. In this case, the server can still directly input the original image after scaling it down into the portrait segmentation network to obtain a first portrait mask. After the server restores the first portrait mask to its original size, it can perform portrait segmentation.
[0070] In some embodiments, if the hand area does not overlap with the body area, for example, when the segmented scene is an awards ceremony, the speaker's hands will make various gestures to assist in their speech. When their hands are outside the body edge and far away, the hand area and body area in the original image are not overlapped. In this case, the server needs to process the original image and the hand area in the original image separately.
[0071] The server obtains the coordinates of the hand recognition box in the original image. Based on these coordinates, the server can copy the area where the hand recognition box is located to obtain a hand image. At the same time, the server needs to record the coordinates to facilitate the subsequent reconstruction of the hand mask image.
[0072] In some embodiments, the server may appropriately enlarge the hand image using bilinear interpolation before inputting it into the system. Figure 9 In the hand segmentation network shown, a hand mask image is obtained. Simultaneously, the server needs to input the original image into... Figure 2 In the image segmentation network shown, a second image mask is obtained. The server restores the acquired hand mask and the second mask to their original size, and replaces the area containing the hand image in the second image mask with the hand mask based on the recorded coordinates of the hand recognition box, thus obtaining a third image mask. It should be noted that, assuming the original image is the same, the second image mask obtained here is identical to the first image mask obtained previously.
[0073] In some embodiments, the server may perform different processing on the original image based on whether a hand region exists in the original image and whether the hand region overlaps with a human body region, to obtain a first portrait mask or a third portrait mask. After obtaining the first portrait mask or the third portrait mask, the server can segment the human figure portion from the original image.
[0074] In this application, the server utilizes multi-scale edge supervision to train the portrait segmentation network, improving the image edge segmentation effect. Furthermore, during upsampling, the server enhances the accuracy of the segmentation network by adding a fusion method. Additionally, the server adds a hand segmentation network to process hand images separately, using an auxiliary hand segmentation network to perform fine segmentation of the fingers, improving the segmentation accuracy of the fingers in portrait segmentation, enhancing the completeness of portrait segmentation, and improving the overall user experience.
[0075] Corresponding to the aforementioned server, this application also provides a portrait segmentation method, the method comprising: the server performing hand recognition on an acquired original image. When there is no hand region in the original image, the server inputs the original image into a pre-trained portrait segmentation network to obtain a first portrait mask, wherein the training process of the portrait segmentation network utilizes multi-scale edge supervision. When there is a hand region in the original image, if the hand region overlaps with the human body region, the server inputs the original image into the portrait segmentation network to obtain the first portrait mask. If the hand region does not overlap with the human body region, the server copies a hand image from the original image based on the hand region, inputs the hand image into a pre-trained hand segmentation network to obtain a hand mask, and inputs the original image into the portrait segmentation network to obtain a second portrait mask. The server replaces the area containing the hand image in the second portrait mask with the hand mask to obtain a third portrait mask. The server segments the human figure from the original image based on either the first or the third human figure mask.
[0076] In some embodiments, in the step of determining whether the hand region overlaps with the human body region, the method includes: the server marking a human body recognition box in the original image based on the human body region, wherein the human body region is the remaining region after removing the arm portion from the region extracted centered on the human figure portion in the original image, and the human body recognition box is a recognition box with the smallest area covering the human body region. The server calculates the intersection area of the human body recognition box and the hand recognition box, wherein the hand recognition box is the recognition box drawn by the server based on the hand region when performing hand recognition. When the intersection area is greater than or equal to a preset threshold, the server determines that the hand region overlaps with the human body region. When the intersection area is less than the preset threshold, the server determines that the hand region does not overlap with the human body region.
[0077] In some embodiments, copying the hand image from the original image based on the hand region includes: the server obtaining the coordinate position of a hand recognition box in the original image, wherein the hand recognition box is a recognition box drawn by the server based on the hand region when performing hand recognition. The server copies the area where the hand recognition box is located based on the coordinate position and records the coordinate position so that the hand mask image can be subsequently replaced in the second portrait mask image based on the coordinate position.
[0078] Since the above embodiments are all described in conjunction with other methods, and different embodiments have the same parts, the same or similar parts between the various embodiments in this specification can be referred to mutually. They will not be described in detail here.
[0079] It should be noted that in this specification, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a circuit structure, article, or device that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a circuit structure, article, or device. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the circuit structure, article, or device that includes the element.
[0080] Other embodiments of this application will readily occur to those skilled in the art upon consideration of the specification and practice of the disclosure herein. This application is intended to cover any variations, uses, or adaptations of the invention that follow the general principles of this application and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of this application are indicated by the content of the claims.
[0081] The above embodiments of this application do not constitute a limitation on the scope of protection of this application.
Claims
1. A server, characterized in that, The server is configured as follows: Hand recognition is performed on the collected raw images; When there is no hand region in the original image, the original image is input into the pre-trained human face segmentation network to obtain the first human face mask image. The training process of the human face segmentation network utilizes multi-scale edge supervision. When a hand region exists in the original image, if the hand region overlaps with the human body region, the original image is input into the human face segmentation network to obtain a first human face mask. If the hand region does not overlap with the human body region, the coordinates of the hand recognition box in the original image are obtained. The hand recognition box is a recognition box drawn by the server based on the hand region when performing hand recognition. The area where the hand recognition box is located is copied according to the coordinates to copy the hand image. The coordinates are recorded, and the hand image is input into the pre-trained hand segmentation network to obtain a hand mask. The original image is then input into the human face segmentation network to obtain a second human face mask. The hand image is replaced with the hand mask in the second human face mask according to the coordinates to obtain a third human face mask. The human figure portion is segmented from the original image based on the first or third human figure mask.
2. The server according to claim 1, characterized in that, In the step of determining whether the hand area overlaps with the human body area, the server is configured to: A human body recognition box is marked in the original image based on the human body region. The human body region is the area extracted from the human figure in the original image after removing the arm part. The human body recognition box is the recognition box with the smallest area covering the human body region. Calculate the intersection area of the human body recognition box and the hand recognition box, wherein the hand recognition box is the recognition box drawn by the server based on the hand area when performing hand recognition; When the intersecting area is greater than or equal to a preset threshold, it is determined that the hand region and the human body region overlap. When the intersecting area is less than the preset threshold, it is determined that the hand area and the human body area do not overlap.
3. The server according to claim 1, characterized in that, During the training process of the human image segmentation network, the server is configured as follows: The original image is reduced in size and then input into the initial module for downsampling and expansion of the number of output channels to obtain output feature information; The output feature information is input into several residual modules for feature learning and downsampling, and the feature information in the original image is extracted by the adjustment module. The feature information in the original image is input into the upsampling module for upsampling to obtain the upscaled feature information; The upscaled feature information is added to the downsampled feature information of the same scale by adding a fusion and residual convolution module to obtain the optimized feature information; The optimized feature information is input into the convolution module. After changing the final number of channels in the image output, the network output is obtained using multi-scale edge supervision.
4. The server according to claim 3, characterized in that, In the step of obtaining the network output using full-scale edge supervision, the server is configured as follows: The loss value of full-scale supervision is calculated using Dice-Loss supervision, and the loss value of edge supervision under full scale is calculated using root mean square error. The total loss is obtained by adding the loss value of the full-scale supervision to the loss value of the edge supervision. The total loss is gradually reduced through network training.
5. The server according to claim 3, characterized in that, In the step of obtaining the network output using quarter-scale or half-scale edge supervision, the server is configured as follows: The loss value of quarter-scale or half-scale supervision is calculated using the cross-entropy loss function, and the loss value of edge supervision at the quarter-scale or half-scale is calculated using the root mean square error. The total loss is obtained by adding the loss value of the quarter-scale or half-scale supervision to the corresponding edge supervision. The total loss is gradually reduced through network training.
6. The server according to claim 1, characterized in that, The server is configured as follows: When enlarging or shrinking an image, bilinear interpolation is used.
7. A method for human face segmentation, characterized in that, The method includes: Hand recognition is performed on the collected raw images; When there is no hand region in the original image, the original image is input into the pre-trained human face segmentation network to obtain the first human face mask image. The training process of the human face segmentation network utilizes multi-scale edge supervision. When a hand region exists in the original image, if the hand region overlaps with the human body region, the original image is input into the human face segmentation network to obtain a first human face mask. If the hand region does not overlap with the human body region, the coordinates of the hand recognition box in the original image are obtained. The hand recognition box is a recognition box drawn by the server based on the hand region when performing hand recognition. The area where the hand recognition box is located is copied according to the coordinates to copy the hand image. The coordinates are recorded, and the hand image is input into the pre-trained hand segmentation network to obtain a hand mask. The original image is then input into the human face segmentation network to obtain a second human face mask. The hand image is replaced with the hand mask in the second human face mask according to the coordinates to obtain a third human face mask. The human figure portion is segmented from the original image based on the first or third human figure mask.
8. The portrait segmentation method according to claim 7, characterized in that, In the step of determining whether the hand area overlaps with the human body area, the method includes: A human body recognition box is marked in the original image based on the human body region. The human body region is the area extracted from the human figure in the original image after removing the arm part. The human body recognition box is the recognition box with the smallest area covering the human body region. Calculate the intersection area of the human body recognition box and the hand recognition box, wherein the hand recognition box is the recognition box drawn by the server based on the hand area when performing hand recognition; When the intersecting area is greater than or equal to a preset threshold, it is determined that the hand region and the human body region overlap. When the intersecting area is less than the preset threshold, it is determined that the hand area and the human body area do not overlap.
Citation Information
Patent Citations
Image processing method and device, electronic equipment and computer readable storage medium
CN112102340A