Image processing method, device, computer readable storage medium and computer equipment

Transparency mask images are automatically generated through image semantic segmentation and gesture recognition technology, which solves the problem of low image processing efficiency caused by manual participation in traditional methods and achieves an efficient image separation process.

CN110335277BActive Publication Date: 2024-09-10TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN201910373797.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2019-05-07
Publication Date
2024-09-10
Estimated Expiration
2039-05-07

AI Technical Summary

Technical Problem

Traditional transparency mask image generation relies on manual participation, resulting in low image processing efficiency.

Method used

The target area and skeleton area are automatically obtained through image semantic segmentation and gesture recognition technology, and the three-dimensional image is generated by fusion, thereby automatically generating a transparency mask image and reducing manual participation.

Benefits of technology

It improves the efficiency of generating transparency mask images, improves the overall efficiency of image processing, and realizes the automated image separation process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN110335277B
    Figure CN110335277B
Patent Text Reader

Abstract

The present application relates to an image processing method, apparatus, computer-readable storage medium and computer equipment, the method comprising: obtaining an image to be processed; performing image semantic segmentation on the image to be processed to obtain a semantic segmentation image; the semantic segmentation image includes a target area and a non-target area obtained through semantic segmentation; performing posture recognition on the image to be processed to obtain a posture recognition image with a skeleton area recognized; fusing the target area and non-target area of ​​the semantic segmentation image with the skeleton area of ​​the posture recognition image to obtain a tripartite map that divides the foreground area, the background area and the area to be recognized; generating a transparency mask image for image separation of the image to be processed based on the image to be processed and the tripartite map. The solution provided by the present application can improve image processing efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to an image processing method, apparatus, computer-readable storage medium and computer equipment. Background Art

[0002] With the development of computer technology, image processing is becoming more and more common. Among them, image matting is a widely used image editing technology. Usually, when performing image matting, it is necessary to first generate a transparency mask image (Alpha Matte), and then perform target matting on the image based on the transparency mask image.

[0003] However, traditional transparency mask images are mainly generated based on trimap, and the generation of trimap requires manual participation, which leads to the problem of low efficiency of image processing. Summary of the invention

[0004] Based on this, it is necessary to provide an image processing method, apparatus, computer-readable storage medium and computer equipment to address the technical problem of low image processing efficiency.

[0005] An image processing method, comprising:

[0006] Get the image to be processed;

[0007] Performing image semantic segmentation on the image to be processed to obtain a semantic segmentation image; the semantic segmentation image includes a target area and a non-target area obtained through semantic segmentation;

[0008] Performing posture recognition on the image to be processed to obtain a posture recognition image in which a skeleton area is recognized;

[0009] The target area and the non-target area of ​​the semantic segmentation image are fused with the skeleton area of ​​the posture recognition image to obtain a tripartite map that divides the foreground area, the background area, and the area to be recognized;

[0010] A transparency mask image for performing image separation on the image to be processed is generated according to the image to be processed and the tripartite map.

[0011] In one embodiment, performing image semantic segmentation on the image to be processed to obtain a semantic segmentation image includes:

[0012] Inputting the image to be processed into an image processing model;

[0013] Obtaining a semantic segmentation image through the semantic segmentation branch of the image processing model;

[0014] The step of performing posture recognition on the image to be processed to obtain a posture recognition image in which a skeleton area is recognized includes:

[0015] Obtaining a gesture recognition image through the gesture recognition branch of the image processing model;

[0016] Among them, the pixel points in the semantic segmentation image have pixel values ​​representing the semantic category to which they belong and correspond to the pixel points in the image to be processed; the pixel points in the target area belong to the target semantic category; the pixel points in the non-target area do not belong to the target semantic category; the skeleton area included in the posture recognition image is predicted based on the skeleton key points.

[0017] An image processing device, comprising:

[0018] An acquisition module, used for acquiring an image to be processed;

[0019] A semantic segmentation module, used for performing image semantic segmentation on the image to be processed to obtain a semantic segmentation image; the semantic segmentation image includes a target area and a non-target area obtained through semantic segmentation;

[0020] A posture recognition module, used for performing posture recognition on the image to be processed to obtain a posture recognition image in which a skeleton area is recognized;

[0021] A fusion module, used to fuse the target area and the non-target area of ​​the semantic segmentation image with the skeleton area of ​​the posture recognition image to obtain a tripartite map that divides the foreground area, the background area, and the area to be recognized;

[0022] A generating module is used to generate a transparency mask image for image separation of the image to be processed according to the image to be processed and the tripartite map.

[0023] A computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the processor executes the steps of the above-mentioned image processing method.

[0024] A computer device comprises a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor executes the steps of the above-mentioned image processing method.

[0025] After acquiring the image to be processed, the above-mentioned image processing method, device, computer-readable storage medium and computer equipment automatically perform image semantic segmentation on the image to be processed to obtain a semantic segmentation image, and automatically perform posture recognition on the image to be processed; since the obtained semantic segmentation image includes the target area and the non-target area obtained through semantic segmentation, and the obtained posture recognition image includes the skeleton area, the two frames of images can be automatically fused to obtain a tripartite map that divides the foreground area, the background area and the area to be recognized, so that a transparency mask image for image separation of the image to be processed can be generated based on the image to be processed and the tripartite map. The entire process of generating the transparency mask image does not require user participation, which greatly improves the efficiency of generating the transparency mask image, thereby improving the efficiency of image processing. BRIEF DESCRIPTION OF THE DRAWINGS

[0026] Figure 1 A diagram showing an application environment of an image processing method in an embodiment;

[0027] Figure 2 is a schematic flow chart of an image processing method in one embodiment;

[0028] Figure 3 is a schematic diagram of image semantic segmentation in one embodiment;

[0029] Figure 4 is a schematic diagram of human body posture recognition in one embodiment;

[0030] Figure 5 A schematic diagram of the principle of fusing a semantic segmentation image and a posture recognition image to obtain a tri-image in one embodiment;

[0031] Figure 6 It is a schematic diagram of obtaining a transparency mask image according to an image to be processed and a tripartite map in one embodiment;

[0032] Figure 7 is a schematic diagram of post-processing an intermediate image in one embodiment;

[0033] Figure 8 A schematic diagram of performing image separation on an image to be processed by using a transparency mask image in one embodiment;

[0034] Fig. 9 A comparison diagram of the cutout effects of a human body cutout in various ways in one embodiment;

[0035] Fig.10 is a structural block diagram of an image processing device in one embodiment;

[0036] Fig.11 is a structural block diagram of an image processing device in another embodiment;

[0037] Fig.12 FIG. 4 is a structural block diagram of a computer device in one embodiment. DETAILED DESCRIPTION

[0038] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0039] Figure 1 FIG. 1 is an application environment diagram of an image processing method in an embodiment. Figure 1 , the image processing method is applied to an image processing system. The image processing system includes a terminal 110 and a server 120. The terminal 110 and the server 120 are connected via a network. The terminal 110 may be a desktop terminal or a mobile terminal, and the mobile terminal may be at least one of a mobile phone, a tablet computer, a laptop computer, etc. The server 120 may be implemented as an independent server or a server cluster composed of multiple servers. The terminal 110 and the server 120 may be used alone to execute the image processing method, or may be used together to execute the image processing method.

[0040] like Figure 2 As shown, in one embodiment, an image processing method is provided. This embodiment mainly uses the method applied to a computer device as an example, and the computer device can specifically be the above-mentioned Figure 1 The terminal 110 or the server 120 in FIG. Figure 2 , the image processing method specifically comprises the following steps:

[0041] S202: Obtain an image to be processed.

[0042] The image to be processed is an image to be processed by the image processing method provided in the embodiment of the present application. The image to be processed can be an image collected in real time by an image acquisition device, or an existing image crawled from the Internet, or a video frame image separated from a video, etc.

[0043] Specifically, the computer device may obtain an image generated on the computer and use the image as the image to be processed. The computer device may also crawl an image from the network and use the image as the image to be processed. The computer device may also obtain an image transmitted by other computer devices and use the image as the image to be processed.

