Image filling method and device, electronic device and medium
The image filling method addresses the issue of user intention misunderstanding by using mask images and neural networks to generate accurate and user-intention-driven image filling results.
Patent Information
- Application Number
- CN202110247367.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-03-05
- Publication Date
- 2024-12-06
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
Current image filling technologies lack the ability to understand the user's filling intention, resulting in inaccurate filling results that do not meet user expectations.
An image filling method that involves obtaining an image to be filled, first and second mask images, extracting background and clue features, calculating similarity scores, and inputting these into a trained neural network to generate a filled image based on user clues.
Accurately understands the user's filling intention and produces a filling effect that meets their expectations, achieving a natural and realistic outcome.
Smart Images

Figure CN112967356B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of artificial intelligence, in particular to the fields of computer vision and deep learning technology, and specifically to an image filling method, device, electronic device, computer-readable storage medium and computer program product. Background Art
[0002] Artificial intelligence is a discipline that studies how to use computers to simulate certain human thought processes and intelligent behaviors (such as learning, reasoning, thinking, planning, etc.). It includes both hardware-level and software-level technologies. Artificial intelligence hardware technologies generally include technologies such as sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, and big data processing. Artificial intelligence software technologies mainly include computer vision technology, speech recognition technology, natural language processing technology, as well as machine learning / deep learning, big data processing technology, knowledge graph technology, and other major directions.
[0003] Image filling technology has a wide range of application scenarios, such as image editing, image restoration, and removing specific objects from images. Currently, image filling technology is data-driven and fills in missing areas based on the empirical distribution of data in the training set, without manual intervention and unable to understand the user's filling intention. Summary of the invention
[0004] The present disclosure provides an image filling method, an apparatus, an electronic device, a computer-readable storage medium, and a computer program product.
[0005] According to one aspect of the present disclosure, there is provided an image filling method, comprising: obtaining an image to be filled, a first mask image and a second mask image corresponding to the image to be filled, the image to be filled comprising a region to be filled and a background region outside the region to be filled, the first mask image being used to indicate a relative positional relationship between the region to be filled and the background region, and the second mask image being used to indicate a relative positional relationship between a user clue region and a region outside the user clue region; extracting background features corresponding to the background region based on the image to be filled and the first mask image; extracting clue features corresponding to the user clue region based on the image to be filled and the second mask image; calculating a similarity score between the background features and the clue features; and inputting the image to be filled, the first mask image and the similarity score into a trained first neural network to obtain a filled image.
[0006] According to another aspect of the present disclosure, there is provided an image filling device, comprising: an image acquisition module, configured to acquire an image to be filled, a first mask image and a second mask image corresponding to the image to be filled, the image to be filled comprising a region to be filled and a background region outside the region to be filled, the first mask image being used to indicate a relative positional relationship between the region to be filled and the background region, and the second mask image being used to indicate a relative positional relationship between a user clue region and a region outside the user clue region; a background feature extraction module, configured to extract background features corresponding to the background region based on the image to be filled and the first mask image; a clue feature extraction module, configured to extract clue features corresponding to the user clue region based on the image to be filled and the second mask image; a similarity calculation module, configured to calculate a similarity score between the background features and the clue features; and an image filling module, configured to input the image to be filled, the first mask image and the similarity score into a trained first neural network to obtain a filled image.
[0007] According to another aspect of the present disclosure, an electronic device is provided, comprising: at least one processor; and a memory communicatively connected to the at least one processor; the memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor so that the at least one processor can execute the image filling method of the present disclosure.
[0008] According to another aspect of the present disclosure, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to enable a computer to execute the image filling method of the present disclosure.
[0009] According to another aspect of the present disclosure, a computer program product is provided, including a computer program, which implements the image filling method of the present disclosure when executed by a processor.
[0010] According to one or more embodiments of the present disclosure, it is possible to accurately understand the user's filling intention, perform image filling based on user clues, and achieve a filling effect that meets the user's expectations.
[0011] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it intended to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0012] The accompanying drawings exemplarily illustrate the embodiments and constitute a part of the specification, and together with the text description of the specification, are used to explain the exemplary implementation of the embodiments. The embodiments shown are for illustrative purposes only and do not limit the scope of the claims. In all drawings, the same reference numerals refer to similar but not necessarily identical elements.
[0013] Figure 1 A schematic diagram showing an exemplary system in which the various methods described herein may be implemented according to an embodiment of the present disclosure;
[0014] Figure 2 A flowchart of an image filling method according to an embodiment of the present disclosure is shown;
[0015] Figure 3 A schematic diagram of an image including an object to be removed and a user clue according to an embodiment of the present disclosure is shown;
[0016] Figure 4 The embodiment according to the present disclosure is shown Figure 3 Schematic diagram of the area corresponding to the middle recliner after filling;
[0017] Figure 5 A schematic diagram of image filling according to the method disclosed in the present invention is shown;
[0018] Figure 6 A structural block diagram of an image filling device according to an embodiment of the present disclosure is shown; and
[0019] Figure 7 A structural block diagram of an exemplary electronic device that can be used to implement the embodiments of the present disclosure is shown. DETAILED DESCRIPTION
[0020] The following is a description of exemplary embodiments of the present disclosure in conjunction with the accompanying drawings, including various details of the embodiments of the present disclosure to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope of the present disclosure. Similarly, for the sake of clarity and conciseness, the description of well-known functions and structures is omitted in the following description.
[0021] In the present disclosure, unless otherwise specified, the use of the terms "first", "second", etc. to describe various elements is not intended to limit the positional relationship, timing relationship, or importance relationship of these elements, and such terms are only used to distinguish one element from another element. In some examples, the first element and the second element may refer to the same instance of the element, and in some cases, based on the description of the context, they may also refer to different instances.
[0022] The terms used in the description of various examples in this disclosure are only for the purpose of describing specific examples and are not intended to be limiting. Unless the context clearly indicates otherwise, if the number of elements is not specifically limited, the element can be one or more. In addition, the term "and / or" used in this disclosure covers any one of the listed items and all possible combinations.
[0023] The embodiments of the present disclosure will be described in detail below with reference to the accompanying drawings.
[0024] Figure 1 FIG. 1 is a schematic diagram of an exemplary system 100 in which various methods and apparatuses described herein may be implemented according to an embodiment of the present disclosure. Figure 1 , the system 100 includes one or more client devices 101, 102, 103, 104, 105, and 106, a server 120, and one or more communication networks 110 coupling the one or more client devices to the server 120. The client devices 101, 102, 103, 104, 105, and 106 may be configured to execute one or more applications.
[0025] In an embodiment of the present disclosure, the server 120 may run one or more services or software applications that enable the image filling method to be performed.
[0026] In some embodiments, server 120 may also provide other services or software applications that may include non-virtualized environments and virtualized environments. In some embodiments, these services may be provided as web-based services or cloud services, such as provided to users of client devices 101, 102, 103, 104, 105, and / or 106 under a software as a service (SaaS) model.
[0027] exist Figure 1 In the configuration shown, the server 120 may include one or more components that implement the functions performed by the server 120. These components may include software components, hardware components, or a combination thereof that can be executed by one or more processors. Users operating client devices 101, 102, 103, 104, 105, and / or 106 may in turn utilize one or more client applications to interact with the server 120 to utilize the services provided by these components. It should be understood that a variety of different system configurations are possible, which may differ from the system 100. Therefore, Figure 1 is one example of a system for implementing the various methods described herein and is not intended to be limiting.
[0028] Client devices 101, 102, 103, 104, 105 and / or 106 may be used to receive images to be filled, etc. The client device may provide an interface that enables a user of the client device to interact with the client device. The client device may also output information to the user via the interface. Figure 1 Only six client devices are depicted, but one skilled in the art will appreciate that the present disclosure may support any number of client devices.
[0029] Client devices 101, 102, 103, 104, 105 and / or 106 may include various types of computer devices, such as portable handheld devices, general-purpose computers (such as personal computers and laptops), workstation computers, wearable devices, game systems, thin clients, various messaging devices, sensors or other sensing devices, etc. These computer devices may run various types and versions of software applications and operating systems, such as Microsoft Windows, Apple iOS, UNIX-like operating systems, Linux or Linux-like operating systems (such as Google Chrome OS); or include various mobile operating systems, such as Microsoft Windows Mobile OS, iOS, Windows Phone, Android. Portable handheld devices may include cellular phones, smart phones, tablet computers, personal digital assistants (PDAs), etc. Wearable devices may include head-mounted displays and other devices. Game systems may include various handheld game devices, Internet-enabled game devices, etc. Client devices are capable of executing a variety of different applications, such as various Internet-related applications, communication applications (such as email applications), short message service (SMS) applications, and may use various communication protocols.
[0030] The network 110 may be any type of network known to those skilled in the art that may support data communications using any of a variety of available protocols, including but not limited to TCP / IP, SNA, IPX, etc. By way of example only, the one or more networks 110 may be a local area network (LAN), an Ethernet-based network, a token ring, a wide area network (WAN), the Internet, a virtual network, a virtual private network (VPN), an intranet, an extranet, a public switched telephone network (PSTN), an infrared network, a wireless network (e.g., Bluetooth, WIFI), and / or any combination of these and / or other networks.
[0031] Server 120 may include one or more general purpose computers, dedicated server computers (e.g., PC (personal computer) servers, UNIX servers, mid-range servers), blade servers, mainframe computers, server clusters, or any other suitable arrangement and / or combination. Server 120 may include one or more virtual machines running virtual operating systems, or other computing architectures involving virtualization (e.g., one or more flexible pools of logical storage devices that may be virtualized to maintain a server's virtual storage device). In various embodiments, server 120 may run one or more services or software applications that provide the functionality described below.
[0032] The computing units in the server 120 may run one or more operating systems including any of the above operating systems and any commercially available server operating systems. The server 120 may also run any of a variety of additional server applications and / or middle-tier applications, including HTTP servers, FTP servers, CGI servers, JAVA servers, database servers, etc.
[0033] In some implementations, server 120 may include one or more applications to analyze and consolidate data feeds and / or event updates received from users of client devices 101, 102, 103, 104, 105, and 106. Server 120 may also include one or more applications to display data feeds and / or real-time events via one or more display devices of client devices 101, 102, 103, 104, 105, and 106.
[0034] In some embodiments, the server 120 may be a server of a distributed system, or a server combined with a blockchain. The server 120 may also be a cloud server, or an intelligent cloud computing server or intelligent cloud host with artificial intelligence technology. A cloud server is a host product in a cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and virtual private servers (VPS) services.
[0035] The system 100 may also include one or more databases 130. In some embodiments, these databases may be used to store data and other information. For example, one or more of the databases 130 may be used to store data such as images to be filled or filled. The data repository 130 may reside in various locations. For example, the data repository used by the server 120 may be local to the server 120, or may be remote from the server 120 and may communicate with the server 120 via a network-based or dedicated connection. The data repository 130 may be of different types. In some embodiments, the data repository used by the server 120 may be a database, such as a relational database. One or more of these databases may store, update, and retrieve data to and from the database in response to commands.
[0036] In some embodiments, one or more of the databases 130 may also be used by applications to store application data. The databases used by the applications may be different types of databases, such as a key-value store, an object store, or a conventional store backed by a file system.
[0037] Figure 1 The system 100 may be configured and operated in various ways to enable the application of various methods and apparatuses described in the present disclosure.
[0038] In image processing, we often encounter situations where we need to remove target objects from images, such as removing a passerby in a photo or removing an object that is not fully photographed. Current image filling technologies often fill in missing areas based on data experience distribution after analyzing the image, without manual intervention or understanding the user's filling intention. For example, if a user wants to fill in the missing area with the features of object A, traditional methods may give the result of filling with the features of object B.
[0039] Therefore, according to an embodiment of the present disclosure, an image filling method 200 is provided, such as Figure 2 As shown, the method includes: obtaining an image to be filled, a first mask image and a second mask image corresponding to the image to be filled (step 210); extracting background features corresponding to the background area based on the image to be filled and the first mask image (step 220); extracting clue features corresponding to the user clue area based on the image to be filled and the second mask image (step 230); calculating the similarity score between the background features and the clue features (step 240); and inputting the image to be filled, the first mask image and the similarity score into a trained first neural network to obtain a filled image (step 250).
[0040] According to the embodiments of the present disclosure, the user's filling intention can be accurately understood, and the image can be filled based on the user's clues, thereby achieving a filling effect that meets the user's expectations.
[0041] In step 210, an image to be filled, a first mask image corresponding to the image to be filled, and a second mask image are obtained. The image to be filled includes a region to be filled and a background region outside the region to be filled, the first mask image is used to indicate the relative positional relationship between the region to be filled and the background region, and the second mask image is used to indicate the relative positional relationship between the user clue region and the region outside the user clue region.
[0042] In some embodiments, the target image may be preprocessed by removing the target area in the target image to obtain the image to be filled, and the missing area in the image to be filled is the area to be filled.
[0043] refer to Figure 3 , schematically shows an image diagram containing an object to be removed and a user clue, for the convenience of description, Figure 3 In the image, mark the object you want to remove by coloring it, which is a pair of deck chairs on the beach. Figure 3 In an embodiment, the target original image is a beach picture containing a lounge chair. The lounge chair can be removed from the original picture by using known image segmentation techniques (such as edge segmentation and semantic segmentation) to obtain an image to be filled, that is, a beach image with the lounge chair area missing. The missing area is the area to be filled.
[0044] The user clue area can be roughly marked by the user in the image to be filled, for example, by a frame or the like. For example, the user circles the user clue area in the image with a frame (such as a dotted line frame or a solid line frame, etc.), and the user clue area is the area that the user wants to use for image filling. Figure 3 The area where the dotted frame in is located is the user clue area. The frame can be of any shape, including but not limited to a rectangular frame, an elliptical frame, etc., as long as it can identify the user's filling intention in the image.
[0045] In some embodiments, the target original image may have various forms, including but not limited to a static image obtained by shooting, a video frame image extracted from a video screen, etc. The video screen may be from a pre-produced video, or may be a video corresponding to a real-time video stream, such as a live video, an instant messaging video, etc. In some embodiments, the to-be-filled area in the to-be-filled image obtained by segmenting the original target image may be one or more.
[0046] In some embodiments, after acquiring the image to be filled, a first mask image may be further acquired. The first mask image includes a region to be filled and a background region outside the region to be filled. In the mask image, the data of the pixel points in the region to be filled is different from the data of the pixel points in the background region, so that the data of each pixel point in the first mask image can represent whether the pixel point is located in the region to be filled or in the background region, that is, the relative positional relationship between the region to be filled and the background region in the image to be filled can be represented by the first mask image.
[0047] By characterizing the above relative position relationship by the first mask image corresponding to the image to be filled, the relative position relationship between the above area to be filled and the background area outside the area to be filled can be accurately known, thereby facilitating more accurate image filling.
[0048] According to some embodiments, the first mask image may be a two-dimensional matrix including a first data region corresponding to the area to be filled and a second data region corresponding to the background area. The first data and the second data are different. The value of each pixel in the area to be filled may be set to the first data, and the value of each pixel in the background area may be set to the second data. For example, the first data may be 1 and the second data may be 0 (or vice versa), and the relative positional relationship between the area to be filled and the background area in the image to be filled is characterized by the difference in the values of "1" and "0".
[0049] In some embodiments, a second mask image may be further acquired. The second mask image includes an area including the user clue area and an area outside the user clue area. In the mask image, the data of the pixel points in the user clue area is different from the data of the pixel points in the area outside the user clue area, so that the data of each pixel point in the second mask image can represent whether the pixel point is located in the user clue area or in the area outside the user clue area, that is, the relative position relationship between the user clue area and the area outside the user clue area in the image to be filled can be represented by the second mask image.
[0050] By characterizing the above relative position relationship by a second mask image corresponding to the image to be filled, the relative position relationship between the above user clue area and the area outside the user clue area can be accurately known, thereby helping to more accurately understand the user's filling intention.
[0051] According to some embodiments, the second mask image may be a two-dimensional matrix including a third data region corresponding to the user clue area and a fourth data region corresponding to an area outside the user clue area. The third data and the fourth data are different. The value of each pixel in the user clue area may be set to the third data, and the value of each pixel in the area outside the user clue area may be set to the fourth data. For example, the third data may be 1 and the fourth data may be 0 (or vice versa), and the relative positional relationship between the user clue area and the area outside the user clue area in the image to be filled is characterized by the difference in the values of "1" and "0".
[0052] In some embodiments, an image segmentation network can be used to obtain a first mask image and a second mask image. For example, the original image marked by the user can be input into a trained image segmentation network so that the image segmentation network can identify the area to be removed (i.e., the area to be filled) marked by the user in the original image, and the area to be filled and the background area outside the area to be filled are binarized to obtain a first mask image. The values of each pixel in the binarized first mask image can be used to characterize the above-mentioned relative position relationship. The marked area to be filled in the image to be filled is identified by a trained image segmentation network, and the area to be filled is distinguished from other areas (background areas) in the image to be filled, and then the first mask image is generated according to the positional relationship between the area to be filled and the background area, so as to ensure that the values of each pixel in the first mask image can accurately characterize the above-mentioned relative position relationship. The second mask image is also as described above, and will not be repeated here.
[0053] In step 220, background features corresponding to the background area are extracted based on the image to be filled and the first mask image. In step 230, clue features corresponding to the user clue area are extracted based on the image to be filled and the second mask image.
[0054] In order for computers to "understand" images, it is necessary to extract useful data or information from images to obtain "non-image" representations or descriptions of images, such as numerical values, vectors, and symbols. This process is feature extraction, and the extracted "non-image" representations or descriptions are the features of the image.
[0055] According to some embodiments, extracting background features corresponding to the background area includes: inputting the image to be filled and the first mask image into a trained second neural network to obtain background features corresponding to the background area.
[0056] According to some embodiments, extracting clue features corresponding to the user clue area includes: inputting the image to be filled and the second mask image into a trained third neural network to obtain clue features corresponding to the user clue area.
[0057] In some examples, any one of the second neural network and the third neural network can be a convolutional neural network, such as a U-net neural network, to give full play to the algorithmic advantages of the U-net structure in achieving image restoration through downsampling and upsampling. The image features can be automatically extracted through the trained convolutional neural network, which is convenient and fast.
[0058] It should be understood that other methods for extracting image features are also possible and are not limited here.
[0059] In step 240 , similarity scores between the background features and the clue features are calculated.
[0060] In some examples, the similarity between the clue feature and the background feature is calculated, and a similarity score ranging from [0, 1] is output.
[0061] According to some embodiments, step 240 includes: calculating the similarity between each feature in the background features and each feature in the clue features; and for each feature in the background features, calculating the average value of the similarity between the feature and all features in the clue features as the similarity score between the feature in the background features and the clue features.
[0062] In step 250, the image to be filled, the first mask image and the similarity score are input into a trained first neural network to obtain a filled image.
[0063] In some examples, according to the similarity scores between the clue features and the background features, the to-be-filled area in the image to be filled is filled based on the background features with a large similarity score. Figure 4 Shows the Figure 3 Schematic diagram after the corresponding area of the middle recliner is filled.
[0064] According to some embodiments, the first neural network is generated by training the neural network using training data and based on the restoration loss of the first mask image generated according to the training data. The restoration loss can be used to represent the deviation of the restored image from its corresponding original image. For example, the restoration loss can be a mean absolute error (MAE). In this way, the neural network trained based on the restoration loss has a higher accuracy to achieve a refined image filling effect.
[0065] In one embodiment according to the present disclosure, Figure 5As shown, background features 504 are extracted based on the acquired image to be filled 502 and the first mask image 501 (process 511); clue features 505 are extracted based on the acquired image to be filled 502 and the second mask image 503 (process 522). The similarity between the clue features 505 and the background features 504 is calculated, and a similarity score 506 with a value range of [0,1] is output (process 533). The similarity score 506, the image to be filled 502, and the first mask image 501 are input into the trained neural network to obtain the filled image 507 (process 544).
[0066] The image filling method disclosed herein can not only understand the user's intention, but also make the filling effect natural and realistic.
[0067] According to some embodiments, the method 200 may further include: optimizing the filled image based on a convolutional neural network. Further optimizing details based on the filled image may make the filling effect more natural and realistic.
[0068] According to an embodiment of the present disclosure, an image filling device 600 is also provided, such as Figure 6 As shown, it includes: an image acquisition module 610, configured to acquire an image to be filled, a first mask image corresponding to the image to be filled, and a second mask image, wherein the image to be filled includes a region to be filled and a background region outside the region to be filled, the first mask image is used to indicate the relative positional relationship between the region to be filled and the background region, and the second mask image is used to indicate the relative positional relationship between the user clue region and the region outside the user clue region; a background feature extraction module 620, configured to extract background features corresponding to the background region based on the image to be filled and the first mask image; a clue feature extraction module 630, configured to extract clue features corresponding to the user clue region based on the image to be filled and the second mask image; a similarity calculation module 640, configured to calculate a similarity score between the background feature and the clue feature; and an image filling module 650, configured to input the image to be filled, the first mask image and the similarity score into a trained first neural network to obtain a filled image.
[0069] Here, the operations of the above-mentioned units 610-650 of the image filling device 600 are respectively similar to the operations of the above-described steps 210-250, and are not described in detail here.
[0070] According to an exemplary embodiment of the present disclosure, an electronic device is also provided, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the above-mentioned image filling method.
[0071] According to an exemplary embodiment of the present disclosure, a non-transitory computer-readable storage medium storing computer instructions is further provided, wherein the computer instructions are used to enable the computer to execute the above-mentioned image filling method.
[0072] According to an exemplary embodiment of the present disclosure, a computer program product is further provided, including a computer program, wherein the computer program implements the above-mentioned image filling method when being executed by a processor.
[0073] refer to Figure 7 , a block diagram of an electronic device 700 that can be used as a server or client of the present disclosure will now be described, which is an example of a hardware device that can be applied to various aspects of the present disclosure. The electronic device is intended to represent various forms of digital electronic computer devices, such as laptop computers, desktop computers, workbenches, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or required herein.
[0074] like Figure 7 As shown, the device 700 includes a computing unit 701, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 702 or a computer program loaded from a storage unit 708 into a random access memory (RAM) 703. In the RAM 703, various programs and data required for the operation of the device 700 can also be stored. The computing unit 701, the ROM 702, and the RAM 703 are connected to each other via a bus 704. An input / output (I / O) interface 705 is also connected to the bus 704.
[0075] A plurality of components in the device 700 are connected to the I / O interface 705, including: an input unit 706, an output unit 707, a storage unit 708, and a communication unit 709. The input unit 706 may be any type of device capable of inputting information to the device 700, the input unit 706 may receive input digital or character information, and generate key signal inputs related to user settings and / or function control of the electronic device, and may include but is not limited to a mouse, a keyboard, a touch screen, a track pad, a track ball, a joystick, a microphone, and / or a remote controller. The output unit 707 may be any type of device capable of presenting information, and may include but is not limited to a display, a speaker, a video / audio output terminal, a vibrator, and / or a printer. The storage unit 708 may include but is not limited to a disk, an optical disk. The communication unit 709 allows the device 700 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks, and may include but is not limited to a modem, a network card, an infrared communication device, a wireless communication transceiver, and / or a chipset, such as a Bluetooth™ device, a 1302.11 device, a WiFi device, a WiMax device, a cellular communication device, and / or the like.
[0076] The computing unit 701 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 701 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The computing unit 701 performs the various methods and processes described above, such as method 200. For example, in some embodiments, the method 200 may be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as a storage unit 708. In some embodiments, part or all of the computer program may be loaded and / or installed on the device 700 via the ROM 702 and / or the communication unit 709. When the computer program is loaded into the RAM 703 and executed by the computing unit 701, one or more steps of the method 200 described above may be performed. Alternatively, in other embodiments, the computing unit 701 may be configured to perform the method 200 in any other appropriate manner (e.g., by means of firmware).
[0077] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0078] The program code for implementing the method of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that the program code, when executed by the processor or controller, enables the functions / operations specified in the flow chart and / or block diagram to be implemented. The program code may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0079] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0080] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).
[0081] The systems and techniques described herein may be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), and the Internet.
[0082] A computer system may include clients and servers. Clients and servers are generally remote from each other and usually interact through a communication network. The relationship of client and server is generated by computer programs running on respective computers and having a client-server relationship to each other.
[0083] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in this disclosure can be performed in parallel, sequentially or in different orders, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved, and this document does not limit this.
[0084] Although the embodiments or examples of the present disclosure have been described with reference to the accompanying drawings, it should be understood that the above-mentioned methods, systems and devices are merely exemplary embodiments or examples, and the scope of the present invention is not limited by these embodiments or examples, but only by the claims after authorization and their equivalent scope. Various elements in the embodiments or examples can be omitted or replaced by their equivalent elements. In addition, each step can be performed in an order different from that described in the present disclosure. Further, the various elements in the embodiments or examples can be combined in various ways. It is important that with the evolution of technology, many elements described herein can be replaced by equivalent elements that appear after the present disclosure.
Claims
1. An image filling method, comprising: Acquire an image to be filled, a first mask image corresponding to the image to be filled, and a second mask image, wherein the image to be filled includes a region to be filled and a background region outside the region to be filled, the first mask image is used to indicate a relative positional relationship between the region to be filled and the background region, and the second mask image is used to indicate a relative positional relationship between a user clue region and a region outside the user clue region; extracting background features corresponding to the background area based on the image to be filled and the first mask image; extracting clue features corresponding to the user clue area based on the image to be filled and the second mask image; Calculating a similarity score between the background feature and the clue feature; as well as The image to be filled, the first mask image and the similarity score are input into a trained first neural network to obtain a filled image.
2. The method of claim 1, wherein: The first mask image is a two-dimensional matrix, and the two-dimensional matrix includes a first data region corresponding to the area to be filled and a second data region corresponding to the background area, wherein the first data and the second data are different.
3. The method of claim 1, wherein: The second mask image is a two-dimensional matrix, which includes a third data region corresponding to the user clue area and a fourth data region corresponding to an area outside the user clue area, wherein the third data and the fourth data are different.
4. The method of claim 1, wherein: Calculating the similarity score between the background feature and the clue feature includes: Calculating the similarity between each of the background features and each of the clue features; and For each feature in the background features, an average value of the similarities between the feature and all the features in the clue features is calculated to serve as a similarity score between the feature in the background features and the clue features.
5. The method of claim 1, wherein: Extracting background features corresponding to the background area includes: The image to be filled and the first mask image are input into a trained second neural network to obtain background features corresponding to the background area.
6. The method of claim 1, wherein: Extracting clue features corresponding to the user clue area includes: The image to be filled and the second mask image are input into a trained third neural network to obtain clue features corresponding to the user clue area.
7. The method of claim 1, wherein: The first neural network is generated by training the neural network using training data and based on a restoration loss of a first mask image generated according to the training data.
8. The method of claim 1, further comprising: The padded image is optimized based on a convolutional neural network.
9. An image filling device, comprising: an image acquisition module, configured to acquire an image to be filled, a first mask image corresponding to the image to be filled, and a second mask image, wherein the image to be filled includes a region to be filled and a background region outside the region to be filled, the first mask image is used to indicate a relative positional relationship between the region to be filled and the background region, and the second mask image is used to indicate a relative positional relationship between a user clue region and a region outside the user clue region; A background feature extraction module, configured to extract background features corresponding to the background area based on the image to be filled and the first mask image; A clue feature extraction module, configured to extract clue features corresponding to the user clue area based on the image to be filled and the second mask image; A similarity calculation module, configured to calculate a similarity score between the background feature and the clue feature; as well as The image filling module is configured to input the image to be filled, the first mask image and the similarity score into a trained first neural network to obtain a filled image.
10. The device of claim 9, wherein: The first mask image is a two-dimensional matrix, and the two-dimensional matrix includes a first data region corresponding to the area to be filled and a second data region corresponding to the background area, wherein the first data and the second data are different.
11. The device according to claim 9, wherein: The second mask image is a two-dimensional matrix, which includes a third data region corresponding to the user clue area and a fourth data region corresponding to an area outside the user clue area, wherein the third data and the fourth data are different.
12. The device of claim 9, wherein: The similarity calculation module is configured as follows: Calculating the similarity between each feature in the background features and each feature in the clue features; as well as For each feature in the background features, an average value of the similarities between the feature and all the features in the clue features is calculated to serve as a similarity score between the feature in the background features and the clue features.
13. The device of claim 9, wherein: The background feature extraction module is configured as follows: The image to be filled and the first mask image are input into a trained second neural network to obtain background features corresponding to the background area.
14. The device of claim 9, wherein: The clue feature extraction module is configured as follows: The image to be filled and the second mask image are input into a trained third neural network to obtain clue features corresponding to the user clue area.
15. The device of claim 9, wherein: The first neural network is generated by training the neural network using training data and based on a restoration loss of a first mask image generated according to the training data.
16. The apparatus of claim 9, further comprising an optimization module configured to: The padded image is optimized based on a convolutional neural network.
17. An electronic device comprising: at least one processor; as well as a memory communicatively coupled to the at least one processor; in The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 8.
18. A non-transitory computer-readable storage medium storing computer instructions, wherein: The computer instructions are used to cause the computer to execute the method according to any one of claims 1-8.
