Image processing method, computer device, and storage medium
Through neural network model prediction and using pixel transparency for automatic cutout, the problem of high-precision cutout in the existing technology is solved, and efficient and accurate image segmentation processing is achieved.
Patent Information
- Application Number
- CN201910741275.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2019-08-12
- Publication Date
- 2025-01-07
- Estimated Expiration
- 2039-08-12
AI Technical Summary
The medium and high-precision cutout of pictures in the prior art requires a lot of manpower, which consumes time and is inefficient, and cannot meet the needs of large-scale cutouts.
Using a neural network model, the pixel transparency is predicted by obtaining the feature data of the foreground and background parts of the image, and image segmentation is performed based on the pixel transparency to achieve automatic cutout.
It greatly reduces the time and labor overhead of manual cutouts, improves the cutout efficiency, can meet the needs of batch cutouts, and ensures the accuracy of cutouts.
Smart Images

Figure CN112396610B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing technology, and in particular to an image processing method, a computer device, and a computer-readable storage medium. Background Art
[0002] In graphic design and image editing, there is often a need for image segmentation. Image segmentation, also known as cutout, refers to separating a part of a picture or image from the original picture or image into a separate layer. For example, the foreground subject such as the model or product in the image is cut out from the image and placed on another background image to synthesize a new image.
[0003] Usually, the cutout accuracy is required to be very high, reaching the pixel level, which requires high-precision image cutout to complete. Professionals estimate the transparency pixel by pixel, and further perform cutout processing based on the pixel transparency.
[0004] It can be seen that high-precision cutouts bring about very large manpower costs, and usually a professional needs nearly five hours to cut out a large image. It is time-consuming and has low cutout efficiency, and cannot be applied to scenes that require large-scale cutouts. Summary of the invention
[0005] In view of the above problems, the present application is proposed to provide an image processing method, a computer device, and a computer-readable storage medium that overcome the above problems or at least partially solve the above problems.
[0006] According to one aspect of the present application, there is provided an image processing method, comprising:
[0007] Acquire an image, wherein the image includes a foreground portion and a background portion;
[0008] Acquire feature data corresponding to the foreground part and the background part of the image respectively;
[0009] Inputting feature data corresponding to the foreground part and the background part of the image into a mixer of a neural network model, wherein the mixer is used to predict pixel transparency of the image by comparing the foreground part and the background part;
[0010] The pixel transparency of the image is determined by the mixer.
[0011] Optionally, determining the transparency of the image by the mixer includes:
[0012] Obtaining relative values of pixel transparency of the foreground part and the background part according to the feature data corresponding to the foreground part and the background part respectively;
[0013] The pixel transparency of the image is determined according to the relative pixel transparency value and the pixel transparency corresponding to the foreground part and the background part respectively.
[0014] Optionally, the method further includes:
[0015] Image segmentation processing is performed based on pixel transparency of the image.
[0016] Optionally, the neural network model further includes at least two decoders, and the method further includes:
[0017] The feature data of the image are respectively input into the decoder to obtain the feature data corresponding to the foreground part and the background part of the image, and the pixel transparency corresponding to the foreground part and the background part.
[0018] Optionally, the neural network model further includes an encoder, and the method further includes:
[0019] The image is input into an encoder to obtain feature data of the image.
[0020] According to another aspect of the present application, there is provided an image processing method, comprising:
[0021] determining a first content element and a second content element of the image;
[0022] Obtaining relative values of pixel attributes of the first content element and the second content element;
[0023] Determining the pixel attributes of the image according to the relative value of the pixel attributes and the pixel attributes corresponding to the first content element and the second content element respectively;
[0024] Image processing is performed based on the pixel attributes.
[0025] Optionally, the first content element includes a foreground portion of an image, the second content element includes a background portion of an image, and the determining of the first content element and the second content element of the image includes:
[0026] identifying at least one target object in the image;
[0027] The image foreground part and the image background part are determined according to the corresponding relationship between the target object and the image foreground part or the image background part.
[0028] Optionally, determining the first content element and the second content element of the image includes:
[0029] The image is input into a first content decoder and a second content decoder of a neural network model to obtain a first content element and a second content element of the image respectively.
[0030] Optionally, obtaining relative values of pixel attributes of the first content element and the second content element includes:
[0031] Acquire feature data corresponding to the first content element and the second content element of the image respectively;
[0032] The relative values of pixel attributes of the foreground part and the background part of the image are determined according to the acquired feature data.
[0033] Optionally, determining the relative values of pixel attributes of the foreground part and the background part of the image according to the acquired feature data includes:
[0034] The feature data corresponding to the first content element and the second content element respectively and the feature data of the image are input into the mixer of the neural network to obtain the relative values of the pixel attributes of the foreground part and the background part of the image.
[0035] Optionally, the acquiring feature data respectively corresponding to the first content element and the second content element of the image includes:
[0036] Inputting the image into an encoder of a neural network model to obtain feature data of multiple dimensions corresponding to the image;
[0037] The feature data of the image is input into a first content decoder and a second content decoder of a neural network model to obtain feature data corresponding to a first content element and a second content element of the image respectively.
[0038] Optionally, the pixel attribute of the image is within a numerical range formed by the pixel attribute of the first content element and the pixel attribute of the second content element.
[0039] Optionally, determining the pixel attribute of the image according to the pixel attribute relative value and the pixel attributes corresponding to the first content element and the second content element respectively includes:
[0040] Determining attribute weights of the pixel attributes corresponding to the first content element and the second content element respectively based on the relative value of the pixel attribute and a preset numerical relationship;
[0041] The pixel attributes of the image are determined according to the pixel attributes respectively corresponding to the first content element and the second content element and the attribute weights corresponding to the pixel attributes.
[0042] Optionally, the pixel attribute includes pixel transparency, and the performing image processing based on the pixel attribute includes:
[0043] Image segmentation processing is performed according to pixel transparency of the image.
[0044] Optionally, before performing image processing based on the pixel attributes, the method further includes:
[0045] A target object to be processed in the image is determined.
[0046] Optionally, determining the target object to be processed in the image includes:
[0047] A target object to be processed in the image is determined according to whether at least one target object in the image belongs to a preset category.
[0048] According to another aspect of the present application, there is provided an image processing method, comprising:
[0049] determining a plurality of content elements of the image;
[0050] Get the relative values of pixel attributes between content elements;
[0051] Determining pixel attributes of the image according to the pixel relative parameters and the pixel attributes of the content element;
[0052] Image processing is performed based on the pixel attributes.
[0053] According to another aspect of the present application, there is provided an image processing method, characterized in that it includes:
[0054] Get an input first image;
[0055] Using a first neural network and a second neural network, determining feature data corresponding to a foreground portion and a background portion of the first image respectively;
[0056] Determining pixel attributes of the first image according to feature data corresponding to the foreground portion and the background portion of the first image respectively;
[0057] extracting the first content element based on pixel attributes of the first image;
[0058] Obtaining a second image according to the first content element and the updated second content element;
[0059] The second image is provided.
[0060] Optionally, also include:
[0061] Determine feature data of a middle scene portion of the first image using a third neural network;
[0062] Determining the pixel attributes of the first image according to the feature data corresponding to the foreground part and the background part of the first image includes:
[0063] The pixel attributes of the first image are determined according to the feature data corresponding to the foreground part, the background part and the middle scene part of the first image respectively.
[0064] According to another aspect of the present application, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements one or more of the above methods when executing the computer program.
[0065] According to another aspect of the present application, a computer-readable storage medium is provided, on which a computer program is stored. When the program is executed by a processor, one or more of the methods described above are implemented.
[0066] According to the embodiment of the present application, after determining the first content element and the second content element of the image, the relative values of the pixel attributes of the two content elements are obtained, and the pixel attributes of the image can be obtained according to the relative values of the pixel attributes and the pixel attributes corresponding to the first content element and the second content element respectively. Further, the image processing can be performed according to the pixel attributes. Taking the first content element and the second content element corresponding to the foreground and background of the image respectively, and the pixel attribute is pixel transparency as an example, the embodiment of the present application can be applied to the field of computer cutouts, and provides a solution for automatically calculating the pixel transparency of an image and automatically cutting out the image according to the pixel transparency of the image, which overcomes the problems of high manpower overhead and low efficiency of manual cutouts, and can meet the needs of batch cutouts.
[0067] Furthermore, since the embodiment of the present application determines the pixel attributes of the image based on the relative values of the pixel attributes and the pixel attributes corresponding to the first content element and the second content element respectively, the pixel attributes of the image can be within the range of the pixel attributes corresponding to the first content element and the second content element, thereby ensuring the accuracy of the cutout.
[0068] The above description is only an overview of the technical solution of the present application. In order to more clearly understand the technical means of the present application, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the present application more obvious and easy to understand, the specific implementation methods of the present application are listed below. BRIEF DESCRIPTION OF THE DRAWINGS
[0069] Various other advantages and benefits will become apparent to those of ordinary skill in the art by reading the detailed description of the optional embodiments below. The accompanying drawings are only for the purpose of illustrating the optional embodiments and are not to be considered as limiting the present application. Moreover, the same reference symbols are used throughout the accompanying drawings to represent the same components. In the accompanying drawings:
[0070] Figure 1 A flowchart of an image processing method based on a neural network model according to the first embodiment of the present application is shown;
[0071] Figure 2 A flowchart of an image processing method according to the second embodiment of the present application is shown;
[0072] Figure 3 A flowchart of an image processing method according to Embodiment 3 of the present application is shown;
[0073] Figure 4 A schematic diagram of the architecture of image processing in an example of the present application is shown;
[0074] Figure 5 A structural block diagram of an image processing device based on a neural network model according to a fourth embodiment of the present application is shown;
[0075] Figure 6 A structural block diagram of an image processing device according to Embodiment 5 of the present application is shown;
[0076] Figure 7 A structural block diagram of an image processing device according to Embodiment 6 of the present application is shown;
[0077] Figure 8 A flowchart of an image processing method according to Embodiment 7 of the present application is shown;
[0078] Fig. 9 A schematic diagram of image processing according to another example of the present application is shown;
[0079] Fig.10 An exemplary system is shown that can be used to implement the various embodiments described in this disclosure. DETAILED DESCRIPTION
[0080] The exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although the exemplary embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be limited by the embodiments set forth herein. On the contrary, these embodiments are provided to enable a more thorough understanding of the present disclosure and to fully convey the scope of the present disclosure to those skilled in the art.
[0081] In order to enable those skilled in the art to better understand the present application, the concepts involved in the present application are explained below:
[0082] The embodiment of the present application divides the image into multiple content elements, which may include a first content element and a second content element. The specific division method can be determined according to actual business needs. For example, the foreground part of the image is used as the first content element, and the background part is used as the second content element. The foreground part is the subject of the image expression or foil, which is generally an object located close to the lens and moving, and the background part is usually the environment in which the foreground part is located. The content elements can also be divided according to the image area, with the image content of a certain area as the first content element and the image content of another area as the second content element; the content elements can also be divided according to the classification of the image content, and the classification of the image content includes text, graphics, video, templates, etc. For example, the text part in the image is used as the first content element and the video part is used as the second content element. The specific content of the first object and the second object can also be set according to actual business needs, and the present application does not limit this.
[0083] The image and content elements have corresponding pixel attributes, for example, one or more of pixel RGB value (pixel color value in red, green, and blue channels), pixel transparency, pixel position coordinates, content classification corresponding to the pixel, pixel clarity, etc. In one embodiment of the present application, the pixel attribute may include pixel transparency.
[0084] The relative value of pixel attributes represents the relative relationship between multiple content elements in terms of pixel attributes, and can be represented as the pixel attributes of one or more pixels, or as a ratio or weighted average of the pixel attributes, etc. Taking the pixel attributes including pixel transparency as an example, the relative value of pixel attributes can be the pixel transparency of one or more content elements, or the relative value (such as a ratio) of the pixel transparency of two content elements.
[0085] The present application determines the pixel attributes of an image based on the pixel attributes of multiple content elements and the relative values of the pixel attributes, and then uses the image attributes as a basis for image processing.
[0086] The image processing involved in the embodiments of the present application may include image segmentation, noise removal, enhancement or restoration, etc. How to perform image processing based on image attributes can be set according to actual business needs, and the present application does not limit this.
[0087] The image processing method of the present application is explained below by taking an application scenario in which image processing includes image segmentation as an example, wherein the image content elements include a foreground part and a background part, the pixel attributes corresponding to the image and content elements include pixel transparency, and the pixel relative parameters of the content element or the image include a relative pixel transparency value.
[0088] Reference Figure 1, shows a flowchart of an image processing method based on a neural network model according to the first embodiment of the present application. This embodiment uses a neural network model to perform an image processing process. The neural network model includes a mixer. The method may specifically include the following steps:
[0089] Step 101: Acquire an image, wherein the image includes a foreground portion and a background portion.
[0090] Step 102: Acquire feature data corresponding to the foreground and background of the image.
[0091] The feature data corresponding to the foreground part and the background part of the image are respectively input into the mixer, and after the image is acquired, the relative value of the pixel transparency of the foreground part and the background part is further obtained.
[0092] In the embodiment of the present application, the content elements of the image divided include a foreground part and a background part, and feature data of the foreground part and the background part are further obtained after the image is acquired.
[0093] In computer vision (CV), if you want a machine to recognize an image, you need to abstractly represent the image in a form that can be understood by the machine, that is, extract features from the image and use feature data to represent the image. Feature data can include features of content elements in one or more dimensions, which can be expressed in the form of vectors, that is, the image is vectorized. For example, the number of data types, number of pixels, position coordinates, etc. corresponding to the content elements. In the embodiment of the present application, feature data is used to characterize content elements, and constructing high-dimensional feature data can more accurately characterize content elements.
[0094] Step 103, inputting the feature data corresponding to the foreground part and the background part of the image into the mixer of the neural network model.
[0095] The neural network model can adopt a supervised learning method, by marking the feature data of the image samples and the corresponding relative values of pixel transparency, and obtaining a mixer through the training method of the neural network model. In an embodiment of the present application, the mixer is used to predict the transparency of the image by comparing the foreground part and the background part.
[0096] Step 104: Determine the pixel transparency of the image through the mixer.
[0097] In one optional embodiment, when determining the transparency of the image through the mixer, the relative value of pixel transparency of the foreground part and the background part can be obtained according to the feature data corresponding to the foreground part and the background part respectively, and the pixel transparency of the image can be further determined according to the relative value of pixel transparency and the pixel transparency corresponding to the foreground part and the background part respectively.
[0098] The pixel transparency of the image is determined based on the pixel transparency of the content elements and the relative value of the pixel transparency. Therefore, the range of the pixel transparency of the image can be defined according to the pixel transparency of each content element, so that the pixel transparency of the image can be within the range of pixel transparency corresponding to the foreground and background parts, thereby ensuring the accuracy of the cutout.
[0099] The specific scheme for determining the pixel transparency of the image based on the pixel transparency of the content element and the relative transparency value can be set according to actual needs. For example, the pixel transparency of the image is a weighted value of the pixel transparency of the foreground part and the pixel transparency of the background part, wherein the weight of the pixel transparency of the foreground part or the background part can be determined according to the relative transparency value, for example, it can be expressed as pixel transparency of the image = pixel transparency of the foreground part * (1-relative transparency value) + pixel transparency of the background part * relative transparency value.
[0100] In an optional embodiment, image segmentation processing may also be performed based on pixel transparency of the image.
[0101] According to the embodiment of the present application, the feature data corresponding to the foreground and background parts of the image are respectively input into the mixer to obtain the corresponding relative pixel transparency values. The pixel transparency of the image is determined according to the relative pixel transparency values and the pixel transparency corresponding to the foreground and background parts, and the image segmentation processing is further performed based on the pixel transparency of the image. The embodiment of the present application can be applied to the field of computer cutouts, and provides a solution for automatically calculating the pixel transparency of an image and automatically cutting out the image according to the pixel transparency of the image, which overcomes the problems of high manpower overhead and low efficiency of manual cutouts and can meet the needs of batch cutouts.
[0102] In an embodiment of the present application, the neural network model also includes at least two decoders. The decoders take the feature data of the image as input and decode the image feature data in combination with the trained model to obtain the feature data corresponding to the foreground and background parts of the image, as well as the pixel transparency corresponding to the foreground and background parts, respectively.
[0103] In an embodiment of the present application, the neural network model also includes an encoder, and the feature data of the image can be obtained based on the encoder. The image is input into the encoder, and the encoder recognizes the image features according to a preset dimension to obtain the feature data of the image.
[0104] Reference Figure 2 , shows a flow chart of an image processing method according to the second embodiment of the present application, the method may specifically include the following steps:
[0105] Step 201: determine a first content element and a second content element of an image.
[0106] Step 202: Obtain relative values of pixel attributes of the first content element and the second content element.
[0107] Step 203: Determine the pixel attributes of the image according to the relative pixel attribute values and the pixel attributes corresponding to the first content element and the second content element, respectively.
[0108] Step 204: performing image processing based on the pixel attributes.
[0109] According to the embodiment of the present application, after determining the first content element and the second content element of the image, the relative values of the pixel attributes of the two content elements are obtained, and the pixel attributes of the image can be obtained according to the relative values of the pixel attributes and the pixel attributes corresponding to the first content element and the second content element respectively. Further, the image processing can be performed according to the pixel attributes. Taking the first content element and the second content element corresponding to the foreground and background of the image respectively, and the pixel attribute is pixel transparency as an example, the embodiment of the present application can be applied to the field of computer cutouts, and provides a solution for automatically calculating the pixel transparency of an image and automatically cutting out the image according to the pixel transparency of the image, which overcomes the problems of high manpower overhead and low efficiency of manual cutouts, and can meet the needs of batch cutouts.
[0110] Furthermore, since the embodiment of the present application determines the pixel attributes of the image based on the relative values of the pixel attributes and the pixel attributes corresponding to the first content element and the second content element respectively, the pixel attributes of the image can be within the range of the pixel attributes corresponding to the first content element and the second content element, thereby ensuring the accuracy of the cutout.
[0111] In an embodiment of the present application, optionally, the first content element includes an image foreground portion, and the second content element includes an image background portion. When determining the first content element and the second content element of the image, at least one target object in the image can be identified; the image foreground portion and the image background portion are determined according to the correspondence between the target object and the image foreground portion or the image background portion. If the target object corresponds to the foreground portion, the area or layer where the target object is located can be identified as the image foreground portion; if the target object corresponds to the background portion, the area or layer where the target object is located can be identified as the image background portion. For example, if a pedestrian is included in the identified image, the image area where the pedestrian is located can be delineated as the foreground portion of the image; if a frame style is included in the identified image, the image area where the frame style is located can be delineated as the background portion of the image.
[0112] In an embodiment of the present application, optionally, a decoder included in a neural network model can be used to obtain content elements of an image. When determining the first content element and the second content element of the image, the image can be input into the first content decoder and the second content decoder of the neural network model to obtain the first content element and the second content element of the image, respectively.
[0113] In an embodiment of the present application, optionally, when obtaining the pixel relative parameters of the first content element and the second content element, feature data corresponding to the first content element and the second content element of the image can be obtained; and the relative values of the pixel attributes of the foreground and background parts of the image can be determined based on the obtained feature data.
[0114] In the embodiment of the present application, optionally, the mixer included in the neural network model can be used to obtain the relative pixel attributes between the content elements of the image. When determining the relative values of the pixel attributes of the foreground part and the background part of the image according to the acquired feature data, the feature data corresponding to the first content element and the second content element respectively and the feature data of the image can be input into the mixer of the neural network to obtain the relative values of the pixel attributes of the foreground part and the background part of the image.
[0115] In an embodiment of the present application, optionally, when obtaining feature data respectively corresponding to the first content element and the second content element of the image, the image can be input into an encoder of a neural network model to obtain feature data of multiple dimensions corresponding to the image; the feature data of the image can be input into a first content decoder and a second content decoder of the neural network model to obtain feature data corresponding to the first content element and the second content element of the image, respectively.
[0116] According to the solution for determining the pixel attributes of an image in the embodiment of the present application, the pixel attributes of the image are within a numerical range formed by the pixel attributes of the first content element and the pixel attributes of the second content element.
[0117] In the embodiment of the present application, the pixel attributes may include pixel transparency. When image processing is performed based on the pixel attributes, image segmentation processing may be performed according to the pixel transparency of the image.
[0118] In an embodiment of the present application, optionally, attribute weights of pixel attributes corresponding to the first content element and the second content element are determined based on relative values of pixel attributes and preset numerical relationships, and pixel attributes of the image are determined based on the pixel attributes corresponding to the first content element and the second content element and the attribute weights corresponding to the pixel attributes.
[0119] Among them, the preset data relationship satisfied by the relative value of the pixel attribute and the attribute weight can be set according to actual needs, so that after obtaining the pixel attribute value, the attribute weights of the pixel transparency corresponding to the first content element and the second content element respectively are obtained, and the pixel attributes of the image are further calculated according to the attribute weights.
[0120] For example, if the attribute weight of the pixel transparency of one content element is the pixel attribute relative value, and the attribute weights of the pixel transparency of the two content elements are summed to 1, then the attribute weight of the pixel transparency of the other content element can be obtained. Taking the content element including the foreground part and the background part as an example, the pixel transparency of the image is characterized by the transparency of the foreground part * the foreground attribute weight + the pixel transparency of the background part * the background attribute weight, and can be further characterized by the transparency of the foreground part * the relative transparency value + the pixel transparency of the background part * (1-relative transparency value).
[0121] In the embodiment of the present application, optionally, before performing image processing based on pixel attributes, the method further includes: determining a target object to be processed in the image. Specifically, various applicable image recognition technologies in the art may be used to identify the target object.
[0122] In an embodiment of the present application, optionally, when determining the target object to be processed in the image, the target object to be processed in the image can be determined based on whether at least one target object in the image belongs to a preset category. For example, based on whether the target object is an animal, it is determined that the target object needs to be cut out. The specific preset category can be set according to actual application requirements.
[0123] Reference Figure 3 , shows a flow chart of an image processing method according to Embodiment 3 of the present application, the method may specifically include the following steps:
[0124] Step 301: determine multiple content elements of an image.
[0125] Step 302: Obtain relative values of pixel attributes between content elements.
[0126] Step 303: Determine the pixel attributes of the image according to the pixel attribute relative value and the pixel attributes of the content element.
[0127] Step 304: performing image processing based on the pixel attributes.
[0128] In this embodiment, the content element may include multiple, for example, two or more, and specific implementation details may refer to the description of the above embodiment, which will not be repeated here.
[0129] According to the embodiments of the present application, after determining the multiple content elements of the image, the relative values of the pixel attributes of the content elements are obtained, and the pixel attributes of the image are obtained based on the relative values of the pixel attributes and the pixel attributes of the content elements. The image is further processed based on the pixel attributes. Taking the content elements including the foreground and background of the image, and the image pixels as pixel transparency as an example, the embodiments of the present application can be applied to the field of computer cutouts, and provide a solution for automatically calculating the pixel transparency of an image and automatically cutting out the image based on the pixel transparency of the image, which overcomes the problems of high manpower overhead and low efficiency of manual cutouts, and can meet the needs of batch cutouts.
[0130] Furthermore, since the embodiment of the present application determines the pixel attributes of the image based on the pixel relative parameters and the pixel attributes corresponding to the content elements, the pixel attributes of the image can be within the numerical range formed by the pixel attributes of multiple content elements, thereby ensuring the accuracy of the cutout.
[0131] In order to enable those skilled in the art to better understand the present application, the scheme of the present application is described below through specific examples.
[0132] Figure 4 The schematic diagram of the architecture of image processing in an example of the present application is shown. It can be seen that the neural network model includes at least an encoder, a decoder and a mixer. The corresponding processing flow includes:
[0133] 1. Image input
[0134] 2. Encoder encoding to obtain feature data
[0135] 3. The foreground decoder decodes and the background decoder obtains the foreground features and background features, and the pixel transparency corresponding to the foreground and background is saved in the video memory.
[0136] 4. The mixer mixes the relative transparency values of the foreground and background pixels and saves them in the video memory.
[0137] 5. Determine the pixel transparency of the image based on the relative transparency value and save it in memory to facilitate subsequent image segmentation processing
[0138] 6. Image segmentation based on pixel transparency
[0139] Reference Figure 5 , shows a structural block diagram of an image processing device embodiment based on a neural network model according to the fourth embodiment of the present application, which may specifically include:
[0140] A relative value obtaining module 401 is used to input feature data corresponding to the foreground part and the background part of the image into the mixer to obtain a relative value of pixel transparency of the foreground part and the background part;
[0141] A transparency determination module 402 determines the pixel transparency of the image according to the pixel transparency relative value and the pixel transparency corresponding to the foreground part and the background part respectively;
[0142] The image segmentation module 403 is used to perform image segmentation processing based on pixel transparency of the image.
[0143] In an optional embodiment of the present application, the neural network model further includes at least two decoders, and the device further includes:
[0144] The feature data processing module is used to input the feature data of the image into the decoder to obtain the feature data corresponding to the foreground and background parts of the image, and the pixel transparency corresponding to the foreground and background parts.
[0145] In an optional embodiment of the present application, the neural network model further includes an encoder, and the device further includes:
[0146] The feature data acquisition module is used to input the image into an encoder to obtain the feature data of the image.
[0147] According to the embodiment of the present application, the feature data corresponding to the foreground and background parts of the image are respectively input into the mixer to obtain the corresponding relative pixel transparency values. The pixel transparency of the image is determined according to the relative pixel transparency values and the pixel transparency corresponding to the foreground and background parts, and the image segmentation processing is further performed based on the pixel transparency of the image. The embodiment of the present application can be applied to the field of computer cutouts, and provides a solution for automatically calculating the pixel transparency of an image and automatically cutting out the image according to the pixel transparency of the image, which overcomes the problems of high manpower overhead and low efficiency of manual cutouts and can meet the needs of batch cutouts.
[0148] Furthermore, since the embodiment of the present application determines the pixel transparency corresponding to the image based on the relative value of pixel transparency and the pixel transparency corresponding to the foreground part and the background part respectively, the pixel transparency of the image can be within the range of the pixel transparency corresponding to the foreground part and the background part, thereby ensuring the accuracy of the cutout.
[0149] Reference Figure 6 , shows a structural block diagram of an image processing device according to Embodiment 5 of the present application, which may specifically include:
[0150] An element determination module 501 is used to determine a first content element and a second content element of an image;
[0151] A parameter acquisition module 502, used to acquire relative values of pixel attributes of the first content element and the second content element;
[0152] An attribute determination module 503, configured to determine the pixel attributes of the image according to the relative value of the pixel attributes and the pixel attributes corresponding to the first content element and the second content element respectively;
[0153] The image processing module 504 is used to perform image processing based on the pixel attributes.
[0154] In an optional embodiment of the present application, the first content element includes an image foreground portion, the second content element includes an image background portion, and the element determination module includes:
[0155] a target object recognition submodule, configured to recognize at least one target object in the image;
[0156] The content determination submodule is used to determine the image foreground part and the image background part according to the corresponding relationship between the target object and the image foreground part or the image background part.
[0157] In an optional embodiment of the present application, the attribute determination module is specifically used to input the image into a first content decoder and a second content decoder of a neural network model to obtain a first content element and a second content element of the image respectively.
[0158] In an optional embodiment of the present application, the parameter acquisition module includes:
[0159] A feature data acquisition submodule, used to acquire feature data corresponding to the first content element and the second content element of the image respectively;
[0160] The relative value determination submodule is used to determine the relative values of the pixel attributes of the foreground part and the background part of the image according to the acquired feature data.
[0161] In an optional embodiment of the present application, the relative value determination submodule is specifically used to input the feature data corresponding to the first content element and the second content element respectively and the feature data of the image into a mixer of the neural network to obtain the relative values of the pixel attributes of the foreground and background parts of the image.
[0162] In an optional embodiment of the present application, the feature data acquisition submodule is specifically used to input the image into an encoder of a neural network model to obtain feature data of multiple dimensions corresponding to the image; input the feature data of the image into a first content decoder and a second content decoder of a neural network model to respectively obtain feature data corresponding to a first content element and a second content element of the image.
[0163] In an optional embodiment of the present application, the pixel attribute of the image is within a numerical range formed by the pixel attribute of the first content element and the pixel attribute of the second content element.
[0164] In an optional embodiment of the present application, the attribute determination module includes:
[0165] A parameter determination submodule, configured to determine attribute weights of the pixel attributes corresponding to the first content element and the second content element respectively based on the relative value of the pixel attribute and a preset numerical relationship;
[0166] The operation submodule is used to determine the pixel attributes of the image according to the pixel attributes corresponding to the first content element and the second content element respectively and the attribute weights corresponding to the pixel attributes.
[0167] In an optional embodiment of the present application, the image processing module is specifically used to perform image segmentation processing according to pixel transparency of the image.
[0168] In an optional embodiment of the present application, the device further includes:
[0169] The object determination module is used to determine the target object to be processed in the image before performing image processing based on the pixel attributes.
[0170] In an optional embodiment of the present application, the object determination module is specifically used to determine the target object to be processed in the image according to whether at least one target object in the image belongs to a preset category.
[0171] According to the embodiment of the present application, after determining the first content element and the second content element of the image, the relative values of the pixel attributes of the two content elements are obtained, and the pixel attributes of the image can be obtained according to the relative values of the pixel attributes and the pixel attributes corresponding to the first content element and the second content element respectively. Further, the image processing can be performed according to the pixel attributes. Taking the first content element and the second content element corresponding to the foreground and background of the image respectively, and the pixel attribute is pixel transparency as an example, the embodiment of the present application can be applied to the field of computer cutouts, and provides a solution for automatically calculating the pixel transparency of an image and automatically cutting out the image according to the pixel transparency of the image, which overcomes the problems of high manpower overhead and low efficiency of manual cutouts, and can meet the needs of batch cutouts.
[0172] Furthermore, since the embodiment of the present application determines the pixel attributes of the image based on the relative values of the pixel attributes and the pixel attributes corresponding to the first content element and the second content element respectively, the pixel attributes of the image can be within the range of the pixel attributes corresponding to the first content element and the second content element, thereby ensuring the accuracy of the cutout.
[0173] refer to Figure 7 , shows a structural block diagram of an image processing device according to Embodiment 6 of the present application, which may specifically include:
[0174] An element determination module 601, used to determine a plurality of content elements of an image;
[0175] A relative value acquisition module 602 is used to acquire relative values of pixel attributes between content elements;
[0176] An attribute determination module 603, configured to determine the pixel attributes of the image according to the pixel attribute relative value and the pixel attributes of the content element;
[0177] The image processing module 604 is used to perform image processing based on the pixel attributes.
[0178] According to the embodiments of the present application, after determining multiple content elements of an image, the relative values of the pixel attributes of the content elements are obtained, and the pixel attributes of the image are obtained based on the relative values of the pixel attributes and the pixel attributes of the content elements. The image is further processed based on the pixel attributes. Taking the example that the content elements include the foreground and background of the image, and the pixel attribute of the image is pixel transparency, the embodiments of the present application can be applied to the field of computer cutouts, and provide a solution for automatically calculating the pixel transparency of an image and automatically cutting out the image based on the pixel transparency of the image, which overcomes the problems of high manpower costs and low efficiency of manual cutouts, and can meet the needs of batch cutouts.
[0179] Furthermore, since the embodiment of the present application determines the pixel attributes of the image based on the relative values of the pixel attributes and the pixel attributes corresponding to the content elements, the pixel attributes of the image can be within the numerical range formed by the pixel attributes of multiple content elements, thereby ensuring the accuracy of the cutout.
[0180] refer to Figure 8 , shows a flow chart of an image processing method embodiment according to Embodiment 7 of the present application, which may specifically include:
[0181] Step 701, obtaining an input first image.
[0182] The first image is an image to be processed, including a first content element and a second content element, and may also include at least one other content element. For example, the first content element is a foreground part, and the second content element is a background part. Other content elements may also be included, such as an intermediate scene part, which specifically refers to the content in the image other than the background part and not the foreground part. The content and identification method may be set according to actual needs.
[0183] Step 702: using a first neural network and a second neural network, determining feature data corresponding to the foreground portion and the background portion of the first image, respectively.
[0184] Step 703: Determine the pixel attributes of the first image according to the feature data corresponding to the foreground part and the background part of the first image respectively.
[0185] After acquiring the first image, the embodiment of the present application further determines the relative values of the pixel attributes of the first content element and the second content element, and determines the pixel attributes of the image according to the relative values of the pixel attributes. The specific determination details can be referred to the above embodiments 1-6, which will not be repeated here.
[0186] Step 704: extract the first content element based on pixel attributes of the first image.
[0187] The pixel attribute of the image can extract the first content element. Taking the pixel attribute of the image as the pixel transparency of the image and the first content element as the background content as an example, the foreground content of the image can be further extracted according to the pixel transparency of the image.
[0188] Step 705: Obtain a second image according to the first content element and the updated second content element.
[0189] The first content element obtained can be resynthesized with the updated second content element into a second image, and one of the differences between the first image and the second image is the difference in the second content element. This solution is applied to a cutout scene, and a new image can be synthesized with the new background content after extracting the foreground content for image synthesis.
[0190] Step 706: provide the second image.
[0191] A second image may further be provided for display or use.
[0192] In an optional embodiment, the first image removes the foreground part and the background part and also includes an intermediate scene part, and a third neural network can be used to determine the feature data of the intermediate scene part of the first image.
[0193] Correspondingly, when determining the pixel attributes of the first image based on the feature data corresponding to the foreground and background parts of the first image, the pixel attributes of the first image can be determined based on the feature data corresponding to the foreground, background and middle scene parts of the first image.
[0194] It is understandable that, in a specific implementation, the number and type of content elements included in the first image can be set according to actual needs, and then a corresponding plurality of neural networks can be used to perform corresponding feature extraction and processing, and the combination of corresponding encoders, decoders and mixers is also different, and this application does not limit this. To improve the efficiency of image processing, multiple neural network models (including encoders, decoders and mixers) can also be used for image processing.
[0195] Using multiple neural networks for processing can improve processing efficiency and image processing effects. Based on specific needs and cost factors, different levels of services can be provided for different customers. Customers who need to achieve higher-precision image processing and can afford higher resource costs can choose to use multiple neural network processing solutions. Customers with lower needs and need to save costs can choose fewer neural networks, such as using one neural network for feature extraction.
[0196] It should also be noted that the implementation of the above steps can adjust the order of the steps according to actual needs. For example, different neural network models can perform feature extraction steps simultaneously or sequentially. The positions and orders of the components in the corresponding neural network models are also different.
[0197] refer to Fig. 9 A schematic diagram showing another example according to the present application is shown.
[0198] In this example, an image is input through the terminal interface. After receiving the image, the terminal further preprocesses the image and further predicts the transparency of the image based on the neural network model. The neural network model includes an encoder, a foreground decoder, a background decoder, and a mixer.
[0199] First, the image encoder obtains the feature data of the image and inputs it into the foreground neural network and the background neural network, that is, the foreground decoder and the background decoder of the neural network model obtain the feature data corresponding to the foreground content and the background content respectively.
[0200] The feature data is input into the mixer of the neural network model to obtain the relative value of pixel transparency of the foreground part and the background part, and the pixel transparency of the image is determined according to the relative value of pixel transparency and the pixel transparency corresponding to the foreground part and the background part respectively.
[0201] According to the transparency of the image, the foreground part of the image can be deducted, and then the foreground part and the new background part are combined into a new image, which can be input into the terminal for display.
[0202] When synthesizing a new image, the foreground portion may be preprocessed, for example, image effects (such as cartoon effects) may be added, the direction may be adjusted (for example, the direction of a person may be adjusted), and the position of the foreground portion within the background portion may be set.
[0203] The above-mentioned image processing part can be executed on the terminal, and the image can also be sent to the server through the network for execution.
[0204] As for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0205] Embodiments of the present disclosure may be implemented as a system using any suitable hardware, firmware, software, or any combination thereof to perform the desired configuration. Fig.10 An exemplary system (or device) 800 that can be used to implement various embodiments described in the present disclosure is schematically illustrated.
[0206] For one embodiment, Fig.10 An exemplary system 800 is shown having one or more processors 802, a system control module (chip set) 804 coupled to at least one of the processor(s) 802, a system memory 806 coupled to the system control module 804, a non-volatile memory (NVM) / storage device 808 coupled to the system control module 804, one or more input / output devices 810 coupled to the system control module 804, and a network interface 812 coupled to the system control module 806.
[0207] Processor 802 may include one or more single-core or multi-core processors, and processor 802 may include any combination of general-purpose processors or special-purpose processors (such as graphics processors, application processors, baseband processors, etc.) In some embodiments, system 800 can be used as a browser as described in the embodiments of the present application.
[0208] In some embodiments, the system 800 may include one or more computer-readable media (e.g., system memory 806 or NVM / storage device 808) having instructions and one or more processors 802 that are combined with the one or more computer-readable media and configured to execute the instructions to implement the modules to perform the actions described in the present disclosure.
[0209] For one embodiment, the system control module 804 may include any suitable interface controller to provide any suitable interface to at least one of the processor(s) 802 and / or any suitable device or component in communication with the system control module 804 .
[0210] The system control module 804 may include a memory controller module to provide an interface to the system memory 806. The memory controller module may be a hardware module, a software module, and / or a firmware module.
[0211] The system memory 806 may be used, for example, to load and store data and / or instructions for the system 800. For one embodiment, the system memory 806 may include any suitable volatile memory, such as a suitable DRAM. In some embodiments, the system memory 806 may include double data rate type four synchronous dynamic random access memory (DDR4 SDRAM).
[0212] For one embodiment, the system control module 804 may include one or more input / output controllers to provide interfaces to the NVM / storage device 808 and the input / output device(s) 810 .
[0213] For example, NVM / storage device 808 may be used to store data and / or instructions. NVM / storage device 808 may include any suitable non-volatile memory (e.g., flash memory) and / or may include any suitable non-volatile storage device(s) (e.g., one or more hard disk drives (HDDs), one or more compact disk (CD) drives, and / or one or more digital versatile disk (DVD) drives).
[0214] NVM / storage device 808 may include storage resources that are physically part of the device on which system 800 is installed, or it may be accessible to the device without being part of the device. For example, NVM / storage device 808 may be accessed via (one or more) input / output devices 810 over a network.
[0215] The input / output device(s) 810 may provide an interface for the system 800 to communicate with any other appropriate device, and the input / output device 810 may include a communication component, an audio component, a sensor component, etc. The network interface 812 may provide an interface for the system 800 to communicate through one or more networks, and the system 800 may wirelessly communicate with one or more components of a wireless network according to any of one or more wireless network standards and / or protocols, for example, accessing a wireless network based on a communication standard, such as WiFi, 2G or 3G, or a combination thereof for wireless communication.
[0216] For one embodiment, at least one of the processor(s) 802 may be packaged together with the logic of one or more controllers (e.g., a memory controller module) of the system control module 804. For one embodiment, at least one of the processor(s) 802 may be packaged together with the logic of one or more controllers of the system control module 804 to form a system-in-package (SiP). For one embodiment, at least one of the processor(s) 802 may be integrated on the same die with the logic of one or more controllers of the system control module 804. For one embodiment, at least one of the processor(s) 802 may be integrated on the same die with the logic of one or more controllers of the system control module 804 to form a system on chip (SoC).
[0217] In various embodiments, the system 800 may be, but is not limited to: a browser, a workstation, a desktop computing device, or a mobile computing device (e.g., a laptop computing device, a handheld computing device, a tablet computer, a netbook, etc.). In various embodiments, the system 800 may have more or fewer components and / or a different architecture. For example, in some embodiments, the system 800 includes one or more cameras, a keyboard, a liquid crystal display (LCD) screen (including a touch screen display), a non-volatile memory port, multiple antennas, a graphics chip, an application specific integrated circuit (ASIC), and a speaker.
[0218] Wherein, if the display includes a touch panel, the display screen can be implemented as a touch screen display to receive input signals from a user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor can not only sense the boundary of the touch or slide action, but also detect the duration and pressure associated with the touch or slide operation.
[0219] An embodiment of the present application also provides a non-volatile readable storage medium, which stores one or more modules (programs). When the one or more modules are applied to a terminal device, the terminal device can execute instructions (instructions) of each method step in the embodiment of the present application.
[0220] In one example, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements a method as in an embodiment of the present application when executing the computer program.
[0221] In one example, a computer-readable storage medium is provided, on which a computer program is stored, characterized in that when the program is executed by a processor, one or more methods of the embodiments of the present application are implemented.
[0222] The embodiments of the present application disclose an image processing method and apparatus. Example 1 includes an image processing method, including:
[0223] Acquire an image, wherein the image includes a foreground portion and a background portion;
[0224] Acquire feature data corresponding to the foreground part and the background part of the image respectively;
[0225] Inputting feature data corresponding to the foreground part and the background part of the image into a mixer of a neural network model, wherein the mixer is used to predict pixel transparency of the image by comparing the foreground part and the background part;
[0226] The pixel transparency of the image is determined by the mixer.
[0227] Example 2 may include the method of Example 1, wherein determining, by the mixer, the transparency of the image comprises:
[0228] Obtaining relative values of pixel transparency of the foreground part and the background part according to the feature data corresponding to the foreground part and the background part respectively;
[0229] The pixel transparency of the image is determined according to the relative pixel transparency value and the pixel transparency corresponding to the foreground part and the background part respectively.
[0230] Example 3 may include the method of Example 1, wherein the method further comprises:
[0231] Image segmentation processing is performed based on pixel transparency of the image.
[0232] Example 4 may include the method of Example 1, wherein the neural network model further includes at least two decoders, and the method further includes:
[0233] The feature data of the image are respectively input into the decoder to obtain the feature data corresponding to the foreground part and the background part of the image, and the pixel transparency corresponding to the foreground part and the background part.
[0234] Example 5 may include the method of Example 1, wherein the neural network model further includes an encoder, and the method further includes:
[0235] The image is input into an encoder to obtain feature data of the image.
[0236] Example 6 includes an image processing method, comprising:
[0237] determining a first content element and a second content element of the image;
[0238] Obtaining relative values of pixel attributes of the first content element and the second content element;
[0239] Determining the pixel attributes of the image according to the relative value of the pixel attributes and the pixel attributes corresponding to the first content element and the second content element respectively;
[0240] Image processing is performed based on the pixel attributes.
[0241] Example 7 may include the method of Example 6, wherein the first content element includes a foreground portion of an image, the second content element includes a background portion of an image, and determining the first content element and the second content element of the image includes:
[0242] identifying at least one target object in the image;
[0243] The image foreground part and the image background part are determined according to the corresponding relationship between the target object and the image foreground part or the image background part.
[0244] Example 8 may include the method of Example 6, wherein determining the first content element and the second content element of the image comprises:
[0245] The image is input into a first content decoder and a second content decoder of a neural network model to obtain a first content element and a second content element of the image respectively.
[0246] Example 9 may include the method of Example 6, wherein obtaining the relative values of pixel attributes of the first content element and the second content element comprises:
[0247] Acquire feature data corresponding to the first content element and the second content element of the image respectively;
[0248] The relative values of pixel attributes of the foreground part and the background part of the image are determined according to the acquired feature data.
[0249] Example 10 may include the method of Example 9, wherein determining the relative values of pixel attributes of the foreground portion and the background portion of the image according to the acquired feature data comprises:
[0250] The feature data corresponding to the first content element and the second content element respectively and the feature data of the image are input into the mixer of the neural network to obtain the relative values of the pixel attributes of the foreground part and the background part of the image.
[0251] Example 11 may include the method of Example 9, wherein acquiring feature data corresponding to the first content element and the second content element of the image respectively comprises:
[0252] Inputting the image into an encoder of a neural network model to obtain feature data of multiple dimensions corresponding to the image;
[0253] The feature data of the image is input into a first content decoder and a second content decoder of a neural network model to obtain feature data corresponding to a first content element and a second content element of the image respectively.
[0254] Example 12 may include the method of Example 6, wherein the pixel attribute of the image is within a numerical interval formed by the pixel attribute of the first content element and the pixel attribute of the second content element.
[0255] Example 13 may include the method of Example 6, wherein determining the pixel attribute of the image according to the pixel attribute relative value and the pixel attributes corresponding to the first content element and the second content element respectively comprises:
[0256] Determining attribute weights of the pixel attributes corresponding to the first content element and the second content element respectively based on the relative value of the pixel attribute and a preset numerical relationship;
[0257] The pixel attributes of the image are determined according to the pixel attributes respectively corresponding to the first content element and the second content element and the attribute weights corresponding to the pixel attributes.
[0258] Example 14 may include the method of Example 6, wherein the pixel attribute includes pixel transparency, and performing image processing based on the pixel attribute includes:
[0259] Image segmentation processing is performed according to pixel transparency of the image.
[0260] Example 15 may include the method of Example 6, wherein, before the performing the image processing based on the pixel attribute, the method further comprises:
[0261] A target object to be processed in the image is determined.
[0262] Example 16 may include the method of Example 6, wherein determining the target object to be processed in the image comprises:
[0263] A target object to be processed in the image is determined according to whether at least one target object in the image belongs to a preset category.
[0264] Example 17 includes an image processing method, comprising:
[0265] determining a plurality of content elements of the image;
[0266] Get the relative values of pixel attributes between content elements;
[0267] Determining pixel attributes of the image according to the pixel relative parameters and the pixel attributes of the content element;
[0268] Image processing is performed based on the pixel attributes.
[0269] Example 18 includes an image processing method, comprising:
[0270] Get an input first image;
[0271] Using a first neural network and a second neural network, determining feature data corresponding to a foreground portion and a background portion of the first image respectively;
[0272] Determining pixel attributes of the first image according to feature data corresponding to the foreground portion and the background portion of the first image respectively;
[0273] extracting the first content element based on pixel attributes of the first image;
[0274] Obtaining a second image according to the first content element and the updated second content element;
[0275] The second image is provided.
[0276] Example 19 may include the method of Example 18, further comprising:
[0277] Determine feature data of a middle scene portion of the first image using a third neural network;
[0278] Determining the pixel attributes of the first image according to the feature data corresponding to the foreground part and the background part of the first image includes:
[0279] The pixel attributes of the first image are determined according to the feature data corresponding to the foreground part, the background part and the middle scene part of the first image respectively.
[0280] Example 20 includes a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, one or more methods of Examples 1-19 are implemented.
[0281] Although certain embodiments are for the purpose of illustration and description, various alternatives, and / or, equivalent implementations, or calculations to achieve the same purpose of the embodiment shown and described implementations do not depart from the scope of the present application. This application is intended to cover any modifications or changes of the embodiments discussed herein. Therefore, it is apparent that the embodiments described herein are limited only by the claims and their equivalents.
Claims
1. An image processing method, characterized in that: include: Acquire an image, wherein the image includes a foreground portion and a background portion; Acquire feature data corresponding to the foreground part and the background part of the image respectively; Inputting feature data corresponding to the foreground part and the background part of the image into a mixer of a neural network model, wherein the mixer is used to predict pixel transparency of the image by comparing the foreground part and the background part; Determining, by the mixer, pixel transparency of the image; Wherein, determining the transparency of the image by the mixer comprises: Obtaining relative values of pixel transparency of the foreground part and the background part according to the feature data corresponding to the foreground part and the background part respectively; The pixel transparency of the image is determined according to the relative pixel transparency value and the pixel transparency corresponding to the foreground part and the background part respectively.
2. The method according to claim 1, characterized in that The method further comprises: Image segmentation processing is performed based on pixel transparency of the image.
3. The method according to claim 1, characterized in that The neural network model also includes at least two decoders, and the method further includes: The feature data of the image are respectively input into the decoder to obtain the feature data corresponding to the foreground part and the background part of the image, and the pixel transparency corresponding to the foreground part and the background part.
4. The method according to claim 1, characterized in that: The neural network model also includes an encoder, and the method further includes: The image is input into an encoder to obtain feature data of the image.
5. An image processing method, characterized in that: include: determining a first content element and a second content element of the image; Obtaining relative values of pixel attributes of the first content element and the second content element; Determining the pixel attributes of the image according to the relative value of the pixel attributes and the pixel attributes corresponding to the first content element and the second content element respectively; Performing image processing based on the pixel attributes; The acquiring of the relative values of the pixel attributes of the first content element and the second content element includes: Acquire feature data corresponding to the first content element and the second content element of the image respectively; Determining relative values of pixel attributes of a foreground portion and a background portion of the image according to the acquired feature data; Determining the relative values of pixel attributes of the foreground part and the background part of the image according to the acquired feature data includes: The feature data corresponding to the first content element and the second content element respectively and the feature data of the image are input into the mixer of the neural network to obtain the relative values of the pixel attributes of the foreground part and the background part of the image.
6. The method according to claim 5, characterized in that The first content element includes a foreground portion of the image, the second content element includes a background portion of the image, and the first content element and the second content element of the determined image include: identifying at least one target object in the image; The image foreground part and the image background part are determined according to the corresponding relationship between the target object and the image foreground part or the image background part.
7. The method according to claim 5, characterized in that The determining the first content element and the second content element of the image comprises: The image is input into a first content decoder and a second content decoder of a neural network model to obtain a first content element and a second content element of the image respectively.
8. The method according to claim 5, characterized in that The acquiring of feature data corresponding to the first content element and the second content element of the image respectively comprises: Inputting the image into an encoder of a neural network model to obtain feature data of multiple dimensions corresponding to the image; The feature data of the image is input into a first content decoder and a second content decoder of a neural network model to obtain feature data corresponding to a first content element and a second content element of the image respectively.
9. The method according to claim 5, characterized in that The pixel attribute of the image is within a numerical interval formed by the pixel attribute of the first content element and the pixel attribute of the second content element.
10. The method according to claim 5, characterized in that Determining the pixel attributes of the image according to the pixel attribute relative value and the pixel attributes corresponding to the first content element and the second content element respectively includes: Determining attribute weights of the pixel attributes corresponding to the first content element and the second content element respectively based on the relative value of the pixel attribute and a preset numerical relationship; The pixel attributes of the image are determined according to the pixel attributes respectively corresponding to the first content element and the second content element and the attribute weights corresponding to the pixel attributes.
11. The method according to claim 5, characterized in that The pixel attribute includes pixel transparency, and the image processing based on the pixel attribute includes: Image segmentation processing is performed according to pixel transparency of the image.
12. The method according to claim 5, characterized in that Before performing image processing based on the pixel attributes, the method further includes: A target object to be processed in the image is determined.
13. The method according to claim 5, characterized in that Determining the target object to be processed in the image comprises: A target object to be processed in the image is determined according to whether at least one target object in the image belongs to a preset category.
14. An image processing method, characterized in that: include: Determine a plurality of content elements of the image; wherein the plurality of content elements are more than two content elements; Get the relative values of pixel attributes between content elements; Determining pixel attributes of the image according to the pixel relative parameters and the pixel attributes of the content element; Performing image processing based on the pixel attributes; Wherein, obtaining the relative values of pixel attributes between content elements includes: Acquire feature data corresponding to a plurality of content elements of the image respectively; Determining relative values of pixel attributes of a foreground portion and a background portion of the image according to the acquired feature data; Determining the relative values of pixel attributes of the foreground part and the background part of the image according to the acquired feature data includes: The feature data respectively corresponding to the plurality of content elements and the feature data of the image are input into a mixer of a neural network to obtain relative values of pixel attributes of a foreground portion and a background portion of the image.
15. An image processing method, characterized in that: include: Get an input first image; Using a first neural network and a second neural network, determining feature data corresponding to a foreground portion and a background portion of the first image respectively; Determining pixel attributes of the first image according to feature data corresponding to the foreground portion and the background portion of the first image respectively; extracting a first content element based on pixel attributes of the first image; Obtaining a second image according to the first content element and the updated second content element; The second image is provided.
16. The method according to claim 15, characterized in that Also includes: Determine feature data of a middle scene portion of the first image using a third neural network; Determining the pixel attributes of the first image according to the feature data corresponding to the foreground part and the background part of the first image includes: The pixel attributes of the first image are determined according to the feature data corresponding to the foreground part, the background part and the middle scene part of the first image respectively.
17. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the method according to one or more of claims 1-16 is implemented.
18. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to one or more of claims 1 to 16 is implemented.
Citation Information
Patent Citations
Automatic matting algorithm and device
CN107452010A
Video image matting processing method and device and computer readable storage medium
CN108305256A