[0044] S204, performing semantic segmentation on the image to be processed to obtain a semantic segmentation image; the semantic segmentation image includes a target area and a non-target area obtained through semantic segmentation.

[0045] Among them, image semantic segmentation is to segment the pixels in the image according to the different semantics expressed. Image semantic segmentation is used to realize the division of the image into multiple pixel areas according to semantics. In essence, image semantic segmentation realizes the classification of the image at the pixel level, and the semantic annotation of the entire image is realized by classifying the pixels. It should be noted that the classification unit is not limited in the embodiment of the present invention, and it can be pixel-by-pixel classification or image block classification. An image block includes multiple pixels.

[0046] The target area is the area where the target is located in the image to be processed. The non-target area is the area remaining after excluding the target area in the image to be processed. The target can be a static target, such as a building, a tree, or a stationary table and chair. The target can also be a dynamic target, such as a natural person, an animal, or an airplane. The target can be a complete object, such as a natural human body or an entire building, or a partial object, such as a natural person's face, a natural person's hand, or a natural person's foot.

[0047] The number of objects in the image to be processed may be one or more than one. The number of object regions segmented from the image to be processed may be one or more than one.

[0048] Specifically, the computer device can encode the image to be processed into a semantic segmentation feature matrix, then decode the semantic segmentation feature matrix to obtain a semantic segmentation image, and then segment the target area from the semantic segmentation image according to the pixels belonging to the target category, and the remaining area is the non-target area. The pixels in the semantic segmentation image have pixel values ​​representing the semantic category to which they belong, and correspond to the pixels in the image to be processed.

[0049] Those skilled in the art can understand that the semantic segmentation feature matrix is ​​a low-dimensional expression of the semantic features of the image content in the image frame, covering the semantic feature information of the entire image frame. A semantically segmented image is an image segmented into several non-overlapping regions with certain semantics. The pixel values ​​of pixels in a semantically segmented image are used to reflect the semantic category to which the corresponding pixel belongs. The classification of pixels can be binary or multi-classified. Binary classification of pixels, such as pixels corresponding to roads and other pixels in a map image. Multi-classification of pixels, such as pixels corresponding to the sky, pixels corresponding to the earth, and pixels corresponding to people in a landscape map. The image size of the semantically segmented image is consistent with the image size of the original image frame. In this way, it can be understood that the acquired image frame is classified pixel by pixel, and the category affiliation of each pixel in the acquired image frame can be obtained according to the pixel values ​​of the pixels in the semantically segmented image.

[0050] It should be noted that the method of image semantic segmentation is not limited in the embodiments of the present application, as long as the target area and the non-target area can be divided from the image to be processed, such as the Deeplab method.

[0051] In one embodiment, the image to be processed is an image including a human body, the target area is a human body area, and the non-target area is a non-human body area. In this way, the computer device performs semantic segmentation on the image to be processed, and can divide the image to be processed into two parts: a human body area and a non-human body area. The divided human body area can be one or more than one.

[0052] For example, Figure 3 FIG. 4 is a schematic diagram showing image semantic segmentation in one embodiment. Figure 3 The computer device performs human semantic segmentation on the image to be processed 310, and performs semantic segmentation on the image to be processed 310 pixel by pixel to determine whether it belongs to human semantics, thereby obtaining a semantic segmentation image 320. The semantic segmentation image 320 includes a target area (white area) 321 and a non-target area (black area) 322.

[0053] S206, performing posture recognition on the image to be processed to obtain a posture recognition image in which the skeleton area is recognized.

[0054] The posture is the shape of the target in the image to be processed, such as the flying posture of an airplane, the walking posture of a natural person, or the running posture of an animal. The skeleton area is the area where the supporting structure of the target is located. The supporting structure of the target, such as the keel of an airplane or a building, or the skeleton of a natural person or an animal. The number of skeleton areas in the image to be processed can be one or more than one.

[0055] Specifically, the computer device detects the skeleton key points of the target in the image to be processed, predicts the skeleton area based on the skeleton key points, and obtains a posture recognition image in which the skeleton area is identified. It should be noted that the posture recognition method is not limited in the embodiment of the present application, as long as the skeleton area can be divided from the image to be processed. For example, the AlphaPose method or the OpenPose method.

[0056] In one embodiment, the image to be processed is an image including a human body, and the skeleton region is a human skeleton region. In this way, the computer device performs semantic segmentation on the image to be processed, and can divide the human skeleton region from the image to be processed. The divided human skeleton region can be one or more than one.

[0057] For example, Figure 4 FIG. 1 is a schematic diagram showing a human body posture recognition in one embodiment. Figure 4The computer device performs human posture recognition on the image to be processed 410 to obtain a posture recognition image 420. The posture recognition image 420 includes a human skeleton area (white area) 421.

[0058] S208, fusing the target area and the non-target area of ​​the semantic segmentation image with the skeleton area of ​​the gesture recognition image to obtain a tripartite map that divides the foreground area, the background area, and the area to be recognized.

[0059] Among them, the trimap is an image that marks the edge contours of the region division in the image, and is an image that provides constraint information for the image separation operation. Usually, the trimap includes three parts: the foreground area, the background area, and the area to be identified. The foreground area is the area where the content to be separated is located, the background area is the area where the content not to be separated is located, and the area to be identified is the area where it is uncertain whether it is the foreground area or the background area.

[0060] Specifically, the computer device may merge the target area and the non-target area of ​​the semantic segmentation image with the skeleton area of ​​the gesture recognition image to obtain a tripartite map that divides the foreground area, the background area, and the area to be recognized. For example, the computer device may use the non-target area in the semantic segmentation image as the background area, the area in the semantic segmentation image corresponding to the skeleton area of ​​the gesture recognition image as the foreground area, and the area in the target area excluding the foreground area as the area to be recognized, thereby obtaining a tripartite map that divides the foreground area, the background area, and the area to be recognized.

[0061] In one embodiment, in a scenario where high image separation accuracy is required or semantic segmentation accuracy is low, the computer device can use the semantic segmentation result as inspiration information to expand the part with inaccurate edges, and then generate a tripartite map based on the image after edge expansion.

[0062] Specifically, in one embodiment, S208 includes: in the semantic segmentation image, extending the regional boundary between the target area and the non-target area; using the non-target area remaining after the expansion in the semantic segmentation image as the background area, and using the area in the semantic segmentation image corresponding to the skeleton area of ​​the posture recognition image as the foreground area, to obtain a tripartite map that divides the foreground area, the background area, and the area to be identified; wherein the area to be identified in the tripartite map is the area remaining after excluding the background area and the foreground area in the semantic segmentation image.

[0063] In one embodiment, in a semantic segmentation image, the region boundary between the target area and the non-target area is extended, including: performing edge detection on the target area and the non-target area to obtain the region boundary between the target area and the non-target area; and extending the region boundary to both sides with the region boundary as the center in the semantic segmentation image.

[0064] Among them, the edge usually refers to the area of ​​the image where the intensity of a certain local area changes dramatically. The edge in this embodiment refers to the boundary between the target area and the non-target area in the semantic segmentation image. Specifically, the computer device can determine the regional boundary between the target area and the non-target area in the semantic segmentation image through an edge detection algorithm, and then expand the regional boundary to both sides in the semantic segmentation image with the regional boundary as the center. The purpose of such expansion is to use the result of semantic segmentation as inspiration information, and mark the part with inaccurate edges as the "unknown" part (i.e., the part to be identified) in the Trimap so as to continue processing in subsequent steps.

[0065] The edge detection algorithm is not limited in the embodiments of the present application, that is, it can perform edge detection. Edge extraction is actually a kind of filtering, and different operators have different extraction effects. There are three commonly used methods: Sobel operator, Laplacian operator and Canny operator.

[0066] Figure 5 FIG. 1 is a schematic diagram showing the principle of fusing a semantic segmentation image and a posture recognition image to obtain a tri-image in one embodiment. Figure 5 The semantic segmentation image 510 includes a target area 511 filled with white and a non-target area 512 filled with black. The computer device expands the region boundary of the target area 511 and the non-target area 512 in the semantic segmentation image 510, and the expanded semantic segmentation image 520 includes a target area 521 filled with white, an expansion area 522 filled with gray, and a non-target area 523 filled with black.

