Image processing method and apparatus, device, medium, and program product
Artificial intelligence technology is used to utilize face detection and conversion networks, and target occlusion objects are used to block face parts, which solves the problem of rough face desensitization in the existing technology, achieves natural and insensitive face desensitization, and improves the efficiency of face desensitization. Image quality and application suitability.
Patent Information
- Application Number
- PCT/CN2023/127613
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-01-16
- Filing Date
- 2023-10-30
- Publication Date
- 2024-10-03
AI Technical Summary
Face desensitization methods in the existing technology are relatively rough, resulting in obvious image processing traces and affecting image quality and downstream applications.
Using an image processing solution based on artificial intelligence, using the face detection network and face conversion network, the target face part in the face is blocked by the target occlusion object (such as a mask), maintaining the appearance attributes of the face, and achieving a natural and non-impressive look. Face desensitization.
It effectively reduces traces of facial desensitization, protects facial privacy, and improves image quality. It is suitable for application scenarios such as training data and vehicle scenarios.
Smart Images

Figure CN2023127613_03102024_PF_FP_ABST
Abstract
Description
Image processing method, device, equipment, medium and program product
[0001] Related applications
[0002] This application claims priority to Chinese patent application No. 2023101068918, filed on January 16, 2023, entitled “A method, device, equipment, medium and program product for image processing,” the entire text of which is hereby incorporated by reference. Technical Field
[0003] The present application relates to the field of computer technology, in particular to the field of artificial intelligence, and specifically to an image processing method, an image processing apparatus, a computer device, a computer-readable storage medium, and a computer program product. Background Art
[0004] Image desensitization refers to the process of removing sensitive information (such as faces, ID numbers, or license plates) from images.
[0005] Currently, traditional technologies for desensitizing faces generally involve mosaicing the face, that is, processing the facial area into multiple blocks of greatly different colors, making it impossible to distinguish the original face.
[0006] However, mosaicing faces is a relatively rough method of face desensitization. The mosaiced area will be very conspicuous in the image, and there will be obvious traces of image processing, which causes obvious damage to the image and needs to be optimized.
[0007] Summary of the Invention
[0008] According to an embodiment of the present application, an image processing method, apparatus, device, medium, and program product are provided.
[0009] On the one hand, the present invention provides
[0010] An image processing method, executed by a computer device, comprising:
[0011] Display the image editing interface;
[0012] Displaying a target image in the image editing interface, the target image includes a human face, the human face has facial parts, the facial parts include a target facial part to be blocked, and the human face has facial appearance attributes; and
[0013] At the target facial part, a target obstructing object that obscures the target facial part is displayed, wherein the face obstructed by the target facial part retains the facial appearance attributes.
[0014] On the other hand, the present invention provides
[0015] An image processing device, comprising:
[0016] An interface display unit, configured to display an image editing interface; display a target image in the image editing interface, wherein the target image includes a face, the face has facial parts, the facial parts include a target facial part to be blocked, and the face has facial appearance attributes; and
[0017] The occluding object display unit is used to display the target occluding object that occludes the target facial part at the target facial part, wherein the face of the person whose target facial part is occluded retains the facial appearance attributes.
[0018] On the other hand, an embodiment of the present application provides a computer device, which includes a memory and a processor, wherein the memory stores computer-readable instructions, and the computer-readable instructions are executed by the processor to implement the image processing method as described above.
[0019] On the other hand, an embodiment of the present application provides a computer-readable storage medium, which stores computer-readable instructions. When the computer-readable instructions are executed by a processor, the image processing method as described above is implemented.
[0020] On the other hand, an embodiment of the present application provides a computer program product, including computer-readable instructions, which implement the above-mentioned image processing method when executed by a processor.
[0021] The details of one or more embodiments of the present application are set forth in the accompanying drawings and the description below. Other features, objects, and advantages of the present application will become apparent from the description, drawings, and claims. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the conventional technology, the following briefly introduces the drawings required for use in the embodiments or the conventional technology descriptions. Obviously, the drawings described below are merely embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on the disclosed drawings without any creative work.
[0023] FIG1 is a schematic diagram of an existing face desensitization method provided by the present application;
[0024] FIG2 is a schematic diagram of face desensitization using a target occluding object to occlude a target facial part of a face, provided by an exemplary embodiment of the present application;
[0025] FIG3 is a schematic diagram of the architecture of an image processing system provided by an exemplary embodiment of the present application;
[0026] FIG4 is a schematic diagram of the architecture of another image processing system provided by an exemplary embodiment of the present application;
[0027] FIG5 is a flow chart of an image processing method provided by an exemplary embodiment of the present application;
[0028] FIG6 is a schematic diagram of selecting one or more video frames from a video as target images for face desensitization, provided by an exemplary embodiment of the present application;
[0029] FIG7 is a schematic diagram of a human face after the nose and mouth are covered with a mask, provided by an exemplary embodiment of the present application;
[0030] FIG8 is a schematic diagram of an exemplary embodiment of the present application, in which an occlusion trigger operation is a trigger operation for a part removal option;
[0031] FIG9 is a schematic diagram of a facial region to be desensitized, selected by a user, provided by an exemplary embodiment of the present application;
[0032] FIG10 is a schematic diagram of an occlusion triggering operation provided by an exemplary embodiment of the present application, which is a gesture operation in an image editing interface;
[0033] FIG11 is a schematic diagram of an exemplary embodiment of the present application, in which an occlusion trigger operation is a voice signal input operation in an image editing interface;
[0034] FIG12 is a schematic diagram of a desensitization prompt information provided by an exemplary embodiment of the present application;
[0035] FIG13 is a schematic diagram of occlusion prompt information provided by an exemplary embodiment of the present application;
[0036] FIG14 is a schematic diagram of an exemplary embodiment of the present application providing an example of displaying occlusion prompt information in a prompt window;
[0037] FIG15 is a schematic diagram of an object style of a target occluding object selected by a user according to an exemplary embodiment of the present application;
[0038] FIG16 is a flow chart of another image processing method provided by an exemplary embodiment of the present application;
[0039] FIG17 is a schematic diagram of a process for implementing face desensitization on a target image using a trained face detection network and a face conversion network, provided by an exemplary embodiment of the present application;
[0040] FIG18 is a schematic diagram of an exemplary embodiment of the present application providing a method of marking a face in an image with a rectangular frame;
[0041] FIG19 is a schematic diagram of a network structure of a face detection network provided by an exemplary embodiment of the present application;
[0042] FIG20 is a schematic diagram of a face conversion data set provided by an exemplary embodiment of the present application;
[0043] FIG21 is a schematic diagram of the structure of a generator network provided by an exemplary embodiment of the present application;
[0044] FIG22 is a schematic diagram of the structure of a discriminator network provided by an exemplary embodiment of the present application;
[0045] FIG23 is a schematic diagram of a process for determining a loss function provided by an exemplary embodiment of the present application;
[0046] FIG24 is a schematic structural diagram of an image processing device provided by an exemplary embodiment of the present application;
[0047] FIG25 is a schematic structural diagram of a computer device provided by an exemplary embodiment of the present application. DETAILED DESCRIPTION
[0048] The following will be combined with the drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are only part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.
[0049] The present application provides an image processing solution based on artificial intelligence technology. The following is a brief introduction to the technical terms and related concepts involved in the image processing solution, including:
[0050] 1. Artificial Intelligence (AI)
[0051] Artificial intelligence (AI) refers to the theories, methods, techniques, and application systems that use digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, to perceive the environment, acquire knowledge, and use that knowledge to achieve optimal results. In other words, AI is a comprehensive field within computer science that seeks to understand the essence of intelligence and create new intelligent machines that can respond in a manner similar to human intelligence. AI also studies the design principles and implementation methods of various intelligent machines, enabling them to possess the capabilities of perception, reasoning, and decision-making. AI technology is an interdisciplinary discipline encompassing a wide range of fields, encompassing both hardware and software technologies. Foundational AI technologies generally include sensors, specialized AI chips, cloud computing, distributed storage, big data processing, operating / interaction systems, and mechatronics. AI software technologies primarily encompass computer vision, speech processing, natural language processing, and machine learning / deep learning.
[0052] The embodiments of this application mainly relate to computer vision technology and machine learning in the field of artificial intelligence. Among them:
[0053] Computer vision (CV) is the science of making machines "see." Specifically, it refers to using cameras and computers to replace the human eye in identifying, tracking, and measuring objects. Further image processing is performed to create images more suitable for human observation or transmission to instrumentation. As a scientific discipline, computer vision studies related theories and technologies, aiming to build artificial intelligence systems that can extract information from images or multidimensional data. Computer vision technologies generally include image processing, image recognition, image semantic understanding, image retrieval, optical character recognition (OCR), video processing, video semantic understanding, video content / behavior recognition, three-dimensional object reconstruction, 3D technology, virtual reality, augmented reality, and simultaneous localization and mapping.
[0054] The embodiments of the present application specifically relate to video semantic understanding (VSU) under computer vision technology; visual semantic understanding can be further subdivided into target detection and localization (target detection / localization), target recognition (target recognition) and target tracking (target tracking), etc. In more detail, the image processing solution provided in the embodiments of the present application mainly relates to target detection and localization (or simply referred to as target detection) under video semantic understanding. Among them, target detection is a computer technology related to computer vision and image processing, which is used to detect instances of specific categories of semantic objects (such as people, buildings or cars, which refer to faces in the embodiments of the present application) in digital images (or electronic images, which can be simply referred to as images) and videos.
[0055] ② Machine learning (ML) is a multidisciplinary field that encompasses probability theory, statistics, approximation theory, convex analysis, and algorithmic complexity theory. It specifically studies how computers can simulate or implement human learning behaviors to acquire new knowledge or skills and reorganize existing knowledge structures to continuously improve their performance. Machine learning is at the core of artificial intelligence and the fundamental path to computer intelligence. Its applications span all areas of AI. Machine learning and deep learning typically include techniques such as artificial neural networks, belief networks, reinforcement learning, transfer learning, inductive learning, and self-learning. Machine learning can be viewed as a task whose goal is to enable machines (in a broad sense, computers) to acquire human-like intelligence through learning. For example, just as humans can identify objects of interest in images or videos, computer programs (such as AlphaGo or AlphaGo Zero) are designed to master this ability. A variety of methods can be used to implement machine learning tasks, including neural networks, linear regression, decision trees, support vector machines, Bayesian classifiers, reinforcement learning, probabilistic graphical models, and clustering.
[0056] Neural networks are a method for implementing machine learning tasks. When discussing neural networks in the field of machine learning, we generally refer to "neural network learning." They are a network structure composed of many simple elements, similar to biological nervous systems, used to simulate the interaction between organisms and the natural environment. The more network structures there are, the richer the neural network's functionality. Neural networks are a relatively broad concept. For different learning tasks, such as speech, text, and images, neural network models more suitable for specific learning tasks have been derived, such as recurrent neural networks (RNNs), convolutional neural networks (CNNs), and fully connected convolutional neural networks (FCNNs).
[0057] 2. Data Masking
[0058] Data desensitization is the process of shielding sensitive data to achieve the protection of sensitive data. Sensitive data can also be called sensitive information. Data desensitization can specifically be the deformation of certain sensitive information (such as identity card number, mobile phone number, card number, customer name, customer address, email address, salary, face and license plate, etc., which involve personal privacy) through desensitization rules to achieve reliable protection of private data. In the embodiment of the present application, it mainly involves image desensitization, that is, removing sensitive information related to personal privacy in the image. The sensitive information here specifically refers to the face of the user in the image that can be identified; that is, the image processing solution provided by the embodiment of the present application is mainly to achieve the removal of sensitive information such as the face in the image, so as to achieve the purpose of protecting the privacy of the face.
[0059] Based on the above-mentioned artificial intelligence and data desensitization and other related contents, the embodiment of the present application proposes a non-perceptible face desensitization solution, which is called an image processing solution in the embodiment of the present application; this solution can use artificial intelligence (specifically machine learning and computer vision technology in the field of artificial intelligence) to train a face detection network and a face conversion network, so as to perform target detection (the target here refers to the face) in the target image (such as any image) through the face detection network to determine the area where the face is located in the target image.
[0060] Furthermore, the face detected from the target image is removed by the face conversion network to achieve the process of image desensitization. Specifically, a target occluding object (such as any occluding object, such as a mask) is used to block the target facial part in the face, such as putting a mask on a face that is not wearing a mask. This not only removes sensitive facial information from the face and avoids identifying the user's identity based on the face, thereby protecting the privacy of the face. Moreover, this method of using a target occluding object to block the target facial part in the face ensures the naturalness of face desensitization, making it difficult for users to see traces of face desensitization, and achieving non-sensitized face desensitization. The target facial part mentioned above may refer to any one or more facial parts in the face; facial parts may include: eyebrows, eyes, nose, mouth, ears, cheeks, and forehead, etc.
[0061] The image processing solution provided in the embodiment of the present application has obvious advantages over other face desensitization methods. The following is a comparison and explanation of the face desensitization involved in the image processing solution provided in the embodiment of the present application and other face desensitization methods.
[0062] As shown in Figure 1a of Figure 1, a certain other face desensitization method is used, which is called the first face desensitization method. A rectangular frame is used to select the area where the face is located from the image, and then mosaic filling or painting the rectangular frame is used to remove the face privacy information. It can be understood that the rectangular frame is a frame with a regular shape, while the face is often a shape with a gentle contour. This causes the rectangular frame to cover part of the non-face area in the image, causing unnecessary damage to the image, which will affect subsequent business in some application scenarios. If the image after removing the face is used as training data, it will have a certain negative impact on model training; and the method of directly coding or painting the rectangular frame is relatively rough, which will affect the business of downstream products.
[0063] As shown in Figure 1b of Figure 1, another face desensitization method is used, which is called the second face desensitization method. It supports replacing the face in the image with a virtual face or an animated face. However, in some scenarios, such as under the vehicle-mounted perspective, the face imaging is relatively small, making it difficult to achieve operations such as face alignment, which can easily cause facial posture mismatch and an abrupt and unnatural face-changing effect. In addition, since the face is small and the facial features are blurred under the vehicle-mounted perspective, if animation is performed, the facial features will be further smoothed, resulting in an unnatural blurred "no face" effect.
[0064] In summary, other face desensitization methods, whether through mosaicing, smearing, or anime face removal, all leave visible traces of face removal in the image, hindering the development of downstream applications after face desensitization. Downstream applications are those that require or rely on desensitized images.
[0065] However, the image processing solution provided by the embodiment of the present application is to use an occluding object to block part of the face part of the face. If the occluding object is a mask, it supports the use of a mask to block the nose and mouth parts of the face, so as to convert the face without a mask into the face with a mask, thereby removing some of the private information in the face. This method of removing some of the private information in the face can not only protect the privacy information of the face, such as the user identity cannot be identified based on the unobstructed face parts in the face, but also the face after desensitization can maintain the facial appearance attributes of the original face. As shown in Figure 2, when the occluding object is a mask, the face after the mask is used to block the nose and mouth not only looks very natural, but also maintains the facial appearance attributes of the original face such as the head orientation and line of sight, thereby achieving user-free desensitization. The user here is any user who wants to desensitize the face. Non-sense desensitization refers to removing sensitive information in the image while maintaining the harmony and beauty of the image. It is difficult to see the traces of desensitization processing, that is, the user cannot feel the desensitization traces based on the desensitized image, avoiding substantial damage to the image itself.
[0066] Face desensitization is a necessary means of protecting personal privacy. The image processing solution provided in the embodiment of the present application can be applied to the target application scenario. The target application scenario can be any application scenario that requires face desensitization. For a specific solution, the target application scenario is a specific application scenario. The target application scenarios include but are not limited to at least one of the following: training image return scenario and vehicle-mounted scenario, etc. The following is a relevant introduction to the specific implementation process of the image processing solution applied to the above-mentioned application scenarios, including:
[0067] (1) Training data return scenario.
[0068] Image perception algorithms are a type of algorithm used for object detection. For example, they can detect pedestrians, vehicles, lane markings, traffic signs, traffic lights, and drivable areas from images. The development and iteration of these perception algorithms require large amounts of image data. In practical applications, the image data used for algorithm training can come from vehicles equipped with image acquisition devices, such as cameras, that capture images for algorithm training. For example, image data can be acquired using dedicated image data acquisition vehicles. For another example, given the large number and widespread distribution of vehicles in the market, the quantity and diversity of image data are highly guaranteed. Therefore, images captured by production vehicles are also transmitted back as image data for algorithm training. However, images transmitted from both image data acquisition vehicles and production vehicles contain sensitive information such as faces, requiring initial desensitization. Using other facial desensitization methods mentioned above, such as blurring or unnatural face swapping, can produce noticeable artifacts, reducing image quality and hindering the training of perception algorithms. However, the image processing solution of non-perceptible desensitization proposed in the embodiment of the present application can achieve desensitization while avoiding image destruction to the greatest extent, is more in line with algorithm training requirements, and improves the friendliness of algorithm training.
[0069] (2) In-vehicle scenario.
[0070] In some embodiments, when the image processing method is applied to an in-vehicle scene, the image processing method further includes: displaying face retention prompt information, wherein the face retention prompt information is used to indicate whether to back up the face of the target facial part that is not blocked; in response to a confirmation operation for the face retention prompt information, displaying retention notification information, wherein the retention notification information includes retention address information of the face of the target facial part that is not blocked.
[0071] Optionally, the in-vehicle scene includes a parking sentry scene. Specifically, when the vehicle is parked, it can perceive the surrounding situation in real time through sensors such as radar. When an abnormality is detected in the vehicle's accessories, such as someone approaching, the vehicle will notify the owner of the abnormality in real time. At this time, the owner can use a terminal device, such as a smartphone that is deployed with an application corresponding to the image acquisition application running in the vehicle, to remotely view the situation around the vehicle in real time through the in-vehicle camera. Optionally, the in-vehicle scene includes a remote automatic parking scene. Specifically, in the process of the owner remotely parking the vehicle through the terminal device, the real-time image of the vehicle's surroundings needs to be transmitted to the terminal device held by the owner through the in-vehicle camera; in this way, the owner can timely grasp the situation around the vehicle through the real-time image output by the terminal device, thereby ensuring that the vehicle can be safely and correctly parked at the correct location.
[0072] In the above process, whether in the parking sentry scene or the remote automatic parking scene, the images automatically pushed to the car owner need to be desensitized. If the image desensitization traces are too severe, it will greatly reduce the aesthetics of the image and affect the car owner's experience of use. Therefore, the image processing scheme of non-sensitized desensitization proposed in the embodiment of this application is adopted. The occlusion object is used to block part of the face in the face while maintaining the facial appearance attributes of the face. This can reduce the facial desensitization traces, making it basically invisible to the car owner, increasing the aesthetics of the real-time video, and helping to improve the competitiveness of the product.
[0073] Of course, in order to facilitate the detection of abnormal situations near the vehicle, the embodiment of the present application also supports saving a non-desensitized image locally in the vehicle. In this way, when abnormal behaviors such as theft and car smashing are confirmed remotely and the face needs to be confirmed, the non-desensitized image can be viewed locally in the vehicle to ensure vehicle safety.
[0074] Optionally, retaining the un-denatured image locally in the vehicle may be the default, that is, a copy of the un-denatured image is retained locally in the vehicle by default in the target application scenario. Optionally, retaining the un-denatured image locally in the vehicle may also be determined independently by the user. For example, when the target application scenario is an in-vehicle scenario, it supports displaying a face retention prompt message, and the face retention prompt message is used to indicate whether to back up the face that does not block the target facial part; if the user wants to save the un-denatured image locally in the vehicle, a confirmation operation can be performed on the face retention information. At this time, the computer device responds to the confirmation operation on the face retention prompt message and displays a retention notification message. The retention notification message includes the retention address information of the face that does not block the target facial part, so that the user can intuitively and timely understand the storage location of the un-denatured image and facilitate the user to view the image.
[0075] It should be noted that the target application scenarios of the friendly (such as embodied in the seamless desensitization of sensitive information) image processing solution provided in the embodiment of the present application are not limited to the above two application scenarios; the image processing solution provided in the embodiment of the present application can be applied to various application scenarios, including but not limited to cloud technology, artificial intelligence, smart transportation, and assisted driving.
[0076] For example, target application scenarios can also include crowd detection scenarios. For example, crowd detection equipment can be deployed in crowded areas and transmit the collected environmental images to users (i.e., any user with viewing or management permissions for the crowd detection equipment) so that users can timely understand the environmental conditions based on the environmental images. Crowds refer to groups of people gathered, and crowd flow can be quantified using the flow rate, which represents the number of people per unit time.
[0077] In the crowd detection scenario mentioned above, it is also necessary to perform face desensitization processing on the environmental image transmitted to the user to ensure the privacy of the face to a certain extent, and to store a non-desensitized image locally in the crowd detection device so that the face can be confirmed when an abnormal situation needs to be eliminated. It should also be noted that when the embodiments of the present application are applied to specific products or technologies, such as when obtaining images collected by a vehicle, it is inevitable to obtain the information of the owner with vehicle management authority (such as the owner's name or number, etc.), then the owner's permission or consent needs to be obtained, and the collection, use and processing of relevant data need to comply with the relevant laws, regulations and standards of the relevant countries and regions.
[0078] In actual applications, the computer devices used to execute the image processing solutions provided in the embodiments of the present application may vary depending on the target application scenarios to which the image processing solutions are applied.
[0079] Optionally, the computer device can be a terminal device used by the user; as shown in Figure 3, after the camera deployed on the vehicle transmits the collected image to the background server, the background server forwards the image to the terminal device used by the user, and the terminal device performs face desensitization on the image and displays the desensitized image; or, the camera deployed on the vehicle directly transmits the collected image to the terminal device, and the terminal device performs face desensitization on the image and displays the desensitized image. Among them, the terminal device may include but is not limited to: smart phones (such as Android phones, iOS phones, etc., which can be referred to as mobile phones), tablet computers (or simply computers), portable personal computers, mobile Internet devices (Mobile Internet Devices, referred to as MIDs), intelligent voice interaction devices, smart home appliances, vehicle-mounted devices (or called vehicle-mounted terminals), head-mounted devices, aircraft and other smart devices that can be touched.
[0080] Optionally, the computer device may include a terminal device used by the user, and a server corresponding to the terminal device; that is, the image processing solution may be jointly executed by the terminal device and the server. As shown in Figure 4, after the camera deployed on the vehicle transmits the collected image to the background server, the background server may perform face desensitization on the image, and send the desensitized image to the terminal device for desensitized display. Among them, the server may include but is not limited to: data processing servers, Web servers, application servers and other devices with complex computing capabilities. The server may be an independent physical server, or it may be a server cluster or distributed system composed of multiple physical servers. The target terminal device and the server may be directly or indirectly connected in communication via wired or wireless means. The embodiment of the present application does not limit the connection method between the target terminal and the computer device.
[0081] Furthermore, the image processing solution provided by the embodiment of the present application can be specifically executed by an application or plug-in deployed in a computer device. As mentioned above, if the face desensitization function provided by the embodiment of the present application is integrated into the application or plug-in, the application or plug-in can be called through the terminal device to use the face desensitization function. Among them, the application can refer to computer-readable instructions for completing one or more specific tasks; by classifying the application according to different dimensions (such as the operation mode and function of the application), the types of the same application under different dimensions can be obtained. Among them, according to the operation mode of the application, the application can include but is not limited to: a client installed in the terminal, a mini-program that can be used without downloading and installing, a web application opened through a browser, etc. According to the functional type of the application, the application can include but is not limited to: IM (Instant Messaging) application, content interaction application, etc.; among them, instant messaging application refers to an application for instant communication of messages and social interaction based on the Internet. Instant messaging application can include but is not limited to: social applications with communication functions, map applications with social interaction functions, game applications, etc. Content interaction application refers to an application that can realize content interaction, such as online banking, sharing platforms, personal space, news and other applications.
[0082] It is worth noting that the embodiments of the present application do not limit the specific type of application that has the face desensitization function. Moreover, for the sake of convenience, the computer device executing the image processing solution is used as an example for description.
[0083] Based on the image processing scheme described above, it can be seen that the embodiment of the present application supports the use of a trained face detection network and a face conversion network to implement face desensitization processing, so as to reduce the traces of face desensitization and ensure the naturalness of the face after desensitization. The following first introduces the interface implementation process of the more detailed image processing method proposed in the embodiment of the present application in conjunction with the embodiment shown in Figure 5; the image processing method can be executed by the computer device mentioned above, and the image processing method may include but is not limited to steps S501-S503:
[0084] S501: Displaying an image editing interface.
[0085] S502: Displaying a target image in the image editing interface, wherein the target image includes a face, the face has facial parts, the facial parts include a target facial part to be blocked, and the face has facial appearance attributes.
[0086] The image editing interface is a user interface (UI) for implementing face desensitization, and is a medium for interaction and information exchange between the system and the user. As described above, the image processing method provided in the embodiment of the present application can be integrated into a plug-in or application, so the image editing interface can be provided by the plug-in or application and displayed by the terminal device where the plug-in or application is deployed; for ease of explanation, the image processing method is integrated into the application as an example.
[0087] In a specific implementation, when a user needs to view an image, the user can use a terminal device to open an application and display an image editing interface provided by the application; a human face is displayed in the image editing interface, and the human face specifically belongs to the target image, and the target image is displayed in the image editing interface to realize the display of the human face in the image editing interface.
[0088] It should be noted that ① the embodiment of the present application does not limit the number of faces contained in the image editing interface and the number of target images contained in the image editing interface; for the sake of convenience, the example in which the image editing interface contains a target image and the target image contains a non-desensitized face is used for explanation.
[0089] ② The embodiment of the present application does not limit the source of the target image in the image editing interface; the source of the target image may include but is not limited to: an image captured in real time by a camera, an image downloaded from the local memory or network of the terminal device, or an image captured from a video (such as a video captured by a vehicle-mounted setting), etc. The embodiment of the present application supports users in obtaining target images that require face desensitization processing in a variety of ways, which can enrich the path for applications to implement face desensitization, meet the user's needs for customizing the image selected for face desensitization, and improve the user experience.
[0090] Depending on the source of the target image, the implementation method of adding and displaying the target image in the image editing interface may be the same or different. Below, in conjunction with Figure 6, the source of the target image is selected from the video as an example, an exemplary implementation method of intercepting the target image from the video is introduced, and it does not limit the embodiments of the present application. As shown in Figure 6, before displaying the image editing interface provided by the target application, the image acquisition interface 601 provided by the application can be displayed first, and the target video 602 (such as a video of any length collected by the vehicle-mounted device) is included in the image acquisition interface. If the user wants to select the target image from the target video 602, then the target video 602 can be subjected to a video viewing operation. The video viewing operation may include a triggering operation on the target video 602, a click operation on the viewing button 603 (or component, button, option, etc.), etc. At this time, the terminal device responds to the video viewing operation and displays the multiple video frames (i.e., images) contained in the target video in the form of thumbnails. In this way, the user can select at least one target image containing a face from the multiple video frames. Furthermore, in response to a confirmation operation on the selected target image (such as a trigger operation on the confirmation option 604), an image editing interface 605 provided by the application can be output, and at least one selected frame of the target image containing a face (the face contained in the image is not desensitized or has been desensitized) is displayed in the image editing interface.
[0091] It is worth noting that the above FIG6 is explained by selecting one or more video frames from the target video as the target image as an example; in actual application, it also supports selecting all video frames contained in the entire target video as the target image to be face desensitized. At this time, the target video after face desensitization is supported to be displayed in the image editing interface in the form of playing video, that is, as long as the video frames containing faces in the target video played in the image editing interface are subjected to face desensitization, so as to achieve batch face desensitization and improve the speed and efficiency of face desensitization. In addition, the embodiment of the present application also supports face desensitization of images acquired in real time and outputting them through the image editing interface; for example, the real-time acquired images can be collected in real time by the on-board equipment deployed in the vehicle. In this way, for the car owner, the images played through the terminal device held by the car owner are all desensitized images. If the car owner needs to view the un-desensitized images, he needs to view them locally in the vehicle. In addition, in some application scenarios, the image acquisition interface and image editing interface mentioned above can also be the same interface; for example, in the training data feedback scenario, the image acquisition interface and the image editing interface can be the same interface (taking the image editing interface as an example), and any image displayed in the image editing interface is required to perform face desensitization as a training image, without the need to perform the related operations of image selection mentioned above.
[0092] S503: Displaying a target blocking object that blocks the target facial part at the target facial part, wherein the face of the person whose target facial part is blocked retains the facial appearance attributes.
[0093] After the computer device obtains the face to be desensitized (specifically, the target image containing the face), the trained face detection network and face conversion network can be called to perform face desensitization on the target image to be desensitized to obtain the desensitized face; and the desensitized face is output in the image editing interface, and the desensitized face is obtained by using the target occluding object to occlude the target facial part in the face.
[0094] The target occluding object mentioned above is an occluding object that matches the target facial part in the human face; for example, if the target facial part is the mouth and nose, then the target occluding object used to cover the mouth and nose can be a mask; for another example, if the target facial part is the eyes, then the target occluding object used to cover the eyes can be glasses or sunglasses; for another example, if the target facial part is the hair, then the target occluding object used to cover the hair can be a wig or a hat, etc.
[0095] In one embodiment, displaying the target blocking object that blocks the target facial part at the target facial part includes: displaying a target blocking object that blocks the at least one target facial part at at least one target facial part.
[0096] In the embodiments of the present application, an occlusion object can correspond to one or more facial parts of a face, and different occlusion objects can correspond to the same or different facial parts. For example, the occlusion object "mask" corresponds to two facial parts "mouth and nose," while the occlusion object "glasses" may correspond to one facial part "eyes." The embodiments of the present application do not limit the specific type of target occlusion object. For ease of explanation, the following example uses the target occlusion object as a mask and the target occlusion part as the mouth and nose as an example.
[0097] It should be noted that in the embodiments of the present application, the face that is obscured by the target occluding object retains the facial appearance attributes of the original face. Facial appearance attributes may include head orientation, line of sight, expression, clothing, and gender, which can be used to describe the appearance attributes of the user's face. In other words, when the target facial area of a face is covered by the target occluding object, compared to the original face (i.e., the target facial area is not obscured by the target occluding object), the target occluding object is simply added to the target facial area, without affecting the appearance of the face.
[0098] In an exemplary case where the target occlusion object is a mask, a schematic diagram of a face after the nose and mouth are covered by a mask can be seen in FIG7 ; as shown in FIG7 , the face desensitized with the mask maintains the facial appearance attributes of the original face, such as maintaining the tilt of the head, maintaining the head hairstyle, and maintaining the line of sight, etc. This face desensitization method that maintains the facial appearance attributes of the face, while eliminating sensitive facial information, basically does not produce any traces of face desensitization, so that users cannot see any traces of desensitization from the desensitized face, maintaining the harmonious beauty and naturalness of the face, thereby ensuring the image usage efficiency of the scene when the more friendly and natural desensitized face is applied to the target application scenario, such as being conducive to the return use of image data or the development of downstream applications after desensitization.
[0099] In some embodiments, the step of displaying a target occluding object that occludes the target facial part at the target facial part is triggered in response to an occlusion trigger operation for the face; wherein the occlusion trigger operation includes: a trigger operation for a part removal option in the image editing interface, a gesture operation performed in the image editing interface, a voice signal input operation in the image editing interface, or an application silently detecting that a target image contains a face.
[0100] In actual application, the embodiment of the present application supports triggering the execution of the step of using the target masking object to mask the target facial part in the face when an occlusion trigger operation for the face in the image editing interface is received. The occlusion trigger operation may include but is not limited to any of the following: a trigger operation for the part removal option in the image editing interface, a gesture operation performed in the image editing interface, a voice signal input operation in the image editing interface, or a silent detection operation of the face in the received target image by an application integrated with an image processing method (such as the received target image is not displayed in the image editing interface before desensitization), etc.
[0101] Of course, the occlusion triggering operations used to trigger the execution of face desensitization are not limited to the ones given above. The following is combined with the accompanying drawings and takes the above-mentioned several occlusion triggering operations as an example to illustrate the specific implementation process of realizing face desensitization based on the occlusion triggering operation, where:
[0102] (1) The occlusion trigger operation is a trigger operation for the part removal option in the image editing interface.
[0103] As shown in Figure 8, the image editing interface includes a part removal option 801; in response to a click operation on the part removal option 801, it indicates that the user wants to remove the target facial part of the face contained in the target image displayed in the icon editing interface. At this time, the target facial part can be a default facial part among the multiple facial parts contained in the face, such as using the default target covering object "mask" to cover the default target facial part to be covered "mouth and nose part" in the face.
[0104] In addition to using a part removal option as shown in FIG8 to represent the default removal of the target facial part, the embodiment of the present application also supports the inclusion of part removal options corresponding to different facial parts in the image editing interface, such as the nose and mouth removal option 802, the eye removal option 803, and the hairstyle removal option 804; as shown in FIG9, under this implementation, the user can independently select at least one part removal option from multiple part removal options according to their own desensitization needs. Then, in response to the selection operation for at least one part removal option, the image editing interface uses the occlusion object that matches the facial part corresponding to the selected at least one part removal option to occlude the corresponding facial part in the face, and obtain the desensitized face. This method of supporting users to customize the facial parts they want to remove from the face increases the user's selection authority for face desensitization, meets the face desensitization needs of different users, and improves user experience and stickiness.
[0105] It should be noted that the above Figures 8 and 9 are only schematic diagrams of the display position and display style of the exemplary part removal option in the image editing interface provided in the embodiment of the present application; depending on the interface style and interface content of the image editing interface, the display position and display style of the part removal option in the image editing interface can also undergo adaptive changes; the embodiment of the present application does not limit this.
[0106] (2) The occlusion trigger operation is a gesture operation performed in the image editing interface.
[0107] Among them, the gesture operation in the image editing interface may include but is not limited to: a double-click operation, a long press operation or a three-finger operation, or an operation of executing a preset trajectory (such as an "S"-shaped trajectory or an "L"-shaped trajectory, etc.). As shown in Figure 10, if the gesture operation used to trigger face desensitization is a long press operation with two fingers, then when the display position in the image editing interface (such as the gesture area 1001 in the image editing interface, or any display position in the entire image editing interface) is triggered by two fingers for a time period exceeding a time threshold (such as 5 seconds), it is determined that there is a long press operation with two fingers in the image editing interface, indicating that the user wants to perform face desensitization on the face in the image editing interface. At this time, the computer device performs face desensitization on the face in the image editing interface, and updates the display of the desensitized face in the image editing interface. Similarly, if the gesture operation used to trigger face desensitization is a movement operation of a preset "S"-shaped trajectory, then when the movement operation of the "S"-shaped trajectory is detected in the image editing interface, it means that the user wants to perform face desensitization on the face in the image editing interface. At this time, the computer device performs face desensitization on the face in the image editing interface, that is, uses the target blocking object to block the target facial part in the face, and updates the display of the desensitized face in the image editing interface.
[0108] In addition, the embodiment of the present application also supports one gesture operation corresponding to one occlusion object; in this way, when the user performs a target gesture operation (such as any gesture operation) in the image editing interface, the computer device uses the occlusion object corresponding to the target gesture operation according to the type of the target gesture operation to occlude the facial part that matches the occlusion object to achieve face desensitization. For example, when the gesture operation is to perform the operation of executing the preset track "S", the corresponding occlusion object is sunglasses. Then, when the gesture operation is detected in the image editing interface, the occlusion object "sunglasses" is used by default to occlude the eyes of the face in the image editing interface, so that the face after the eyes are blocked cannot be identified as the user's identity. For another example, when the gesture operation is a double-click operation, the corresponding occlusion object is a mask. Then, when the gesture operation is detected in the image editing interface, the occlusion object "mask" is used by default to occlude the mouth and nose of the face in the image editing interface, so that the face after the mouth and nose are blocked cannot be identified as the user's identity.
[0109] (3) The occlusion trigger operation is a voice signal input operation in the image editing interface.
[0110] Specifically, in the process of displaying the image editing interface on the computer device, the audio in the physical environment where the user is located can be obtained through the microphone deployed in the computer device, and the obtained audio can be analyzed for voice signals. If the voice signal indicates that face desensitization needs to be triggered, the computer device performs face desensitization on the face in the image editing interface and displays the desensitized face in the image editing interface. An exemplary operation diagram of inputting a voice signal in the image editing interface can be seen in Figure 11; as shown in Figure 11, a voice input option 1101 is included in the image editing interface. When the voice input option 1101 is triggered, the microphone deployed in the computer device is turned on, and the audio in the physical environment where the user is located is obtained through the microphone; of course, the image editing interface may not include a voice input option, but in the process of displaying the image editing interface, the microphone deployed in the computer device is always in the on state to collect the audio in the physical environment where the user is located in real time.
[0111] Furthermore, after automatically detecting that the audio collection in the physical environment is complete, the computer device can perform operations such as voice signal analysis to determine whether it is necessary to desensitize the face in the image editing interface. Of course, in addition to the computer device automatically detecting whether the input of the voice signal has ended, the embodiment of the present application also supports detecting a trigger operation for the end option 1102, indicating that the user has completed the voice signal input, and the terminal performs subsequent operations such as analyzing the voice signal.
[0112] (4) The application silently detects that the received target image contains an operation of a human face; that is, after obtaining the target image, the computer device (specifically, the application deployed in the computer device) can directly perform face detection on the target image, and when a face is detected from the target image, determine to trigger the desensitization condition for the face in the target image.
[0113] Specifically, when an image editing interface is triggered and displayed on a computer device, the computer device (specifically, an application deployed on the computer device) can automatically and silently perform face detection on the image editing interface and automatically perform face desensitization after detecting a face, without the user having to perform any operation to trigger the execution of face desensitization. This method of automatic silent face detection and desensitization by the application does not require user operation, reduces user workload, and improves the intelligence and automation of face desensitization.
[0114] It is worth noting that the computer device renders and displays the target image on the display screen of the computer device only after receiving the target image; therefore, the computer device can perform face detection and desensitization on the target image after receiving the target image to be rendered and displayed, and directly display the desensitized target image in the image editing interface; rather than first displaying the non-desensitized face in the image editing interface as mentioned above, and then the computer device performs the related operations of face detection and desensitization. The above-mentioned method of directly performing face desensitization on the target image after receiving the target image to be rendered and displayed improves the speed and efficiency of face desensitization to a certain extent.
[0115] In some embodiments, the image processing method further includes: in response to an occlusion trigger operation on the face, outputting occlusion prompt information, wherein the occlusion prompt information is used to indicate that a target facial part in the face is occluded; and in response to a confirmation operation on the occlusion prompt information, triggering the execution of the step of displaying a target occlusion object that occludes the target facial part at the target facial part.
[0116] As can be seen from the above description, the occlusion trigger operation is: when the application performs a silent detection operation on the face in the image editing interface, the user cannot perceive the process of triggering face desensitization; in order to improve the user's perception of triggering face desensitization, the embodiment of the present application also supports the application performing a silent detection operation and detecting the face in the image editing interface, prompting the user that the face is detected and the face desensitization is about to be performed; so that the user can intuitively perceive the desensitization process for the face. Optionally, as shown in Figure 12, it supports the output of desensitization prompt information 1201, which is used to prompt that the face is detected and the face desensitization is about to be performed; the desensitization prompt information 1201 can display the target time period (such as 3 seconds) in the image editing interface, so that the user has enough time to understand the content of the desensitization prompt information 1201.
[0117] In some embodiments, the occlusion prompt information is displayed in a prompt window, and the prompt window also includes a target facial part identifier and a part refresh component of the target facial part. The image processing method also includes: when the part refresh component is triggered, the candidate facial part identifier of the candidate facial part in the face is displayed in the prompt window, and the candidate facial part is different from the target facial part; in response to a confirmation operation for the candidate facial part identifier, a target occluding object that occludes the candidate facial part is displayed at the candidate facial part, wherein the face whose candidate facial part is occluded retains the facial appearance attributes.
[0118] Optionally, as shown in Figure 13, it also supports outputting occlusion prompt information 1302, which is used to indicate the target facial part in the occluded face; at this time, in response to the confirmation operation for the occlusion prompt information 1302 (such as the confirmation component 13031 contained in the prompt window 1303 where the occlusion prompt information 1302 is located is triggered), the step of using the target occlusion object to occlude the target facial part in the face is triggered.
[0119] Furthermore, the embodiment of the present application also supports the user to independently select the facial part to be blocked through window 1303 to meet the user's desensitization needs for different facial parts. As shown in Figure 14, the above-mentioned blocking prompt information 1302 is displayed in the prompt window 1303. At this time, the prompt window 1303 also includes a target facial part identifier 13032 of the target facial part (such as a mark that can be used to uniquely identify the facial part, such as an icon or text, etc.) and a part refresh component 13033. When the part refresh component 13033 is triggered, it means that the user wants to change the facial part to be desensitized. At this time, the candidate facial part identifiers of the candidate facial parts of the face other than the target facial part are output in the prompt window 1303. Specifically, the location of the target facial part originally displayed in the prompt window 1303 is updated to the candidate facial part identifier of the candidate facial part. For example, if the target facial part is the eye part, the candidate facial parts include the nose part and the mouth part. In response to the confirmation operation on the candidate facial part identifier, the computer device uses the occlusion object corresponding to the candidate facial part corresponding to the selected candidate facial part identifier to occlude the reference facial part to achieve face desensitization. Of course, the facial part identifiers of other facial parts of the face other than the target facial part are also directly output in the prompt window 1303 for the user to select. For example, the facial part identifiers of multiple facial parts can be selected. At this time, the matching occlusion object can be determined based on the facial part identifiers of the selected multiple facial parts. The embodiment of the present application does not limit the specific implementation process of selecting the facial part identifier in the prompt window 1303.
[0120] It should be noted that the above implementation methods (1)-(4) are only several exemplary occlusion trigger operations provided in the embodiments of the present application; in actual applications, the occlusion trigger operation existing in the image editing interface may also change, such as the occlusion trigger operation may also include the operation of inputting shortcut keys through a physical input device (such as a physical keyboard) or a virtual input device (such as a virtual keyboard); the embodiments of the present application do not limit the specific implementation process of the occlusion trigger operation for triggering face desensitization.
[0121] It should also be noted that the above-mentioned implementation method of allowing the user to independently select the facial part to be blocked is applicable to any type of occlusion trigger operation; the specific implementation process of the user selecting the facial part to be blocked in the image editing interface as shown in Figure 9 can actually also be applied to the process in which the occlusion trigger operation is a voice input operation.
[0122] In addition, in addition to supporting the user to independently select the facial part to be blocked, the embodiment of the present application also supports the user to independently select the blocking object to enrich the user's facial desensitization selection authority. In one implementation, it supports directly selecting the blocking object to determine the facial part to be blocked according to the selected blocking object; similar to the aforementioned Figure 8, the icon editing interface can include multiple object identifiers of candidate blocking objects (such as a mark for uniquely identifying the blocking object), so that the user can select an identifier from the object identifiers of multiple candidate blocking objects to determine the facial part corresponding to the selected object identifier as the facial part to be blocked.
[0123] In some embodiments, the image processing method also includes: displaying an object selection interface, wherein the object selection interface includes one or more candidate occluding objects corresponding to the target facial part, and different candidate occluding objects have different object styles; in response to the object selection operation, the candidate occluding object selected from the one or more candidate occluding objects is determined as the target occluding object.
[0124] In other implementations, support is provided for autonomously selecting the object style of an occluding object that matches the facial part to be occluded, based on the determination of the facial part to be occluded. This allows for user customization of the object style of the target occluding object, enhancing the user experience. As shown in FIG15 , after performing an occlusion trigger operation in the image editing interface and determining the target facial part to be occluded (e.g., a default or user-selected one), support is provided for outputting an object selection interface 1501. This object selection interface 1501 includes one or more candidate occluding objects corresponding to the target facial part, such as candidate occluding object 1502, candidate occluding object 1503, and candidate occluding object 1504; these candidate occluding objects have different object styles. The user can perform an object selection operation in this object selection interface 1501, and the computer device can select a target occluding object of the target occluding style from the one or more candidate occluding objects in response to the object selection operation. The target facial part in the face is thereby occluded using the target occluding object of the target occluding style, resulting in a desensitized face. It is understandable that one or more candidate occluding objects can also be directly displayed in the image editing interface instead of being displayed in an independent object selection interface; the embodiment of the present application does not limit the specific display location of one or more candidate occluding objects, which is specifically explained here.
[0125] In an embodiment of the present application, a face is displayed in the image editing interface; when the user has a face desensitization requirement, it supports the use of a target occlusion object to automatically block the target face parts (such as the nose and mouth parts) in the face to achieve desensitization of the face. In the above scheme, when the target occlusion object is used to block the target face parts in the face, the target occlusion object can adapt to the face posture and flexibly block the target face parts in the face; this allows the face after blocking to still retain the facial appearance attributes of the original face. For example, if the original face posture is head-up, the shape of the target occlusion object can adapt to the face posture to change, so that the target occlusion object after the shape change can be well matched with the face posture, thereby removing sensitive information in the face (such as facial features, etc., which can identify the face) while ensuring that the face basically does not form any modification traces, maintaining the harmonious beauty and naturalness of the blocked face, and providing the user with a senseless face desensitization effect.
[0126] The embodiment shown in FIG5 above mainly introduces the interface implementation process of the image processing method. The following introduces the background technical process of the image processing method; specifically, FIG16 shows the background technical process of the image processing method. The background technical process mainly introduces the specific implementation process of the computer device calling the network or model to perform face desensitization on the target image for face desensitization. FIG16 is a flow diagram of an image processing method provided by an exemplary embodiment of the present application; the image processing method can be executed by a computer device, and the image processing method can include but is not limited to steps S1601-S1605:
[0127] S1601: Obtain a target image to be desensitized to human faces, where the target image contains human faces.
[0128] In a specific implementation, when the computer device receives an occlusion trigger operation, it determines that face desensitization needs to be performed, and at this time, the target image to be desensitized can be obtained. As described above, the occlusion trigger operation for triggering face desensitization can include multiple types. For example: the occlusion trigger operation includes: a gesture operation in the image editing interface, a trigger operation for the part removal option in the image editing interface, and a voice signal input operation, etc. At this time, the image containing the face displayed in the image editing interface can be directly used as the target image to be desensitized. For example: the occlusion trigger operation includes: a silent detection operation of the application for the face in the target image; specifically, after receiving the target image, the computer device directly performs face detection on the target image (without displaying the un-desensitized target image in the image editing interface), and determines that the target image to be desensitized is obtained when the face is detected. Further, the target image obtained can be uploaded by the user, or it can be an image collected in real time by an on-board device deployed in the vehicle (or called an on-board image), etc. The embodiment of the present application does not limit the specific source of the target image.
[0129] S1602: Obtain a trained face detection network, and call the face detection network to perform face recognition on the target image to obtain a face region containing a face in the target image.
[0130] S1603: Perform region cropping on the target image to obtain a facial image corresponding to the target image, where the facial image contains the face in the target image.
[0131] In steps S1602-S1603, after the target image to be desensitized is obtained based on the aforementioned steps, the embodiment of the present application uses a model or network to implement face detection and desensitization (or conversion) in the target image to achieve desensitization processing of the face in the target image; by utilizing a trained network to implement detection and conversion of the face in the target image, the user does not need to perform tedious operations. For the user, the difficulty of face detection and conversion is reduced, and the trained network is trained using a large amount of training data, thereby ensuring the accuracy of face detection and conversion.
[0132] The networks involved in the embodiments of the present application may include: a face detection network and a face conversion network; wherein the face detection network is used to detect the area where the face is located from the target image, and the face conversion network converts the face detected from the target image to achieve the goal of using a target occluding object to occlude the target face part in the face, thereby achieving face desensitization; an exemplary process of training a face detection network and a face conversion network, and using the trained face detection network and face conversion network to achieve face desensitization on the target image can be seen in Figure 17. For ease of explanation, in steps S1602-S1603, only the network training and application of the face detection network are introduced, and in subsequent steps S1604-S1605, the network training and application of the face conversion network are introduced.
[0133] In a specific implementation, after obtaining the target image to be desensitized, the computer device supports calling a trained face detection network to perform multi-scale feature extraction on the target image, and obtains feature maps of different scales (i.e., the height h and width w of the feature map) to determine the area where the face is located in the target image, so as to accurately locate the area where the face is located from the target image. The following introduces the network training process of the face detection network. The training process of the face detection network can generally include the construction of a face detection data set, and the design and training of the face detection network. The two steps can be further subdivided into but not limited to steps s11-s14; wherein:
[0134] s11: Get the face detection data set.
[0135] Among them, the face detection data set contains at least one sample image and face annotation information corresponding to each sample image. Among them: ① When the target application scenario is a vehicle-mounted scenario, the sample image can be collected by a vehicle-mounted device deployed in the vehicle (such as a driving recorder); of course, the source of the sample image is not limited to the vehicle-mounted device, and there is no limitation on this. ② The face annotation information corresponding to any sample image is used to mark the location of the face in the corresponding sample image. To facilitate understanding, the face annotation information can be represented in the form of a rectangular frame, as shown in Figure 18. In the sample image, a rectangular frame can be used to mark all the faces contained in the sample image, and one rectangular frame is used to mark one face; but when recording the face annotation information in the background, it is recorded in the form of a data structure.
[0136] s12: Select the i-th sample image from the face detection data set, and use the face detection network to perform multi-scale feature processing on the i-th sample image to obtain feature maps of different scales and face prediction information corresponding to each feature map.
[0137] After obtaining the face detection data set for training the face detection network based on the annotation in step s11, support is provided for network training of the face detection network based on the face detection data set. Specifically, the face detection network is iteratively trained using sample images from the face detection data set for multiple rounds until a trained face detection network is obtained. The process of one round of network training is described using the i-th sample image from the face detection data set as an example, where i is a positive integer. In a specific implementation, support is provided for performing multi-scale feature processing on the i-th sample image using the face detection network, obtaining feature maps of different scales and face prediction information corresponding to each feature map. Among them, the specific implementation process of multi-scale feature processing may include: first performing multi-scale feature extraction on the i-th sample image to obtain feature maps of different scales; then, in order to make the face detection network better adapt to the scale changes of the face in the sample image, it supports feature fusion of feature maps of different scales; finally, generating corresponding output features at each scale, the output features at any scale include the feature map corresponding to the any scale and the face prediction information corresponding to the feature map, the face prediction information corresponding to the feature map can be used to indicate the area where the face is predicted in the corresponding feature map, that is, the face detection network is used to predict the area where the face is in the sample image.
[0138] The following describes the specific implementation process of face detection using the face detection network given above, in conjunction with the network structure of the face detection network shown in Figure 19. As shown in Figure 19, the face detection network designed in the embodiment of the present application generally includes: a backbone network and a multi-scale feature module. The structure and function of the backbone network and the multi-scale feature module are described below, including:
[0139] 1) The backbone network is primarily used to perform multi-scale feature extraction on the i-th sample image input to the face detection network. This extracts rich image information from the i-th sample image, which is beneficial for accurately predicting the face contained in the i-th sample image. The backbone network comprises a backbone stem and multiple network layers (B-layers). The following sections describe the following: ① The backbone stem structure can still be seen in Figure 19. The backbone stem consists of a max pooling layer (Maxpool), a convolutional layer, a normalization (BN), and an activation function (ReLU). The specific implementation process of performing multi-scale feature extraction on the i-th sample image based on the backbone stem in the backbone network may include: after the face detection network obtains the i-th sample image, it first performs pooling on the i-th sample image using the max pooling layer in the backbone stem. It then uses a convolutional layer (e.g., a convolutional layer with a 3×3 kernel and a stride of 2) to extract the pooled features. The extracted features are then normalized and activated to obtain the feature information extracted by the backbone stem for the i-th sample image.
[0140] Furthermore, ② the network layers B-layers of multiple downsampling scales (or scales for short) contained in the backbone network can be used to continue to perform feature extraction of different learning scales on the feature information extracted by the trunk stem, and obtain feature information of different scales to extract rich information of the i-th sample image. In an embodiment of the present application, the network layers B-layer contained in the backbone network are: B-layer1→B-layer2→B-layer3→B-layer4 as an example, and the downsampling scale of each network layer B-layer is twice the downsampling scale of the previous network layer B-layer; by using network layers B-layers of different learning scales to extract features from the i-th sample image, the rich image information contained in the i-th sample image can be extracted, thereby improving the detection accuracy of the face area in the i-th sample image.
[0141] Each network layer (B-layer) contains multiple residual convolution modules (Res Blocks). As shown in Figure 19, a network layer (B-layer) consists of a residual convolution module (Res Block) and m residual convolution modules (Res Blocks) connected in series, and these m residual convolution modules (Res Blocks) are connected in parallel. Each residual module (Res Block) is used to perform a convolution operation on the input feature information, implementing multiple convolution operations on the image to extract rich feature information (such as the grayscale value of each pixel) of the i-th sample image. The specific value of m is related to the downsampling scale of the network layer (B-layer) and is not limited. The structure of a single residual convolution module (Res Block) can be seen in Figure 19. A residual convolution module (Res Block) can include multiple convolution kernels of different or equal learning feature scales (for example, the residual convolution module (Res Block) in Figure 19 consists of a 3×3 convolution kernel connected in series with a normalization module, a 3×3 convolution kernel connected in series with a 1×1 convolution kernel), as well as a downsampling module. Wherein: each convolution kernel is used to extract features of the input feature information at the corresponding learning feature scale (such as 3*3). The specific downsampling scale of the downsampling module contained in the residual convolution module Resblock is related to the learning scale of the network B-layer to which the residual convolution module Resblock belongs. Specifically, the feature information input to the residual convolution module Resblock will undergo feature extraction by the convolution kernel and downsampling processing by the downsampling module respectively, and the feature information extracted and the feature information obtained by downsampling will be fused to obtain the feature information extracted by the residual convolution module Resblock.
[0142] In summary, by performing multi-scale feature extraction on the i-th sample image through the backbone network containing multiple downsampling scales described above, feature information (or feature maps) of different scales corresponding to the i-th sample image can be extracted to obtain rich information of the i-th sample image.
[0143] 2) The multi-scale feature module is mainly used to perform feature fusion (or feature enhancement) on feature information of multiple different scales output by the backbone network to generate corresponding feature maps at each scale; by fusing feature information of different scales, it is beneficial for the face detection network to better learn and adapt to the size changes of faces in sample images. For example, the scales of the rectangular boxes used to mark faces in different sample images may be different, and the scales of the rectangular boxes used to mark different faces in the same sample image may also be different. As shown in Figure 19, the multi-feature scale module contains multiple network layers F-layers, and the downsampling scale of each network layer F-layer is the same as that of a network layer B-layer included in the previous stage (i.e., the backbone network), and is used to receive the feature information output by the same network layer B-layer included in the previous stage to enhance the feature information; specifically, in order for the face detection network to adapt to the size changes of faces in sample images, in the embodiment of the present application, it supports the fusion of feature information of different scales output in the previous stage before using the corresponding network layer F-layer to generate corresponding feature information.
[0144] As shown in Figure 19, the network layers F-layer included in the multi-scale feature module in the embodiment of the present application are: F-layer2→F-layer3→F-layer4; as shown in Figure 19, each network layer F-layer is composed of multiple residual convolution modules Resblock in parallel and a transposed convolution module convTranspose in series; for the relevant content of the residual convolution module Resblock, please refer to the aforementioned related description, which will not be repeated here. The transposed convolution module convTranspose is also called deconvolution, which is an upsampling method. It is similar to the principle of convolution and has learnable parameters. The optimal upsampling method can be obtained through network learning to achieve upsampling processing of feature information. In a specific implementation, the specific implementation process of feature fusion based on the multiple network layers F-layer included in the multi-scale feature module may include: the network layer F-layer4 receives the feature information output by the network layer B-layer4 in the backbone network, and performs feature enhancement on the feature information to generate feature information of the corresponding scale, such as the scale of the generated feature map is n*h / 32*w / 32. Then, network layer F-layer3 receives the feature information output by network layer B-layer3 in the backbone network and the feature information output by network layer F-layer4. After fusing the two feature information, network layer F-layer3 generates feature information at the scale indicated by network layer F-layer3 based on the fused feature information. For example, the scale of the generated feature map is n*h / 16*w / 16. Similarly, network layer F-layer2 receives the feature information output by network layer B-layer2 in the backbone network and the feature information output by network layer F-layer3. After fusing the two feature information, network layer F-layer2 generates feature information at the scale indicated by network layer F-layer2 based on the fused feature information. For example, the scale of the generated feature map is n*h / 8*w / 8.
[0145] Among them, the parameter n in the scale of each feature map output by the above network represents the number of channels of the feature map; each channel of the feature map corresponds to specific information used to characterize the i-th sample image. The number of channels n of the feature map can be expressed as n=b*(4+1+c); wherein: b is the number of anchor boxes (i.e., the aforementioned rectangular boxes) at each position on the feature map; 4 represents the offset regression amount of the center horizontal coordinate, center vertical coordinate, length, and width of each anchor box; 1 represents the confidence (i.e., the degree of confidence, expressed in the form of probability) that a certain position on the feature map is the location of a human face (or the location of the target); c is the number of target categories, i.e., the number of object categories to be identified in the set sample image. In the embodiment of the present application, the object to be identified is a human face, so c can take the value of 1. It can be seen that the number of channels of the feature map can be expressed as n=b*(5+c).
[0146] Furthermore, the number of anchor frames b at each position on the feature map is determined as follows: specify the total number of anchor frames on all sizes as B (such as B = 9); then, use the height and width of the rectangular frame used to mark the face as features, and use k-means to cluster all rectangular frames into B categories; wherein, the k-means algorithm is a clustering algorithm based on Euclidean distance, which believes that the closer the distance between two targets, the greater the similarity. When k-means is applied to the embodiment of the present application, the height and width of the rectangular frame are specifically used as features to achieve clustering of all rectangular frames. For example, it is believed that rectangular frames with similar height and width have a greater similarity and can be divided into the same category. Further, the class center of this B category is taken as the height and width of the corresponding anchor frame to determine the B category anchor frame. Finally, the anchor boxes are sorted from smallest to largest by area (determined by height and width). When the feature map contains three scales, the anchor boxes in the first third of the sorted sequence are used on the feature map with the largest scale, the anchor boxes in the middle third of the sorted sequence are used on the feature map with the middle scale, and the anchor boxes in the last third of the sorted sequence are used on the feature map with the smallest scale. Based on the anchor boxes on each output feature map, the number of anchor boxes b at each position on the feature map is determined, and face prediction information corresponding to feature maps of different scales is also obtained. This face prediction information can be reflected by the various parameters involved in the channel number determination process and the anchor box determination process on the feature map mentioned above, such as the number of anchor boxes on the feature map, confidence level, and number of target categories.
[0147] In summary, based on the backbone network and multi-scale feature module described above, multi-scale feature extraction and feature enhancement of the i-th sample image can be achieved to obtain rich image information in the i-th sample image, thereby helping the face detection network to better realize face detection in the image and ensure the face detection performance of the face detection network.
[0148] s13: Based on feature maps of different scales, face prediction information corresponding to each feature map, and face annotation information corresponding to the i-th sample image, a face detection network is trained to obtain a trained face detection network.
[0149] Based on the above steps, after using the face detection network to perform multi-scale feature processing on the i-th sample image, feature maps of different scales and face prediction information corresponding to each feature map can be obtained; then, the face annotation information corresponding to the i-th sample image is used to perform loss calculations with the feature map at each scale and the corresponding face prediction information, respectively, to obtain the loss information corresponding to each scale; in this way, the loss information corresponding to each scale is added, and the result of the addition is used to train the face detection network. Among them, the loss function used to determine the loss information corresponding to any scale (each scale can be considered to correspond to a branch) is as follows:
[0150] As can be seen from formula (1), the loss function is composed of four sub-parts in sequence. Among them, the first and second sub-parts are: the prediction box obtained by using the face detection network to predict the i-th sample image, the offset regression loss relative to the center point and width and height of the anchor box. The third sub-part is the category loss, that is, the difference between the actual category face in the i-th sample image and the predicted category predicted by the face detection network for the i-th sample image. The fourth sub-part is the confidence loss of whether the target exists, which is determined by calculating the sum of the losses of each category on the output feature map. S n Indicates the width and height of the output feature map. b n is the number of anchor boxes at each position of the feature map mentioned above. It indicates whether the (i, j) position of the output feature map is on the target (i.e., the face); if the (i, j) position is on the target, the value is 1, otherwise it is 0. α, β, and γ represent the weights of the loss of each sub-part.
[0151] As shown in FIG19 , the exemplary scales provided in the embodiment of the present application are three, and the total loss information of the face detection model can be expressed as the sum of the loss information of the three scale branches; as shown below: Loss = Loss1 + Loss2 + Loss3 (2)
[0152] After the loss information of this round of network training is calculated based on formula (2), it is supported to use the loss information to optimize the model parameters of the face detection network to obtain the trained face detection network.
[0153] s14: Reselect the i+1th sample image from the face detection data set, and use the i+1th sample image to iteratively train the trained face detection network until the face detection model becomes stable.
[0154] It is understandable that after selecting the i-th sample image from the face detection data set and performing network training on the face detection network to obtain the trained face detection network, it is also supported to continue using the i+1-th sample image in the face detection data set to continue training the trained face detection network until all sample images in the face detection data set are used for network training, or the trained face detection network achieves better face prediction performance. The specific implementation process of using the i+1-th sample image to train the face detection network is the same as the specific implementation process of using the i-th sample image to train the face detection network; for details, please refer to the relevant description of the specific implementation process shown in the aforementioned steps s11-s13, which will not be repeated here.
[0155] S1604: Obtain a trained face conversion network, and call the face conversion network to perform face conversion on the face image to obtain a converted face image; the target face part in the converted face image is occluded by the target occlusion object.
[0156] S1605: The face region in the target image is replaced with the converted face image to obtain a new target image.
[0157] In steps S1604-S1605, after performing face detection on the target image based on the face detection network trained in the aforementioned steps, the area where the face is located in the target image can be determined; and the area where the face is located can be cropped to obtain a face image containing the face; then, the trained face conversion network can be used to perform face conversion on the face image, so that the face in the face image that is not blocked by the target occluding object (such as a mask) is converted into a face that blocks the target face part by the target occluding object, thereby achieving face desensitization; finally, the face image after desensitization replaces the face area detected in the target image to obtain a new target image, which is the image after face desensitization. After obtaining the new target image, the new target image can be displayed in the image editing interface.
[0158] In an embodiment of the present application, the face conversion network is implemented using a generative adversarial network (GAN). The GAN network is a deep learning model in artificial intelligence (AI) technology; the GAN network may include at least two networks (or modules): a generator network (Generative Model) and a discriminator network (Discriminative Model), and a better output result is generated through the mutual game learning between the at least two modules. Taking the input data type of the GAN network as an image and the GAN network having the function of generating an image containing a target as an example, the generator network and the discriminator network contained in the GAN network are briefly introduced; wherein, the so-called generator network is used to process one or more frames of input images containing the target to generate a new frame of image containing the target, and the new image is not contained in the one or more frames of input images; the so-called discriminator network is used to judge the input frame image to determine whether the object contained in the image is the target. During the training process of the GAN network, the images generated by the generator network can be given to the discriminator module for judgment, and the parameters of the GAN network can be continuously corrected according to the judgment results until the generator network in the trained GAN network can generate new images more accurately and the discriminator network can judge the images more accurately.
[0159] It can be seen that the face conversion network provided by the embodiment of the present application may include a generator network and a discriminator network; further, considering that the embodiment of the present application involves two image domains, namely an image domain that does not contain the target occluded object, and an image domain that contains the target occluded object. Therefore, the generator network included in the face conversion network may include: a first image domain generator corresponding to the first image domain, and a second image domain generator corresponding to the second image domain; similarly, the discriminator network included in the face conversion network may include: a first image domain discriminator corresponding to the first image domain generator, and a second image domain discriminator corresponding to the second image domain generator. For the sake of convenience, taking the target occluded object as a mask as an example, the embodiment of the present application will record the image domain without a mask as A, that is, the first image domain, and the image domain with a mask as B, that is, the second image domain; G A As the first image domain generator from domain B to domain A, G B As the second image domain generator from domain A to domain B, D A As the first image domain discriminator for judging the authenticity of images in domain A, D b As the second image domain discriminator to judge the authenticity of images in domain B.
[0160] In a specific implementation, after the computer device calls the trained face detection network to crop a face image containing a face from the target image, it can call the trained face conversion network (specifically, calling the trained second image domain generator) to convert the face image to put a mask on the face image, thereby desensitizing the face. The following introduces the network training process of the face conversion network. The training process of the face conversion network can generally include the construction of a face conversion data set, and the two steps of designing and training the face conversion network. These two steps can be further subdivided into but not limited to steps s21-s24; wherein:
[0161] s21: Get the face conversion data set.
[0162] Among them, the face conversion data set includes multiple first sample face images belonging to the first image domain and multiple second sample face images belonging to the second image domain; the target face part in the first sample face image is not blocked, and the target face part in the second sample face image is blocked. Specifically, the specific implementation method of obtaining the face conversion data set may include: cropping the faces marked in the aforementioned face detection data set to add the cropped face images containing faces to the face image set; further, in order to enrich the face conversion data set, the embodiment of the present application also supports collecting more images (such as vehicle-mounted images), and then using the aforementioned trained face detection network to detect the faces in the images and crop them, and adding the cropped face images to the face image set to obtain a new face image set. Then, the face image set obtained by the above operation is processed, and the processing here may include but is not limited to: removing blurred or incomplete faces, and removing false detection results that are not faces. Finally, the remaining face image set is divided into a first image domain of faces without masks and a second image domain of faces with masks.
[0163] A schematic diagram of an exemplary first image domain containing multiple first sample facial images of people without masks and a second image domain containing multiple second sample facial images of people wearing masks can be seen in Figure 20; Figure 20a shown in Figure 20 is a plurality of first sample facial images of people without masks, and Figure 20b shown in Figure 20 is a plurality of second sample facial images of people wearing masks.
[0164] s22: Using the first image domain generator, perform image generation processing on the second sample face image to obtain a first reference face image; and using the second image domain generator, perform image generation processing on the first sample face image to obtain a second reference face image.
[0165] Among them, an exemplary schematic diagram of the network structure of the generator network (such as the first image domain generator and the second image domain generator) can be seen in Figure 21; as shown in Figure 21, the generator network consists of an encoder, a residual convolution module, a context information extraction module, and a decoder. Among them, the encoder plays a downsampling role and can be called a downsampling module, while the decoder plays an upsampling role and can be called an upsampling module. To avoid detail information, when the encoder is used to downsample the input sample face image, the height and width of the feature map are only downsampled to 1 / 4 of the original; considering that the downsampling multiple is small, it is easy to cause insufficient extraction of the upper and lower part information in the sample face image. Therefore, the generator network uses a dilated convolution pyramid composed of different dilation rates in the middle to increase the generator network's receptive field of the sample face image, thereby extracting richer image information from the sample face image. Finally, a lighter decoder is used to restore the features to the resolution of the input sample face image to generate a new reference image belonging to the image domain to which the generator network belongs.
[0166] Based on the above introduction to the generator network, it can be known that the embodiment of the present application supports inputting an RGB image (i.e., a sample face image composed of red (Red, R), green (Green, G) and blue (Blue, B); the sample face image is different for different image domain generators) into the generator network. The generator network performs image generation processing on the input sample face image to generate a three-channel feature map with the same resolution as the input resolution. Specifically, if the generator network is a first image domain generator, then the sample face image input to the generator network is a second sample face image wearing a mask. At this time, the first image domain generator is used to perform image generation processing on the second sample face image to generate a first reference face image corresponding to the second sample face image. The difference between the first reference face image and the second sample face image is that the target face part in the first reference face image is not blocked. Similarly, if the generator network is a second image domain generator, then the sample face image input to the generator network is the first sample face image without a mask. At this time, the second image domain generator is used to perform image generation processing on the first sample face image to generate a second reference face image corresponding to the first sample face image. The difference between the second reference face image and the first sample face image is that the target face part in the second reference face image is blocked. It can be seen that whether it is the first image domain generator or the second image domain generator, it is intended to generate a reference face image belonging to the current image domain from a sample face image that does not belong to the current image domain, so as to generate a new image. When applied to the field of face desensitization, the target image without a mask can be generated into a target image with a mask based on the second image domain generator wearing a mask, thereby achieving desensitization of the face in the target image and protecting the privacy of the face.
[0167] s23: Perform image discrimination processing on the first reference face image using the first image domain discriminator, and perform image discrimination processing on the second reference face image using the second image domain discriminator to obtain adversarial generation loss information of the face conversion network.
[0168] Among them, an exemplary schematic diagram of the network structure of the discriminator network (such as the first image domain discriminator and the second image domain discriminator) can be seen in Figure 22; as shown in Figure 22, the discriminator network is composed of multiple convolution modules connected in series, where the convolution kernel of the first convolution module can be 7×7, and the convolution kernels of subsequent convolution modules can be 3×3. In a specific implementation, the input of the discriminator network includes: a fake image output by the corresponding generator network (such as a first reference face image generated by a first image domain generator based on a second sample face image. The first reference face image does not really exist and can therefore be called a fake image), and a true image in the image domain to which the discriminator network belongs (such as a first image domain discriminator, then the true image can refer to any first sample face image belonging to the first image domain. The discriminator network performs multiple convolution operations on the input fake image and the true image, and can output a feature map with a height and width that is 1 / 16 of the scale of the downsampled input image (such as the true image and the fake image), and the number of channels of the feature map is 1; thereby, the degree to which the false image input to the discriminator network is correct (such as expressed in probability) is judged based on the feature map.
[0169] Furthermore, based on the implementation of the generator network and the discriminator network given above, the adversarial generation loss information L from the first image domain (i.e., domain A) to the second image domain (i.e., domain B) can be determined. GAN (G B , D B , A, B), and the adversarial generation loss information L from the second image domain (i.e., B domain) to the first image domain (i.e., A domain) GAN (G A , D A , A, B). Among them, the adversarial generation loss information L GAN (G B , D B , A, B) can be expressed as:
[0170] Similarly, adversarial generation loss information L GAN (G A , D A , A, B) can be expressed as:
[0171] Among them, A represents the image domain without mask, that is, the first image domain; B represents the image domain with mask, that is, the second image domain; G Arepresents the first image domain generator from the second image domain to the first image domain; G B A second image domain generator representing the first image domain to the second image domain; D A Denotes the first image domain discriminator for judging the authenticity of an image in the first image domain, D b Represents a second image domain discriminator that judges the authenticity of an image in the second image domain.
[0172] B real A represents the second sample face image belonging to the second image domain that is input to the first image domain generator, real represents the first sample face image belonging to the first image domain that is input into the second image domain generator; B real ~P data (B real ) represents the probability distribution of multiple second sample face images belonging to the second image domain; A real ~P data (A real ) represents the probability distribution of multiple first sample face images belonging to the first image domain. E can represent the mathematical expectation.
[0173] s24: Train the face conversion network based on the adversarial generation loss information, the first reference face image, and the second reference face image.
[0174] Considering that the generator network can only generate fake images with the same style, the embodiment of the present application hopes that the semantics of the translated image remains unchanged; for example, after the conversion, the part that was originally an ear is still an ear, and the part that was originally a forehead is still a forehead. Therefore, when using the second image domain generator to generate a fake image, such as represented by B fake (i.e. the second reference face image mentioned above), i.e. B fake is the true image A belonging to the first domain real The generated B domain fake image, then B fake Then the image A in domain A is reconstructed by the first image domain generator rec , ensuring that the desensitized face retains its appearance and attributes with the original face. This makes the desensitized face appear more natural, thus achieving seamless face desensitization. Furthermore, we hope that the reconstructed image is identical to the original image, so we can calculate the similarity between the original and reconstructed images to measure the reconstruction loss of the face conversion network.
[0175] Based on the above introduction to the principle of image reconstruction, the specific implementation process of training the face conversion network based on the adversarial generation loss information, the first reference face image and the second reference face image can include: ① Using the second image domain generator, the first reference face image is reconstructed to obtain a second reconstructed face image, and the target face part in the second reconstructed face image is occluded by the occluding object; and using the first image domain generator, the second reference face image is reconstructed to obtain a first reconstructed face image, and the target face part in the first reconstructed face image is not occluded. ② Based on the similarity between the first reconstructed face image and the corresponding first sample face image, and the similarity between the second reconstructed face image and the corresponding second sample face image, the reconstruction loss information of the face conversion network is obtained. Among them, the similarity between the two images (such as the first reconstructed face image and the corresponding first sample face image, or the second reconstructed face image and the corresponding second sample face image) can be calculated using the L1 (L1 regularization or lasso) norm. The L1 norm is actually the process of finding the optimal solution. Then the reconstruction loss of domain A can be expressed as:
[0176] Similarly, the reconstruction loss of domain B can be expressed as:
[0177] ③ Based on the reconstruction loss information and adversarial generation loss information, the face conversion network is trained.
[0178] In summary, by setting weights for the reconstruction loss information and adversarial generation loss information of the face conversion network, the total loss information of the face conversion network can be obtained as follows:
[0179] For ease of understanding, the flowchart shown in Figure 23 is used to represent the specific generation process of each sub-loss information contained in the total loss information of the face conversion network; the process shown in Figure 23 is similar to the above description and will not be repeated here.
[0180] After obtaining the total loss information of the face conversion network, the model parameters of the face conversion network can be optimized based on the total loss information to obtain the optimized face conversion network. It is worth noting that in the process of optimizing the model parameters of the face conversion network based on the total loss information, the embodiment of the present application supports training the face conversion network (or called a generative adversarial network) based on the maximum and minimum zero-sum game; specifically, based on the value function G * =argmin G max DLoss is used to train the face conversion network. The training process of the face conversion network based on the value function may include: first fixing the weights of the discriminator network in formula (7), and then updating the weights of the generator network in the direction of minimizing the total loss information. Then fixing the weights of the generator network in formula (7), and then updating the weights of the discriminator network in the direction of maximizing the total loss information. Finally, the above two steps are performed alternately to achieve model training of the face conversion network.
[0181] It's also worth noting that, similar to the training process for the face detection network described above, after the current round of face conversion network training is completed, it is supported to select new sample face images from the face conversion dataset to continue iteratively training the previously trained face conversion network until a face conversion network with stable performance is obtained. The specific implementation process of continuing to train the previously trained face conversion network with new sample face images can be found in the description of the specific implementation process of training the face conversion network with sample face images described above and will not be repeated here.
[0182] In summary, the embodiments of the present application support the use of a target occluding object to occlude a target facial part in a face. The target occluding object can adapt to the facial posture and flexibly occlude the target facial part in the face; this allows the occluded face to still retain the facial appearance attributes of the original face. For example, if the posture of the original face is head-up, the shape of the target occluding object can change to adapt to the facial posture, so that the target occluding object after the shape change can be well matched with the facial posture, thereby removing sensitive information in the face (such as facial features and other information that can identify the face) while ensuring that the face basically does not form any modification traces, maintaining the harmony, beauty and naturalness of the occluded face, and providing users with a non-perceptible face desensitization effect.
[0183] The above describes in detail the method of the embodiment of the present application. In order to facilitate better implementation of the above method of the embodiment of the present application, the device of the embodiment of the present application is provided below accordingly.
[0184] FIG24 shows a schematic diagram of the structure of an image processing apparatus provided by an exemplary embodiment of the present application. The image processing apparatus may be a computer-readable instruction (including program code) running on a computing device. The image processing apparatus may be used to execute some or all of the steps in the method embodiments shown in FIG5 and FIG16 . The apparatus includes the following units:
[0185] The interface display unit 2401 is used to display an image editing interface; a target image is displayed in the image editing interface, wherein the target image includes a face, the face has facial parts, the facial parts include target facial parts to be blocked, and the face has facial appearance attributes.
[0186] The occluding object display unit 2402 is configured to display a target occluding object that occludes the target facial part at the target facial part, wherein the face that occludes the target facial part retains the facial appearance attributes.
[0187] In one implementation, the blocking object display unit 2402 is further configured to display, at at least one of the target facial parts, a target blocking object that blocks the at least one target facial part.
[0188] In one implementation, facial appearance attributes include: head orientation, gaze, expression, clothing, and gender.
[0189] In one implementation, the occluding object display unit 2402 is further configured to: in response to an occlusion trigger operation on the face, trigger the display of a target occluding object that occludes the target face part at the target face part.
[0190] Among them, the occlusion trigger operation includes: a trigger operation for the part removal option in the image editing interface, a gesture operation performed in the image editing interface, a voice signal input operation in the image editing interface, or at least one of the operations in which the application silently detects that the target image contains a face.
[0191] In one implementation, the occlusion object display unit 2402 is also used to output occlusion prompt information in response to an occlusion trigger operation on the face, wherein the occlusion prompt information is used to indicate that a target facial part in the face is occluded; and in response to a confirmation operation on the occlusion prompt information, a target occlusion object that occludes the target facial part is displayed at the target facial part.
[0192] In one implementation, the occlusion prompt information is displayed in a prompt window, which also includes a target facial part identifier and a part refresh component of the target facial part. The occlusion object display unit 2402 is also used to display the candidate facial part identifier of the candidate facial part in the face in the prompt window when the part refresh component is triggered, and the candidate facial part is different from the target facial part; in response to a confirmation operation on the candidate facial part identifier, a target occlusion object that occludes the candidate facial part is displayed at the candidate facial part, wherein the face whose candidate facial part is occluded retains the facial appearance attributes.
[0193] In one implementation, the occluding object display unit 2402 is also used to display an object selection interface, which includes one or more candidate occluding objects corresponding to the target facial part, and different candidate occluding objects have different object styles; in response to the object selection operation, the candidate occluding object selected from the one or more candidate occluding objects is determined as the target occluding object.
[0194] In one implementation, the device is applied to a vehicle-mounted scene, and the obstructed object display unit 2402 is also used to display face retention prompt information, wherein the face retention prompt information is used to indicate whether to back up the face of the target facial part that is not obstructed; in response to a confirmation operation on the face retention prompt information, retention notification information is displayed, wherein the retention notification information includes the retention address information of the face of the target facial part that is not obstructed.
[0195] In one implementation, the occlusion object display unit 2402 is used to obtain a trained face detection network, and call the face detection network to perform face recognition on the target image to obtain a face area in the target image containing a face; perform regional cropping on the target image to obtain a face image corresponding to the target image, and the face image contains the face in the target image; obtain a trained face conversion network, and call the face conversion network to perform face conversion on the face image to obtain a converted face image, and the target face part in the converted face image is occluded by the target occlusion object; use the converted face image to replace the face area in the target image to obtain a new target image, and display the new target image in the image editing interface.
[0196] In one implementation, the device also includes a training module for obtaining a face detection data set, wherein the face detection data set includes at least one sample image and face annotation information corresponding to each sample image, and the face annotation information is used to mark the area where the face in the corresponding sample image is located; selecting the i-th sample image from the face detection data set, and using the face detection network to perform multi-scale feature processing on the i-th sample image to obtain feature maps of different scales and face prediction information corresponding to each feature map, the face prediction information is used to indicate the area where the face predicted in the corresponding feature map is located, and i is a positive integer; based on the feature maps of different scales, the face prediction information corresponding to each feature map and the face annotation information corresponding to the i-th sample image, the face detection network is trained to obtain a trained face detection network; re-selecting the i+1-th sample image from the face detection data set, and using the i+1-th sample image to iteratively train the trained face detection network
[0197] In one implementation, the face conversion network includes a first image domain generator, a first image domain discriminator, a second image domain generator, and a second image domain discriminator. The training module is also used to obtain a face conversion data set, which includes multiple first sample face images belonging to a first image domain and multiple second sample face images belonging to a second image domain; the target face part in the first sample face image is not blocked, and the target face part in the second sample face image is blocked; using the first image domain generator, the second sample face image is processed by image generation to obtain a first reference face image, and the target face part in the first reference face image is not blocked; and using the second image domain generator, the first sample face image is processed by image generation to obtain a second reference face image, and the target face part in the second reference face image is blocked by an occluding object; using the first image domain discriminator, the first reference face image is processed by image discrimination, and using the second image domain discriminator, the second reference face image is processed by image discrimination to obtain adversarial generation loss information of the face conversion network; based on the adversarial generation loss information, the first reference face image and the second reference face image, the face conversion network is trained.
[0198] In one implementation, the training module is further used to use the second image domain generator to perform image reconstruction processing on the first reference face image to obtain a second reconstructed face image, and the target face part in the second reconstructed face image is occluded by the occluding object; use the first image domain generator to perform image reconstruction processing on the second reference face image to obtain a first reconstructed face image, and the target face part in the first reconstructed face image is not occluded; based on the similarity between the first reconstructed face image and the corresponding first sample face image, and the similarity between the second reconstructed face image and the corresponding second sample face image, obtain the reconstruction loss information of the face conversion network; and train the face conversion network based on the reconstruction loss information and the adversarial generation loss information.
[0199] According to one embodiment of the present application, the various units in the image processing device shown in Figure 24 can be individually or completely merged into one or several other units to form, or one (or some) of the units can be further divided into multiple smaller units in function to form, which can achieve the same operation without affecting the realization of the technical effects of the embodiments of the present application. The above-mentioned units are divided based on logical functions. In practical applications, the function of one unit can also be implemented by multiple units, or the functions of multiple units can be implemented by one unit. In other embodiments of the present application, the image processing device can also include other units. In practical applications, these functions can also be implemented with the assistance of other units and can be implemented by the collaboration of multiple units. According to another embodiment of the present application, the image processing device shown in Figure 24 can be constructed, and the image processing method of the embodiment of the present application can be implemented by running computer-readable instructions (including program codes) that can execute the steps involved in the corresponding methods shown in Figures 5 and 16 on a general computing device such as a computer including processing elements and storage elements such as a central processing unit (CPU), an access storage medium (RAM), and a read-only storage medium (ROM). The computer-readable instructions may be recorded on a computer-readable recording medium, for example, and loaded into the computing device through the computer-readable recording medium to be executed therein.
[0200] In an embodiment of the present application, a face is displayed in an image editing interface; when a user (such as any user) has a face desensitization requirement, it supports the use of a target occlusion object to automatically block the target face parts (such as the nose and mouth parts) in the face to achieve desensitization of the face. In the above scheme, when the target occlusion object is used to block the target face parts in the face, the target occlusion object can adapt to the face posture and flexibly block the target face parts in the face; this allows the face after blocking to still retain the facial appearance attributes of the original face. For example, if the original face posture is head-up, the shape of the target occlusion object can adapt to the face posture to change, so that the target occlusion object after the shape change can be well matched with the face posture, thereby removing sensitive information in the face (such as facial features that can identify the face) while ensuring that the face basically does not form any modification traces, maintaining the harmonious beauty and naturalness of the face after blocking, and providing the user with a senseless face desensitization effect.
[0201] Figure 25 shows a schematic diagram of the structure of a computer device provided by an exemplary embodiment of the present application. Referring to Figure 25, the computer device includes a processor 2501, a communication interface 2502 and a computer-readable storage medium 2503. The processor 2501, the communication interface 2502 and the computer-readable storage medium 2503 can be connected via a bus or other means. The communication interface 2502 is used to receive and send data. The computer-readable storage medium 2503 can be stored in the memory of the computer device, and the computer-readable storage medium 2503 is used to store computer-readable instructions. The computer-readable instructions include program instructions, and the processor 2501 is used to execute the program instructions stored in the computer-readable storage medium 2503. The processor 2501 (or CPU (Central Processing Unit)) is the computing core and control core of the computer device, which is suitable for implementing one or more instructions, and is specifically suitable for loading and executing one or more instructions to implement the corresponding method flow or corresponding function.
[0202] The embodiment of the present application also provides a computer-readable storage medium (Memory), which is a memory device in a computer device for storing programs and data. It is understandable that the computer-readable storage medium here can include both built-in storage media in the computer device and, of course, extended storage media supported by the computer device. The computer-readable storage medium provides a storage space that stores the processing system of the computer device. In addition, one or more instructions suitable for being loaded and executed by the processor 2501 are also stored in the storage space. These instructions can be one or more computer-readable instructions (including program codes). It should be noted that the computer-readable storage medium here can be a high-speed RAM memory, or a non-volatile memory (non-volatile memory), such as at least one disk memory; optionally, it can also be at least one computer-readable storage medium located away from the aforementioned processor.
[0203] In one embodiment, one or more instructions are stored in the computer-readable storage medium; the processor 2501 loads and executes the one or more instructions stored in the computer-readable storage medium to implement the corresponding steps in the above-mentioned image processing method embodiment; in a specific implementation, the one or more instructions in the computer-readable storage medium are loaded by the processor 2501 and execute the image processing method of any of the above embodiments.
[0204] In one embodiment, the computer device includes a memory and a processor, the memory stores computer-readable instructions, and the computer-readable instructions are executed by the processor 2501 to implement the image processing method of any of the above embodiments.
[0205] Based on the same inventive concept, the principles and beneficial effects of solving the problems provided by the computer device in the embodiment of the present application are similar to the principles and beneficial effects of solving the problems provided by the image processing method in the method embodiment of the present application. Please refer to the principles and beneficial effects of the implementation of the method. For the sake of concise description, they will not be repeated here.
[0206] The present application also provides a computer program product including computer-readable instructions stored in a computer-readable storage medium. A computer processor reads the computer-readable instructions from the computer-readable storage medium and executes the computer-readable instructions to implement the image processing method of any of the above embodiments.
[0207] Those skilled in the art will appreciate that the units and algorithmic steps of each example described in conjunction with the embodiments disclosed in this application can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional technical personnel may use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0208] In the above embodiments, all or part of the embodiments can be implemented by software, hardware, firmware, or any combination thereof. When implemented using software, all or part of the embodiments can be implemented in the form of a computer program product. The computer program product includes one or more computer-readable instructions. When the computer-readable instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of the present invention are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer-readable instructions can be stored in a computer-readable storage medium or transmitted via a computer-readable storage medium. The computer-readable instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via a wired (e.g., coaxial cable, optical fiber, digital line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) method. The computer-readable storage medium can be any available medium that can be accessed by a computer or a data processing device such as a server or data center that includes one or more available media. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state drive (SSD)).
[0209] The above description is merely a specific embodiment of the present application, but the scope of protection of the present application is not limited thereto. Any technical object that can be easily conceived by a person familiar with the technical field within the technical scope disclosed in this invention should be included in the scope of protection of the present application. Therefore, the scope of protection of the present application should be based on the scope of protection of the claims.
[0210] The technical features of the above embodiments can be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0211] The above-described embodiments merely represent several implementation methods of the present application. While the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the present invention. It should be noted that a person skilled in the art could make various modifications and improvements without departing from the spirit of the present application, all of which fall within the scope of protection of the present application. Therefore, the scope of protection of the present patent application shall be determined by the appended claims.
Claims
1. An image processing method, executed by a computer device, comprising: Display the image editing interface; Displaying a target image in the image editing interface, the target image includes a face, the face has face parts, the face parts include a target face part to be blocked, and the face has face appearance attributes; and At the target facial part, a target obstructing object that obstructs the target facial part is displayed, wherein the face obstructed by the target facial part retains the facial appearance attributes.
2. The method according to claim 1, wherein displaying the target blocking object blocking the target face part at the target face part comprises: At at least one of the target facial parts, a target blocking object is displayed to block the at least one target facial part.
3. The method according to claim 1 or 2, wherein the facial appearance attributes include: At least one of head orientation, gaze, expression, clothing, or gender.
4. The method according to any one of claims 1 to 3, wherein the step of displaying, at the target face part, a target blocking object blocking the target face part is triggered in response to a blocking trigger operation for the face; in, The occlusion trigger operation includes: a trigger operation for a part removal option in the image editing interface, a gesture operation performed in the image editing interface, a voice signal input operation in the image editing interface, or at least one of an operation in which an application silently detects that a human face is contained in a target image.
5. The method according to any one of claims 1 to 3, further comprising: In response to an occlusion trigger operation on the human face, outputting occlusion prompt information, wherein the occlusion prompt information is used to indicate that a target facial part in the human face is occluded; In response to a confirmation operation on the occlusion prompt information, the step of displaying a target occluding object that occludes the target face part at the target face part is triggered.
6. The method according to claim 5, wherein the occlusion prompt information is displayed in a prompt window, the prompt window further comprises a target face part identifier and a part refresh component of the target face part, and the method further comprises: When the part refresh component is triggered, in the prompt window, a candidate face part identifier of a candidate face part in the face is displayed, and the candidate face part is different from the target face part; In response to a confirmation operation on the candidate facial part identifier, a target obstructing object that obstructs the candidate facial part is displayed at the candidate facial part, wherein the face obstructed by the candidate facial part retains the facial appearance attributes.
7. The method according to any one of claims 1 to 6, further comprising: Displaying an object selection interface, wherein the object selection interface includes one or more candidate occlusion objects corresponding to the target face part, and different candidate occlusion objects have different object styles; In response to the object selection operation, a candidate occluding object selected from the one or more candidate occluding objects is determined as a target occluding object.
8. The method according to any one of claims 1 to 7, when the method is applied to a vehicle-mounted scenario, the method further comprises: Displaying face retention prompt information, wherein the face retention prompt information is used to indicate whether to back up faces that do not cover the target face part; In response to a confirmation operation on the face retention prompt information, retention notification information is displayed, wherein the retention notification information includes retention address information of the face that does not block the target face part.
9. The method according to any one of claims 1 to 8, wherein displaying a target blocking object blocking the target face part at the target face part comprises: Obtaining a trained face detection network, and calling the face detection network to perform face recognition on the target image, to obtain a face region containing a face in the target image; Performing regional cropping on the target image to obtain a face image corresponding to the target image, wherein the face image contains the face in the target image; Obtaining a trained face conversion network, and calling the face conversion network to perform face conversion on the face image to obtain a converted face image, wherein a target face part in the converted face image is occluded by a target occlusion object; The converted face image is used to replace the face area in the target image to obtain a new target image, and the new target image is displayed in the image editing interface.
10. The method according to claim 9, wherein the training process of the face detection network comprises: Acquire a face detection data set, wherein the face detection data set includes at least one sample image and face annotation information corresponding to each sample image, wherein the face annotation information is used to annotate a region where a face is located in the corresponding sample image; Selecting an i-th sample image from the face detection data set, and performing multi-scale feature processing on the i-th sample image using the face detection network to obtain feature maps of different scales and face prediction information corresponding to each feature map, wherein the face prediction information is used to indicate the area where the predicted face is located in the corresponding feature map, and i is a positive integer; Based on feature maps of different scales, face prediction information corresponding to each feature map and face annotation information corresponding to the i-th sample image, the face detection network is trained to obtain a trained face detection network; Reselecting the i+1th sample image from the face detection data set, and using the i+1th sample image to iteratively train the trained face detection network.
11. The method according to claim 9 or 10, wherein the face conversion network comprises a first image domain generator, a first image domain discriminator, a second image domain generator and a second image domain discriminator; The training process of the face conversion network includes: Acquire a face conversion data set, wherein the face conversion data set includes a plurality of first sample face images belonging to a first image domain and a plurality of second sample face images belonging to a second image domain, wherein target face parts in the first sample face images are not blocked, and target face parts in the second sample face images are blocked; Using the first image domain generator, performing image generation processing on the second sample face image to obtain a first reference face image, wherein the target face part in the first reference face image is not blocked, and using the second image domain generator, performing image generation processing on the first sample face image to obtain a second reference face image, wherein the target face part in the second reference face image is blocked by the blocking object; Using the first image domain discriminator, performing image discriminant processing on the first reference face image, and using the second image domain discriminator, performing image discriminant processing on the second reference face image, to obtain adversarial generation loss information of the face conversion network; Based on the adversarial generation loss information, the first reference face image and the second reference face image, the face conversion network is trained.
12. The method of claim 11, wherein the step of training the face conversion network based on the adversarial generation loss information, the first reference face image, and the second reference face image comprises: Using the second image domain generator, performing image reconstruction processing on the first reference face image to obtain a second reconstructed face image, wherein a target face part in the second reconstructed face image is blocked by an occluding object; Using the first image domain generator, performing image reconstruction processing on the second reference facial image to obtain a first reconstructed facial image, wherein a target facial part in the first reconstructed facial image is not blocked; Based on the similarity between the first reconstructed face image and the corresponding first sample face image, and the similarity between the second reconstructed face image and the corresponding second sample face image, obtaining reconstruction loss information of the face conversion network; The face conversion network is trained based on the reconstruction loss information and the adversarial generation loss information.
13. An image processing device, comprising: An interface display unit, used for displaying an image editing interface; Displaying a target image in the image editing interface, the target image includes a human face, the human face has facial parts, the facial parts include a target facial part to be blocked, and the human face has facial appearance attributes; and The occluding object display unit is used to display the target occluding object that occludes the target face part at the target face part, wherein the face that is occluded by the target face part retains the face appearance attributes.
14. A computer device comprising a memory and a processor, wherein the memory stores computer-readable instructions, and the computer-readable instructions are executed by the processor to implement the method according to any one of claims 1 to 12.
15. A computer-readable storage medium storing computer-readable instructions, wherein when the computer-readable instructions are executed by a processor, the method according to any one of claims 1 to 12 is implemented.
16. A computer program product, comprising computer-readable instructions, wherein the computer-readable instructions, when executed by a processor, implement the method according to any one of claims 1 to 12.
