WO2023239299A1 - 图像处理方法、装置、电子设备及存储介质 - Google Patents

图像处理方法、装置、电子设备及存储介质 Download PDF

Info

Publication number
WO2023239299A1
WO2023239299A1 PCT/SG2023/050392 SG2023050392W WO2023239299A1 WO 2023239299 A1 WO2023239299 A1 WO 2023239299A1 SG 2023050392 W SG2023050392 W SG 2023050392W WO 2023239299 A1 WO2023239299 A1 WO 2023239299A1
Authority
WO
WIPO (PCT)
Prior art keywords
image
preset
model
preset object
sample
Prior art date
Application number
PCT/SG2023/050392
Other languages
English (en)
French (fr)
Inventor
万仰岳
沈晓辉
Original Assignee
脸萌有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 脸萌有限公司 filed Critical 脸萌有限公司
Publication of WO2023239299A1 publication Critical patent/WO2023239299A1/zh

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/08Learning methods
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/50Image enhancement or restoration using two or more images, e.g. averaging or subtraction
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/13Edge detection

Definitions

  • the present disclosure provides an image processing method, device, electronic device and storage medium to remove target objects in images in real time and reduce the cost of removing element objects in images.
  • An embodiment of the present disclosure provides an image processing method.
  • the method includes: obtaining an image to be processed, wherein the image to be processed is an image with a preset object, and some pixels of the preset object are located in the image to be processed. Within the main body outline area in the image, another part of the pixel points of the preset object is located outside the main body outline area; input the image to be processed into the preset object removal processing model to obtain a target image, where, the target image Remove images for objects corresponding to the images with preset objects;
  • the preset object removal processing model is a model obtained by training a set based on pre-established image samples without preset objects, wherein, the no preset objects
  • Each non-preset object image sample pair in the object image sample pair set includes an original image with a preset object, and the pixel points and the preset object's pixels located outside the body outline area in the original image respectively.
  • An embodiment of the present disclosure also provides an image processing device.
  • the device includes: an image acquisition module configured to acquire an image to be processed, wherein the image to be processed is an image with a preset object, and the preset object is Some pixel points are located within the subject outline area in the image to be processed, and another part of the pixel points of the preset object are located outside the subject outline area; an image processing module configured to input the image to be processed to the preset object Remove the processing model and obtain the target image, where, the target image Remove images for preset objects corresponding to the images with preset objects;
  • the preset object removal processing model is a model obtained by training a set based on pre-established image samples without preset objects, wherein, the preset object removal processing model is Each non-preset object image sample pair in the set of preset object image sample pairs includes an original image with a preset object, and identifies the
  • the preset object-removed image is obtained by processing the pixel points of the preset object outside the main body outline area and the pixel points of the preset object located in the main body outline area in the original image.
  • An embodiment of the present disclosure also provides an electronic device, including: at least one processor; a storage device configured to store at least one program, and when the at least one program is executed by the at least one processor, the at least one process The processor implements the image processing method described in any one of the embodiments of the present disclosure.
  • Embodiments of the present disclosure also provide a storage medium containing computer-executable instructions, which, when executed by a computer processor, are used to perform the image processing method as described in any embodiment of the present disclosure.
  • Figure 1 is a schematic flow chart of an image processing method provided by an embodiment of the present disclosure
  • Figure 2 is a schematic diagram of an image to be processed provided by an embodiment of the present disclosure
  • Figure 3 is an image processing method provided by an embodiment of the present disclosure.
  • Figure 4 is a schematic flowchart of an image processing method provided by an embodiment of the present disclosure;
  • Figure 5 is a schematic diagram of an image background repair provided by an embodiment of the present disclosure;
  • Figure 6 is a schematic flowchart of an image processing method provided by an embodiment of the present disclosure.
  • the user when responding to the user's active request, send a prompt message to the user to clearly prompt the user that the operation requested will require obtaining and using the user's Personal information. Therefore, the user can autonomously choose according to the prompt information whether to provide personal information to software or hardware such as electronic devices, applications, servers or storage media that perform the operations of the technical solution of the present disclosure.
  • the method of sending prompt information to the user in response to receiving the user's active request, can be, for example, a pop-up window, and the prompt information can be presented in the form of text in the pop-up window.
  • FIG. 1 is a schematic flow chart of an image processing method provided by an embodiment of the present disclosure.
  • the embodiment of the present disclosure is suitable for converting images to be processed into
  • the method can be executed by an image processing device, which can be implemented in the form of software and/or hardware, and can optionally be implemented by an electronic device.
  • the electronic device can be a mobile terminal or a personal computer.
  • Computer Personal Computer, PC
  • the image processing method includes:
  • the image to be processed is an image containing an image special effects processing object, and can be an image obtained by downloading, shooting, or uploading.
  • the image to be processed is an image with a preset object.
  • the preset object is the image special effects processing object in the image feature processing process. It is the target object that needs to be removed, and some pixels of the preset object are located in the to-be-processed image. Within the subject outline area in the processed image, another part of the pixels is located outside the subject outline area in the image to be processed.
  • the pixels of the preset object located in different areas can be processed separately according to the pixel information characteristics of different parts.
  • the subject may be a foreground object containing partial pixels of the preset object or a partial area object of the foreground in the image to be processed, and the subject outline is a line formed by edge pixels of the corresponding foreground or partial area of the foreground.
  • a unified pixel value can be used to replace the pixel value of the preset object, such as making the preset object pure white or pure black, or using the average pixel of the image to be processed. The value replaces the pixel value of the preset object.
  • the pixel points of the preset object within the subject outline range appear as the pixel features of the subject itself in the image to be processed.
  • the pixel points of the preset object outside the subject outline range are removed, they appear as the pixel features of the subject image to be processed. Pixel characteristics of the background other than the subject.
  • the preset object can be any object. When the relationship between the preset object in the image to be processed and the foreground subject object in the image satisfies the requirement that some of the pixel points of the preset object are located in the subject outline area of the image to be processed, and the other part of the pixel points are located in When the subject outline area in the image to be processed is outside, the image processing method of this embodiment can be used to perform image special effects processing.
  • an image to be processed is shown.
  • the subject is a dining table
  • the preset object is an object placed on the dining table
  • the object is two parts separated by a dotted line.
  • part of the pixel points of the object are within the outline range of the dining table
  • the other part of the pixel points are outside the outline range of the dining table.
  • the image special effect processing effect of removing objects is that the pixels of the corresponding objects within the outline of the main body of the dining table are processed into pixels that are consistent with the main body of the dining table, and the pixels of the corresponding objects outside the outline of the main body of the dining table are processed into pixels that are consistent with the main body of the dining table in the image to be processed. pixels consistent with the background.
  • the preset object removal processing model can realize the special effect of removing preset objects from the image to be processed. If the image to be processed containing the preset object is input into the preset object removal processing model, the corresponding output result can be obtained, that is, it does not contain the preset object.
  • the preset object removal processing model may be based on a pre-established set of image sample pairs without preset objects. The model obtained by training.
  • Each image sample pair without a preset object includes an original image with a preset object, and a pair of pixels of the preset object located outside the subject outline area in the original image and pixels located in the original image.
  • the preset object removal image obtained by processing the pixel points of the preset object within the subject outline area.
  • the preset object removal processing model can learn the mapping relationship between the original image with the preset object and the corresponding preset object removal image to achieve the preset object removal effect.
  • the training process of the preset object removal processing model may include the following steps: Step-1: Identify the main body contour area showing the preset object in the original image with the preset object. In this step, the corresponding subject contour area can be identified and extracted in the original image through interactive image segmentation technology.
  • Step 2 Process the pixels of the preset object located in the main body outline area in the original image to be the same as the pixels of the preset object in the main body outline area of the original image. pixels with consistent pixel information, and process pixels of the preset object located outside the main body outline area in the original image into non-preset pixels outside the main body outline area in the original image. If the pixel information of the pixels of the object is consistent, the preset object removal image is obtained.
  • the consistency of pixel information can be understood as the same pixel characteristics, or the visual effect of the pixel information is the same.
  • the pixels of the preset object are processed, that is, the pixels of the preset object in one area are processed first, and then the pixels of the preset object in another area are processed.
  • the pixels of preset objects in different areas can also be processed according to corresponding pixel processing strategies at the same time.
  • the average pixel value of the area can be used to replace the pixel value of the preset object, or interpolation can be used to calculate the preset based on the pixel information of the area.
  • the updated pixel value of the object can be used to replace the pixel value of the preset object.
  • Step 3 Train an initial image removal model based on the original image and the preset object removal image to obtain the preset object removal processing model.
  • the original image can be used as the model input, and the preset object The object removal image is the expected output of the model.
  • the training process can be completed, thereby obtaining the preset object removal processing model, which is used for During the removal process of the preset object.
  • the technical solution of the embodiment of the present disclosure is that when an image to be processed is acquired, and the image to be processed is an image with a preset object, the pixel points of the preset object are located in the subject outline area of the image to be processed, and the other part of the pixel points are When located outside the body contour area; the image to be processed can be input to the preset object removal processing model to obtain the target image after the preset object is removed, wherein the preset object removal processing model is based on the preset-free A model obtained by training a set of object image sample pairs, where each pair of image samples without preset objects includes the original image with the preset object, and the preset object pixels located outside the subject outline area and the preset object pixels located in the subject.
  • FIG. 3 is a schematic flow chart of another image processing method provided by an embodiment of the present disclosure. In the process of implementing the method flow, it describes the training process of the preset object removal processing model when the target object to be removed is hair. , especially the construction process of model training sample pairs.
  • the method may be executed by an image processing device, which may be implemented in the form of software and/or hardware, or optionally, by an electronic device, which may be a mobile terminal, a PC, or a server.
  • an image processing method includes the following steps.
  • S210> Construct a pair of image samples without preset time for training the preset object removal processing model.
  • an original image with a preset object is constructed, and a sample consisting of an image without the preset object after hair removal corresponding to the original image with the preset object is constructed.
  • the pixels of the preset object outside the head area correspond to the background part of the original image after removal.
  • Making the pixels of the preset object consistent with the pixel information of the non-preset object pixels outside the subject outline area in the original image after processing is to make the pixels of the preset object become part of the background of the original image after processing , which can achieve the effect of seamlessly removing preset objects.
  • Deep learning can be used to superimpose the binary image of the head area with the original image, and input the image superposition result into the image background repair model to obtain a preliminary object removal image that removes preset objects located outside the head area.
  • Superimposing the binary image of the head area with the original image can temporarily mask the pixel information in the head area of the original image, and avoid being affected by the pixel information in the head area during the image processing process of the image background repair model.
  • Step 3 Based on Step 2, process the pixel points of the preset object located in the main body outline area in the original image to be the same as the non-preset objects in the main body outline area in the original image. pixels whose pixel information is consistent. After removing the hair in the head area, the pixel position corresponding to the head and hair corresponds to the scalp part.
  • the preliminary object removal image obtained in step 2 can be input into the facial skin repair model to obtain the pixels located in the head area. Complete object removal images of preset object removal.
  • the facial skin repair model is an image processing model trained based on the image of a bald head that does not contain hair and the head area corresponding to the bald head image superimposed on the hairstyle mask. This model can restore the bald head image based on the pixel information in the head area of the bald head image.
  • the hair mask covers the area of facial skin, so that a complete head area image without hair can be obtained.
  • S240 Input the image to be processed into the preset object removal processing model to obtain the target image.
  • the technical solution of the embodiment of the present disclosure is to gradually process on the basis of the original image to obtain the corresponding sample image without preset objects and then construct a model training sample pair to train the preset object removal processing model, and then after obtaining the image to be processed , input the image to be processed into the preset object removal processing model to obtain the target image, which solves the unnatural problem in related technologies of changing the image attributes by adding special effects locally to the image, and realizes the real-time removal of targets in the image. image, which reduces the cost of target object removal in the image.
  • FIG. 4 is a schematic flow chart of another image processing method provided by an embodiment of the present disclosure.
  • the process of implementing the method flow it describes the training process of the preset object removal processing model when the target object to be removed is hair.
  • the method can be executed by an image processing device, which can be implemented in the form of software and/or hardware, and optionally, can be implemented by an electronic device.
  • the electronic device can be a mobile terminal, a PC or a server.
  • a head region prediction model and use the head region prediction model to identify the main body outline region of the preset object in the original image with the preset object.
  • the head area can be understood as the real head area after removing the hair (default object). This area can be represented by a black and white binary image.
  • a model training sample pair is constructed.
  • the model training sample pair includes the original image with the preset object, and the binary image of the head region corresponding to the original image.
  • a three-dimensional skull model can be established. The display angle of the three-dimensional skull model can be adjusted arbitrarily, and the skull outline can also be adjusted.
  • multiple original sample images with preset objects of known skull structures are rendered.
  • a three-dimensional skull model with a corresponding display angle is matched; then the three-dimensional skull model is projected into a plane to obtain a binary image of the skull region that matches the original sample image.
  • the outline of the binary image of the skull area can also be adjusted according to the facial outline of the human object in the original sample image.
  • the original sample image can be used as the model input image, and the corresponding head region binary image can be used as the model's expected output image for neural network model training to obtain a head region prediction model.
  • the trained head region prediction model can be used to predict the subject outline area (i.e., head area) on the original image with preset objects.
  • the image background repair model trains the image background repair model, and process the pixel points of the preset object outside the subject outline area in the original image based on the image background repair model to obtain a primary object removal image. After obtaining the original sample image correspondence After removing the hair from the skull area, it becomes hairless. State, the hair can be divided into hair inside the skull area and hair outside the skull area. The hair outside the skull needs to be processed into the background, and the hair inside the skull area needs to be processed into facial skin.
  • the image background repair model is a model used to process hair outside the head area.
  • the head region binary images in the preset head region binary image set and the background images in the preset background image set are randomly combined to obtain multiple combinations, and each combination is The combined binary image of the head region is superimposed on the background image to obtain the first superimposed sample image, as shown in the left image in Figure 5.
  • the head area of a head area binary image is represented by black.
  • the first superimposed sample image is obtained by randomly superimposing the head area binary image with a background image. This processing is equivalent to The pixel information inside the head area is covered, and the pixel information inside the head area will not be extracted during the model learning image features.
  • preset object pixel marking is performed outside the corresponding head area in the first superimposed sample image to obtain a first superimposed sample marked image, such as the middle image in Figure 5, where the gray area represents the preset object pixel mark. It can be understood that the area marked by the preset object pixel can be set with reference to different hairstyles.
  • the neural network model is trained based on the first superimposed sample image and the first superimposed sample marked image to obtain an image background repair model.
  • the first overlay sample marked image can be input into the initial image background repair model to obtain the first model generated image; the first model generated image can be combined with any other image in the preset background image set except the background image in the first overlay sample image.
  • a background image is input into the first discriminator; the initial image background repair model is updated based on the output result of the first discriminator and the comparison result between the first model generated image and the first superimposed sample image to obtain an image background repair model.
  • the background repair effect shown in the right picture in Figure 5 can be obtained by processing the first superimposed sample marked image.
  • adding a second discriminator can make the result of image background repair closer to the real background image, and the effect is more natural, so that the discriminator cannot distinguish the original image.
  • the background image is also a patched background image.
  • a certain acceptable error will be allowed between the first model-generated image and the first superimposed sample image, and the two will not be forced to be exactly the same to avoid over-fitting of the model.
  • the code image can be set with reference to various hairstyles. Then, a preset number of head region anchor points are collected in the head region of the second superimposed sample image according to the preset calibration point collection strategy, and a second superimposed sample image marked with the preset number of head region anchor points is obtained.
  • the head region anchor point can be used as auxiliary reference information for the scraped neural network model, so that the neural network model can distinguish between the head region and outside the head region, and extract features within the area corresponding to the head region anchor point.
  • the facial skin can be obtained by performing neural network model training based on the second superimposed sample image marked with a preset number of head region anchor points and the corresponding sample image that does not contain the preset object (the inverted right image in Figure 6). Patch the model.
  • the strategy for collecting anchor points in the skull area can be: for the interior of the skull area of the second superimposed sample image, perform anchor point sampling according to the contour of the facial features; for the edge of the skull area contour of the second superimposed sample image, perform sampling at the contour edge according to the preset sampling interval Anchor point sampling*
  • Anchor point sampling results please refer to the black point on the left in Figure 6.
  • the second superimposed sample image marked with the preset number of head region anchor points can be input into the initial facial skin repair model to obtain a second model generated image; generate the second model
  • the image and any sample image that does not contain the preset object except the original sample image that does not contain the preset object corresponding to the second superimposed sample image are input into the second discriminator; based on the output result of the second discriminator and The comparison result between the second model-generated image and the original sample image that does not contain the preset object corresponding to the second superimposed sample image is used to update the initial facial skin repair model to obtain a facial skin repair model.
  • a second discriminator can make the result of facial skin repair in the image closer to the real image of a person without a preset object, making the effect more natural and making the facial skin repair result more natural.
  • the discriminator cannot distinguish whether it is the original human object image without preset objects or the image without preset objects after facial skin patching.
  • the technical solution of the embodiment of the present disclosure is to separately train the head region prediction model, the background repair model and the facial skin repair model.
  • the corresponding non-preset object sample is obtained through step-by-step processing through the scraped and trained model.
  • the image is then used to construct a model training sample pair to train the preset object removal processing model.
  • the to be processed image is input to the preset object removal processing model to obtain the target image, which solves the problem of image-based processing in related technologies.
  • FIG. 7 is a schematic structural diagram of an image processing device provided by an embodiment of the present disclosure.
  • the device is suitable for removing preset objects from images to be processed. It can be implemented in the form of software and/' or hardware.
  • the image processing device can be configured on an electronic device, and the electronic device can be a mobile terminal, a PC, a server, etc.
  • the image processing device includes: an image acquisition module 410 and an image processing module 420.
  • An image acquisition module is configured to acquire an image to be processed, wherein the image to be processed is an image with a preset object, Some of the pixel points of the preset object are located within the main body outline area in the image to be processed, and another part of the pixel points of the preset object are located outside the main body outline area; the image processing module is configured to process the to-be-processed image.
  • the image is input to the preset object removal processing model to obtain the target image, wherein the target image is the preset object removal image corresponding to the image with the preset object; the preset object removal processing model is based on.
  • the technical solution provided by the embodiment of the present disclosure is to obtain an image to be processed, wherein the image to be processed is an image with a preset object, and some pixels of the preset object are located in the subject outline area in the image to be processed.
  • the pixel points is located outside the main body outline area; input the image to be processed into the preset object removal processing model to obtain a target image, where the target image corresponds to the image with the preset object
  • the preset object removal image obtained by processing the pixels of the preset object solves the problem in related technologies of changing the image attributes by adding special effects locally to the image, and achieves the real-time removal of target objects in the image. Reduce the cost of target object removal in images.
  • the image processing device further includes a model training sample construction module, configured to: identify the body outline area showing the preset object in the original image with the preset object Domain; Process the pixels of the preset object located in the main body outline area in the original image into pixels that are not the preset object pixels in the main body outline area of the original image. pixels with consistent information, and process the pixels of the preset object located outside the main body outline area in the original image as non-preset pixels outside the main body outline area in the original image.
  • the pixels with consistent pixel information of the object's pixels are used to obtain a preset object-removed image; the original image and the preset object-removed image are composed of the preset object-free image sample pair.
  • the model-training sample construction module is configured to: input the original image with the preset object into the skull area prediction model , obtain a binary image of the head region showing the preset object; superimpose the binary image of the head region with the original image to obtain an image overlay result, and input the image overlay result into the image background repair model, Obtain a preliminary object removal image in which the preset objects located outside the head area in the original image are removed; input the preliminary object removal image into the facial skin repair model to obtain the original image
  • the preset object-removed complete object-removed image located in the head area; the original image and the complete object-removed image form the preset-object-free image sample pair.
  • the image processing device further includes a first auxiliary model training module configured to train the head region prediction model.
  • the training process includes the following steps: Obtain the image with the preset time image. any sample image, and match the corresponding three-dimensional skull model for any sample image; perform planar projection on the three-dimensional skull model to obtain a binary image of the head region that matches any sample image; match the any sample image A sample image is used as the model input image, and the binary image of the head region matching any of the sample images is used as the expected output image of the model for neural network model training to obtain the head region prediction model.
  • the image processing device further includes a second auxiliary model training module configured to train the image background repair model.
  • the training process includes the following steps: Add the preset head region binary image set to The binary image of the head region is randomly combined with the background image in the preset background image set to obtain multiple combinations, and the binary image of the head region in each combination is superimposed on the background image in each group to obtain A first superimposed sample image; Mark the preset object pixels outside the corresponding head area in the first superimposed sample image to obtain a first superimposed sample marked image; Based on the first superimposed sample image and the first superimposed sample The labeled image is trained on a neural network model to obtain the image background repair model.
  • the second auxiliary model training module is configured to: input the first superimposed sample marked image into the initial image background repair model to obtain the first model generated image; Any background image in the first model generated image and the preset background image set except the background image in the first superimposed sample image is input into the first discriminator; based on the first discriminator; The initial image background repair model is updated based on the output result of the discriminator and the comparison result between the first model generated image and the first superimposed sample image to obtain the image background repair model.
  • the image processing device further includes a third auxiliary model training module, configured to train the facial skin repair model.
  • the training process includes the following steps: any collected images that do not contain Superimpose the preset object mask image in the head area of the sample image of the preset object to obtain a second superimposed sample image; collect a preset number of head areas in the head area of the second superimposed sample image according to the preset calibration point collection strategy anchor points to obtain a second superimposed sample image marked with the preset number of head region anchor points; based on the second superimposed sample image marked with the preset number of head region anchor points and the corresponding image that does not contain the preset Assume that the sample image of the object is trained on the neural network model to obtain the facial skin repair model.
  • the third auxiliary model scraping module is configured to: input the second superimposed sample image marked with the preset number of head region anchor points into the initial facial skin. Obtain a second model-generated image from the repair model; compare the second model-generated image with any image except the collected sample image that does not contain a preset object corresponding to the second superimposed sample image. The sample image that does not contain the preset object is input into the second discriminator; based on the output result of the second discriminator and the second model, an image and the collected image corresponding to the second superimposed sample image are generated. Based on the comparison result of any sample image that does not contain the preset object, the initial facial skin repair model is updated to obtain the facial skin repair model.
  • the third auxiliary model training module may also be configured to: perform anchor point sampling according to facial features contours inside the skull area of the second superimposed sample image; Anchor point sampling is performed on the contour edge of the head region of the sample image according to a preset sampling interval.
  • the image processing device provided by the embodiments of the present disclosure can execute the image processing method provided by any embodiment of the present disclosure, and has functional modules corresponding to the execution method.
  • FIG. 8 is a schematic structural diagram of an electronic device provided by an embodiment of the present disclosure. Referring now to FIG. 8 , a schematic structural diagram of an electronic device (such as the terminal device or server in FIG. 8 ) 500 suitable for implementing embodiments of the present disclosure is shown.
  • Terminal devices in the embodiments of the present disclosure may include, but are not limited to, mobile phones, notebook computers, digital broadcast receivers, personal digital assistants (Personal Digital Assistant, PDA), tablet computers (Portable Android Device, PAD), and portable multimedia players. (Portable Media Player, PMP).
  • Mobile terminals such as vehicle-mounted terminals (such as vehicle-mounted navigation terminals) and mobile terminals such as Digital TV (Television, TV).
  • Fixed terminals such as desktop computers.
  • the electronic device 500 shown in FIG. 8 is only an example and should not bring any limitations to the functions and usage scope of the embodiments of the present disclosure.
  • the electronic device 500 may include a processing device (such as a central processing unit, a graphics processor, etc.) 50L, which may process data according to a program stored in a read-only memory (Read-Only Memory, ROM) 502 or from a storage device 508
  • ROM Read-Only Memory
  • RAM Random Access Memory
  • the processing device 50E ROM 502 and RAM 503 are connected to each other via a bus 504 .
  • An input/output (hipirt/output I/O) interface 505 is also connected to bus 504.
  • Input devices S06 including, for example, a touch screen, touch pad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, etc.; including, for example, a Liquid Crystal Display (LCD) , an output device 507 such as a speaker, a vibrator, etc.; a storage device 508 including a magnetic tape, a hard disk, etc.; and a communication device 509.
  • Communication device 509 may allow electronic device 500 to communicate wirelessly or wiredly with other devices to exchange data.
  • FIG. 8 illustrates electronic device 500 with various devices, it should be understood that implementation or availability of all illustrated devices is not required. More or fewer means may alternatively be implemented or provided.
  • embodiments of the present disclosure include a computer program product including a computer program carried on a non-transitory computer-readable medium, the computer program including program code for performing the method illustrated in the flowchart. .
  • the computer program may be downloaded and installed from the network via communication device 509, or from storage device 508, or from ROM 502.
  • the processing device 501 When the computer program is executed by the processing device 501, the above functions defined in the method of the embodiment of the present disclosure are performed.
  • the names of messages or information exchanged between multiple devices in the embodiments of the present disclosure are only for illustrative purposes and are not used to limit the scope of these messages or information.
  • Embodiments of the present disclosure provide a computer storage medium on which a computer program is stored. When the program is executed by a processor, the image processing method provided by the above embodiments is implemented.
  • the computer-readable medium mentioned above in the present disclosure may be a computer-readable signal medium or a computer-readable storage medium, or any combination of the above two.
  • the computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination thereof.
  • Examples of computer-readable storage media may include, but are not limited to For: Electrical connections with one or more wires, portable computer disks, hard drives, RAM, ROM, Erasable Programmable Read-Only Memory (EPROM) or flash memory, fiber optics, portable compact disks only Read-only memory (Compact Disc Read-Only Memoiy, CD-ROM), optical storage device, magnetic storage device, or any suitable combination of the above.
  • a computer-readable storage medium may be any tangible medium that contains or stores a program for use by or in connection with an instruction execution system, apparatus, or device.
  • the computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, in which computer-readable program code is carried.
  • This propagated data signal can take many forms, including but not limited to electromagnetic signals > optical signals or any suitable combination of the above.
  • a computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium that can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device .
  • Program code contained on a computer-readable medium can be transmitted using any appropriate medium, including but not limited to: wires, optical cables, radio frequency (Radio Frequency, RF), etc., or any suitable combination of the above.
  • the client and server can communicate using any currently known or future developed network protocol such as HyperText Transfer Protocol (HTTP), and can communicate with digital data in any form or medium. Communication (e.g., communication network) interconnection.
  • HTTP HyperText Transfer Protocol
  • Examples of communication networks include Local Area Networks (LANs), Wide Area Networks (WANs), the Internet (e.g., the Internet), and end-to-end networks (e.g., ad hoc end-to-end networks), as well as any current network for knowledge or future research and development.
  • the above-mentioned computer-readable medium may be included in the above-mentioned electronic device; it may also exist independently without being assembled into the electronic device.
  • the computer-readable medium carries one or more programs. When the one or more programs are executed by the electronic device, the electronic device: obtains an image to be processed, wherein the image to be processed is an image with a preset object.
  • the preset object removal processing model is based on a pre-established image without a preset object A model obtained by training a set of sample pairs, wherein each pair of image sample pairs without a preset object in the set of image sample pairs without a preset object includes an original image with a preset object, and is respectively aligned with the body contour
  • the preset object removal image is obtained by processing the preset object pixel points outside the area and the preset object pixel points located within the body contour area.
  • each block in the flowchart or block diagram may represent a module, segment, or portion of code that contains one or more items that implement the specified Executable instructions for logical functions.
  • the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown one after another may actually execute substantially in parallel, or they may execute in a sequential order, depending on the functionality involved.
  • each block of the block diagram and/or flowchart illustration, and combinations of blocks in the block diagram and/or flowchart illustration can be implemented by special purpose hardware-based systems that perform the specified functions or operations. , or can be implemented using a combination of dedicated hardware and computer instructions.
  • the units involved in the embodiments of the present disclosure may be implemented in software or hardware. In one case, the name of the unit does not constitute a limitation on the unit itself.
  • the first acquisition unit can also be described as "the unit that acquires at least two Internet Protocol addresses.”
  • the functions described above herein may be performed, at least in part, by one or more hardware logic components.
  • exemplary types of hardware logic components include: field programmable gate array (Field Programmable Gate Array, FPGA), application specific integrated circuit (Application Specific Integrated Circuit, ASIC), application specific standard product (Application Specific Standaid Parts (ASSP), System on Chip (SOC), Complex Programmable Logic Device (CPLD), etc.
  • the machine-readable medium may be a tangible medium, which may A program contained or stored for use by or in conjunction with an instruction execution system, apparatus, or device.
  • the machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium.
  • Machine-readable medium May include but are not limited to electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems" devices or equipment, or any suitable combination of the above. More specific examples of machine-readable storage media would include electrical connections based on one or more wires. Laptop computer disks. Hard drives. RAM. ROM. EPROM or flash memory, fiber optics. CD-ROM, optical storage devices, magnetic storage. storage device, or any suitable combination of the above.
  • Example 1 provides an image processing method, which method includes: obtaining an image to be processed, wherein the image to be processed is an image with a preset object, and the preset object is Assume that some pixel points of the object are located within the main body outline area in the image to be processed, and another part of the pixel points of the preset object are located outside the main body outline area; input the image to be processed into the preset object removal processing model , to obtain a target image, wherein the target image is an object-removed image corresponding to the image with a preset object; the preset object removal processing model is based on a set of pre-established image samples without preset objects.
  • each non-preset object image sample pair in the set of preset object-free image sample pairs includes an original image with a preset object, and each pair of the original image is located in the body contour.
  • the preset object-removed image is obtained by processing the pixel points of the preset object outside the area and the pixel points of the preset object located in the body contour area in the original image.
  • Example 2 provides an image processing method, which further includes: In some optional implementations, the non-preset object image sample pairs no preset objects in the set.
  • the construction process of object image sample pairs includes: identifying the main body outline area in the original image with the preset object that exhibits the preset object; converting the preset object located in the main body outline area in the original image
  • the pixels in the original image are processed into pixels consistent with the pixel information of the pixels of the non-preset object in the main body outline area in the original image, and the pixels in the original image located outside the main body outline area are processed
  • the pixel points of the preset object are processed into pixel points that are consistent with the pixel information of the pixel points of the non-preset object outside the main body outline area in the original image, and a preset object removed image is obtained;
  • the original image and the preset object-removed image form the preset-object-free image sample pair.
  • Example 3 provides an image processing method, including:
  • the construction process of the image sample pairs without preset objects in the set of image sample pairs without preset objects includes: inputting the original image with the preset objects into the head area prediction model to obtain the displayed
  • the binary image of the head region of the preset object is superimposed on the binary image of the head region and the original image to obtain an image overlay result, and the image overlay result is input into the image background repair model to obtain the original image.
  • Example 4 provides an image processing method, which also includes:
  • the training process of the head region prediction model includes: Obtain any sample image with the preset object, and match the corresponding three-dimensional skull model for any sample image; perform planar projection on the three-dimensional skull model to obtain a skull region matching the any sample image.
  • Example 5 provides an image processing method, which also includes:
  • the training process of the image background repair model includes: Randomly combine the head region binary images in the preset head region binary image set with the background images in the preset background image set to obtain multiple groups, and superimpose the head region binary images in each combination on the background image.
  • a superimposed sample labeled image is used for neural network training to obtain the image background repair model.
  • Example 6 provides an image processing method, further comprising: In some optional implementations, based on the first superimposed sample image and the third Performing neural network model training on a superimposed sample labeled image to obtain the image background repair model includes: inputting the first superimposed sample labeled image into the initial image background repair model to obtain a first model generated image; Any background image in the model generated image and the preset background image set except the background image in the first superimposed sample image is input into the first discriminator; based on the output result of the first discriminator and The comparison result between the first model generated image and the first superimposed sample image updates the initial image background repair model to obtain the image background repair model.
  • Example 7 provides an image processing method, further comprising: the training process of the facial skin repair model, including: any collected image that does not contain a preset object Superimpose the preset object mask image in the head area of the sample image to obtain a second superimposed sample image; collect a preset number of head area anchor points in the head area of the second superimposed sample image according to the preset calibration point collection strategy to obtain A second overlay sample image marked with the preset number of head region anchor points; based on the second overlay sample image marked with the preset number of head region anchor points and the corresponding image that does not include the preset pair
  • the sample images are trained on the neural network model to obtain the iftr facial skin repair model.
  • Example 8 provides an image processing method, further comprising:
  • the preset is based on the mark Perform neural network model training on second superimposed sample images of a number of skull region anchor points and corresponding sample images that do not contain preset objects to obtain the facial skin repair model, including: The second superimposed sample image of the regional anchor point is input into the initial facial skin repair model to obtain the second model generate an image; compare the second model generated image with any sample image that does not include a preset object except for any of the collected sample images that do not include a preset object corresponding to the second superimposed sample image.
  • Example 9 provides an image processing method, further comprising: In an optional implementation, the second acquisition strategy is performed according to the preset calibration point acquisition strategy.
  • Collecting a preset number of head area anchor points in the head area of the superimposed sample image includes: performing anchor point sampling according to the outline of the facial features inside the head area of the second superimposed sample image; Anchor point sampling is performed on the contour edge of the region according to a preset sampling interval.
  • Example 10 provides an image processing device, which includes: an image acquisition module configured to acquire an image to be processed, wherein the image to be processed has a preset object The image, part of the pixel points of the preset object is located within the main body outline area in the image to be processed, and another part of the pixel points of the preset object is located outside the main body outline area; the image processing module is set to Input the image to be processed into the preset object removal processing model to obtain a target image, wherein the target image is a preset object removal image corresponding to the image with the preset object; the preset object removal processing The model is a model obtained by training based on a pre-established set of image sample pairs without preset objects, wherein each pair of image sample pairs without preset objects in the set of image sample pairs without preset objects includes an image sample pair with a preset object.
  • Example 111 provides an image processing device, further including:
  • the image processing device further includes a model training sample construction module, It is set to: identify the main body outline area showing the preset object in the original image with the preset object; process the pixel points of the preset object located in the main body outline area in the original image to be consistent with the The pixels in the original image that are not the pixels of the preset object within the main body outline area have consistent pixel information, and the pixels of the preset object that are outside the main body outline area in the original image are Process pixel points that are consistent with pixel information of pixel points that are not the preset object outside the body outline area in the original image to obtain a preset object-removed image; combine the original image and
  • Example 12 provides an image processing device, further including:
  • the model training sample construction module is set to: input the original image with the preset object into the head region prediction model to obtain a binary image of the head region showing the preset object;
  • the binary image of the head region is superimposed with the original image to obtain an image overlay result, and the image overlay result is input to the image background repair model to obtain the pre-set image located outside the head region in the original image.
  • the primary object removal image of elephant killing removal is input into the facial skin repair model to obtain the complete removal of the preset object located in the head area in the original image.
  • Example 13 provides an image processing device, further including:
  • the image processing device further includes a first auxiliary model training
  • the module is configured to train the head region prediction model.
  • the training process includes the following steps: Obtain any sample image with the preset object, and match the corresponding three-dimensional head model for any sample image;
  • the head model performs planar projection to obtain a binary image of the head area that matches the any sample image; use the any sample image as a model input image, and use the two-value image of the head area that matches the any sample image.
  • Example 14 provides an image processing device, further comprising: In an optional implementation, the image processing device further includes a second auxiliary model.
  • the training module is configured to train the image background repair model.
  • the training process includes the following steps: Randomly combine the head region binary image in the preset head region binary image set with the background image in the preset background image set to obtain a multi-dimensional combinations, and superimpose the binary image of the head region in each combination on the background image in each combination to obtain a first superimposed sample image; perform the operation outside the corresponding head region in the first superimposed sample image Preset object pixel marks to obtain a first superimposed sample marked image; perform neural network model training based on the first superimposed sample image and the first superimposed sample marked image to obtain the image background repair model.
  • Example 15 provides an image processing device, further comprising:
  • the second auxiliary model training module is configured to: Input the first superimposed sample mark image into the initial image background repair model to obtain a first model generated image; divide the first superimposed sample image from the first model generated image and the preset background image set Any background image other than the background image is input into the first discriminator; based on the output result of the first discriminator and the comparison result of the first model generated image and the first superimposed sample image
  • the initial image background repair model is updated to obtain the image background repair model.
  • Example 16 provides an image processing device, which also includes:
  • the image processing device further includes a third auxiliary model training
  • the training module is configured to train the facial skin repair model.
  • the training process includes the following steps: superimpose the preset object mask image in the skull area of any collected sample image that does not contain the preset object to obtain a second superimposed sample.
  • the facial skin repair model is obtained by performing neural network model training based on the second superimposed sample image marked with the preset number of head region anchor points and the corresponding sample image not containing the preset object.
  • the third auxiliary model training module is configured To: input the second superimposed sample image marked with the preset number of head region anchor points into the initial facial skin repair model to obtain a second model generated image; divide the second model generated image with Any sample image that does not contain a preset object other than any of the collected sample images that does not contain a preset object corresponding to the second superimposed sample image is input into the second discriminator; based on the third The output result of the second discriminator and the second model generated (image and the comparison result of any of the collected sample images that do not contain the preset object when compared with the second superimposed sample image, update The initial facial skin repair model is used to obtain the facial skin repair model.
  • Example 18 provides an image processing device, further comprising:
  • the third auxiliary model training module may also be configured to: perform anchor point sampling according to the outline of the five palaces inside the skull area of the second superimposed sample image; Anchor point sampling is performed on the contour edge of the head region according to preset sampling intervals.

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computational Linguistics (AREA)
  • Data Mining & Analysis (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Artificial Intelligence (AREA)
  • Biomedical Technology (AREA)
  • Biophysics (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Health & Medical Sciences (AREA)
  • Evolutionary Computation (AREA)
  • General Health & Medical Sciences (AREA)
  • Molecular Biology (AREA)
  • Computing Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Mathematical Physics (AREA)
  • Software Systems (AREA)
  • Image Processing (AREA)

Abstract

本公开实施例公开了一种图像处理方法、装置、电子设备及存储介质,其中,方法包括:获取待处理图像,其中,待处理图像中预设对象的部分像素点位于待处理图像中主体轮廓区域内,预设对象的另一部分像素点位于主体轮廓区域外;将待处理图像输入至预设对象去除处理模型,得到目标图像,预设对象去除处理模型是基于预先建立的无预设对象图像样本对集合进行训练得到的模型,无预设对象图像样本对集合中的每个无预设对象图像样本对中包括具有预设对象的原始图像,以及分别对原始图像中位于主体轮廓区域外的预设对象的像素点和原始图像中位于主体轮廓区域内的预设对象的像素点进行处理得到的预设对象去除图像。申请申请

Description

图像 处理方 法、 装置、 电子设备及存 储介质 本 申请要求在 2022年 06月 10 EJ提交中国专利局、申请号为 202210657612.2 的 中国专利 申请的优 先权, 该申请的全部内容 通过引 用结合在 本申请 中。 技术 领域 本公 开实施例 涉及图 像处理技 术领域 , 例如涉及一种 图像处理 方法. 装置、 电 子设备及 存储介质 。 背景 技术 需要 为有头 发的 目标对象 的图像 中添加光 头的特 效时, 通常是在 采集图像 的 时候, 通过佩戴物 理头套将 原本的 头发遮 住, 直接采集目标 对象的 无头发 的 光 头图像; 或者, 直接采集目标对 象原本 有头发 的图像 , 采用人工修图 的方式 进行 头发去 除。 这两种方 式中, 前者头套 成本较 高且效果 不够真 实, 后者修图 操作 的人工 成本 .较高, 并且不能实时处理。 发 明内容 本公 开提供 了一种 图像处理 方法 、 装置、 电子设备及存储 介质 以 实现可 以 实时的去 除图像 中的目标对 象, 降低图像 中元素对 象去除 的成本。 本公 开实施 例提供 了一种 图像处理 方法, 该方法包括: 获取待处 理图像 , 其 中, 所述待处理图 像为具 有预设对 象的图 像, 所述预设对 象的部 分像素 点位 于 所述待处 理图像 中主体轮 廓区域 内, 所述预设 对象的 另一部分 像素点位 于所 述主 体轮廓 区域外 ; 将所述待处理 图像输 入至预设 对象去 除处理 模型, 得到 目 标 图像, 其中, 所述目标 图像为 与所述具 有预设对 象的 图像对应 的对象去 除图 像 ; 所述预设对象 去除处理 模型是 基于预 先建立 的无预设 对象 图像样本对 集合 进行 训练得 到的模 型, 其中, 所述无预设 对象图像 样本对 集合 中的每个 无预设 对 象图像样 本对中 包括具有 预设对 象的原 始图像 , 以及分别对所 述原始 图像中 位 于所述主 体轮廓 区域外 的预设对 象的像 素点和 所述原始 图像 中位于所 述主体 轮廓 区域 内的预设对 象的像 素点进行 处理得到 的预设 对象去除 图像。 本公 开实施 例还提供 了一种 图像处 理装置 , 该装置包括: 图像荻取模块, 设 置为获取 待处理 图像, 其中, 所述待处理图像 为具有预 设对 象的图像 , 所述 预设 对象的 部分像 素点位 于所述待 处理图 像中主体 轮廓 区域内 , 所述预设对象 的 另一部分 像素点位 于所述 主体轮 廓区域 外; 图像处理模 块, 设置为将 所述待 处理 图像输 入至预设 对象去 除处理 模型, 得到目标图像 , 其中, 所述目标 图像 为 与所述具 有预设 对象的 图像对应 的预设 对象去 除图像 ; 所述预设对象去 除处 理模 型是基 于预先 建立的无 预设对 象图像 样本对 集合进行 训练得 到的模 型, 其 中 , 所述无预设对 象图像样 本对集 合中的 每个无预 设对 象图像样 本对中 包括具 有预 设对象 的原始 图像, 以及对所述原始 图像中主 体轮廓 区域识 别, 并分别对 所述 原始 图像中位 于所述主 体轮廓 区域外 的预设对 象的像 素点和 所述原 始图像 中位 于所述 主体轮 廓区域 内的预设 对象的 像素点 进行处理 得到的 预设对 象去除 图像 。 本公 开实施例 还提供 了一种 电子设备 , 包括: 至少一个处理器 ; 存储装置, 设 置为存储 至少一 个程序 , 当所述至少一 个程序被 所述至 少一个 处理器 执行, 使得 所述至 少一个处 理器实现 如本公 开实施例 任一所 述的图像 处理方 法。 本公 开实施 例还提供 了一种 包含计 算机可执 行指令 的存储 介质, 所述计算 机可 执行指 令在由 计算机处 理器执 行时用 于执行如 本公开 实施例 任一所 述的图 像 处理方法 。 附 图说明 贯穿 附图中 , 相同或相似 的附图标 记表示相 同或相 似的元 素。 应当理解 附 图是 示意性 的, 原件和元素 不一定按 照比例绘 制。 图 1是本公开 实施例所提 供的一 种图像 处理方法 流程示意 图; 图 2是本公开 实施例所提 供的一 种待处理 图像示 意图; 图 3是本公开 实施例所提 供的一 种图像处 理方法 流程示意 图; 图 4是本公开 实施例所提 供的一 种图像处 理方法 流程示意 图 ; 图 5是本公开 实施例所提 供的一 种图像 背景修补 示意图 ; 图 6是本公开 实施例所提 供的一 种面部皮 肤修补 示意图 ; 图 7是本公开 实施例所提 供的一 种图像处 理装置 结构示意 图; 图 8是本公开 实施例所提 供的一 种电子设 备的结 构示意 图。 具体 实施方 式 下面 将参照 附图描述 本公开 的实施 例。 虽然附图 中显示 了本公开 的一些 实 施 例, 然而应当理 解的是 , 本公开可以通 过多种 形式来 实现, 而且不应 该被解 释 为限于这 里阐述 的实施例 。 应当理解的 是, 本公开的 附图及实 施例仅 用于示 例性 作用, 并非用于限制本公 开的保 护范围 。 应 当理解, 本公开的方法 实施方式 中记载 的多个 步骤可以 按照不 同的顺序 执行 , 和/ '或并行执行。 此外, 方法实施方式可以包括附加的 步骤和 /或省略执行 示 出的步骤 ■。 本公开的范国在此方面 不受限制 O 本文 使用的术 语 “包括 ”及其变形是开放性 包括",即“包括"但不限于”。术语 “基 于 ” 是 “至少部分地基 于" 。 术语 “一个实施例 ” 表示 “至少一个实施 例” ; 术语 “另一实 施例” 表示 “至少一个另外 的实施例” ; 术语 “一些夹施 例” 表 示 “至少一些 实施例” 。 其他术语的才目关定义将在下文描 述中给 出。 需要 注意, 本公开中提及的 “第一” 、 “第二 ” 等概念仅用于对不 同的装 置" 模块或单 元进行 区分, 并非用于 限定这 些装置 、 模块或单元所 执行的 功能 的顺 序或者相 互依存 关系。 需要 注意, 本公开中提及的 “一个” 、 “多个 ” 的修饰是示意性而 非限制 性 的, 本领域技术人 员应 当理解 , 除非在上下文 另有明确 指出, 否则应该理解 为“一 个或多个” 。 可以 理解的 是, 在使用本公 开多个 实施例公 开的技 术方案 之前, 均应当依 据相 关法律 法规通 过恰当 的方式对 本公开 所涉及 个人信息 的类型 , 使用范围、 使用 场景等告 知用户 并荻得用 户的授权 。 例如 , 在响应于接收 到用户 的主动请 求时 , 向用户发送提 示信息 , 以明确 地提 示用户 , 其请求执行 的操作将 需要获取 和使 用到用户 的个人 信息。 从而, 使得 用户可 以根据提 示信 息来自主 地选择 是否向执 行本公 开技术 方案的操 作的 电子 设备、 应用程序 、 服务器或存储 介质等软 件或硬件 提供个 人信息 。 作为 一种可 选的但非 限定性 的实现 方式, 响应于接收到用 户的主动 请求 , 向用 户发送 提示信 息的方式 例如可 以是弹 窗的方式 , 弹窗中可以 以文字的 方式 呈现 提示信 息。 此外, 弹窗中还可 以承载供 用,户选择 “同意 ” 或者 “不同意” 向 电子设备提 供个人 信息的选 择控件 。 可以 理解的 是, 上述通知和 获取用 户授权 过程仅是 示意性 的, 不对本公 开 的 实现方式 构成限 定, 其它满足相 关法律 法规的方 式也可 应用于 本公开 的实现 方式 中。 图 1 为本公开实施 例所提 供的一种 图像处 理方法的 流程示 意图, 本公 ■开实 施例 适用于 将待处理 图像 中预设的 对象去 除的情形 , 该方法可以 由图像处 理装 置来 执行, 该装置可以通过 软件和/或硬件 的形式 实现, 可选的, 通过电子设 备 来 实现, 该电子设备可 以是移 动终端 、 个人计算机 ( Personal Computer, PC )端 或服 务器等 。 如图 1所示, 所述图像 处理方法 包括:
SU0. 获取 待处理 图像。 待处 理图像 是包含 图像特效 处理对 象的图像 , 可以是通过 下载、 拍摄、 或 上传 等方式 获取的 图像。 在本 实施例 中, 待处理图像 为具有 预设对 象的图像 , 预设对象便 是图像特 征处 理过程 中的图像 特效处 理对 象, 是需要去除的 目标对象, 且预设 对象的部 分像 素点位 于待处 理图像 中主体轮 廓区域 内, 另一部分像 素点位 于待处理 图像 中主 体轮廓 区域外 。 预设对象的位 于不同 区域的像 素点可 以依据 不同部位 的像 素信 息特征 分别进 行处理 。 主体可以是待 处理图像 中的 包含有预 设对象 的部分 像 素的前景 对象或 是前景 的部分 区域对象 , 主体轮廓则是 对应的 前景或是 前景 的部 分区域 的边缘像 素点形成 的线条 。 可以 理解的 是, 在预设对 象去除处 理的过程 中, 可以使统 一的像 素值替 代 预设 对象的 像素值 , 如使预设对 象变成纯 白或纯 黑, 或者采用待 处理图像 的平 均像 素值替 代预设 对象的像 素值 。 为了使预设对 象去除 的特效效 果就像是 该预 设对 象没有 存在过 一样, 需要对图像 中不同 部位的预 设对象 的像素 采用不 同的 处理 策略。 在主体轮廓范 围内的预 设对象 的像素 点在去除 之后, 表现为待处理 图像 中主体 本身的像 素特征 , 在主体轮廓 范国外 的预设对 象的像 素点在 去除之 后 , 则表现为待处理 图像中 除主体之 外的背景 的像素 特征。 预设 对象可 以是任 意对象, 当待处理 图像中预 设对 象与图像 中前景 主体对 象之 间的关 系, 满足预设对 象的部分像 素点位 于待处理 图像中 主体轮廓 区域内 , 另一 部分像 素点位 于待处理 图像 中主体轮 廓区域外 时, 便可以通 过本实施 例的 图像 处理方 式进行 图像特效处 理。 示例 性的, 如图 2所示的 一张待 处理图像 , 在该图像中主 体为-一张餐桌, 预设 对象为放 置于餐 桌上的一 个物体 , 且该物体由虚线 隔开的 两个部分, 其中, 该物 体的一 部分像 素点在餐 桌的轮 廓范围 内, 另一 ■部分像素点则在餐桌 的轮廓 范 围外。 将物体去掉 的图像 特效处 理效果 是餐桌主 体轮廓 范围内 对应的物 体的 像素 点处理 为与餐 桌主体一 致的像 素点, 餐桌主体轮 廓范围 外对应 的物体 的像 素点 处理为 与待处理 图像中餐 桌主体之 外的 背景一致 的像素点 。
S120、 将所述待处 理图像 输入至预 设对象 去除处理 模型 , 得到目标图 像。 目标 图像为 与具有预 设对 象的图像 对应的对 象去 除图像, 即目标图像 中不 存在 预设对 象这一元 素。 预设 对象去 除处理模 型可 以实现将 待处理 图像中预 设对象 去除的 特效, 将 包含 预设对 象的待 处理图像 输入预 设对象 去除处理 模型 , 便可以得到对应 的输 出结 果, 即不包含预 设对象 的目标图 像。 预设 对象去 除处理模 型可 以是基于 预先建 立的无预 设对象 图像样 本对集合 进行 训练得 到的模 型。 每个无预设 对象图 像样本对 中包括 具有预 设对象 的原始 图像 , 以及分别对 所述原始 图像 中位于所 述主体轮 廓区域 外的预 设对象 的像素 点和 所述原 始图像 中位于 ■所述主体轮廓区 域内的预 设对 象的像素 点进行 处理得 到 的预设对 象去除 图像。 经过模型 的训练 过程, 预设对 象去除处 理模型可 以学 习具 有预设 对象的原 始图像 以及对 应的预设 对象去 除图像 之间的 映射关 系, 实 现预 设对象 的去除效 果。 预设 对象去 除处理模 型训练过 程可包 括如下步 骤: 步骤-一, 识别具有预 设对 象的原始 图像中展 示所述 预设对 象的主 体轮廓 区 域 。 在该 步骤中 , 可以通过交 互式的图 像分割技 术在原 始图像 中识别 并提取 出 时应 的主体 轮廓区 域。 或者, 还可以采用 其他能 够实现识 别图像 中主体 的图像 识别 算法。 步骤 二, 将所述原始 图像 中位于所 述主体轮 廓区域 内的所 述预设 对象的像 素点 处理为 与所述原 始图像 中所述 主体轮 廓区域 内的非所 述预设 对象的像 素点 的像 素信息 一致的像 素点 , 并将位于所述原 始图像 中所述主 体轮廓 区域外 的所 述预 设对象 的像素 点处理 为与所述 原始图 像中所 述主体轮 廓区域 外的非 所述预 设对 象的像 素点的像 素信 息一致的 像素点 , 得到预设对 象去除 图像。 像素信息 的一 致可以 理解为像 素特征 相同 , 或者是像素信息在 视觉上 呈现 出的效果是 相 同 的。 在针 对主 体轮廓 区域 内以及 主体轮 廓区域 外的预 设对 象像素 点进行 处理 时 , 可以先针对其 中的主体 轮廓 区域内的 预设对 象像素点 进行处 理 , 也可以先 针对 其中的 主体轮 廓区域外 的预设 对象像 素点进行 处理 , 即先处理一个 区域的 预设 对象的像 素点 , 在此基础上再进行 处理另 外一 ■个区域的预设对象的像 素点 。 或者 , 还可以针对不 同区域 的预设对 象的像 素点同 时按照对 应的像 素处理 策略 进行 处理。 在针 对其中 一个区域 的预设 对象的 像素点 进行处理 时, 可以采用 该区域 的 平 均像素值 替代预设 对象 的像素值 , 或者采用插值 的方式 , 根据该区域 的像素 信 息进行插 值计算得 到预设 对象的 更新后 的像素值 。 此外, 还可以采用 深度学 习 的方式, 训练不同 区域的用 于预设 对象像 素处理 的图像处 理神经 网络模型 , 从 而实现对原 始图像 中预设对 象像素 点的处理 。 得到预设对 象去除图 像。 步骤 三 , 根据所述原始 图像和 所述预 设对象 去除图像 对初始 时象去 除模型 进行 训练, 得到所述 预设对 象去除处 理模型 。 在训 练预设 对象去 除模型 的过程中 , 可以以原始 图像为模 型输入 , 预设对 象去 除图像 为模型 的期望输 出, 在预设的训 练次数和 /或预设的模型损失 函数达 到相 应的预 设条件 时, 即可完成训练 过程, 从而得到预设对 象去除 处理模 型, 用 于对预设 对象的去 除处理过 程中。 本公 开实施 例的技 术方案 , 当获取待处理 图像, 且待处理 图像为 具有预设 对 象的图像 , 预设对象的邵 分像素 点位于 待处理 图像中主 体轮廓 区域内 , 另一' 部分 像素点 位于所 述主体轮 廓区域 外时; 可以将待处理 图像输入 至预设对 象去 除处 理模型 , 得到将预设对 象去除 之后的 目标图像 , 其中, 预设对象去 除处理 模型 是基于预 先建立 的无预设 对象图 像样本对 集合进行-训练得 到的模型 , 其中, 每 个无预设 对象图像 样本对 中包括 具有预设 对象 的原始 图像, 以及分别 对位于 主体 轮廓 区域外的预 设对 象像素点 和位于 主体轮廓 区域 内的预设 对象像 素点进 行处 理得到 的预设 对象去 除图像 , 解决了相关技 术中去 除图像 中预设对 象的修 图操 作效率 低的问题 , 实现了可以 实时的 去除图像 中的 目标对象 , 降低图像中 目标 对象去 除的时间 成本和人 工成本 。 图 3 为本公开实 施例所提 供的又 一图像处 理方法 的流程示 意图, .在实现该 方 法流程的 过程中 , 描述了在要去 除的 目标对象 为头发 时, 预设对象去 除处理 模型 的训练 过程, 特别是模型训练 样本对 的构造 过程。 该方法可 以由图像 处理 装 置来执行, 该装置可 以通过 软件和/或硬件 的形式 实现, 可选的, 通过电子设 备 来实现, 该电子设备可以是 移动终 端、 PC端或 服务器等 。 如 图 3所示, 所述图像处理方法 包括如 下步骤。
S210> 构造用于训 练预设 对象去除 处理模 型的无预 设时象 图像样本 对。 在训 练用于 去除头发 的预设 对象去 除处理模 型时 , 首先, 要构造有预设对 象 的原始 图像, 与有预设对 象的原 始图像 对应的去 除头发 后的无 预设对 象图像 组成 的样本 时。 步骤 一, 识别具有预 设对 象的原始 图像中展 示所述 预设对 象的主 体轮廓 区 域 。
Figure imgf000008_0001
步骤 二, 将原始图像 中位 于所述主 体轮廓 区域外 的所述预 设对象 的像素 点 处理 为与原 始图像 中所述主 体轮廓 区域外 的非所述 预设对 象的像 素点的像 素信 息一 致的像 素点。 头颅 区域夕卜的预设对象 的像素点 , 在去除之后对 应的是 原始图 像的背 景部 分 。 使预设对象的像 素点在 经过处 理之后 与原始 图像中主 体轮廓 区域外 的非预 设对 象的像 素点的像 素信 息一致 , 是使预设对象 的像素点 在经过 处理之后 成为 原始 图像背 景的一部 分, 可以达到将 预设对 象无痕去 除的效果 。 可以 采用深 度学习 的方式将 头颅 区域二值 图像与原 始图像 进行叠加 , 并将 图像 叠加结 果输入 至图像 背景修补 模型 , 得到将位 于头颅 区域外的 预设对 象去 除 的初阶对 象去除 图像。 将头颅 区域二值 图像与原 始图像 进行叠加 可以暂 时将 原始 图像的 头颅区 域内的像 素信息 掩盖 , 在图像背景 修补模 型进行 图像处理 过 程 中, 避免受到头 颅区域 内像素信 息的影 响。 从而可以根 据头颅 区域外 的背景 部分 的像素 信息处 理头颅 区域外的 预设对 象的像 素点, 有更好的 预设对 象去除 效 果。 步骤 三, 在步骤二 的基础之 上, 将原始图像 中位 于所述主 体轮廓 区域内 的 所述 预设对 象的像 素点处理 为与原 始图像 中所述 主体轮廓 区域 内的非所 述预设 对 象的像素 点的像素 信息一致 的像素 点。 将头 颅区域 内的头发 去除之 后, 头 .发对应的像素点位置对 应的表 现为头皮 部分 , 可以将步骤 二中得到 的初阶 对象去 除图像输 入至 面部皮肤 修补模型 中 , 得到 将位于 头颅区域 内的预设 对象去 除的完全 对象去 除图像 。 面部 皮肤修 补模型是 基于 不包含头 发的光 头图像 以及光头 图像对应 的头 颅 区域 内叠加 .发型掩膜的图像训练得 到的一 个图像处 理模型 , 该模型可以根 据光 头 图像中头 颅区域 内的像素 信息恢 复被发 型掩膜遮 挡住 的区域的 面部皮肤 , 从 而可 以得到 ―个没有头 发的完整 的头颅 区域图像 。 步骤 四, 将所述原始 图像和 所述完 全对象去 除图像 组 .成所述无预设对象 图 中样 本对。
S220、 基于所述 无预设 对象图像 样本对 通过生 成对抗 的方式进 行模型 -训练 得到 预设对 象去除处 理模型 。 为 了减少图 像样本对 的构建 过程以 及图像 处理的 中间过程 , 减少图像处理 的耗 时, 可以将得到 的无预设对 象图像 样本对输 入至一 个 Pix2Pix模型学习, 从 而得 到预设 对象去除 处理模型 , 最终实现高效 的预设对 象去除效 果。
S230. 获取待处理 图像。
S240. 将所述待处理 图像输 入至预设 对象去 除处理模 型, 得到目标图 像。 本公 开实施 例的技 术方案 , 通过在原始图像 的基础 上, 逐步处理 得到对应 的 无预设对 象样本 图像进 而构造模 型训练样 本对 , 以训练预设对 象去除处 理模 型 , 进而在获取待处 理图像之 后 , 将待处理图像 输入至预 设对象去 除处理 模型, 得到 目标 图像, 解决了相关技 术中以 图像局 部增加特 效的方 式改变 图像属性 效 果 不自然的 问题, 实现了可以实时 的去除 图像中 的目标时 象, 降低了图像 中 目 标对 象去除 的成本 。 在构.造模型训练样本 对的过程 中, 采用了头 颅区域预 测模 型 、 图像背景修补模 型以及 面部皮 肤修补 模型逐 步获取原 始图像 对应的 无预设 对 象样本图像 , 得到图像处理 效果更 佳的模型-训练样 本对。 图 4 为本公开实 施例所提 供的又一 图像处 理方法 的流程示 意图, 在实现该 方 法流程的 过程中 , 描述了在要去 除的 目标对象 为头发 时, 预设对象去 除处理 模 型的训练 过程, 特别是训练头颅 区域预 测模型 、 图像背景修补 模型以及 面部 皮肤 修补模 型来构造 训练样 本对的 过程。 该方法可以由 图像处理 装置来执 行, 该 装置可以 通过软件 和 /或硬件的形式实 现, 可选的, 通过电子设 备来 •实现, 该 电 子设备可 以是移动 终端、 PC端 或服务 器等。
S310. 训练头颅 区域预测模 型, 并通过所 述头颅 区域预 测模型识 别具有 预 设对 象的原 始图像 中展示所述 .预设对象的主体 轮廓区域 。 头颅 区域可 以理解 为去除 头发 (预设对象 )后真 实的头部 区域, 该区域可 以用 一个黑 白二值 图来代表 。 在训练头颅 区域预 测模型 时, 首先, 要构造模型 训 练样本对 , 模型训练样本 对中 包括带有 预设对 象的原始 图像, 以及与原 始图 像对 应的头 颅区域 的二值 图像。 在构造模 型训练样 本对的 过程中 , 可以建立一 个三 维的头 颅模型 , 该三维头颅模 型可以 任意调 整展示 角度, 也可以调 整头颅 轮廓 。 然后, 渲染出多个 已知头颅 结构 (如构建的三维头 颅模型 ) 的带有预设 对 象的原始 样本图像 。 然后, 针对任一存 在预设对 象的原 始样本 图像, 为其匹 配对 应的展 示角度 的三维 头颅模型 ; 进而将三维 头颅模型 进行平 面投影得 到与 原始 样本 图像匹配 的头颅 区域二值 图像。 此外, 还可以根据原始 样本图像 中人 物对 象的面 部轮廓 调整头颅 区域二 值图像 的轮廓 。 最终, 可以将原始样 本图像 作 .为模型输入图像, 并将对应的头 颅区域 二值图像 作为模 型期望 输出图像 进行 神经 网络模型 训练, 得到头颅区域预 测模型 。 训练 后的头 颅区域预 测模型 , 便可以用于对 带有预 设对 象的原始 图像进 行・ 主体 轮廓区 域 (即头颅区域 ) 的预测。
S320、 训练图像 背景修 补模型 , 并基于所述图 像背景修 补模型 对原始 图像 中主 体轮廓 区域之 外的所述 预设对 象的像 素点进行 处理 , 得到初阶对象去 除图 像. 在得 到原始 样本图像 对应 的头颅 区域后, 为了把头发去除 变成无 头发的状 态 , 可以把头发分 为头颅 区域内部 的头发 和头颅 区域外部 的头发 , 头颅外部的 头发 需要处 理成背 景, 头颅区域 内部的头 发需要处 理成 面部皮肤 。 图像背景修 补模 型就是 用于对头 颅区域 外的头发 进行处理 的模型 。 在训 练图像 背景修补 模型 的过程中 , 首先, 要将预设头颅 区域二 值图像 集 合 中的头颅 区域二值 图像与 预设背 景图像 集合中 背景图像 进行随 机组合得 到多 个组 合, 并将每个 组合中 的头颅 区域二值 图像叠加 于背景 图像上 , 得到第一叠 加样 本图像 , 如图 5中左侧 图像。 如图 5中左侧图像 所示, 一个头颅区域二值 图像 的头颅 区域用 黑色进行 表示 , 将该头颅区域二值 图像随 机与一 个背景 图像 进行 叠加即 得到第 一叠加样 本图像 , 这样处理相 当于遮住 了头颅 区域内部 的像 素信 息, 在模型学 习图像特 征的过 程中不 会提取到 头颅 区域内部 的像素信 息。 然后 , 在第一叠加样 本图像 中对应 头颅区 域的外部 进行预 设对象像 素标记 , 得 到 第一叠加样 本标记 图像, 如图 5 中的中间图像 , 其中, 灰色区域表示预设 对 象像 素标记 。 可以理解的是 , 预设对象像 素标记 的区域可 以参照 不同发 型进行 设定 。 最终, 基于第一叠加 样本图 像和所 述第一 ■叠加样本标记图像 进行神 经网 络模 型训练 , 得到图像背景 修补模 型。 可以将第 一叠加样 本标记 图像输入 到初 始 图像背景 修补模 型中得到 第一 •模型生成图像; 将第一模型 生成图 像与预设 背 景 图像集合 中除第 一叠加样 本图像 中背景 图像之 外的任一 背景图像 输入到 第一 判别 器中; 基于第一判别 器的输 出结果以 及第一模 型生成 图像与 第一叠加 样本 图像 的比较 结果更 新所述初 始图像 背景修 补模型 , 得到图像背景 修补模 型。 使 用 图像背景修 补模型 , 对第一叠加样 本标记 图像进行 处理可以 得到图 5 中右图 所示 的背景修 补效果 。 这里 需要说 明的是, 在背景修 补模型 的训练 过程中 , 增加第 —判别器 可以 是使 图像背 景修补 的结果 更加的接 近真实 的背景 图像, 效果更加 的自然 , 使判 别 器不能分 辨出是原 来的 背景图像 还是经 过修补 的背景 图像。 而且, 在模型训 练过 程中 , 会允许第一模型 生成 图像与第 一叠加样 本图像 之间存 在一定 的可接 受误 差, 不会强制要 求这两者 完全一样 , 避免模型的过 拟合。
8330、 训练面部 皮肤修 补模型 , 并基于所示面部 皮肤修 补模型对 所述初 阶 对 象去除图像 进行处 理, 得到完全对 象去除 图像。 在上 述图像 处理步< 的基础 上 , 需要对头颅 区域内预 设对象 的像素 点进行 处理 , 即将头颅区域 内的预设 对象的 像素点处 理为与 面部皮肤 一致的像 素点。 在训 练面部 皮肤修补 模型 的过程 中, 首先, 针对采集到的 任一不 包含预设 对 象的样本 图像 (如无头发 的任务 对象图 像) , 将不包含预设对 象的样 本图像 的 头颅区域 内叠加预 设对象掩 码图像 , 得到第二叠加样 本图像 , 如图 6 中左侧 图像 所示 , 其中, 白色区域为预设 对象掩 码图像 。 可以理解的是 , 预设对象掩 码 图像可参 考多种发 型进行 设置 。 然后, 按照预设标定点 采集策 略在第二 叠加 样本 图像的 头颅区 域采集预 设数量 的头颅 区域锚 点, 得到标记有 所述预 设数量 的 头颅区域 锚点的 第二叠加 样本图 像。 头颅区域锚 点可以 作为被 刮练的神 经网 络模 型辅助 参考信 息, 使神经网络 模型能 够区分 头颅区域 内与头 颅区域 外, 在 头颅 区域锚 点对应 的区域 范围内进 行特征 的提取 。 最终, 可以基于标记 有预设 数量 的头颅 区域锚 点的第二 叠加样 本图像 与对应 的不包含 预设对 象的样本 图像 (如图 6 中右倒图像 )进行神经 网络模型 训练得到 所述面 部皮肤修 补模型 。 采 集 头颅区域 锚点的 策略可 以是, 针对第二 叠加样本 图像的 头颅区 域内部 , 按照 五 官轮廓进 行锚点 采样; 针对第二 叠加样 本图像 的头颅 区域轮廓 边缘, 按照预 设 采样间隔 在轮廓边 缘进行锚 点采样 * 锚点采集 结果可参 考图 6中左图黑色 点。 在面 部皮肤 修补模 型的训练 过程中 , 可以将标记有 所述预 设数量 的头颅 区 域锚 点的第 二叠加样 本图像 输入到 初始面 部皮肤修 补模型 中得到 第二模型 生成 图像 ; 将第二模型 生成图像 与除与 第二叠 加样本 图像对应 的原不 包含预设 对象 的样 本图像 之外的任 一不 包含预设 对象的 样本图像 输入到 第二判 别器中 ; 基于 第二 判别器 的输出 结果以及 第二模 型生成 图像和 与第二 叠加样本 图像对应 的原 不 包含预设 对象的样 本图像 的比较 结果, 更新初始面部皮 肤修补 模型, 得到面 部皮 肤修补模 型。 这里 需要说 明的是, 在面部皮 肤修补 模型的训 练过程 中 , 增加第二判 别器 可 以是使 图像面部 皮肤修补 的结果 更加的 接近真 实的无预 设对象 的人物对 象图 像 , 效果更加的 自然, 使判别器 不能分辨 出是原来 的无预 设对象 的人物对 象图 像还 是经过 面部皮肤 修补的无 预设对 象图像 。
S340、 基于所述 无预设 对象图像 样本对 通过生 成对抗 的方式进 行模型 -训练 得到 预设对 象去除处 理模型 。 为 了减少图 像样本对 的构建 过程以 及图像 处理的 中间过程 , 减少图像处理 的耗 时, 可以将得到 的无预设对 象图像 样本对输 入至一 个 Pix2Pix模型学习, 从 而得 到预设 对象去除 处理模型 , 最终实现高效 的预设对 象去除效 果。
S350. 获取待 •处理图像。
8360、 将所述待 处理图像 输入至预 设时象 去除处理 模型, 得到目标 图像。 本公 开实施 例的技 术方案 , 通过分别训练 头颅区域 预测模 型、 背景修 •补模 型 以及面部 皮肤修 补模型 , 在原始图像的基 础上 , 通过刮练好的模 型逐 步处理 得到 对应的 无预设 对象样本 图像进 而构造模 型训练 样本对 , 以训练预设对 象去 除处 理模型 , 进而在荻取待 处理 图像之后 , 将待处理图像 输入至 预设对 象去除 处理 模型 , 得到目标图像 , 解决了相关技 术中以 图像局部 增加特 效的方 式改变 图像 属性效 果不 自然的问题 , 实现了可以 实时的去 除图像 中的 目标对象 , 降低 图像 中目标 对象去 除的成本 。 在构造模型 训练样 本对的过 程中, 采用了头颅区 域预 测模型 > 图像背景修补模 型以及 面部皮 肤修补模 型逐步 获取原 始图像对 应 的无 预设对 象样本 图像, 得到图像处 理效果 更 .佳的模型训练样本对。 图 7 为本公开实施 例所提 供的-一种图像处 理装置结 构示意 图, 该装置适用 于将 待处理 图像中预 设的对 象去除的 情形,可以通 过软件和 /'或硬件的形式实现, 可选 的, 图像处理装 置可配 置于'电子设备来 , 该电子设备可 以是移 动终端 、 PC 端或 服务器 等。 如 图 7所示, 所述图像 处理装 置包括: 图像获取模块 410和图像处 理模块 420 o 图像 荻取模 块, 设置为获取 待处理 图像, 其中, 所述待处理图像 为具有预 设对 象的 图像, 所述预设对 象的部 分像素 点位于 所述待处 理图像 中主体轮 廓区 域 内, 所述预设对 象的另一 部分像 素点位 于所述主 体轮廓 区域外 ; 图像处理模 块 , 设置为将所述待 处理 图像输入 至预设 对象去 除处理模 型, 得到目标 图像, 其 中, 所述目标图像 为与所 述具有 预设对 象的图像 对应 的预设对 象去除 图像; 所述 预设对 象去除 处理模型 是基 .于预先建立的无预 设对 象图像样 本对集合 进行 训 练得到 的模型, 其中, 所述无预设对象 图像样 本对集合 中的每 个无预设 对象 图像 样本对 中包括 具有预设 对象的 原始图 像, 以及分别对 所述原 始图像 中位于 所述 主体轮 廓区域 外的预设 对象 的像素点 和所述原 始图像 中位于 所述主体 轮廓 区域 内的预设 对象的 像素点 进行处理 得到的预 设对象 去除图像 。 本公 开实施 例所提供 的技术 方案, 通过获取待处理 图像 , 其中, 所述待处 理 图像为具 有预设 对象的 图像, 所述预设 对象的部 分像素 点位于 所述待处 理图 像 中主体轮 廓区域 内, 另一部分像 素点位 于所述主 体轮廓 区域外 ; 将所述待处 理 图像输入 至预设 对象去 除处理模 型, 得到目标 图像, 其中, 所述目标图像 为 与所 述具有预 设对象 的图像对 应的对 象去除 图像; 所述预设对 象去除处 理模型 是基 于预先 建立的 无预设对 象图像 样本对 集合进行 训练得 到的模 型, 其中, 所 述无 预设对 象图像样 本对 集合中 的每个无 预设对 象图像样 本对中 包括具有 预设 对 象的原始 图像, 以及分别对所述 原始图 像中位 于所述主 体轮廓 区域外 的预设 对 象的像素 点和所 述原始 图像中位 于所述 主体轮廓 区域 内的预设 对象的 像素点 进行 处理得 到的预设 对象去 除图像 , 解决了相关技 术中 以图像局 部增加特 效的 方 式改变 图像属性 效果不 自然的 问题, 实现了可 以实时 的去除图 像中的 目标对 象 , 降低图像中目标 对象去 除的成本 。 在一 种可选 的实施 方式中 , 所述图像处理 装置还 包括模型 训练样 本构造模 块 , 设置为: 识别具有预设 对象的 原始图 像中展 示所述预 设对象 的主体 轮廓区 域 ; 将所述原始图像 中位于 所述主 体轮廓 区域内 的所述预 设对象 的像素 点处理 为与 所述原 始图像 中所述主 体轮廓 区域内 的非所述 预设对 象的像 素点的像 素信 息一 致的像 素点, 并将所述原始 图像中位 于 '所述主体轮廓区域外 的所述预 设对 象 的像素点 处理为 与所述原 始图像 中所述 主体轮 廓区域外 的非所 述预设对 象的 像素 点的像 素信息 一致的像 素点 , 得到预设对象去 除图像 ; 将所述原始 图像和 所述 预设对 象去除图 像组成所 述无预设 对象 图像样本 对 . 在一一种可选的实施 方式 中, 当所述预设对 象为头 发, 所述主体 轮廓区域 为 头颅 区域时 , 所述模型-训练样本构 造模块 , 是设置为: 将具有预设 对象 的原始 图像 输入至 头颅区域 预测模型 中, 得到展示所 述预设对 象的头颅 区域二 值图像 ; 将所 述头颅 区域二值 图像与 所述原 始图像 进行叠加 得到 图像叠加 结果, 并将所 述 图像叠加 结果输入 至图像 背景修 补模型 , 得到将所述原 始图像 中位于 所述头 颅 区域外的 所述预设 对象去 除的初 阶对象 去除图像 ; 将所述初阶 对象去 除图像 输入 至面部 皮肤修 补模型 中, 得到将所述 原始图像 中位于 所述头 颅区域 内的所 述预 设对象 去除的 完全对 象去除 图像; 将所述原始 图像与 所述完 全对象去 除图 像组 成所述 无预设对 象图像样 本对。 在一 种可选 的实施方 式中 , 所述图像处理装 置还包括 第一辅 助模型训 练模 块 , 设置为训练所 述头颅 区域预测 模型, 训练过程 包括如 下步骤 : 荻取具有所 述预 设时象 的任 ~样本 图像, 并为所述任 一样本 图像匹配 对应的三 维头颅模 型; 将所 述三维 头颅模 型进行平 面投影 得到与 所述任一'样本 图像匹配 的头颅 区域二 值 图像; 将所述任 一样本 图像作为 模型输 入图像 , 并将与所述任 一'样本图像匹 配 的头颅 区域二值 图像作为 模型期 望输出 图像进行 神经 网络模型训 练, 得到所 述头 颅区域预 测模型 。 在一 种可选 的实施方 式中 , 所述图像处理 装置还 包括第二 辅助模 型训练模 块 , 设置为训练所 述图像 背景修补 模型, 训练过程 包括如 下步骤 : 将预设头颅 区域 二值图 像集合 中的头颅 区域二 值图像 与预设 背景图像 集合中 背景图像 进行 随机 组合得 到多个组 合, 并将每个组合中 的头颅 区域二值 图像叠 加于所述 每个 组佥 中的背 景图像 上, 得到第一叠 加样本 图像; 在所述第 一叠加样 本图像 中对 应头 颅区域 的外部 进行预设 对象像 素标记 , 得到第一叠加 样本标记 图像 ; 基于 所述 第一叠加 样本 图像和所 述第一 叠加样本 标记 图像进行 神经网络 模型训 练, 得到 所述图像 背景修 补模型 。 在一 种可选 的实施方 式中 , 所述第二辅助模 型训练 模块 , 是设置为: 将所 述第 一叠加样 本标记 图像输 入到初 始图像 背景修补 模型中 得到第 一模型生 成图 像 ; 将所述第一 '模型生成图像与所 述预设 背景图像 集合 中除所述 第一叠加 样本 图像 中的背 景图像之 外的任 一背景 图像输入 到第一 判别器 中; 基于所述第 一判 别 器的输 出结果以 及所述第 一模型 生成图 像与所述 第一 叠加样本 图像的 比较结 果 更新所述 初始图像 背景修补 模型, 得到所述图像背 景修补模 型。 在一-种可选 的实施 方式中 , 所述图像处理装 置还包括 第三辅 助模型训 练模 块 , 设置为训练所 述面部皮 肤修补 模型, 训练过程包括如 下步骤 : 将采集到的 任 -一不包含预设对 象的样本 图像 的头颅区 域内叠加 预设对 象掩码 图像, 得到第 二 叠加样本 图像; 按照预设 标定点 采集策 略在所述 第二叠 加样本 图像的头 颅区 域采 集预设 数量的 头颅区域 锚点 , 得到标记有所 述预设数 量的头 颅区域锚 点的 第二 叠加样 本图像 ; 基于所述标记 有所述 预设数量 的头颅 区域锚 点的第二 叠加 样本 图像与 对应的 不包含预 设对 象的样本 图像进行 神经 网络模型 •训练得到所述 面部 皮肤修 补模型。 在一 种可选 的实施 方式中 , 所述第三辅助模 型刮练 模块是 设置为 : 将所述. 标记 有所述 预设数 量的头颅 区域锚 点的第 二叠加样 本图像 输入到 初始面部 皮肤 修 补模型 中得到第 二模型生 成图像 ; 将所述第二模 型生成 图像与 除与所述 第二 叠加 样本图 像对应 的所述采 集到的 任一不 包含预设 对象的 样本图像 之外 的任一 不 包含预设 对象的样 本图像 输入到 第二判 别器中 ; 基于所述第二 判别器 的输出 结 果以及所 述第二模 型生成 图像和 与所述 第二叠加 样本 图像对应 的所述 采集到 的任 一 '不包含预设对象的样 本图像 的比较 结果, 更新所述初始面 部皮肤修 补模 型 , 得到所述面部皮 肤修补模 型。 在一 种可选 的实施 方式中 , 所述第三辅助模 型训练 模块还 可设置 为: 在所 述 第二叠加 样本图像 的头颅 区域的 内部按 照五官轮 廓进行 锚点采 样; 在所述第 二 叠加样本 图像的 头颅区域 的轮廓 边缘按 照预设采 样间隔 在所述 轮廓边缘 进行 锚点 采样。 本公 开实施 例所提供 的图像 处理装 .置可执行本公开 任意 实施例所 提供的 图 像处 理方法 , 具备执行方法相 应的功 能模块 。 值得 注意的 是, 上述装置所 包括的 多个单 元和模块 只是按 照功能 逻辑进 行 划分,的, 但并不局限于上 述的划 分, 只要能够 实现相应 的功能 即可; 另外, 多 个功 能单元 的名称 也只是 为了便于 相互区 分, 并不用于 限制本公 开实施 例的保 护 范围。 图 8为本公开 实施例所提 供的一 种电子设 备的结 构示意 图。 下面参考图 8, 其示 出了适 于用来实 现本公开 实施例 的电子设 备 (例如图 8 中的终端设备或月艮 务 器 ) 500的结构示意图 。 本公开实施例中的 终端设备 可以包括 但不限 于诸如 移 动 电话、笔记本电 脑、数字广播接 收器 ,个人数字助理 ( Personal Digital Assistant, PDA )、平板电脑( Portable Android Device , PAD )、便携式多媒体播放器( Portable Media Player, PMP ) . 车载终端 (例如车载导航终 端) 等的移动终端 以及诸如 数字 电视 ( Television, TV ) . 台式计算机等的固定终端。 图 8示出的电子设备 500仅 仅是一 个示例 , 不应对本公开 实施例的 功能和使 用范围 带来任何 限制。 如图 8所示 , 电子设备 500可以包括处 理装置 (例如中央 处理器 、 图形处 理器 等) 50L 其可以根据存储 在只读 存储器 ( Read-Only Memory, ROM ) 502 中 的程序或者 从存储 装置 508加载到随机访 问存储 器 ( Random Access Memory,RAM ) 503中的程 序而执 行多种适 当的动作 和处理 。 在 RAM 503中, 还存储有 电子 设备 500操作所需的 多种程序 和数据 。 处理装置 50E ROM 502以及 RAM 503通 过总线 504彼此相连 。 输入,/输出 ( hipirt/OutpiiL I/O )接口 505也连接至 总线 504。 通常 , 以下装置可以连接 至 UO接口 505: 包括例如触摸屏、触摸 板、键 :盘. 鼠标 . 摄像头、 麦克风、 加速度计、 陀螺仪等的输入 装置 S06; 包括例如液晶显 示器 ( Liquid Crystal Display, LCD )、 扬声器、 振动器等的输出装置 507; 包括 例如 磁带、 硬盘等的存 储装置 508; 以及通信装 置 509。 通信装置 509可以允许 电子 设备 500与其他设 备进行 无线或有 线通信 以交换数 据。 虽然图 8示出了具 有多 种装.置的电子设 备 500, 但是应理解的是, 并不要求实 施或具备 所有示 出的 装置 。 可以替代地实 施或具备 更多或 更少的装 置。 根据 本公开 的实施例 , 上文参考流 程图描述 的过程 可以被 实现为 计算机软 件程 序。 例如, 本公开的 实施例 包括一种 计算机程 序产品 , 其包括承载在 非暂 态计 算机可 读介质 上的计 •算机程序, 该计算机程序 ■包含用于执行 流程图所 示的 方法 的程序 代码。 在这样的 实施例中 , 该计算机程序可 以通过 通信装 置 509 从 网络 上被下载 和安装 , 或者从存储装 置 508被安装 , 或者从 ROM 502被安装 。 在该 计算机程 序被处 理装置 501 执行时, 执行本公开 实施例 的方法 中限定的上 述功 能。 本公 开实施 方式中 的多个装 置之间 所交互 的消息或 者信息 的名称 仅用于说 明性 的目的 , 而并不是用于时 这些消 息或信 息的范围 进行限制 。 本公 开实施 例提供 的电子设 备与上 述实施 例提供 的图像处 理方法 属于同 一 发 明构思, 未在本实施例中详 尽描述 的技术细 节可参见 上述实 施例。 本公 开实施 例提供 了一种计 算机存 储介质 , 其上存储有计 算机程序 , 该程 序被 处理器执 行时实 现上述 实施例所提 供的 图像处理 方法。 需要 说明的 是, 本公开上述的 计算机 可读介质 可以是 计算机 可读信 号介质 或者 计算机 可读存储 介质或 者是上 述两者 的任意组 合。 计算机可读 存储介 质例 如可 以是 — 但 不限于 — 电、 磁、 光、 电磁、 红外线、 或半导体的系统 、 装 置或 器件, 或者任意以上 的组 .合。 计算机可读存储介质的 例子可 以包括但 不限 于 : 具有一个或多个 导线的 电连接、 便携式计算机磁盘 、 硬盘、 RAM 、 ROM、 可擦 式可编程 只读存 储器 ( Erasable Programmable Read-Only Memory, EPROM ) 或 闪存 ■、 光纤、 便携式紧凑磁盘只读存储器 ( Compact Disc Read-Only Memoiy , CD-ROM ) 、 光存储器件、 磁存储器件 , 或者上述的任 意合适 的组合 。 在本公 开 中, 计算机可读存 储介质 可以是 任何包 含或存储 程序 的有形介 质, 该程序可 以被 指令执 行系统 、 装置或者器件 使用或 者与其 结合使用 。 而在本公开 中, 计 算机 可读信 号介质 可以包括 在基带 中或者 作为载 波一部分 传播的 数据信 号, 其 中承 载了计 算机可读 的程序 代码 。 这种传播的数据 信号可 以采用 多种形 式, 包 括但 不限于 电磁信 号 > 光信号或上述 的任意 合适的组 合。 计算机可读 信号介 质 还可 以是计 算机可读 存储介 质以外 的任何 计算机可 读介质 , 该计算机可读 信号 介质 可以发 送、 传播或者传 输用于 由指令 执行系统 、 装置或者器 件使用或 者与 其结 合使用 的程序 。 计算机可读介 质上 包含的程序 代码可 以用任 何适当 的介质 传输 , 包括但不限 于: 电线. 光缆. 射频 ( Radio Frequency, RF )等, 或者上 述 的任意合 适的组合 。 在 一些 实施 方式 中, 客户端、 服务器可 以利 用诸 如超 文 本传 输协议 ( HyperText Transfer Protocol , HTTP )之类的任何当前已知或未来研发的网络 协议 进行通信 , 并且可以与任 意形式 或介质的 数字数据 通信 (例如, 通信网络) 互连 。 通信网络的示例 包括局域 网 ( Local Area Network, LAN ) , 广域网 ( Wide Area Network, WAN ) , 网际网 (例如, 互联网 )以及端对端网络 (例如, ad hoc 端对 端网络) , 以及任何当前 已知或未 来研发的 网络。 上述 计算机可 读介质 可以是上 述电子设 备中所 包含的 ; 也可以是单独存在 , 而 未装配入 该电子设 备中。 上述 计算机 可读介质 承载有 一个或 者多个程 序 , 当上述一个 或者多 个程序 被该 电子设 备执行 时, 使得该电子 设备: 获取待处理图像 , 其中, 所述待处理 图像 为具有 预设对 象的图像 , 所述预设对 象的部分 像素点 位于所 述待处理 图像 中主 体轮廓 区域内 , 所述预设对象的 另一部分像 素点位 于所述主 体轮廓 区域外 ; 将所 述待处 理图像 输入至预 设对 象去除处 理模型 , 得到目标图像 , 其中, 所述 目 标图像为 与所述 具有预设 对象的 图像对 应的对 象去除 图像; 所述预设 对象去 除 处理模 型是基 于预先 建立 的无预 设对象 图像样 本对 集合进 行训练 得到 的模 型 , 其中, 所述无预设对 象图像样 本对集 合中的每 个无预 设对象 图像样 本对中 包括 具有预 设对象 的原始 图像, 以及分别 对位于 所述主体 轮廓 区域外的预 设对 象像 素点和 位于所 述主体轮 廓区域 内的预设 对象像 素点进 行处理 得到的预 设对 象去 除图像 。 可以 以一种 或多种程 序设计 •语言或其组合 来编写用 于执行 本公开 的操作 的
Figure imgf000018_0001
来通 £史因特网连 4 ■霎) O 附 图中的流 程图和框 图, 图示了按照本公 开多种 实施例的 系统, 方法和计 算机 程序产 品的可 能实现 的体系架 构、 功能和操作 。 在这点上, 流程图或框图 中 的每个方框 可以代 表一个模 块、 程序段、 或代码的 一部分, 该模块、 程序段、 或代 码的一 部分包含 一 •个或多个用于实现 规定的逻 辑功 能的可执 行指令 。 也应 当 注意, 在有些作 为替换 的实现 中, 方框中所标 注的功能 也可以 以不同 于附图 中所 标注的 顺序发 生。 例如, 两个接连地表 示的 方框实际 上可以基 .本并行地执 行 , 它们甫时也可 以按 ■相及的顺序执行, 这依所涉及的功 能而定 ,。 也要注意的 是 , 框图和/或流程图中的每 个方框 、 以及框图和 /或流程图中的方框 的组合, 可 以 用执行规 定的功 能或操作 的专用 的基于 硬件的 系统来 实现, 或者可以 用专用 硬件 与计算机 指令的 组合来 •实现。 描述 于本公 开实施例 中所 涉及到的 单元可 以通过软 件的方 式实现 , 也可以 通 过硬件的 方式来 实现。 单元的名 称在一 种情况 下并不构 成对该 单元本 身的限 定, 例如, 第一获取单 元还可 以被描述 为 “获取至少两个 网际协议地 址的单元” 。 本文 中以 上描述 的功 能可以 至少部 分地 由一个或 多个硬 件逻 辑部件 来 ■执 行 。 例如, 非限制性地, 可以使用 的示范 类型的硬 件逻辑 部件 包括: 现场可编 程 门阵列 ( Field Programmable Gate Array, FPGA )、 专用集成电路 ( Application Specific Integrated Circuit, ASIC )、 专用标准产品 ( Application Specific Standaid Parts, ASSP )、片上系统 ( System on Chip, SOC )、复杂可编程逻辑设备 ( Complex Programmable Logic Device , CPLD ) 等 „ 在本 公开的 上下文 中, 机器可读介 质可以是 有形 的介质 , 其可以包含或存 储 以供指令 执行系 统、 装置或设备 使用或 与指令执 行系统 、 装置或设备 结合地 使 用的程序 。 机器可读介质 可以是 机器可 读信号介 质或机 器可读 储存介质 。 机 器可 读介质 可以包 括但不 限于电子 的、 磁性的、 光学的、 电磁的、 红外的、 或 半导 体系统" 装置或设 备, 或者上述 内容的 任何合适 组合。 机器可读存储介 质 的 更具体示 例会包 括基于一 个或多 个线的 电气连接. 便携式 计算机 盘 . 硬盘 . RAM. ROM. EPROM 或快闪存 储器 , 光纤. CD-ROM, 光学储 存设备 、 磁储 存设 备、 或上述内容 的任何合 适组合 。 根据 本公开 的一个或 多个 实施例, [示例一]提供 了一种 图像处 理方法 , 该 方法包括 : 获取待处理图像 , 其中, 所述待处理图像 为具有预 设对象 的图像, 所述 预设对 象的部 分像素点 位于所 述待处 理图像 中主体轮 廓区域 内, 所述预设 对 象的另一 部分像 素点位 于所述主 体轮廓 区域外 ; 将所述待处理 图像输入 至预 设对 象去除 处理模 型, 得到目标 图像, 其中, 所述目标 图像为与 所述具有 预设 对 象的图像 对应的 对象去 除图像; 所述预设对象去 除处理 模型是 基于预 先建立 的无 预设对 象图像样 本对 集合进行 训练得 到的模型 , 其中, 所述无预设 对象图 像样 本对 集合 中的每个 无预设 对象 图像样 本对 中包括 具有预 设对 象的原始 图 像 , 以及分别对所 述原始 图像中位 于所述 主体轮廓 区域外 的预设 对象的像 素点 和 所述原始 图像中位 于所述 主体轮 廓区域 内的预设 对象 的像素点 进行处 理得到 的预 设对象 去除图像 。 根据 本公开 的一个或 多个 实施例 , Q示例二 』提供 了一种 图像处理 方法, 还 包括 ■: 在一些可选的实现方 式中 , 所述无预设对 象图像样 本对集 合中的 无预 设对 象图像 样本对 的构造过 程, 包括: 识别具有预设对 象的原始 图像中展 示所 述预 设对 象的主体轮 廓区域; 将所述 原始图 像中位 于所述主 体轮廓 区域内 的所 述预 设对象 的像素 点处理 为与所述 原始图 像中所 述主体轮 廓区域 内的非 所述预 设对 象的像 素点的像 素信 息一致的 像素点 , 并将所述原始 图像 中位于所 述主体 轮廓 区域外 的所述预 设对 象的像素 点处理 为与所 述原始 图像中所 述主体轮 廓区 域外 的非所 述预设 对象的像 素点的 像素信 息一致 的像素点 , 得到预设对 象去除 图像 ; 将所述原始 图像和所 述预设 对象去 除图像组 成所述 无预设 对象图 像样本 对 。 才艮据本公开的一 个或多个 实施例 , T示例三』提供 了 -一种图像处理方法 , 包括 : 在一些可选 的实现 方式中 , 当所述预设对 象为头发 , 所述主体轮廓 区域 为 头颅区域 时, 所述无预设 对象 图像样本 对集合 中的无预 设对象 图像样 本对的 构造 过程, 包括: 将具有预设对象 的原始 图像输入 至头颅 区域预 测模型 中, 得 到展 示所述 预设对 象的头颅 区域二 值图像 ; 将所述头颅 区域二值 图像与 所述原 始 图像进行 叠加得 到图像 叠加结果 , 并将所述图像 叠加结 果输入至 图像背 景修 补模 型 , 得到将所述原 始图像 中位于 所述头 颅区域 外的所述 预设对 象去除 的初 阶对 象去除 图像; 将所述初 阶对象去 除图像 输入至 面部皮肤 修补模 型中, 得到 将 所述原始 图像中位 于所述 头颅 区域内的 所述预设 对象去 除的完 全对象去 除图 像 ; 将所述原始图像 与所述完 全时象去 除图像 组成所述 无预设对 象图像 样本对 。 根据 ■本公开的一个或 多个 实施例, 示例四 』提供 了一 '种图像处理方法, 还 包括: 在一些可选 的实现方 式中, 所述头颅区域预测 模型的 训练过程 , 包摇: 获取 具有所 述预设 对象的任 一样本 图像, 并为所述任一样 本图像 匹配对 应的三 维 头颅模型 ; 将所述三维 头颅模型 进行平 面投影得 到与所 述任一 样本图像 匹配 的 头颅区域 二值图像 ; 将所述任一 样本图 像作为模 型输入 图像 , 并将与所述任 一 ■样本图像匹配的 头颅区域 二值 图像作为 模型期 望输出 图像进行 神经网络 模型 •训练, 得到所述头颅 区域预 测模型。 根据 本公开 的- ~个或多个实施 例, 示 例五』提 供了 一种图像 处理方 法, 还 包括: 在一些可选 的实现方 式中, 所述图像背景修补 模型的 训练过 .程, 包括: 将预 设头颅 区域二值 图像 集合中的 头颅 区域二值 图像与预 设背景 图像集合 中背 景 图像进行 随机组合 得到 多个组佥 , 并将每个组合 中的 头颅区域 二值图像 叠加 于 背景图像 上, 得到第一 叠加样本 图像; 在所述第一叠加 样本图像 中对应 头颅 区域 的外部 进行预设 对象像 素标记 , 得到第一叠加 样本标 记图像 ; 基于所述第 一 叠加样本 图像和 所述第一 叠加样 本标记 图像进行 神经 网络 型训 练, 得到所 述 图像背景修 补模型 。 根据 本公开 的 -一个或多个实施例, F示例六 』提供 了一种 图像处理 方法, 还 包括: 在一些可 选的实现 方式 中, 所述基于所述 第一 叠加样本 图像和 所述第 一 叠加样本 标记图像 进行神 经网络模 型训 练, 得到所述图 像背景修 补模型 , 包 括 : 将所述第一叠加 样本标 记图像 输入到 初始图像 背景修 补模型 中得到第 一模 型生 成图像 ; 将所述第一模 型生成 图像与 所述预设 背景 图像集合 中除所 述第一 叠加 样本图 像中的 背景图像 之外的 任一背 景图像输 入到第 一判别 器中; 基于所 述 第一判别 器的输 出结果 以及所述 第一模 型生成 图像与所 述第一 叠加样本 图像 的 比较结果 更新所述 初始图像 背景修 补模型 , 得到所述图像背景 修补模型 。 根据 本公开 的一个或 多个 实施例, £示例七 』提供 了一种 图像处理 方法, 还 包括: 所述面部 皮肤修补 模型的 训练过 程, 包括: 在采集到的 任一不 包含预 设对 象的样 本图像 的头颅 区域内叠 加预设 对象掩码 图像 , 得到第二叠加样 本图 像; 按照预设 标定点 采集策略 在所述 第二叠 加样本 图像的头 颅区域 采集预设 数 量 的头颅 区域锚点 , 得到标记有所 述预设 数量的 头颅区域 锚点的 第二叠加 样本 图像 ; 基于所述标 记有所述 预设数 量的头 颅区域锚 点的第 二叠加样 本图像 与对 应 的不包含 预设对 琴的样本 图像进 行神经 网络模型 训练得 到所述 iftr部皮肤修补 模型 。 根据 本公开 的一'个或多个 实施例, £示例八 』提供 了一 •种图像处理方法, 还 包括: 在一种可 选的实施 方式 中, 所述基于所 述标记有 所述预 设数量 的头颅 区域 锚点的 第二叠加 样本 图像与对 应的不 包含预设 对象的 样本图像 进行神 经网 络模 型训练 得到所 述面部皮 肤修补 模型 , 包括: 将所述标记 有所述 预设数 量的 头颅 区域锚 点的第 二叠加样 本图像 输入到 初始面部 皮肤修 *卜模型中得到第二模 型生 成图像 ; 将所述第二模 型生成 图像与 除与所述 第二叠 加样本 图像对应 的所 述采 集到的 任一不 包含预设 对象的 样本图像 之外 的任一 不包含预设 对象 的样本 图像 输入到 第二判 别器中; 基于所述 第二判 别器的输 出结果 以及所 述第二模 型 生成 图像和 与所述 第二叠加 样本图 像对应 的所述采 集到的 任一不 包含预设 对象 的样 本图像 的比较 结果, 更新所述 初始面 部皮肤修 补模型 , 得到所述面部 皮肤 修补 模型。 根据 本公开 的一个或 多个 实施例, £示例九 』提供 了一种 图像处理 方法, 还 包括: 在一种可选 的实施 方式 中, 所述按照预设 标定点 采集策 略在所述 第二 叠加 样本图像 的头颅 区域采 集预设 数量的 头颅区域 锚点 , 包括 ■: 在所述第二叠 加样 本图像 的头颅 区域的 内部按照 五官轮 廓进行锚 点采样 ; 在所述第二 叠加样 本 图像的 头颅 区域的轮 廓边缘 按照 预设采 样间 隔在所 述轮廓 边缘进 行锚 点采 样 。 根据 本公开 的一个或 多个 实施例, Q示例十 』提供 了一种 图像处理 装置, 该装 置包括 : 图像获取模块 , 设置为获取待 处理 图像, 其中, 所述待处理 图像 为具 有预设 对象的 图像, 所述预设 对象的 部分像素 点位 于所述待 处理图像 中主 体轮 廓区域 内, 所述预设对 象的另 一 ■部分像素点位于所述 主体轮 廓区域外 ; 图 像处 理模块 , 设置为将所述 待处理 图像输入 至预设 对象去 除处理模 型, 得到目 标 图像, 其中, 所述目标 图像为与 所述具有 预设对 象的 图像对应 的预设对 象去 除 图像; 所述预设对 象去除 处理模 型是基 于预先建 立的无 预设对 象图像样 本对 集合 进行训 练得到 的模型 , 其中, 所述无预设 对象图像 样本对 集合中 的每个 无 预设 对象图 像样本对 中包括 具有预 设对象 的原始 图像, 以及分别 对所述原 始图 像 中位于 ■所述主体轮廓区域 夕卜的预设对象的像 素点和所 述原始 图像中位 于所述 主体 轮廓区域 内的预 设对象 的像素点 进行处理 得到的预 设对象 去除图像 。 根据 本公开 的一个或 多个实施 例, 【示例十一 1提供了一种 图像处 理装置 , 还 包括: 在一种可选 的实施方 式中, 所述图像处理装 置还 包括模型 训练样 本构 造模 块, 设置为: 识别具有预设对 象的原 始图像 中展示所 述预设 对象的主 体轮 廓 区域; 将所述原始 图像中位 于所述 主体轮 廓区域 内的所述 预设对 象的像 素点 处理 为与所 述原始 图像中所 述主体 轮廓区 域内的 非所述预 设对象 的像素 点的像 素信 息一致 的像素 点 , 并将所述原始 图像中 位于所述 主体轮 廓区域 外的所 述预 设对 象的像 素点处 理为与所 述原始 图像中 所述主体 轮廓 区域外的 非所述预 设对 象 的像素点 的像素信 息一致 的像素 点, 得到预设对 象去除 图像; 将所述原始图 像和 所述预设 对象去 除图像组 成所述 无预设对 象图像样 本对 。 根据 本公开 的一个或 多个实施 例, [示例十二]提供 了一种图像 处理装 置, 还 包摇: 在一种可选 的实施 方式 中, 当所述预设对 象为头 发, 所述主体轮 廓区 域 为头颅 区域时, 所述模型训练样 本构造模 块, 是设置为 : 将具有预设对 象的 原始 图像输 入至头 颅区域预 测模型 中, 得到展示 所述预设 对象的 头颅区域 二值 图像 ; 将所述头颅 区域二值 图像与 所述原 始图像进 行叠加 得到图 像叠加结 果, 并将 所述 图像叠加 结果输入 至图像 背景修 补模型, 得到将所 述原始 图像中位 于 所述 头颅 区域外的 所述-预设弑象去 除的初 阶对象去 除图像 ; 将所述初阶弑 象去 除 图像输入 至面部 皮肤修补 模型 中, 得到将所述原 始图像 中位于 所述头 颅区域 内 的所述预 设对象 去除的 完全对 象去除图 像; 将所述原始 图像与 所述完 全对象 去 除图像组 成所述无 预设对 象图像样 本对。 根据 本公开 的一个或 多个实施 例, [示例十三』提供 了一种图像 处理装 置, 还 包括: 在一种可 选的实施 方式 中, 所述图像处理 装置还 包括第 一'辅助模型训 练模 块, 设置为训 练所述 头颅区域 预测模 型, 训练过程 包括如下 步骤: 获取具 有所 述预设 对象的 任一样本 图像 , 并为所述任一样 本图像 匹配对应 的三维 头颅 模型 ; 将所述三维 头颅模型 进行平 面投影 得到与 所述任一 样本 图像匹配 的头颅 区域 二值 图像; 将所述任一 样本 图像作 .为模型输入图像 , 并将与所述任 一 '样本 图像 匹配的 头颅区 域二值 图像作为 模型期 望输出 图像进行 神经 网络模型训 练, 得到 所述头 颅区域预 测模型 。 根据 本公开 的一 ■个或多个实施例, £示例十四』提 供了一 种图像处 理装置 , 还 包括: 在一种可 选的实施 方式 中, 所述图像处理 装置还 包括第 二辅助模 型训 练模 块, 设置为训 练所述 图像背景 修补模 型, 训练过程 包括如下 步骤: 将预设 头颅 区域二 值图像 集合中 的头颅 区域二值 图像与预 设背景 图像集 合中的 背景图 像进 行随机 组合得 到多个组 合, 并将每个 组合中 的头颅 区域二值 图像叠加 于所 述每 个组合 中的背 景图像上 , 得到第一叠加 样本 图像; 在所述第 一叠加样 本图 像 中对应头 颅区域的 外部进行 预设对 象像素标 记 , 得到第一叠加样 本标记 图像; 基 于所述第 一叠加样 本图像 和所述 第一叠加 样本标 记图像 进行神 经网络模 型训 练 , 得到所述图像背 景修补模 型。 根据 本申请 的一个或 多个实施 例, (示例十五』提供 了一种图像 处理装 置, 还 包括: 在一种可选 的实施方 式中 , 所述第二辅助模 型训练 模块, 是设置为: 将所 述第一 叠加样 本标记 图像输入 到初始 图像背景 修补模 型中得 到第一模 型生 成 图像; 将所述第 一模型生 成图像 与所述 预设背 景图像集 合中除 所述第 一叠加 样本 图像 中的背景 图像之外 的任 -一背景图像输入到 第一'判别器中 ; 基于所述第 一 •判别器的输出结 果以及所 述第一 模型生 成图像 与所述第 一叠加 样本图像 的比 较结 果更新 所述初始 图像背景 修补模 型, 得到所述图像 背景修 补模型 。 根据 本公开 的一个或 多个实施 例 , [示例十六]提供了一 种图像处 理装置 , 还 包才击: 在一种可选的实施方式 中, 所述图像 处理装置 还包才舌第三辅助模型 训 练模 块, 设置为训 练所述 面部皮肤 修补模 型, 训练过程包括 如下步 骤: 在采集 到 的任一不 包含预设 对象 的样本 图像的头 颅区域 内叠加预 设对象掩 码图像 , 得 到第 二叠加样 本图像 ; 按照预设标 定点采 集策略在 所述第 二叠加样 本图像 的头 颅 区域采集 预设数 量的头颅 区域锚 点, 得到标记有 所述预 设数量 的头颅 区域锚 点 的第二叠加 样本 图像; 基于所述 标记有 所述预设 数量的 头颅区 域锚点 的第二 叠加 样本图像 与对应 的不 包含预设 对象的样 本图像 进行神 经网络模 型训练 得到 所述 面部皮肤 修补模 型。 根据 本公开 的一个或 多个实施 例, 【示例十七』提供 了一种图像 处理装 ■置, 还 包括 ”: 在一种可选的实施方式 中, 所述第三辅助 模型训 练模块 是设置 为: 将 所述 标记有 所述预设 数量 的头颅 区域锚点 的第二 叠加样本 图像输 A.到初始面部 皮肤 修补模 型中得 到第二模 型生成 图像; 将所述第二模型 生成图 像与除 与所述 第二 叠加样 本图像对 应的所 述采集 到的任 一不包含 预设对 象的样 本图像之 外的 任一 不包含 预设对 象的样本 图像输 入到第 二判别 器中; 基于所述第 二判别 器的 输 出结果以 及所述 第二模型 生成(图像和与所述 第二叠加 样 '本图像时应的所述采 集到 的任一'不包含预 设对 象的样本 图像的 比较结果 , 更新所述初 始面邵皮 肤修 补模 型, 得到所述面 部皮肤修 补模型 。 根据 本公开 的一 ■个或多个实施例, [示例十八』提供 了一种图像 处理装 置, 还 包括: 在一种可选 的实施 方式 中, 所述第三辅助 模型训 练模块 还可设 置为: 在所 述第二 叠加样本 图像的 头颅 区域的内 部按照五 宫轮廓 进行锚 点采样 ; 在所 述第 二叠加样 本图像 的头颅 区域的 轮廓边 缘按照预 设采样 间隔在 所述轮廓 边缘 进行 锚点采样 。 以上 描述仅 为本公开 的可选 实施例 以及对 所运用技 术原理 的说明 。 本领域 技术 人员应 当理解 , 本公开中所涉 及的公 开范围 , 并不限于上述 技术特征 的特 定 .组合而成的技术 方案, 同时也应涵盖在 不脱离上 述公开 构思的 情况下 , 由上 述技 术特征 或其等 同特征进 行任意 组合而 形成的其 它技术 方案。 例如上述特征 与本 公开中 公开的 (但不限于)具 有类似 功能的技 术特征 进行互 相替换 而形成 的技 术方案 。 此夕卜, 虽然采用特定次序 ■描绘了多个操 作, 但是这不应 当理解 为要求 这些 操作 以所示 出的特 定次序或 以顺序 次序执 行来执行 。 在一定环境 下, 多任务和 并行 处理可 能是有 利的。 同样地, 虽然在上 面论述 中包含 了多个实 现细节, 但 是这 些不应 当被解释 为对本 公开的 范围的 限制。 在单独的 实施例 的上下文 中描 述 的一些特 征还可 以组合地 实现在 单个实 施例中 。 相反地, 在单个实施例 的上 下文 中描述 的多种 特征也可 以单独 地或以任 何合适 的子组.合的方 式实现在 多个 实施 例中。

Claims

权 利 要 求 书
L .一种图像处理方法, 包括: 获取 待处理 图像, 其中, 所述待处 理图像 为具有预 设对象 的图像 , 所述预 设对 象的部 分像素 点位于所 述待处 理图像 中主体轮 廓区域 内, 所述预设 对象的 另一 部分像素 点位于 所述主体 轮廓区域 外; 将所 述待处 理图像输 入至预 设对象 去除处 理模型 , 得到目标图像, 其中, 所述 目标图像 为与所 述具有预 设对象 的图像对 应的对 象去除 图像; 所述 预设对 象去除处 理模型 是基于 预先建 立的无预 设对象 图像样 本对集合 进行 训练得 到的模 型, 其中, 所述无预设 对象图像 样本对 集合 中的每个 无预设 对 象图像样 本对中 包括具有 预设对 象的原 始图像 , 以及分别对所 述原始 图像中 位 于所述主 体轮廓 区域外 的预设对 象的像 素点和 所述原始 图像 中位于所 述主体 轮廓 区域 内的预设对 象的像素 点进行 处理得到 的预设 对象去除 图像。
2.根据权利 要求 1所述的方法 , 其中, 所述无预设对象图像 样本对集 合中的 无预 设对象 图像样本 对的构造 过程, 包括 : 识别 具有预设 对象的原 始图像 中展示 所述预设 对象的主 体轮廓 区域; 将所 述原始 图像中位 于所述 主体轮 廓区域 内的所述 预设对 象的像 素点处 理 为 与所述原 始图像 中所述主 体轮廓 区域 内的非所述 预设对 象的像 素点的像 素信 息一 致的像 素点, 并将所述原始 图像中位 于所述 主体轮廓 区域外 的所述 预设对 象 的像素点 处理为 与所述原 始图像 中所述 主体轮廓 区域夕卜的非所述预 设对象 的 像素 点的像 素信息一 致的像素 点 , 得到预设对 象去除图像; 将所 述原 始图像 和所述 预设 对象去 除图像 组成 所述无 预设对 象图像 样本 对 。
3.根据权利 要求 1或 2所述的方 法, 其中, 在所述预设弑象 为头发, 所述王 体轮 廓区域 为头颅 区域的 情况下 , 所述无预设对 象图像样 本对集 合中的 无预设 对 象图像样 本对的构 造过程 , 包括: 将具 有预设 对象的原 始图像 输入至 头颅区 域预测模 型中 , 得到展示所述预 设对 象的头 颅区域二 值图像 ; 将所 述头颅 区域二值 图像与 所述原 始图像 进行叠加 得到 图像叠加 结果, 并 将所 述图像 叠加结 果输入至 图像背 景修补 模型, 得到将所 述原始 图像中位 于所 述 头颅区域 外的所述 预设对 象去除的 初阶对 象去除图像 ; 将所 述初阶 对象去 除图像输 入至面 部皮肤修 补模型 中, 得到将所 述原始 图 像 中位于所 述头颅 区域内的 所述预设 对象去 除的完全对 象去除 图像 ; 将所 述原 始图像 与所述 完全 对象去 除图像 组成 所述无 预设对 象图像 样本
22
4.根据权利 要求 3所述的方法 , 其中, 所述头颅区域预 测模型 的训练过程 , 包括 : 获取 具有所 述预设对 象的任 一样本 图像, 并为所述任一样 本图像 匹配对应 的三 维头颅模 型; 将所 述三维 头颅模型 进行平 面投影 得到与 所述 _任一样本图像匹配 的头颅 区 域二 值图像 ; 将所 述任一样 本图像 作为模 型输入 图像, 并将与所述任一 样本图 像匹配 的 头颅 区域二 值图像作 为模型 期望输 出图像 进行神经 网络模 型训练 , 得到所述头 颅 区域预测模 型。
5.根据权利 要求 3所述的方法 , 其中, 所述图像背景修 补模型 的训练过程 , 包括 : 将预 设头颅 区域二值 图像集 合中的 头颅区域 二值 图像与预 设背景 图像集合 中 的背景 图像进行 随机组合 得到多 个组合 , 并将每个组合 中的头 颅区域二 值图 像 叠加于所述 每个组 合中的 背景图像 上, 得到第一 •叠加样本图像; 在所 述第一 叠加样本 图像中 对应头 颅区域 的外 ,部进行预设对象像素 标记 , 得到 第一叠加 样本标 记图像 ; 基于 所述第 一叠加样 本图像 和所述 第一叠加 样本标 记图像 进行神经 网络模 型训 练, 得到所述图 像背景修 补模型 。
6.根据权利 要求 5所述的方法 , 其中, 所述基于所述第一叠加 样本图像 和所 述第 一叠加样 本标记 图像进行 神经网络 模型训 练, 得到所述图像 背景修补 模型, 包括 : 将所 述第一 叠加样本 标记 图像输入 到初始 图像背景 修补模 型中得 到第一模 型生 成图像 ; 将所 述第一模 型生成 图像与 所述预设 背景 图像集合 中除所 述第一'叠加样 本 图像 中的背 景图像之 外的任一 背景图像 输入到 第一判 别器中; 基于 所述第 一判另 q器的输出结果以及 所述第 一模型 生成图像 与所 述第一 叠 加样 本图像 的比较 结果更新 所述初 始图像 背景修补 模型 , 得到所述图像 背景修 补模 型。
7.根据权利 要求 3所述的方法 , 其中, 所述面部皮肤修 补模型 的-训练过 .程, 包括 : 在采 集到的任 一不 包含预设 对象的 样本图像 的头颅 区域 内叠加预设 对象掩 码 图像, 得到第二叠 加样本 图像; 按照 预设标 定点采 集策略在 所述第 二叠加样 本图像 的头颅 区域采 集预设数 量 的头颅 区域锚点 , 得到标记有所 述预设数 量的 头颅区域 锚点的 第二叠加 样本 图像 ; 基 于所述标 记有所述 预设数 量的头 颅区域锚 点的第 二叠加 样本图像 与所述 采集 到的任 一不包含 预设对 象的样 本图像 进行神经 网络模 型训练得 到所述 面部 皮肤 修补模 型。
8.根据权利 要求 7所述的方法 , 其中, 所述基于所述标记有 所述预设 数量的 头颅 区域锚 点的第二 叠加样 本图像 与所述 采集到 的任一 ■不包含预设对象 的样本 图像 进行神 经网络模 型训练得 到所述 面部皮肤 修补模型 , 包括: 将所 述标记 有所述预 设数量 的头颅 区域锚 点的第二 叠加样 本图像输 入到初 始 面部皮肤修 补模型 中得到第 二模型 生成图像 ; 将所 述第二模 型生成 图像与 除与所 述第二 叠加样本 图像对应 的所 述采集到 的任 一不 包含预设对 象的样 本图像 之外的任 一不 包含预设 对象的 样本图像 输入 到第 二判别 器中; 基于 所述第 二判别 器的输 出结果以 及所述 第二模型 生成图 像和与 所述第二 叠加 样本 图像对 应的所 述采 集到的 任一不 包含预 设对 象的样 本图像 的比较 结 果 , 更新所述初始面 部皮肤修 补模型 , 得到所述面部皮肤 修补模 型。
9.根据权利 要求 7所述的方法, 其中, 所述按照预设标 定点采 集策略在 所述 第二 叠加样本 图像的 头颅区域 采集预设 数量的 头颅区域 锚点 , 包括: 在所 述第二 叠加样本 图像的头 颅区域 的内部按 照五官轮 廓进行锚 点采样 ; 在所 述第二 叠加样本 图像的 头颅区域 的轮廓 边缘按 照预设 采样间 隔在所述 轮廓 边缘进行 锚点采 样 O
10 —种 图像处 理装 ■置, 包括: 图像 获取模 块, 设置为获取 待处理 图像, 其中, 所述待处理图像 为具有预 设对 象的图 像, 所述预设对 象的部 分像素 点位于 所述待处 理图像 中主体轮 廓区 域 内, 所述预设对象 的另一部 分像素 点位于所 述主体轮 廓区域 外; 图像 处理模 块, 设置为将所 述待处 理图像输 入至预 设对象 去除处 理模型 , 得到 目标图 像, 其中, 所述目标 图像为与 所述具有 预设对 象的图 像对应 的预设 对 象去除图像 ; 所述 预设对 象去除处 理模型 是基.于预先建 立的无预 设对象 图像样 本时集佥 进行 训练得 到的模 型, 其中, 所述无预设 对象图像 样本对 集合中 的每个 无预设 对 象图像样 本对中 包括具有 预设对 象的原 始图像 , 以及分别对所 述原始 图像中 位 于所述主 体轮廓 区域外 的预设对 象的像 素点和 所述原始 图像中 位于所 述主体 轮廓 区域内 的预设对 象的像素 点进行 处理得到 的预设对 象去除 图像。
1 L一种电子 设备, 包括: 至少 一个处理 器; 存储 装置, 设置为存储 至少一 个程序 , 当所 述至少 一个程序 被所述 至少一 •个处理器执行 , 使得所述至少 一个处 理 器 实现如权 利要求 1-9中任一所述的 图像处理 方法。
12 —种 计算机 可读存储 介质 , 其上存储有计算 机程序 , 其中, 该计算机程 序被 处理器执 行时实 现如权利 要求 1-9中任一所述的 图像处理 方法。
25
PCT/SG2023/050392 2022-06-10 2023-06-01 图像处理方法、装置、电子设备及存储介质 WO2023239299A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202210657612.2 2022-06-10
CN202210657612.2A CN115937009A (zh) 2022-06-10 2022-06-10 图像处理方法、装置、电子设备及存储介质

Publications (1)

Publication Number Publication Date
WO2023239299A1 true WO2023239299A1 (zh) 2023-12-14

Family

ID=86654759

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/SG2023/050392 WO2023239299A1 (zh) 2022-06-10 2023-06-01 图像处理方法、装置、电子设备及存储介质

Country Status (2)

Country Link
CN (1) CN115937009A (zh)
WO (1) WO2023239299A1 (zh)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117315406B (zh) * 2023-11-28 2024-02-13 吉咖智能机器人有限公司 一种样本图像处理方法、装置及设备

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110008832A (zh) * 2019-02-27 2019-07-12 西安电子科技大学 基于深度学习人物图像自动分割方法、信息数据处理终端
CN112215784A (zh) * 2020-12-03 2021-01-12 江西博微新技术有限公司 图像去污方法、装置、可读存储介质及计算机设备
CN112734633A (zh) * 2021-01-07 2021-04-30 京东方科技集团股份有限公司 虚拟发型的替换方法、电子设备及存储介质
CN113963409A (zh) * 2021-10-25 2022-01-21 百果园技术(新加坡)有限公司 一种人脸属性编辑模型的训练以及人脸属性编辑方法

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110008832A (zh) * 2019-02-27 2019-07-12 西安电子科技大学 基于深度学习人物图像自动分割方法、信息数据处理终端
CN112215784A (zh) * 2020-12-03 2021-01-12 江西博微新技术有限公司 图像去污方法、装置、可读存储介质及计算机设备
CN112734633A (zh) * 2021-01-07 2021-04-30 京东方科技集团股份有限公司 虚拟发型的替换方法、电子设备及存储介质
CN113963409A (zh) * 2021-10-25 2022-01-21 百果园技术(新加坡)有限公司 一种人脸属性编辑模型的训练以及人脸属性编辑方法

Also Published As

Publication number Publication date
CN115937009A (zh) 2023-04-07

Similar Documents

Publication Publication Date Title
US20220261960A1 (en) Super-resolution reconstruction method and related apparatus
CN110058685B (zh) 虚拟对象的显示方法、装置、电子设备和计算机可读存储介质
CN112989904B (zh) 风格图像生成方法、模型训练方法、装置、设备和介质
US11501574B2 (en) Multi-person pose recognition method and apparatus, electronic device, and storage medium
CN110766777A (zh) 虚拟形象的生成方法、装置、电子设备及存储介质
WO2022068451A1 (zh) 风格图像生成方法、模型训练方法、装置、设备和介质
CN112562019A (zh) 图像色彩调整方法及装置、计算机可读介质和电子设备
WO2022033111A1 (zh) 图像信息提取方法、训练方法及装置、介质和电子设备
WO2023143222A1 (zh) 图像处理方法、装置、设备及存储介质
WO2020034981A1 (zh) 编码信息的生成方法和识别方法
CN110211195B (zh) 生成图像集合的方法、装置、电子设备和计算机可读存储介质
CN114092678A (zh) 图像处理方法、装置、电子设备及存储介质
WO2023273697A1 (zh) 图像处理方法、模型训练方法、装置、电子设备及介质
WO2022233223A1 (zh) 图像拼接方法、装置、设备及介质
WO2023239299A1 (zh) 图像处理方法、装置、电子设备及存储介质
WO2023051244A1 (zh) 图像生成方法、装置、设备及存储介质
WO2023143129A1 (zh) 图像处理方法、装置、电子设备及存储介质
WO2022132032A1 (zh) 人像图像处理方法及装置
WO2023030381A1 (zh) 三维人头重建方法、装置、设备及介质
WO2023232056A1 (zh) 图像处理方法、装置、存储介质及电子设备
CN114863214A (zh) 图像生成模型训练、图像生成方法、装置、介质及设备
CN112714263B (zh) 视频生成方法、装置、设备及存储介质
WO2023098649A1 (zh) 视频生成方法、装置、设备及存储介质
WO2023143118A1 (zh) 图像处理方法、装置、设备及介质
WO2023140787A2 (zh) 视频的处理方法、装置、电子设备、存储介质和程序产品

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 23820194

Country of ref document: EP

Kind code of ref document: A1