[0067] Furthermore, the computer device can use the non-target area remaining after expansion in the semantic segmentation image as the background area, the area in the semantic segmentation image corresponding to the skeleton area of ​​the posture recognition image as the foreground area, and the remaining area as the area to be recognized, so as to obtain a tripartite map that divides the foreground area, the background area and the area to be recognized.

[0068] Continue to refer Figure 5 , the gesture recognition image 530 includes a skeleton area 531 filled with white. The computer device can merge the extended semantic segmentation image 520 with the gesture recognition image 530, use the non-target area 523 of the extended semantic segmentation image 520 as the background area, use the extended area 522 as the area to be recognized, use the area in the target area 521 corresponding to the skeleton area 531 of the gesture recognition image 530 as the foreground area, and merge the remaining target area into the area to be recognized, so as to merge and obtain a trisection image 540. The trisection image 540 includes three parts: a foreground area 541 filled with white, an area to be recognized 542 filled with gray, and a background area 543.

[0069] In the above embodiment, specific steps are provided for generating a tripartite map using the results of semantic segmentation and posture recognition. Semantic segmentation technology is used to obtain a rough segmentation boundary of the foreground, and then posture estimation is used to extract the skeleton area. The result of the posture estimation is used as the determined foreground, and the semantic segmentation foreground is used as the uncertain area, so that a more accurate transparency mask image can be subsequently generated based on the tripartite map.

[0070] S210 , generating a transparency mask image for performing image separation on the image to be processed according to the image to be processed and the tripartite map.

[0071] Image separation refers to separating a part of an image from the image. Image separation can be commonly referred to as image cutout. A transparency mask image can also be referred to as a transparency mask, which is an image with transparency as the pixel value of a pixel point and is used to perform image separation on an image.

[0072] For example, the transparency mask image A of the image P uses a decimal between 0 and 1 to represent transparency (i.e., the pixel value of a pixel point), 1.0 represents complete opacity, 0.0 represents complete transparency, and other values ​​represent partial transparency. When the transparency mask image A is multiplied by the image P, the foreground part is actually multiplied by 1.0, so the value remains unchanged and is retained; the background part is actually multiplied by 0.0, and both become zero and are removed, thus completing the cutout.

[0073] It can be understood that when generating a tripartite map based on the image to be processed and the tripartite map, since the foreground area and the area to be identified divided in the current tripartite map are very inaccurate, in the case of insufficient local information (for example, the contrast is not strong enough, the noise is too large, or the subject background is flipped, etc.), an erroneous prediction may be made (for example, the background is judged as the foreground), and then the global information needs to be considered. Although the current tripartite map is rough, it already has the necessary foreground and background information. If the global information (for example, the color information of the adjacent background and foreground) can be referred to, it can assist the local prediction and avoid erroneous results. Therefore, in this embodiment, the target pixel points of the area to be identified in the image to be processed are globally sampled according to the tripartite map to generate a transparency mask image, which can improve the accuracy of the generated transparency mask image.

[0074] In one embodiment, S210 includes: performing global sampling of target pixels in the area to be identified in the image to be processed according to the triplicate map, selecting matching foreground pixels and background pixels for each target pixel; fusing the matching foreground pixels and background pixels of each target pixel to obtain the corresponding transparency of each target pixel; and generating a transparency mask image for image separation of the image to be processed according to the corresponding transparency of each pixel in the image to be processed.

[0075] Among them, global sampling refers to selecting the best candidate sample pair (Candidate Pair) for the pixel points in the area to be identified in the global candidate sample set (Global-sample-set). The global candidate sample set refers to the pixels in the area obtained by expanding the area to be identified to the foreground area and the background area. The candidate sample pair refers to the foreground pixel point and the background pixel point pair. When selecting the best candidate sample pair for the pixel point in the area to be identified, the distance between it and the pixel point in color space and geometric space is comprehensively considered.

[0076] Specifically, the computer device can determine a global candidate sample set and a region to be identified in the image to be processed according to the tripartite map, and then select matching foreground pixels and background pixels for target pixels in the region to be identified from the global candidate sample set. For each target pixel in the region to be identified, the computer device can fuse the matching foreground pixels and background pixels of the target pixel to obtain a fusion parameter, which is the corresponding transparency of the target pixel, that is, the pixel value of the pixel corresponding to the target pixel in the transparency mask image.

[0077] In addition, the computer device can also determine the foreground area and the background area in the image to be processed according to the tri-map, and set the corresponding transparency of the pixel points in the foreground area to 1 (i.e., opaque), which is the pixel value of the pixel point corresponding to the pixel point in the transparency mask image; and set the corresponding transparency of the pixel points in the background area to 0 (i.e., fully transparent), which is the pixel value of the pixel point corresponding to the pixel point in the transparency mask image; thereby obtaining a transparency mask image for image separation of the image to be processed.

[0078] For example, Figure 6 FIG. 1 is a schematic diagram showing a method of obtaining a transparency mask image according to an image to be processed and a tripartite map in an embodiment. Figure 6 It can be seen that after the image to be processed 610 and the tripartite image 620 are globally sampled (GlobalSample), a transparency mask image 630 can be obtained.

[0079] In this embodiment, the image to be processed is globally sampled according to the tripartite map, and global information can be referred to, thereby improving the accuracy of the generated transparency mask image.

[0080] It is understandable that the transparency mask image obtained by global sampling may also have uneven areas. In order to further improve the accuracy of the transparency mask image, the transparency mask image obtained by global sampling may be further post-processed.

[0081] In one embodiment, a transparency mask image for image separation of the image to be processed is generated according to the corresponding transparency of each pixel in the image to be processed, including: using the corresponding transparency of each pixel in the image to be processed as the pixel value of each pixel to generate an intermediate image; after filtering and performing image morphological operations on the intermediate image, a transparency mask image for image separation of the image to be processed is generated.

[0082] Among them, filtering refers to suppressing the noise of the image while retaining the image detail features as much as possible. The filtering operation in this embodiment can be specifically a guide filter. The image morphological operation is used to correct the morphology of the image. In this embodiment, the image morphological operation can be specifically dilation and erosion. Dilation is specifically an operation to find the local maximum value. Erosion is the opposite of dilation, and specifically an operation to find the local minimum value. In layman's terms, erosion means making the target area "thinner", and dilation means making the target area "fatter".

[0083] Specifically, after the computer device determines the corresponding transparency of each pixel in the image to be processed through global sampling according to the trigraph, the corresponding transparency of each pixel in the image to be processed is used as the pixel value of each pixel in the intermediate image to generate the intermediate image. The computer device can continue to perform guided filtering, dilation operation and erosion operation on the intermediate image to generate a transparency mask image. It can be understood that the intermediate image is also a transparency mask image, but the accuracy is lower than the transparency mask image obtained by post-processing.

[0084] For example, Figure 7 FIG. 1 is a schematic diagram showing post-processing of an intermediate image in one embodiment. Figure 7 It can be seen that after the guided filtering operation is performed on the intermediate image 710, the image accuracy is improved to a certain extent, and after dilation and erosion, the transparency mask image 720 is obtained, and the image accuracy is further improved.

[0085] In this embodiment, the accuracy of the generated transparency mask image is further improved through post-processing of filtering and image morphological operations.

[0086] In one embodiment, the image to be processed is an image including a human body, the target area is a human body area, the non-target area is a non-human body area, and the skeleton area is a human body skeleton area. According to the image to be processed and the tripartite map, a transparency mask image for image separation of the image to be processed is generated, including: according to the image to be processed and the tripartite map, a transparency mask image for portrait cutout of the image to be processed is generated.

[0087] After acquiring the image to be processed, the above-mentioned image processing method automatically performs image semantic segmentation on the image to be processed to obtain a semantic segmentation image, and automatically performs posture recognition on the image to be processed; since the obtained semantic segmentation image includes the target area and the non-target area obtained through semantic segmentation, and the obtained posture recognition image includes the skeleton area, the two frames of images can be automatically fused to obtain a tripartite map that divides the foreground area, the background area, and the area to be recognized, so that a transparency mask image for image separation of the image to be processed can be generated based on the image to be processed and the tripartite map. The entire process of generating the transparency mask image does not require user participation, which greatly improves the efficiency of generating the transparency mask image, thereby improving the efficiency of image processing.

[0088] In one embodiment, semantic segmentation is performed on an image to be processed to obtain a semantic segmentation image, including: inputting the image to be processed into an image semantic segmentation model; outputting a semantic category probability distribution matrix through the image semantic segmentation model; generating a semantic segmentation image according to the semantic category probability distribution matrix; wherein pixels in the semantic segmentation image have pixel values ​​representing the semantic category to which they belong and correspond to pixels in the image to be processed; pixels in a target area belong to the target semantic category; and pixels in a non-target area do not belong to the target semantic category.

[0089] Among them, the image semantic segmentation model is a machine learning model that has semantic segmentation function after training. The full name of machine learning is Machine Learning, or ML for short. Machine learning models can have specific capabilities through sample learning. Machine learning models can use neural network models, support vector machines, or logistic regression models. Neural network models include convolutional neural networks, etc.

[0090] It should be noted that the image semantic segmentation model can be generally understood as a classifier, which is used to classify the pixels included in the image of the input model pixel by pixel. The number of classification categories of the image semantic segmentation model can be customized during training. In the present embodiment, the image semantic segmentation model is set as a binary classifier, and the classification categories include two types: target category and non-target category. The pixels belonging to the target category in the image of the input model are the pixels of the target area, and the pixels that do not belong to the target category are the pixels of the non-target area. In this way, the computer device can divide the pixels according to the semantic category to which the pixels belong, and segment the target area and the non-target area in the image to be processed.

[0091] The matrix elements of the semantic category probability distribution matrix have probability values ​​representing the target category and correspond to the pixels in the image of the input model (i.e., the image to be processed). In other words, assuming that the pixel size of the image to be processed is 2*2, the matrix size of the semantic category probability distribution matrix is ​​also 2*2, and the matrix element value of the matrix position (m,n) is the probability that the pixel at the pixel position (m,n) in the image to be processed belongs to the target category. Among them, the matrix (image frame) has the matrix position (pixel position) of the upper left corner as (0,0).

[0092] Specifically, the computer device can input the image to be processed into a pre-trained image semantic segmentation model, and output a semantic category probability distribution matrix through the image semantic segmentation model. The computer device can then determine the area surrounded by the pixel points corresponding to the matrix elements with probability values ​​greater than the preset probability in the semantic category probability distribution matrix as the target area, so that the remaining area in the image to be processed is the non-target area. Among them, the preset probability is a pre-set demarcation value for determining whether it is classified as a target category.

[0093] The image semantic segmentation model is trained by supervised training. Specifically, the computer device can obtain training samples and determine the training labels corresponding to each training sample, that is, the semantic category of each pixel in each training sample, so as to perform supervised training according to the training samples and the corresponding training labels.

[0094] In an embodiment, after the image to be processed is acquired, the image is automatically input into a trained machine learning model, and the target area and non-target area are determined according to the semantic category probability distribution matrix output by the machine learning model. Among them, the matrix elements in the semantic category probability distribution matrix have probability values ​​indicating that the corresponding pixel points in the image frame belong to the target category, so that the target area can be automatically determined according to the pixel points belonging to the target category, which improves the accuracy of image area division and lays a foundation for subsequent processing.

[0095] In one embodiment, posture recognition is performed on an image to be processed to obtain a posture recognition image in which a skeleton region is identified, including: inputting the image to be processed into a posture recognition model; determining skeleton key points of a target in the image to be processed through a hidden layer of the posture recognition model; outputting a posture recognition image in which a skeleton region is identified through the posture recognition model; and the skeleton region is predicted based on the skeleton key points.

[0096] Among them, the posture recognition model is a machine learning model that has posture recognition function after training. Skeleton key points refer to the location points of key parts on the skeleton. Skeleton key points include: key location points of key parts such as head, shoulders, elbows, hands, waist, knee joints or ankle joints. The area where the lines between skeleton key points are located is the skeleton area.

[0097] Hidden layer is a term in the neural network model, which is the middle layer relative to the input layer and the output layer. The hidden layer includes the model parameters obtained by training the neural network model. Here, the hidden layer of the posture recognition model is the middle layer relative to the input layer of the posture recognition model and the output layer of the posture recognition model. All the middle layers between the input layer and the output layer of the posture recognition model can be collectively referred to as hidden layers, and these middle layers can also be divided, that is, multiple hidden layers. The hidden layer of the posture recognition model may include a multi-layer neural network structure. Each layer of the neural network structure may include one or more neural network layers.

[0098] The hidden layer in the neural network model is used to extract features or transform features of the input. For example, the hidden layer of the posture recognition model can extract skeleton feature points or identify target areas of the input image.

[0099] In one embodiment, the skeleton key points of the target in the image to be processed are determined through the hidden layer of the posture recognition model, including: dividing the image area where the target in the image to be processed is located through the first hidden layer of the posture recognition model; and determining the skeleton key points in the image area through the second hidden layer of the posture recognition model.

[0100] Specifically, the gesture recognition model may include more than one hidden layer, and different hidden layers have different functions. The computer device may first divide the image area where the target in the image to be processed is located through the first hidden layer of the gesture recognition model, and then determine the skeleton key points in the divided image area where the target is located through the second hidden layer of the gesture recognition model. Among them, the number of hidden layers included in the first hidden layer can be one or more than one layer, and the number of hidden layers included in the second hidden layer can be one or more than one layer. In the model structure, the first hidden layer is located before the second hidden layer. There may also be a hidden layer between the first hidden layer and the second hidden layer.

[0101] When the number of objects in the image to be processed is more than one, the number of image regions divided by the first hidden layer of the gesture recognition model is also more than one. At this time, the second hidden layer of the gesture recognition model can determine the skeleton key points in each image region.

[0102] It can be understood that the method for determining the skeleton key points of the target in the image to be processed in this embodiment is a top-down skeleton key point positioning method, that is, firstly each target is detected by target detection, and then skeleton key point detection is performed on the area where the single target is located based on the detection frame.

[0103] In one embodiment, the skeleton key points of the target in the image to be processed are determined through the hidden layer of the posture recognition model, including: determining the skeleton key points in the image to be processed through the first hidden layer of the posture recognition model; clustering the skeleton key points according to the target through the second hidden layer of the posture recognition model to obtain the skeleton key points corresponding to each target; wherein a skeleton area is predicted based on the skeleton key points corresponding to a target.

[0104] Specifically, the posture recognition model may include more than one hidden layer, and different hidden layers have different functions. The computer device may determine the skeleton key points in the image to be processed through the first hidden layer of the posture recognition model, and then cluster the skeleton key points according to the target through the second hidden layer of the posture recognition model to obtain the skeleton key points corresponding to each target. Among them, the number of hidden layers included in the first hidden layer may be one or more than one layer, and the number of hidden layers included in the second hidden layer may be one or more than one layer. In the model structure, the first hidden layer is located before the second hidden layer. There may also be a hidden layer between the first hidden layer and the second hidden layer.

[0105] When the number of objects in the image to be processed is more than one, the second hidden layer of the gesture recognition model clusters the determined skeleton key points, and the number of skeleton key point groups that can be obtained is also more than one. At this time, one skeleton key point group belongs to one cluster.

[0106] It can be understood that the method for determining the skeleton key points of the target in the image to be processed in this embodiment is a bottom-up skeleton key point positioning method, that is, firstly all the skeleton key points in the image to be processed are detected, and then these skeleton key points are clustered into different targets.

[0107] Furthermore, the computer device may continue to determine the skeleton region of each target according to the skeleton key points belonging to each target through the hidden layer of the posture recognition model, and then output a posture recognition image in which the skeleton region is identified.

[0108] The posture recognition model is trained by supervised training. Specifically, the computer device can obtain training samples and determine the training labels corresponding to each training sample, that is, the image with the skeleton area marked corresponding to each training sample, so as to perform supervised training according to the training samples and the corresponding training labels.

[0109] In the above embodiment, after the image to be processed is obtained, the image is automatically input into the trained machine learning model, and the posture recognition image of the skeleton area is recognized according to the output of the machine learning model. In this way, the skeleton area in the posture recognition image can be used as the determined foreground area, laying the foundation for the subsequent generation of the tripartite map.

[0110] In one embodiment, the image to be processed is subjected to image semantic segmentation to obtain a semantic segmentation image, including: inputting the image to be processed into an image processing model; and obtaining the semantic segmentation image through the semantic segmentation branch of the image processing model. The image to be processed is subjected to posture recognition to obtain a posture recognition image in which a skeleton area is recognized, including: obtaining the posture recognition image through the posture recognition branch of the image processing model; wherein the pixel points in the semantic segmentation image have pixel values ​​representing the semantic category to which they belong, and correspond to the pixel points in the image to be processed; the pixel points in the target area belong to the target semantic category; the pixel points in the non-target area do not belong to the target semantic category; and the skeleton area included in the posture recognition image is predicted based on the skeleton key points.

[0111] It can be understood that in this embodiment, the image processing model includes a common structure in front and two parallel task branches in the back, and the output of the common structure outputs the two parallel task branches respectively. Among them, the common structure is used to extract image features from the image to be processed. The parallel task branches are a semantic segmentation branch and a gesture recognition branch. The semantic segmentation branch performs image semantic segmentation based on the extracted image features, and the gesture recognition branch performs gesture recognition based on the extracted image features.

[0112] When training the image processing model, the parallel task branches can be trained separately. That is, the model parameters of the semantic segmentation branch are fixed, the loss function of the posture recognition branch is constructed, and the common structure and posture estimation branches are trained; the model parameters of the posture recognition branch are fixed, the loss function of the semantic segmentation branch is constructed, and the common structure and semantic segmentation branches are trained. When training the image processing model, the parallel task branches can also be trained simultaneously, that is, the joint loss function of the posture recognition branch and the semantic segmentation branch is constructed, and the common structure, semantic segmentation branch, and posture recognition branch are trained simultaneously.

[0113] In this embodiment, a multi-task approach is adopted to perform joint training and prediction, so that during prediction, the results of semantic segmentation and posture estimation can be obtained at one time, further improving efficiency.

[0114] In one embodiment, the image processing method further includes: performing calculations on pixel values ​​of pixels in the image to be processed and pixel values ​​of corresponding pixels in the transparency mask image, and separating a foreground area from the image to be processed according to the calculation results.

[0115] Among them, the transparency mask image is an image used to describe the foreground and background of the image to be processed, and has the same size as the image to be processed. The pixel values ​​of the pixels in the transparency mask image corresponding to the foreground pixels in the image to be processed are transparency values ​​indicating transparency; the pixel values ​​of the pixels in the transparency mask image corresponding to the background pixels in the image to be processed are transparency values ​​indicating opacity. In this way, when the image to be processed is separated by the transparency mask image, the foreground part of the image to be processed is actually multiplied by the transparency value indicating transparency, and the pixel value remains unchanged and is thus retained. The background part of the image to be processed is actually multiplied by the transparency value indicating opacity, and the pixel value changes and is initially removed, thus completing the image separation.

[0116] Specifically, after obtaining the transparency mask image used to separate the image to be processed, the computer device can multiply the image to be processed and the pixels in the transparency mask image bit by bit, that is, multiply the pixel values ​​of the pixels in the image to be processed with the pixel values ​​of the corresponding pixels in the transparency mask image, thereby separating the foreground area from the image to be processed according to the multiplication result.

[0117] For example, Figure 8 FIG. 1 is a schematic diagram of performing image separation on an image to be processed by using a transparency mask image in one embodiment. Figure 8 After the image to be processed 820 is processed by the transparency mask image 810, the target image 830 can be obtained. It can be clearly seen that the foreground area in the target image 830 is retained (ie, separated), and the background part is removed by covering it with black.

[0118] In this embodiment, the image to be processed is processed by using a transparency mask image to separate the foreground area, thereby completing image separation efficiently and laying a foundation for subsequent image editing processing.

[0119] In a specific embodiment, the computer device also compares the target image obtained by performing human body cutout on the human body image in the embodiment of the present application with the cutout effect of the target image obtained by performing human body cutout on the human body image in other ways. Fig. 9 , Fig. 9 (a) is based on Figure 5 The target image is obtained by performing human body cutout on the expanded semantic segmentation image 520. Fig. 9 (b) is based on Figure 5 The target image is obtained by performing human body cutout on the semantic segmentation image 510. Fig. 9 (c) is based on Figure 5 The target image is obtained by performing human body cutout on the middle three-dimensional image 540. Fig. 9 (d) is based on Figure 7The target image is obtained by performing human body cutout on the medium transparency mask image 720. Fig. 9 (e) is based on Figure 5 In the semantic segmentation image 510, a transparency mask image is generated by using a deep learning algorithm (Deep Image Matting) and then a human body is cut out to obtain the target image. Fig. 9 It can be clearly seen from the figures in Fig. 9 The cutout effect of (d) is the best, that is, the transparency mask image obtained according to the embodiment of the present application has the best effect for human body cutout.

[0120] In one embodiment, obtaining the image to be processed includes: obtaining the video to be processed; using the video frames included in the video to be processed as the image to be processed. The image processing method also includes: performing an editing operation on the image to be processed with the foreground area separated to obtain a corresponding edited image; generating a target video based on the edited image and then sharing it.

[0121] The video to be processed may be a video acquired in real time by an image acquisition device, an existing video crawled from the Internet, a video segment separated from an existing video, or a video synthesized by more than one frame of images.

[0122] Specifically, after acquiring the video to be processed, the computer device can use the video frames included in the video to be processed as the images to be processed, and perform the steps of processing the images to be processed in the above embodiment for each frame of the image to be processed. The computer device can use all the video frames included in the video frames to be processed as the images to be processed, or the computer device can select a video frame from the video frames included in the video frames to be processed as the images to be processed.

[0123] Furthermore, the computer device can perform an editing operation on the image to be processed with the foreground area separated, obtain a corresponding edited image, and then generate a target video based on the edited image. When the computer device does not use each video frame in the video to be processed as the video to be processed, the computer device can also generate a target video based on the video frames that are not used as the image to be processed and the generated edited image; of course, the computer device can also generate a target video based only on the edited image. Among them, the editing operation includes changing the background, splicing the foreground, or copying the foreground.

[0124] The computer device can save the generated target video locally, or transmit it to other computer devices, or share it through social applications, etc. Sharing the target video can be sharing in a social session, or publishing it on a social content publishing platform, etc.

[0125] For example, a user can record a video in real time through a social application running on a terminal, process the recorded video as a to-be-processed video, and share the target video in a social application after obtaining the target video. Social applications include short video recording applications.

[0126] It should be understood that, although each step in the flow chart of the above-mentioned embodiments is shown in sequence according to the indication of the arrows, these steps are not necessarily performed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be performed in other orders. Moreover, at least a part of the steps in the above-mentioned embodiments may include a plurality of sub-steps or a plurality of stages, and these sub-steps or stages are not necessarily performed at the same time, but can be performed at different times, and the execution order of these sub-steps or stages is not necessarily performed in sequence, but can be performed in turn or alternately with at least a part of other steps or sub-steps or stages of other steps.

[0127] like Fig.10 As shown, in one embodiment, an image processing apparatus 1000 is provided. Fig.10 The image processing device 1000 includes: an acquisition module 1001, a semantic segmentation module 1002, a posture recognition module 1003, a fusion module 1004 and a generation module 1005.

[0128] The acquisition module 1001 is used to acquire the image to be processed.

[0129] The semantic segmentation module 1002 is used to perform semantic segmentation on the image to be processed to obtain a semantic segmentation image; the semantic segmentation image includes a target area and a non-target area obtained through semantic segmentation.

[0130] The posture recognition module 1003 is used to perform posture recognition on the image to be processed to obtain a posture recognition image in which the skeleton area is recognized.

[0131] The fusion module 1004 is used to fuse the target area and non-target area of ​​the semantic segmentation image with the skeleton area of ​​the gesture recognition image to obtain a tripartite map that divides the foreground area, the background area, and the area to be recognized.

[0132] The generating module 1005 is used to generate a transparency mask image for image separation of the image to be processed according to the image to be processed and the tripartite map.

[0133] In one embodiment, the semantic segmentation module 1002 is also used to input the image to be processed into the image semantic segmentation model; output the semantic category probability distribution matrix through the image semantic segmentation model; generate a semantic segmentation image according to the semantic category probability distribution matrix; wherein the pixel points in the semantic segmentation image have pixel values ​​representing the semantic category to which they belong and correspond to the pixel points in the image to be processed; the pixel points in the target area belong to the target semantic category; and the pixel points in the non-target area do not belong to the target semantic category.

[0134] In one embodiment, the posture recognition module 1003 is also used to input the image to be processed into a posture recognition model; determine the skeleton key points of the target in the image to be processed through the hidden layer of the posture recognition model; output a posture recognition image of the skeleton area through the posture recognition model; and the skeleton area is predicted based on the skeleton key points.

[0135] In one embodiment, the gesture recognition module 1003 is further used to divide the image region where the target is located in the image to be processed through the first hidden layer of the gesture recognition model; and determine the skeleton key points in the image region through the second hidden layer of the gesture recognition model.

[0136] In one embodiment, the posture recognition module 1003 is also used to determine the skeleton key points in the image to be processed through the first hidden layer of the posture recognition model; cluster the skeleton key points according to the target through the second hidden layer of the posture recognition model to obtain the skeleton key points corresponding to each target; wherein a skeleton area is predicted based on the skeleton key points corresponding to a target.

[0137] In one embodiment, the fusion module 1004 is also used to expand the regional boundary between the target area and the non-target area in the semantic segmentation image; the non-target area remaining after the expansion in the semantic segmentation image is used as the background area, and the area in the semantic segmentation image corresponding to the skeleton area of ​​the posture recognition image is used as the foreground area, to obtain a tripartite map divided into a foreground area, a background area and an area to be identified; wherein the area to be identified in the tripartite map is the area remaining after excluding the background area and the foreground area in the semantic segmentation image.

[0138] In one embodiment, the fusion module 1004 is further used to perform edge detection on the target area and the non-target area to obtain the region boundary between the target area and the non-target area; in the semantic segmentation image, the region boundary is centered and expanded to both sides.

[0139] In one embodiment, the generation module 1005 is also used to perform global sampling of target pixel points in the area to be identified in the processed image according to the triplicate map, select matching foreground pixel points and background pixel points for each target pixel point; fuse the matching foreground pixel points and background pixel points of each target pixel point to obtain the corresponding transparency of each target pixel point; and generate a transparency mask image for image separation of the processed image according to the corresponding transparency of each pixel point in the triplicate map.

[0140] In one embodiment, the generation module 1005 is also used to use the corresponding transparency of each pixel in the trigraph as the pixel value of each pixel to generate an intermediate image; after filtering and image morphological operations are performed on the intermediate image, a transparency mask image is generated for image separation of the image to be processed.

[0141] In one embodiment, the target area is a human body area; the non-target area is a non-human body area. The posture recognition module 1003 is also used to perform human posture recognition on the image to be processed to obtain a posture recognition image in which the human skeleton area is recognized. The generation module 1005 is also used to generate a transparency mask image for performing portrait cutout on the image to be processed based on the image to be processed and the tripartite map.

[0142] like Fig.11 As shown, in one embodiment, the image processing device 1000 further includes: a separation module 1006, which is used to calculate the pixel value of the pixel point in the image to be processed and the pixel value of the corresponding pixel point in the transparency mask image, and separate the foreground area from the image to be processed according to the calculation result.

[0143] In one embodiment, the acquisition module 1001 is further used to acquire the video to be processed; the video frames included in the video to be processed are used as the image to be processed. The separation module 1006 is further used to edit the image to be processed with the foreground area separated to obtain a corresponding edited image; and the target video is generated according to the edited image and then shared.

[0144] In one embodiment, the semantic segmentation module 1002 is further used to input the image to be processed into the image processing model; the semantic segmentation image is obtained through the semantic segmentation branch of the image processing model. The posture recognition module 1003 is further used to obtain the posture recognition image through the posture recognition branch of the image processing model; wherein the pixel points in the semantic segmentation image have pixel values ​​representing the semantic category to which they belong and correspond to the pixel points in the image to be processed; the pixel points in the target area belong to the target semantic category; the pixel points in the non-target area do not belong to the target semantic category; the skeleton area included in the posture recognition image is predicted based on the skeleton key points.

[0145] After acquiring the image to be processed, the above-mentioned image processing device 1000 automatically performs image semantic segmentation on the image to be processed to obtain a semantic segmentation image, and automatically performs posture recognition on the image to be processed; since the obtained semantic segmentation image includes the target area and the non-target area obtained through semantic segmentation, and the obtained posture recognition image includes the skeleton area, the two frames of images can be automatically fused to obtain a tripartite map that divides the foreground area, the background area, and the area to be recognized, so that a transparency mask image for image separation of the image to be processed can be generated based on the image to be processed and the tripartite map. The entire process of generating the transparency mask image does not require user participation, which greatly improves the efficiency of generating the transparency mask image, thereby improving the efficiency of image processing.

[0146] Fig.12 The internal structure diagram of a computer device in one embodiment is shown. The computer device may specifically be Figure 1 The terminal 110 or the server 120 in FIG. Fig.12 As shown, the computer device includes a processor, a memory and a network interface connected via a system bus. The memory includes a non-volatile storage medium and an internal memory. The non-volatile storage medium of the computer device stores an operating system and may also store a computer program. When the computer program is executed by the processor, the processor can implement the image processing method. The internal memory may also store a computer program. When the computer program is executed by the processor, the processor can implement the image processing method. Those skilled in the art can understand that Fig.12 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0147] In one embodiment, the image processing apparatus provided by the present application can be implemented in the form of a computer program. The computer program can be Fig.12 The computer device shown in the figure is run on the computer device. The memory of the computer device can store various program modules constituting the image processing device, such as: Fig.10 The acquisition module 1001, semantic segmentation module 1002, gesture recognition module 1003, fusion module 1004 and generation module 1005 are shown. The computer program composed of various program modules enables the processor to execute the steps of the image processing method of each embodiment of the present application described in this specification.

[0148] For example, Fig.12 The computer device shown can be Fig.10The acquisition module 1001 in the image processing device 1000 shown acquires the image to be processed. The semantic segmentation module 1002 performs image semantic segmentation on the image to be processed to obtain a semantic segmentation image; the semantic segmentation image includes the target area and the non-target area obtained through semantic segmentation. The posture recognition module 1003 performs posture recognition on the image to be processed to obtain a posture recognition image in which the skeleton area is recognized. The fusion module 1004 fuses the target area and the non-target area of ​​the semantic segmentation image with the skeleton area of ​​the posture recognition image to obtain a tripartite map that divides the foreground area, the background area and the area to be recognized. The generation module 1005 generates a transparency mask image for image separation of the image to be processed based on the image to be processed and the tripartite map.

[0149] In one embodiment, a computer device is provided, including a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor executes the steps of the above-mentioned image processing method. The steps of the image processing method here may be the steps of the image processing method in the above-mentioned various embodiments.

[0150] In one embodiment, a computer-readable storage medium is provided, which stores a computer program, and when the computer program is executed by a processor, the processor executes the steps of the above-mentioned image processing method. The steps of the image processing method here can be the steps in the image processing method of each of the above-mentioned embodiments.

[0151] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the program can be stored in a non-volatile computer-readable storage medium. When the program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).

[0152] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0153] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.

Claims

1. An image processing method, comprising: Get the image to be processed; Performing image semantic segmentation on the image to be processed to obtain a semantic segmentation image; the semantic segmentation image includes a target area and a non-target area obtained through semantic segmentation; Inputting the image to be processed into a gesture recognition model; Dividing the image area where the target is located in the image to be processed through the first hidden layer of the gesture recognition model; Determining skeleton key points in the image region through a second hidden layer of the gesture recognition model; Outputting a posture recognition image of a skeleton area through the posture recognition model; The skeleton region is predicted based on the skeleton key points; The target area and the non-target area of ​​the semantic segmentation image are fused with the skeleton area of ​​the posture recognition image to obtain a tripartite map that divides the foreground area, the background area, and the area to be recognized; A transparency mask image for performing image separation on the image to be processed is generated according to the image to be processed and the tripartite map.

2. The method according to claim 1, characterized in that The step of performing image semantic segmentation on the image to be processed to obtain a semantic segmentation image includes: Inputting the image to be processed into an image semantic segmentation model; Outputting a semantic category probability distribution matrix through the image semantic segmentation model; Generate a semantic segmentation image according to the semantic category probability distribution matrix; Among them, the pixel points in the semantic segmentation image have pixel values ​​representing the semantic category to which they belong and correspond to the pixel points in the image to be processed; the pixel points in the target area belong to the target semantic category; and the pixel points in the non-target area do not belong to the target semantic category.

3. The method according to claim 1, characterized in that The step of fusing the target area and the non-target area of ​​the semantic segmentation image with the skeleton area of ​​the posture recognition image to obtain a tripartite map that divides the foreground area, the background area, and the area to be recognized includes: In the semantic segmentation image, extending a region boundary between the target region and the non-target region; The remaining non-target area in the semantic segmentation image after expansion is used as the background area, and the area in the semantic segmentation image corresponding to the skeleton area of ​​the gesture recognition image is used as the foreground area, to obtain a tripartite map that divides the foreground area, the background area, and the area to be recognized; The to-be-identified area of ​​the tri-image is the remaining area in the semantic segmentation image after excluding the background area and the foreground area.

4. The method according to claim 3, characterized in that The step of extending the region boundary between the target region and the non-target region in the semantic segmentation image includes: Performing edge detection on the target area and the non-target area to obtain a region boundary between the target area and the non-target area; In the semantic segmentation image, the region boundary is expanded to both sides with the region boundary as the center.

5. The method according to claim 1, characterized in that The step of generating a transparency mask image for performing image separation on the image to be processed according to the image to be processed and the trisection image comprises: Performing global sampling of target pixel points in the to-be-recognized area in the to-be-processed image according to the trisection map, and selecting matching foreground pixel points and background pixel points for each of the target pixel points; Fusion of foreground pixels and background pixels that match the target pixels to obtain the corresponding transparency of the target pixels; A transparency mask image for performing image separation on the image to be processed is generated according to the corresponding transparency of each pixel in the trisection image.

6. The method according to claim 5, characterized in that The step of generating a transparency mask image for image separation of the image to be processed according to the corresponding transparency of each pixel in the trisection image comprises: Using the transparency of each pixel in the three-part image as the pixel value of each pixel to generate an intermediate image; After filtering and image morphological operations are performed on the intermediate image, a transparency mask image is generated for image separation of the image to be processed.

7. The method according to claim 1, characterized in that The target area is a human body area, the non-target area is a non-human body area, the posture recognition is human body posture recognition, and the posture recognition image that recognizes the skeleton area is a posture recognition image that recognizes the human body skeleton area; The step of generating a transparency mask image for performing image separation on the image to be processed according to the image to be processed and the trisection image comprises: A transparency mask image for performing portrait cutout on the image to be processed is generated according to the image to be processed and the trisection image.

8. The method according to any one of claims 1 to 7, characterized in that The method further comprises: The pixel values ​​of the pixels in the image to be processed are calculated with the pixel values ​​of the corresponding pixels in the transparency mask image, and the foreground area is separated from the image to be processed according to the calculation result.

9. The method according to claim 8, characterized in that The obtaining of the image to be processed comprises: Get the video to be processed; Using the video frames included in the video to be processed as images to be processed; The method further comprises: Performing an editing operation on the image to be processed from which the foreground area is separated to obtain a corresponding edited image; A target video is generated based on the edited image and then shared.

10. An image processing method, comprising: Get the image to be processed; Performing image semantic segmentation on the image to be processed to obtain a semantic segmentation image; the semantic segmentation image includes a target area and a non-target area obtained through semantic segmentation; Inputting the image to be processed into a gesture recognition model; Determining skeleton key points in the image to be processed through the first hidden layer of the posture recognition model; Clustering the skeleton key points according to the objects in the image to be processed through the second hidden layer of the posture recognition model to obtain the skeleton key points corresponding to each object; Outputting a posture recognition image of a skeleton area through the posture recognition model; The skeleton region is predicted based on the skeleton key points corresponding to the target; The target area and the non-target area of ​​the semantic segmentation image are fused with the skeleton area of ​​the posture recognition image to obtain a tripartite map that divides the foreground area, the background area, and the area to be recognized; A transparency mask image for performing image separation on the image to be processed is generated according to the image to be processed and the tripartite map.

11. The method according to claim 10, characterized in that The step of performing image semantic segmentation on the image to be processed to obtain a semantic segmentation image includes: Inputting the image to be processed into an image semantic segmentation model; Outputting a semantic category probability distribution matrix through the image semantic segmentation model; Generate a semantic segmentation image according to the semantic category probability distribution matrix; Among them, the pixel points in the semantic segmentation image have pixel values ​​representing the semantic category to which they belong and correspond to the pixel points in the image to be processed; the pixel points in the target area belong to the target semantic category; and the pixel points in the non-target area do not belong to the target semantic category.

12. The method according to claim 10, characterized in that The step of fusing the target area and the non-target area of ​​the semantic segmentation image with the skeleton area of ​​the posture recognition image to obtain a tripartite map that divides the foreground area, the background area, and the area to be recognized includes: In the semantic segmentation image, extending a region boundary between the target region and the non-target region; The remaining non-target area in the semantic segmentation image after expansion is used as the background area, and the area in the semantic segmentation image corresponding to the skeleton area of ​​the gesture recognition image is used as the foreground area, to obtain a tripartite map that divides the foreground area, the background area, and the area to be recognized; The to-be-identified area of ​​the tri-image is the remaining area in the semantic segmentation image after excluding the background area and the foreground area.

13. The method according to claim 12, characterized in that The step of extending the region boundary between the target region and the non-target region in the semantic segmentation image includes: Performing edge detection on the target area and the non-target area to obtain a region boundary between the target area and the non-target area; In the semantic segmentation image, the region boundary is expanded to both sides with the region boundary as the center.

14. The method according to claim 10, characterized in that The step of generating a transparency mask image for performing image separation on the image to be processed according to the image to be processed and the trisection image comprises: Performing global sampling of target pixel points in the to-be-recognized area in the to-be-processed image according to the trisection map, and selecting matching foreground pixel points and background pixel points for each of the target pixel points; Fusion of foreground pixels and background pixels that match the target pixels to obtain the corresponding transparency of the target pixels; A transparency mask image for performing image separation on the image to be processed is generated according to the corresponding transparency of each pixel in the trisection image.

15. The method according to claim 14, characterized in that The step of generating a transparency mask image for image separation of the image to be processed according to the corresponding transparency of each pixel in the trisection image comprises: Using the transparency of each pixel in the three-part image as the pixel value of each pixel to generate an intermediate image; After filtering and image morphological operations are performed on the intermediate image, a transparency mask image is generated for image separation of the image to be processed.

16. The method according to claim 10, characterized in that The target area is a human body area; the non-target area is a non-human body area; the posture recognition is human body posture recognition, and the posture recognition image that recognizes the skeleton area is a posture recognition image that recognizes the human body skeleton area; The step of generating a transparency mask image for performing image separation on the image to be processed according to the image to be processed and the trisection image comprises: A transparency mask image for performing portrait cutout on the image to be processed is generated according to the image to be processed and the trisection image.

17. The method according to any one of claims 10 to 16, characterized in that The method further comprises: The pixel values ​​of the pixels in the image to be processed are calculated with the pixel values ​​of the corresponding pixels in the transparency mask image, and the foreground area is separated from the image to be processed according to the calculation result.

18. The method according to claim 17, characterized in that The obtaining of the image to be processed comprises: Get the video to be processed; Using the video frames included in the video to be processed as images to be processed; The method further comprises: Performing an editing operation on the image to be processed from which the foreground area is separated to obtain a corresponding edited image; A target video is generated based on the edited image and then shared.

19. An image processing device, comprising: An acquisition module, used for acquiring an image to be processed; A semantic segmentation module, used for performing image semantic segmentation on the image to be processed to obtain a semantic segmentation image; the semantic segmentation image includes a target area and a non-target area obtained through semantic segmentation; A posture recognition module is used to input the image to be processed into a posture recognition model; divide the image area where the target in the image to be processed is located through the first hidden layer of the posture recognition model; and determine the skeleton key points in the image area through the second hidden layer of the posture recognition model; A posture recognition image of a skeleton region is outputted by the posture recognition model; the skeleton region is predicted based on the skeleton key points; A fusion module, used to fuse the target area and the non-target area of ​​the semantic segmentation image with the skeleton area of ​​the posture recognition image to obtain a tripartite map that divides the foreground area, the background area, and the area to be recognized; A generating module is used to generate a transparency mask image for image separation of the image to be processed according to the image to be processed and the tripartite map.

20. The device according to claim 19, characterized in that The semantic segmentation module is also used to input the image to be processed into an image semantic segmentation model; output a semantic category probability distribution matrix through the image semantic segmentation model; generate a semantic segmentation image according to the semantic category probability distribution matrix; wherein the pixel points in the semantic segmentation image have pixel values ​​representing the semantic category to which they belong and correspond to the pixel points in the image to be processed; the pixel points in the target area belong to the target semantic category; and the pixel points in the non-target area do not belong to the target semantic category.

21. The device according to claim 20, characterized in that The fusion module is also used to expand the regional boundary between the target area and the non-target area in the semantic segmentation image; use the non-target area remaining after the expansion in the semantic segmentation image as the background area, and use the area in the semantic segmentation image corresponding to the skeleton area of ​​the posture recognition image as the foreground area, to obtain a tripartite map divided into a foreground area, a background area and an area to be identified; wherein the area to be identified in the tripartite map is the area remaining after excluding the background area and the foreground area in the semantic segmentation image.

22. The device according to claim 21, characterized in that The fusion module is also used to perform edge detection on the target area and the non-target area to obtain a region boundary between the target area and the non-target area; and expand the region boundary to both sides with the region boundary as the center in the semantic segmentation image.

23. The device according to claim 19, characterized in that The generation module is also used to perform global sampling of target pixel points in the area to be identified in the image to be processed according to the tripartite map, select matching foreground pixel points and background pixel points for each target pixel point; fuse the matching foreground pixel points and background pixel points of each target pixel point to obtain the corresponding transparency of each target pixel point; and generate a transparency mask image for image separation of the image to be processed according to the corresponding transparency of each pixel point in the tripartite map.

24. The device according to claim 23, characterized in that The generation module is also used to use the corresponding transparency of each pixel in the three-part image as the pixel value of each pixel to generate an intermediate image; after filtering and image morphological operations are performed on the intermediate image, a transparency mask image is generated for image separation of the image to be processed.

25. The device according to claim 19, characterized in that The target area is a human body area, the non-target area is a non-human body area, the posture recognition is human body posture recognition, and the posture recognition image that recognizes the skeleton area is a posture recognition image that recognizes the human body skeleton area; The generating module is further used to generate a transparency mask image for performing portrait cutout on the image to be processed according to the image to be processed and the tripartite map.

26. The device according to any one of claims 19 to 25, characterized in that The device further comprises: a separation module, which is used to calculate the pixel values ​​of the pixels in the image to be processed and the pixel values ​​of the corresponding pixels in the transparency mask image, and to separate the foreground area from the image to be processed according to the calculation result.

27. The device according to claim 26, characterized in that The acquisition module is also used to acquire the video to be processed; and use the video frames included in the video to be processed as the image to be processed; The separation module is also used to perform an editing operation on the image to be processed from which the foreground area is separated to obtain a corresponding edited image; and to generate a target video based on the edited image and then share it.

28. An image processing device, comprising: An acquisition module, used for acquiring an image to be processed; A semantic segmentation module, used for performing image semantic segmentation on the image to be processed to obtain a semantic segmentation image; the semantic segmentation image includes a target area and a non-target area obtained through semantic segmentation; A posture recognition module, used for inputting the image to be processed into a posture recognition model; determining skeleton key points in the image to be processed through the first hidden layer of the posture recognition model; Clustering the skeleton key points according to the objects in the image to be processed through the second hidden layer of the posture recognition model to obtain the skeleton key points corresponding to each object; Outputting a posture recognition image of a skeleton region identified by the posture recognition model, the skeleton region being predicted based on skeleton key points corresponding to the target; A fusion module, used to fuse the target area and the non-target area of ​​the semantic segmentation image with the skeleton area of ​​the posture recognition image to obtain a tripartite map that divides the foreground area, the background area, and the area to be recognized; A generating module is used to generate a transparency mask image for image separation of the image to be processed according to the image to be processed and the tripartite map.

29. The device according to claim 28, characterized in that The semantic segmentation module is also used to input the image to be processed into an image semantic segmentation model; output a semantic category probability distribution matrix through the image semantic segmentation model; generate a semantic segmentation image according to the semantic category probability distribution matrix; wherein the pixel points in the semantic segmentation image have pixel values ​​representing the semantic category to which they belong and correspond to the pixel points in the image to be processed; the pixel points in the target area belong to the target semantic category; and the pixel points in the non-target area do not belong to the target semantic category.

30. The device according to claim 29, characterized in that The fusion module is also used to expand the regional boundary between the target area and the non-target area in the semantic segmentation image; use the non-target area remaining after the expansion in the semantic segmentation image as the background area, and use the area in the semantic segmentation image corresponding to the skeleton area of ​​the posture recognition image as the foreground area, to obtain a tripartite map divided into a foreground area, a background area and an area to be identified; wherein the area to be identified in the tripartite map is the area remaining after excluding the background area and the foreground area in the semantic segmentation image.

31. The device according to claim 30, characterized in that The fusion module is also used to perform edge detection on the target area and the non-target area to obtain a region boundary between the target area and the non-target area; and expand the region boundary to both sides with the region boundary as the center in the semantic segmentation image.

32. The device according to claim 28, characterized in that The generation module is also used to perform global sampling of target pixel points in the area to be identified in the image to be processed according to the tripartite map, select matching foreground pixel points and background pixel points for each target pixel point; fuse the matching foreground pixel points and background pixel points of each target pixel point to obtain the corresponding transparency of each target pixel point; and generate a transparency mask image for image separation of the image to be processed according to the corresponding transparency of each pixel point in the tripartite map.

33. The device according to claim 32, characterized in that The generation module is also used to use the corresponding transparency of each pixel in the three-part image as the pixel value of each pixel to generate an intermediate image; after filtering and image morphological operations are performed on the intermediate image, a transparency mask image is generated for image separation of the image to be processed.

34. The device according to claim 28, characterized in that The target area is a human body area, the non-target area is a non-human body area, the posture recognition is human body posture recognition, and the posture recognition image that recognizes the skeleton area is a posture recognition image that recognizes the human body skeleton area; The generating module is further used to generate a transparency mask image for performing portrait cutout on the image to be processed according to the image to be processed and the tripartite map.

35. The device according to any one of claims 28 to 34, characterized in that The device further comprises: a separation module, which is used to calculate the pixel values ​​of the pixels in the image to be processed and the pixel values ​​of the corresponding pixels in the transparency mask image, and to separate the foreground area from the image to be processed according to the calculation result.

36. The device according to claim 35, characterized in that The acquisition module is also used to acquire the video to be processed; and use the video frames included in the video to be processed as the image to be processed; The separation module is also used to perform an editing operation on the image to be processed from which the foreground area is separated to obtain a corresponding edited image; and to generate a target video based on the edited image and then share it.

37. A computer-readable storage medium storing a computer program, wherein when the computer program is executed by a processor, the processor is caused to perform the steps of the method according to any one of claims 1 to 18.

38. A computer device comprising a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor performs the steps of the method according to any one of claims 1 to 18.