WO2023207778A1 - Data recovery method and device, computer, and storage medium - Google Patents

Data recovery method and device, computer, and storage medium Download PDF

Info

Publication number
WO2023207778A1
WO2023207778A1 PCT/CN2023/089718 CN2023089718W WO2023207778A1 WO 2023207778 A1 WO2023207778 A1 WO 2023207778A1 CN 2023089718 W CN2023089718 W CN 2023089718W WO 2023207778 A1 WO2023207778 A1 WO 2023207778A1
Authority
WO
WIPO (PCT)
Prior art keywords
repaired
image
area
sample
repair
Prior art date
Application number
PCT/CN2023/089718
Other languages
French (fr)
Chinese (zh)
Inventor
赵远远
Original Assignee
腾讯科技(深圳)有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 腾讯科技(深圳)有限公司 filed Critical 腾讯科技(深圳)有限公司
Publication of WO2023207778A1 publication Critical patent/WO2023207778A1/en

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/77Retouching; Inpainting; Scratch removal
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/50Image enhancement or restoration using two or more images, e.g. averaging or subtraction
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/10Image acquisition modality
    • G06T2207/10004Still image; Photographic image
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20021Dividing image into blocks, subimages or windows
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20081Training; Learning
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20212Image combination
    • G06T2207/20221Image fusion; Image merging

Definitions

  • the present application relates to the field of computer technology, and in particular, to a data repair method, device, computer and readable storage medium.
  • image repair processing is generally performed by inputting the image to be repaired into the model. This also requires more comprehensive information recognition of the image to be repaired in this model. In other words, more parameters need to be trained for image repair.
  • Embodiments of the present application provide a data repair method, device, computer and readable storage medium, which can improve the accuracy of data repair.
  • embodiments of the present application provide a data repair method, which method includes:
  • the parameters of the first area prediction model and the first media repair model are jointly adjusted to obtain the target area prediction model corresponding to the first area prediction model, and a target media repair model corresponding to the first media repair model.
  • embodiments of the present application provide a data repair method, which method includes:
  • the area to be repaired in the image frame to be repaired is repaired based on the target media repair model to obtain the optimized image frame corresponding to the image frame to be repaired.
  • the target area prediction model and the target media repair model are obtained through joint training.
  • a data repair device which includes:
  • the sample acquisition module is used to obtain the repaired image sample to be repaired, the repair area label corresponding to the repaired image sample, and the original image sample;
  • the sample area prediction module is used to use the first area prediction model to predict the area to be repaired of the repaired image sample, and obtain the sample predicted repair area;
  • the sample repair module is used to use the first media repair model to repair the sample predicted repair area in the repair image sample, to obtain Optimize the image to the sample corresponding to the repaired image sample;
  • the model adjustment module is used to jointly adjust the parameters of the first area prediction model and the first media repair model based on the sample prediction repair area, repair area label, original image sample and sample optimized image, and obtain the corresponding parameters of the first area prediction model.
  • a target area prediction model, and a target media repair model corresponding to the first media repair model are used to jointly adjust the parameters of the first area prediction model and the first media repair model based on the sample prediction repair area, repair area label, original image sample and sample optimized image.
  • a data repair device which includes:
  • Image acquisition module used to acquire image frames to be repaired
  • the area prediction module is used to predict the image frame to be repaired based on the target area prediction model and obtain the area to be repaired of the image frame to be repaired;
  • the data repair module is used to repair the area to be repaired in the image frame to be repaired based on the target media repair model, and obtain the optimized image frame corresponding to the image frame to be repaired.
  • the target area prediction model and the target media repair model are jointly trained. owned.
  • embodiments of the present application provide a computer device, including a processor, a memory, and an input and output interface;
  • the processor is connected to the memory and the input and output interface respectively.
  • the input and output interface is used to receive data and output data.
  • the memory is used to store the computer program.
  • the processor is used to call the computer program so that the computer device containing the processor executes the computer program.
  • the data repair method in one aspect of the application embodiment.
  • inventions of the present application provide a computer-readable storage medium.
  • the computer-readable storage medium stores a computer program.
  • the computer program is adapted to be loaded and executed by a processor, so that a computer device having the processor executes the present application.
  • the data repair method in one aspect of the embodiment.
  • embodiments of the present application provide a computer program product or computer program.
  • the computer program product or computer program includes computer instructions, and the computer instructions are stored in a computer-readable storage medium.
  • the processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the methods provided in various optional ways in one aspect of the embodiments of the present application.
  • the repaired image sample to be repaired, the repaired area label corresponding to the repaired image sample, and the original image sample can be obtained;
  • the first area prediction model is used to predict the area to be repaired of the repaired image sample, and the sample predicted repaired area is obtained ;
  • the first media repair model to repair the sample predicted repair area in the repaired image sample to obtain the sample optimized image corresponding to the repaired image sample; based on the sample predicted repair area, repair area label, original image sample and sample optimized image, perform
  • the parameters of the first region prediction model and the first media repair model are jointly adjusted to obtain a target region prediction model corresponding to the first region prediction model and a target media repair model corresponding to the first media repair model.
  • the image can be repaired based on the target area prediction model and the target media repair model.
  • the multi-task joint training and use of the first regional prediction model and the first media repair model are realized to realize mutual adjustment and promotion between different tasks, and fully learn complementary information and similar information in different tasks, etc. , obtain mutual gain effects, improve the efficiency of model training, and save computing resources. Since different tasks can provide each other with enhanced effective information to promote model performance of different tasks, mutually improve the accuracy of the output results of different models, it is conducive to the improvement of model design and effects, thereby improving the accuracy of data repair.
  • Figure 1 is a network interaction architecture diagram of data repair provided by an embodiment of the present application.
  • Figure 2 is a schematic diagram of a data repair scenario provided by an embodiment of the present application.
  • Figure 3 is a flow chart of a model training method provided by an embodiment of the present application.
  • Figure 4 is a schematic diagram of a multi-step training method provided by an embodiment of the present application.
  • Figure 5 is a flow chart of a data repair method provided by an embodiment of the present application.
  • Figure 6 is a schematic diagram of a regional prediction method provided by an embodiment of the present application.
  • Figure 7 is a schematic diagram of another regional prediction method provided by an embodiment of the present application.
  • Figure 8 is a schematic diagram of a repair method provided by an embodiment of the present application.
  • Figure 9 is a schematic diagram of another repair method provided by an embodiment of the present application.
  • Figure 10 is a schematic diagram of a data repair device provided by an embodiment of the present application.
  • Figure 11 is a schematic diagram of another data repair device provided by an embodiment of the present application.
  • Figure 12 is a schematic structural diagram of a computer device provided by an embodiment of the present application.
  • Figure 1 is a network interaction architecture diagram of data repair provided by an embodiment of the present application.
  • the computer device 101 can perform data exchange with the terminal device, and different terminal devices can also perform data exchange with each other.
  • the number of terminal devices may be one or at least two.
  • the number of terminal devices is three, such as the terminal device 102a, the terminal device 102b, the terminal device 102c, etc. shown in FIG. 1 .
  • the computer device 101 can obtain the repaired image sample from the storage space of the computer device 101 itself, or can obtain the repaired image sample from any one or more terminal devices, etc., which is not limited here.
  • the computer device 101 can perform model training based on the obtained repaired image samples. Specifically, the computer device 101 can jointly train the first region prediction model and the first media repair model to obtain the target region prediction model corresponding to the first region prediction model and the target media repair model corresponding to the first media repair model. wait. Further, the computer device 101 can perform data repair based on the trained target area prediction model and target media repair model. Data repair is, for example, video completion. Video completion refers to completing the missing position information or the area to be cut out in the video based on the texture information and timing information of the non-missing area.
  • this application may involve machine learning technology in the field of artificial intelligence, using machine learning technology to expand the training samples of the model, and to train the model, etc.
  • AI artificial intelligence
  • a comprehensive technology of computer science that attempts to understand the essence of intelligence and produce a new intelligent machine that can respond in a similar way to human intelligence.
  • Artificial intelligence is the study of the design principles and implementation methods of various intelligent machines, so that the machines have the functions of perception, reasoning and decision-making.
  • Artificial intelligence technology is a comprehensive subject that covers a wide range of fields, including both hardware-level technology and software-level technology.
  • Basic artificial intelligence technologies generally include technologies such as sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, big data processing technology, operation/interaction systems, mechatronics and other technologies.
  • Artificial intelligence software technology mainly includes computer vision technology, speech processing technology, natural language processing technology, machine learning/deep learning, autonomous driving, smart transportation and other major directions.
  • Machine Learning is a multi-field interdisciplinary subject involving probability theory, statistics, approximation theory, convex analysis, algorithm complexity theory and other disciplines. It specializes in studying how computers can simulate or implement human learning behavior to acquire new knowledge or skills, and reorganize existing knowledge structures to continuously improve their performance.
  • Machine learning is the core of artificial intelligence and the fundamental way to make computers intelligent. Its applications cover all fields of artificial intelligence.
  • Machine learning and deep learning usually include artificial neural networks, belief networks, reinforcement learning, transfer learning, inductive learning, teaching learning and other technologies. For example, in this application, for the training and use of target area prediction models and target media repair models, the models are trained to continuously learn new knowledge or skills, and then the trained models are obtained for use in data repair.
  • artificial intelligence technology has been researched and applied in many fields, such as common smart homes, smart wearable devices, virtual assistants, smart speakers, smart marketing, driverless driving, autonomous driving, and drones. , robots, smart medical care, smart customer service, Internet of Vehicles, autonomous driving, smart transportation, etc. It is believed that with the development of technology, artificial intelligence technology will be applied in more fields and play an increasingly important role.
  • Figure 2 is a schematic diagram of a data repair scenario provided by an embodiment of the present application.
  • this application conducts multi-task model joint training and uses the model based on the joint training.
  • the computer device can obtain the repaired image, and based on the repaired image, model training and prediction use of the regional prediction model and the media repair model.
  • the repaired image refers to the repaired image sample to be repaired.
  • the repaired image sample is input into the first region prediction model for prediction, and a sample predicted repairing area to be repaired corresponding to the repaired image sample is obtained.
  • the regional prediction model in Figure 2 is used to represent the first regional prediction model, and the repair area is used to represent the sample prediction repair area. Further, the computer device can use the repair area as an input to the first media repair model.
  • the repair image sample and the sample predicted repair area are input into the first media repair model for repair, and a sample optimized image corresponding to the repair image sample is obtained.
  • the part indicated by the dotted line in Figure 2 is also included.
  • the model training can further jointly adjust the parameters of the first region prediction model and the first media repair model to obtain a target region prediction model corresponding to the first region prediction model and a target media repair model corresponding to the first media repair model.
  • the repaired image can be an image frame to be repaired
  • the area prediction model refers to the target area prediction model
  • the repair area refers to the area to be repaired
  • the media repair model refers to the target media repair model
  • the optimized image is Refers to optimizing image frames.
  • the computer device can input the image frame to be repaired into the target area prediction model, perform prediction based on the target area prediction model, and obtain the area to be repaired of the image frame to be repaired.
  • the area to be repaired in the image frame to be repaired is repaired based on the target media repair model to obtain an optimized image frame corresponding to the image frame to be repaired.
  • the accuracy of the model's output results can be mutually improved. Different tasks provide mutually reinforcing effective information to promote the model performance of different tasks, which can improve the efficiency of model training and save computing resources. , thereby improving the accuracy of data repair.
  • the computer equipment mentioned in the embodiments of this application includes but is not limited to terminal equipment or servers.
  • the computer device can be a server or a terminal device, or it can be a system composed of a server and a terminal device.
  • the above-mentioned terminal device can be an electronic device, including but not limited to a mobile phone, a tablet computer, a desktop computer, a notebook computer, a handheld computer, a vehicle-mounted device, an augmented reality/virtual reality (AR) /VR) equipment, helmet-mounted displays, wearable devices, smart speakers boxes, digital cameras, cameras and other mobile internet devices (mobile internet devices, MID) with network access capabilities, etc.
  • AR augmented reality/virtual reality
  • the server mentioned above can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or it can provide cloud services, cloud databases, cloud computing, cloud functions, cloud storage, Cloud servers for basic cloud computing services such as network services, cloud communications, middleware services, domain name services, security services, vehicle-road collaboration, Content Delivery Network (CDN), and big data and artificial intelligence platforms.
  • cloud services such as network services, cloud communications, middleware services, domain name services, security services, vehicle-road collaboration, Content Delivery Network (CDN), and big data and artificial intelligence platforms.
  • CDN Content Delivery Network
  • the data involved in the embodiments of this application can be stored in any one or at least two devices of computer equipment or terminal equipment, or the data can be stored based on cloud storage technology or blockchain network, which will not be done here. limit.
  • Figure 3 is a flow chart of a model training method provided by an embodiment of the present application. As shown in Figure 3, the model training method includes the following steps:
  • Step S301 Obtain the repaired image sample to be repaired, the repair area label corresponding to the repaired image sample, and the original image sample.
  • the computer device can obtain the repaired image sample.
  • the repaired image sample refers to the image sample to be repaired.
  • the repaired image sample may be an image, or may be one sample image frame among N sample image frames that constitute the video sample, where N is a positive integer.
  • the computer device can obtain the repaired area label and the original image sample corresponding to the repaired image sample.
  • the repaired image sample is one of the N sample image frames that make up the video sample, the computer device can, for example, directly obtain the repaired area label and the original image sample corresponding to the repaired image sample from the video sample.
  • the repair area label is, for example, the area to be repaired in the repair image sample generated through manual annotation.
  • the label may be a numerical value used to represent the position of a pixel in an image sample or image frame, and may be one of two values.
  • the numerical value of the pixel position in the area to be repaired is represented by a repair area label with one of the binary values (for example, 1), and the numerical value of the pixel position in the remaining areas is represented by the other of the binary values. represented by a value (for example, 0).
  • the binary value can also be other values, for example, 1 and 100, etc.
  • the computer device may search the repaired area label corresponding to the repaired image sample from its internal memory or externally. If the repair area label is found, the computer device can directly obtain the repair area label. If the repair area label is not found, the computer device can predict the repair area label of the repair image sample based on the previous image sample of the repair image sample.
  • the video sample may include N sample image frames, in which there are repair area labels of the first image frame and repair area labels of the key image frames.
  • the first image frame is the first image frame among N sample image frames, and the N sample image frames include key image frames.
  • the repair area label of the first image frame and the repair area label of the key image frame are generated by manual annotation, for example, and are used to represent the area to be repaired in the first image frame and the area to be repaired in the key image frame.
  • the repaired image sample is one of the N sample image frames that make up the video sample
  • the preamble image sample of the repaired image sample in the N sample image frames is obtained, and the preamble image sample corresponding to the preamble image sample is obtained.
  • Preamble sample repair area is generated by manual annotation, for example, and are used to represent the area to be repaired in the first image frame and the area to be repaired in the key image frame.
  • the computer equipment can directly obtain the repaired image sample from the data set, or can obtain the repaired image sample from the Internet, etc., or can generate the repaired image sample, etc., which are not limited here. That is, computer equipment can also obtain repaired image samples through other methods. In this application, any one of the above methods, or a combination of multiple methods, can be used to obtain the repaired image sample.
  • the computer device when generating a repaired image sample, can obtain the original image sample, perform damage processing on the original image sample, and obtain a repaired image sample.
  • the damage processing may include but is not limited to adding watermarks, erasing part of the area, adding area noise or area blur processing, etc.
  • One or at least two corresponding repaired image samples can be generated from an original image sample.
  • the computer device can generate the video sample through the following operations.
  • the computer equipment can first obtain foreground object samples and conventional video data, and then perform simulation operations on the foreground object samples. Motion processing is performed to obtain the object motion trajectory.
  • the foreground object sample may be, but is not limited to, area noise, area erasure mask, object object or area blur mask, etc.
  • the computer device fuses the foreground object samples with conventional video data based on the object's motion trajectory to obtain fused video data.
  • the computer device performs scene rendering optimization on the fused video data to generate video samples.
  • the scene rendering optimization includes but is not limited to tone adjustment or lighting processing.
  • the obtained video samples are more like real scenes and the authenticity of the video samples is improved.
  • the conventional video data can be considered as the original sample corresponding to the video sample.
  • the N regular video frames that make up the regular video data are the original image samples that make up the N sample image frames of the video sample.
  • the first regular video frame among N regular video frames is the original image sample of the first sample image frame among N sample image frames, etc.
  • Step S302 Predict the area to be repaired of the repaired image sample based on the first area prediction model to obtain the sample predicted repair area.
  • the computer device can input the repaired image sample into the first area prediction model for prediction, and obtain the sample predicted repair area.
  • the sample predicted repair area is the area to be repaired in the repair image sample, for example, the area to be removed foreground.
  • the computer device can input the pre-order image sample, the repaired image sample and the pre-order sample repair area into the first region prediction model to predict the repaired image
  • the area to be repaired of the sample is obtained to obtain the predicted repair area of the sample.
  • the preamble sample repair area is, for example, the area to be repaired in the preamble image sample.
  • the predicted value of the pixel position in the sample prediction repair area is, for example, represented by one of the two values corresponding to the label (for example, 1).
  • the number of preorder image samples may be p, where p is a natural number less than or equal to the preorder quantity threshold.
  • the computer device may determine a sample image frame located before the repaired image sample among the N sample image frames as a preceding image sample of the repaired image sample.
  • the computer device may obtain the sample image frame number of the sample image frame located before the repaired image sample among the N sample image frames. If the number of sample image frames is less than or equal to the preamble number threshold, the computer device determines the sample image frame located before the repaired image sample as the preamble image sample of the repaired image sample.
  • the computer device will sequentially obtain the sample image frames corresponding to the pre-order quantity threshold (pre-order quantity threshold) based on the repaired image samples among the N sample image frames. sample image frame), as the preamble image sample of the repaired image sample.
  • the computer device can perform semantic analysis on the video samples to obtain sample image semantic information corresponding to N sample image frames.
  • the computer device divides the N sample image frames into one or at least two sample clusters based on the sample image semantic information.
  • the sample image frames included in each sample cluster are continuous in the video sample and the similarity of the sample image semantic information is greater than the image similarity. threshold.
  • the computer device can obtain the target sample cluster where the repaired image sample is located, and determine the sample image frame located before the repaired image sample in the target sample cluster as the preceding image sample of the repaired image sample.
  • the repaired image sample is the t-th sample image frame among N sample image frames.
  • the repaired image sample can be recorded as t-1 ), p is a natural number less than or equal to the preorder quantity threshold. That is to say, when the repaired image sample is the first image frame of the video sample, there is no preceding image sample in the repaired image sample.
  • the repaired image sample is the second image frame of the video sample, the repaired image sample has a preamble image sample, etc.
  • the above-mentioned pre-order image samples (X tp , ..., X t-2 , X t-1 ) are only one possible expression form. In this example, the number of preamble image samples is at least three.
  • the preamble sample repair area of the preamble image sample The pre-sequence sample repair area of 1 is denoted as B t-1 and so on.
  • the computer device can process the preamble image sample, the repaired image sample and the preamble sample repair area of the preamble image sample, that is, (X tp ,..., X t-2 , X t-1 , X t , B tp ,..., B t-2 , B t-1 ), input the first area prediction model for prediction, and obtain the sample predicted repair area, denoted as
  • the order in which the pre-order image samples, repaired image samples and pre-order sample repair areas of the pre-order image samples are arranged can be adjusted according to the needs of the model and will not be discussed here.
  • the pre-order sample repair area refers to the pre-order repair area label of the corresponding pre-order image sample. If there is a repair area label of the first image frame and a repair area label of the key image frame in the video sample, the repair area of the previous sample of the previous regular image sample can be predicted based on the first area prediction model.
  • the preamble regular image sample is an image frame in the preamble image sample except the first image frame and the key image frame.
  • Step S303 Use the first media repair model to repair the sample predicted repair area in the repaired image sample to obtain a sample optimized image corresponding to the repaired image sample.
  • the computer device can input the sample predicted repair area and the repaired image sample into the first media repair model for repair, and obtain a sample optimized image corresponding to the repaired image sample.
  • the repaired image sample is one of the N sample image frames that make up the video sample
  • the preamble image sample, the repaired image sample, the sample prediction repair area and the preamble sample repair area can be combined, for example (X tp ,... ,X t-2 ,X t-1 ,X t ,B tp ,...,B t-2 ,B t-1 , ), input the first media repair model to repair the repaired image sample, and obtain a sample optimized image corresponding to the repaired image sample.
  • the order of arrangement of the pre-order image samples, repaired image samples, sample prediction repair areas and pre-order sample repair areas of the pre-order image samples can be adjusted according to the needs of the model, and is not limited here.
  • Step S304 Jointly adjust the parameters of the first region prediction model and the first media repair model based on the sample predicted repair area, repair area label, original image sample, and sample optimized image to obtain the target area corresponding to the first area prediction model. a prediction model, and a target media repair model corresponding to the first media repair model.
  • the computer device can generate a third loss function based on the sample prediction of the repair area and the repair area label, and a fourth loss function based on the original image sample and the sample optimized image.
  • the third loss function can be any one of h 1 first model loss functions, or be obtained by a combination of at least two of h 1 first model loss functions, or be obtained by h 1 first model loss functions Obtained by weighted combination of at least two of .
  • h 1 is a positive integer.
  • the h 1 first model loss function can include the loss function shown in formula 1:
  • L CE is used to represent a first model loss function
  • B gt is used to represent the repair area label of the repair image sample (used to represent the real area to be repaired in the repair image sample), Used to represent the sample predicted repair area.
  • the h 1 first model loss function can also include the loss function shown in formula 2:
  • L focal is used to represent a first model loss function
  • B gt is used to represent the repair area label of the repair image sample (used to represent the real area to be repaired in the repair image sample), Used to represent the sample predicted repair area.
  • is an exponential parameter, which can be obtained based on empirical values or commonly used parameter values.
  • h 1 first model loss function can also include other loss functions, such as intersection over union loss (IoU loss) and generalized intersection over union loss (GIoU loss), etc., which are not mentioned here. Make restrictions.
  • IoU loss intersection over union loss
  • GOU loss generalized intersection over union loss
  • the repaired image sample is one sample image frame among the N sample image frames that make up the video sample.
  • Any one of the h 1 first model loss functions can be determined as the third loss function.
  • at least two first model loss functions among h 1 first model loss functions may be combined to obtain a third loss function.
  • at least two first model loss functions among h 1 first model loss functions can be weighted and summed to obtain a third loss function.
  • a regional difference loss function can be generated based on the difference data between the sample prediction repair area and the repair area label, and the second discriminator is used to perform discriminant detection on the first regional prediction model to obtain an auxiliary loss function. Based on the regional difference loss function and The auxiliary loss function generates a third loss function.
  • the pre-sequence sample repair area can be And the sample optimized image is input into the first region prediction model for prediction (predicting the area to be repaired in the sample optimized image), and the first prediction region is obtained.
  • the adjacent image sample adjacent to the repaired image sample can be obtained from the pre-order image sample, and the pre-order sample repair area and the sample optimized image of the adjacent image sample are input into the first area prediction model for prediction, and the first prediction area is obtained.
  • the pre-sequence sample repair area and the original image sample are input into the first area prediction model for prediction (predicting the area to be repaired of the original image sample), and a second prediction area is obtained.
  • the pre-sequence sample repair area and the original image sample of the adjacent image sample can be input into the first area prediction model for prediction to obtain the second prediction area.
  • An auxiliary loss function is generated based on the first prediction area and the second prediction area. A possible way to generate this auxiliary loss function can be found in formula 3:
  • L DS is used to represent the auxiliary loss function
  • D S is used to represent the second discriminator
  • NetS is used to represent the first region prediction model
  • Y t is used to represent the original image sample
  • B t-1 is used to represent Represents the preorder sample repair area of adjacent image samples, Used to represent sample optimization images. That is to say, NetS(Y t ,B t-1 ) is used to represent the second prediction area, Used to represent the first prediction area.
  • the first prediction area can be input into the second discriminator for detection to obtain the first area detection result
  • the second prediction area can be input into the second discriminator for detection to obtain the second area detection result. According to the first area detection result
  • the difference data from the second region detection results generates an auxiliary loss function.
  • the parameters of the first region prediction model are adjusted through the relevant data of the first media repair model, so that the output results of the first region prediction model are more applicable and beneficial to the task execution of the first media repair model, and the interaction between different models is realized. It promotes optimization, improves the speed of model training, saves computing resources, and thereby improves the accuracy of data repair.
  • a regional difference loss function can be generated based on the difference data between the sample prediction repair area and the repair area label.
  • the regional difference loss function may be generated based on h 1 first model loss functions.
  • the regional difference loss function can be any one of h 1 first model loss functions, or be obtained by a combination of at least two of h 1 first model loss functions, or be obtained by a combination of h 1 first model loss functions. At least two weighted combinations are obtained.
  • the third loss function can be generated based on the auxiliary loss function and the regional difference loss function.
  • the third loss function can be recorded as L seg .
  • ⁇ , ⁇ , etc. are used to represent the function weight of the corresponding first model loss function.
  • a fourth loss function can be generated according to h 2 second model loss functions.
  • the fourth loss function may be any one of the h 2 second model loss functions, or be obtained by a combination of at least two of the h 2 second model loss functions, or be obtained by a combination of the h 2 second model loss functions. At least two weighted combinations are obtained.
  • h 2 is a positive integer.
  • the h 2 second model loss function can include the loss function shown in formula 4:
  • L sec is used to represent a second model loss function
  • Y t is used to represent the original image sample
  • 2" is used to represent an operation symbol.
  • the h 2 second model loss function can include a loss function as shown in formula 5:
  • L style is used to represent a second model loss function
  • F can be a neural network, such as Visual Geometry Group Network (VGG), etc.
  • the h 2 second model loss function can include a loss function as shown in formula 6:
  • Lgan is used to represent a second model loss function
  • D is used to represent the first discriminator
  • the above formula 4 to formula 6 are examples of possible second model loss functions.
  • the h 2 second model loss function can also include other loss functions, such as cross-entropy loss function or point-by-point difference loss function, etc., which are not limited here.
  • the image difference data between the original image sample and the sample optimized image can be obtained, and the image difference loss function is generated based on the image difference data. See formula 4 and formula 5, etc.
  • the original image sample is input into the first discriminator for detection, and the original discrimination result corresponding to the original image sample is obtained.
  • the sample optimized image is input into the first discriminator for detection, and the optimized discrimination result corresponding to the sample optimized image is obtained.
  • the original discrimination result and optimize the discrimination results to generate a discrimination loss function. It can be seen as shown in formula 6, where D(Y t ) is used to represent the original discrimination result, Used to represent optimization discrimination results.
  • the image difference loss function and the discrimination loss function are combined to obtain the fourth loss function.
  • the third loss function and the fourth loss function can be functionally combined to obtain a joint loss function, denoted as L ALL .
  • the parameters of the first region prediction model and the first media repair model are jointly adjusted through a joint loss function to obtain a target region prediction model corresponding to the first region prediction model and a target media repair model corresponding to the first media repair model.
  • the repaired image sample to be repaired, the repaired area label corresponding to the repaired image sample, and the original image sample can be obtained;
  • the first area prediction model is used to predict the area to be repaired of the repaired image sample, and the sample predicted repaired area is obtained ;
  • the first media repair model to repair the sample predicted repair area in the repaired image sample to obtain the sample optimized image corresponding to the repaired image sample; based on the sample predicted repair area, repair area label, original image sample and sample optimized image, perform
  • the parameters of the first region prediction model and the first media repair model are jointly adjusted to obtain a target region prediction model corresponding to the first region prediction model and a target media repair model corresponding to the first media repair model.
  • the image can be repaired based on the target area prediction model and the target media repair model.
  • the joint training and use of multiple tasks is achieved to achieve mutual adjustment and promotion between different tasks, fully learn the complementary information and similar information in different tasks, and obtain the effect of mutual gain, that is to say, Different tasks can provide each other with enhanced effective information to promote model performance of different tasks, mutually improve the accuracy of the output results of different models, which is beneficial to the design and effect of the model, can improve the efficiency of model training, and save calculations resources while improving the accuracy of data repair.
  • the computer device can directly obtain the first regional prediction model and the first media repair model, or can perform preliminary adjustments to obtain the first regional prediction model and the first media repair model. Specifically, the computer device can obtain the second regional prediction model and the second media repair model, determine the second regional prediction model as the first regional prediction model, and determine the second media repair model as the first media repair model; or, it can The repaired image sample is used to adjust the parameters of the second region prediction model to obtain the first region prediction model, and the repaired image sample is used to adjust the parameters of the second media repair model to obtain the first media repair model, etc.
  • the number of the first region prediction models may be d, and d is a positive integer.
  • Figure 4 is a schematic diagram of a multi-step training method provided by an embodiment of the present application. As shown in Figure 4, the process may include the following steps:
  • Step S401 Obtain the repaired image sample to be repaired, the repair area label corresponding to the repaired image sample, and the original image sample.
  • step S301 in Figure 3 reference may be made to the relevant description of step S301 in Figure 3 , which will not be described again here.
  • Step S402 Perform preliminary adjustments to obtain a first regional prediction model and a first media repair model.
  • the computer device can acquire the second regional prediction model and the second media repair model, use the repaired image sample to adjust parameters of the second regional prediction model, and obtain the first regional prediction model, and use the repaired image sample to adjust the parameters of the second regional prediction model.
  • the parameters of the second media repair model are adjusted to obtain the first media repair model, etc.
  • the second regional prediction model is, for example, the initial regional prediction model.
  • the second media repair model is, for example, the initial media repair model.
  • the repaired image sample is input into the second area prediction model for prediction, and the initial predicted repaired area in the repaired image sample is obtained; the first loss function is generated based on the initial predicted repaired area and the repaired area label, and the second loss function is calculated through the first loss function.
  • the parameters of the regional prediction model are adjusted to obtain the first regional prediction model.
  • Generating a first loss function based on the initial predicted repair area and the repair area label includes: determining the real area to be repaired in the repair image sample based on the repair area label, and based on the real area to be repaired and the initial area to be repaired. Predict the repair area and generate the first loss function.
  • the generation of the first loss function can refer to the generation method of the third loss function.
  • the third loss function is obtained by predicting the repair area based on the repair area label and the sample, while the first loss function is obtained based on the repair area label and the initial prediction of the repair area, that is, the sample in the third loss function predicts the repair area.
  • Changing to the initial predicted repair area can represent how the first loss function is generated.
  • the generation of the second loss function please refer to the generation method of the fourth loss function, where the fourth loss function is obtained based on the sample optimized image and the original image sample, and the second loss function is based on the initial optimized image and the original image sample. what you get.
  • the number of the first region prediction models may be d, and d is a positive integer.
  • the first region prediction model may include a region separation model and a region identification model.
  • the repaired image sample can be input into the initial region separation model for prediction to obtain a binary prediction image, and the separated repair area can be obtained from the binary prediction image.
  • the value of each pixel position in the area to be repaired can be represented by one of the two values (for example, 1), and the value of each pixel position in the remaining areas is represented by the other of the two values. value (for example, 0).
  • the first area loss function is generated based on the separation of the repair area and the repair area label
  • the second area loss function is generated based on the identification of the repair area and the repair area label
  • the third area loss function is generated based on the separation of the repair area and the identification of the repair area.
  • the parameters of the initial regional separation model and the initial regional identification model are jointly adjusted to obtain the regional separation model corresponding to the initial regional separation model, and the initial regional The region recognition model corresponding to the recognition model.
  • the d first region prediction models may include any one or more of a region separation model, a region recognition model, an object detection model, etc. Since the function of the d first area prediction models is to identify the areas that need to be repaired in the repaired image samples, in theory, the results obtained by each first area prediction model for the repaired image samples have certain similarities. , the d first region prediction models can be jointly trained to make mutual adjustments based on the prediction results, thereby improving the prediction accuracy of the regions that need to be repaired.
  • Step S403 Use the first area prediction model to predict the area to be repaired of the repaired image sample, and obtain the sample predicted repair area.
  • step S302 in Figure 3 reference may be made to the relevant description of step S302 in Figure 3 , which will not be described again here.
  • Step S404 Use the first media repair model to repair the sample predicted repair area in the repaired image sample to obtain a sample optimized image corresponding to the repaired image sample.
  • step S303 in Figure 3 reference may be made to the relevant description of step S303 in Figure 3 , which will not be described again here.
  • Step S405 Predict the repair area, the repair area label, the original image sample and the sample optimized image based on the sample, and predict the first area
  • the parameters of the model and the first media repair model are jointly adjusted to obtain a target area prediction model corresponding to the first area prediction model and a target media repair model corresponding to the first media repair model.
  • step S304 in Figure 3 reference may be made to the relevant description of step S304 in Figure 3 , which will not be described again here.
  • FIG. 5 is a flow chart of a data repair method provided by an embodiment of the present application. As shown in Figure 5, the method may include the following steps:
  • Step S501 Obtain the image frame to be repaired, predict the image frame to be repaired based on the target area prediction model, and obtain the area to be repaired of the image frame to be repaired.
  • the computer device can input the image frame to be repaired into the target area prediction model for prediction, and obtain the area to be repaired of the image frame to be repaired.
  • k pooling parameters can be used in the target region prediction model to perform pooling processing on the image frames to be repaired respectively, and k pooling features corresponding to the image frames to be repaired are obtained, and k is Positive integer.
  • FIG. 6 is a schematic diagram of a region prediction method provided by an embodiment of the present application.
  • the computer device can input the image frame 601 to be repaired into the target area prediction model to obtain the initial image features 602.
  • the computer equipment uses k pooling parameters to perform pooling processing on the initial image features 602 of the image frame to be repaired, and obtains k pooling features corresponding to the image frame to be repaired, such as pooling features 6031, pooling features 6032, and pooling features. Features 6033, etc.
  • the computer device can perform convolution processing on the k pooling features respectively to obtain k convolution features, such as the convolution feature 6041 corresponding to the pooling feature 6031 and the convolution feature 6042 corresponding to the pooling feature 6032. And the convolution feature 6043 corresponding to the pooling feature 6033, etc.
  • the computer equipment can perform feature fusion prediction on k convolution features to obtain the area to be repaired of the image frame to be repaired.
  • the computer device can perform upsampling processing on k convolution features based on the initial feature size of the initial image feature 602 to obtain upsampling features corresponding to the k convolution features.
  • the computer device performs feature fusion on the initial image feature 602 and k upsampling features to obtain a fused feature 605.
  • the computer device performs feature fusion on the k upsampled features to obtain the fused feature 605.
  • the prediction result 606 includes the area to be repaired 6061 of the image frame to
  • the initial image features of the image frame to be repaired can be obtained through the target region prediction model, and the initial image features are convolved to obtain the initial convolution features.
  • the initial convolutional features are pooled to obtain the encoded pooling features to increase the receptive field.
  • the receptive field refers to the area affected by a certain point on the feature map in the input space. For example, the pixel points on the feature map are mapped back to the size of the area on the input image.
  • the encoded pooling features are deconvolved to obtain the decoded convolution features.
  • the decoded convolution features are upsampled to obtain the prediction feature map of the image frame to be repaired.
  • the prediction feature map is activated to obtain the area to be repaired of the image frame to be repaired.
  • the initial image features of the image frame to be repaired can be obtained through the target region prediction model, and the initial image features are convolved to obtain the initial convolution features.
  • the initial convolution feature is pooled to obtain the encoded pooling feature.
  • Perform continuous convolution processing on the coding pooling features that is, perform convolution processing on the coding pooling features sequentially through r convolution layers, and predict the area to be repaired of the image frame to be repaired, where r is a positive integer.
  • FIG. 7 is a schematic diagram of another regional prediction method provided by an embodiment of the present application.
  • the computer device can obtain the initial image feature 701 of the image frame to be repaired, and perform convolution processing on the initial image feature 701 to obtain the initial convolution feature 702.
  • the computer device can then pool the initial convolutional features to obtain encoded pooled features 703.
  • the computer device performs continuous convolution processing on the encoded pooling features, that is, through r convolution layers, sequentially
  • the coding pooling feature is subjected to convolution processing, and the region to be repaired 7041 of the image frame 704 to be repaired is predicted.
  • the initial image features of the image frame to be repaired can be obtained through the target region prediction model, and s convolution sizes are used to perform atrous convolution sampling on the initial image features to obtain s atrous convolution features.
  • s is a positive integer.
  • Multi-scale feature extraction is performed on the hole fusion feature to obtain global features and local features.
  • Prediction is performed based on global features and local features to obtain the area to be repaired in the image frame to be repaired.
  • region prediction methods can also be used to predict the region to be repaired in the image frame to be repaired, and are not limited here.
  • the image frame to be repaired is one of the M image frames that make up the video data, and M is a positive integer.
  • the computer device can obtain the pre-order image frame of the image frame to be repaired in the M image frames, and obtain the pre-order repair area corresponding to the pre-order image frame; input the pre-order repair area, the pre-order image frame and the pre-order image frame to the target
  • the area prediction model predicts and obtains the area to be repaired corresponding to the image frame to be repaired.
  • the number of pre-order image frames may be a natural number less than or equal to the pre-order number threshold. This is because there is no preceding image frame for the first image frame among the M image frames.
  • the computer device may determine the image frame located before the image frame to be repaired among the M image frames as the preceding image frame of the image frame to be repaired. Alternatively, the computer device may obtain the image frame number of the image frame located before the image frame to be repaired among the M image frames. If the number of image frames is less than or equal to the preamble number threshold, the computer device determines the image frame located before the image frame to be repaired as the preamble image frame of the image frame to be repaired. If the number of image frames is greater than the previous number threshold, then among the M image frames, based on the image frame to be repaired, the computer device sequentially acquires the image frames corresponding to the previous number threshold as the image frame to be repaired. Preamble image frame.
  • the computer device can perform semantic analysis on the video samples to obtain image semantic information corresponding to the M image frames.
  • the computer device divides the M image frames into one or at least two image clusters based on the image semantic information, the image frames included in each image cluster are continuous in the video sample and the similarity of the image semantic information is greater than the image similarity threshold.
  • the computer device can obtain the target image cluster in which the image frame to be repaired is located, and determine the image frame in the target image cluster that is located before the image frame to be repaired as the preceding image frame of the image frame to be repaired.
  • the computer device can input the previous repair area, the previous image frame, and the image frame to be repaired into the target area prediction model.
  • the image frame to be repaired is predicted based on the image continuity between the previous image frame and the image frame to be repaired through the target area prediction model, and the initial prediction area corresponding to the image frame to be repaired is obtained.
  • the target area prediction model based on the regional continuity of the pre-order repair area, the initial prediction area is adjusted to obtain the area to be repaired corresponding to the image frame to be repaired.
  • k pooling parameters are used to perform pooling processing on the pre-order repair area, the pre-order image frame and the image frame to be repaired respectively, and the pre-order repair area, the pre-order image frame and the image frame to be repaired are obtained.
  • K pooling features corresponding to the image frames respectively, k is a positive integer; perform convolution processing on the k pooling features respectively to obtain k convolution features; perform feature fusion prediction on the k convolution features to obtain the image to be repaired The area of the frame to be repaired.
  • the computer device can use any of the above-mentioned area prediction methods to predict the area to be repaired corresponding to the image frame to be repaired.
  • any region prediction method when the computer device obtains the initial image features of the image frame to be repaired, the pre-repair region, the pre-order image frame and the image frame to be repaired can be processed through the target region prediction model.
  • Feature fusion extraction is used to obtain initial image features.
  • the computer device can obtain the feature maps of the pre-order repair area, the pre-order image frame and the image frame to be repaired respectively, and perform feature fusion processing on the feature maps of the pre-order repair area, the pre-order image frame and the image frame to be repaired to obtain the initial Image features.
  • the computer device can splice the pre-order repair area, the pre-order image frame and the image frame to be repaired to obtain the input data and obtain the initial image features of the input data.
  • the number of target area prediction models can be d, where d is a positive integer, such as a target area separation model or a target area identification model.
  • the computer device can respectively predict the individual prediction areas of the image frame to be repaired based on d target area prediction models, and predict the d individual prediction areas. The areas are fused and adjusted to obtain the area to be repaired of the image frame to be repaired.
  • Step S502 Repair the area to be repaired in the image frame to be repaired based on the target media repair model to obtain an optimized image frame corresponding to the image frame to be repaired.
  • the target area prediction model and the target media repair model are obtained through joint training.
  • the computer device can input the image frame to be repaired and the area to be repaired into the target area prediction model for repair, and obtain an optimized image frame corresponding to the image frame to be repaired.
  • the computer device can determine the effective area in the image frame to be repaired based on the area to be repaired through the target media repair model, and perform repair processing on the area to be repaired based on the effective image information in the effective area to obtain the image frame to be repaired.
  • the corresponding optimized image frame is obtained through joint training.
  • the computer device can obtain the image features to be repaired of the image frame to be repaired through the target media repair model, perform feature analysis on the image features to be repaired based on the area to be repaired, and obtain the semantic features to be repaired and the rendering to be repaired of the image frame to be repaired.
  • the computer device can perform repair processing on the semantic features to be repaired and the rendering features to be repaired, to obtain optimized semantic features and optimized rendering features.
  • the computer equipment can perform feature fusion processing on the optimized semantic features and the optimized rendering features to obtain an optimized feature map, and convert the optimized feature map into an optimized image frame.
  • the semantic features to be repaired refer to the relevant features used to represent the image content in the image frame to be repaired.
  • the rendering features to be repaired refer to related features used to represent the distribution and changes of lighting, hue, etc. in the image frame to be repaired.
  • the image frame to be repaired is one of the M image frames that make up the video data, and M is a positive integer.
  • the pre-order image frame, the image frame to be repaired, the pre-order repair area and the area to be repaired can be input into the target media repair model for repair, and an optimized image frame of the image frame to be repaired can be obtained.
  • the pre-order image frame, the image frame to be repaired, the pre-order repair area and the area to be repaired can be input into the target media repair model; in the target media repair model, the pre-order image frame and the pre-order repair area are Combine to obtain a pre-order combined image; obtain (for example, extract) the pixel feature map and semantic feature map of the pre-order combined image from the pre-order combined image, and obtain (e.g., extract) from the image frame to be repaired
  • the pixel feature map and semantic feature map of the image frame to be repaired; the pixel feature map of the pre-order combined image and the pixel feature map of the image frame to be repaired are feature fused to obtain the attention map; based on the attention map, the pixel feature map of the pre-order combined image is obtained
  • FIG. 8 is a schematic diagram of a repair method provided by an embodiment of the present application.
  • the computer device can combine the pre-order image frame and the pre-order repair area to obtain a pre-order combined image 802, such as the pre-order combined image 8021 and the pre-order combined image shown in Figure 8.
  • Sequentially combined image 8022, etc. Obtain the pixel feature map and semantic feature map of the preamble combined image 802, such as the pixel feature map and semantic feature map of the preamble combined image 8021, and the pixel feature map and semantic feature map of the preamble combined image 8022, etc.
  • Feature fusion is performed on the pixel feature map 8031 of the pre-order combined image 802 and the pixel feature map 8031 of the image frame 801 to be repaired to obtain an attention map; according to the attention map, the semantic repair data is obtained from the semantic feature map of the pre-order combined image.
  • the computer device can obtain the forward optical flow and reverse optical flow of the pre-order image frame and the adjacent frames in the image frame to be repaired and a group of non-adjacent frames through the target media repair model, based on the to-be-repaired image frame.
  • the forward optical flow and reverse optical flow are repaired in the repair area to obtain an optimized optical flow field.
  • the computer device can propagate candidate pixels for the pixels to be repaired in the area to be repaired based on the optical flow trajectory in the optimized optical flow field.
  • the optimized optical flow field may include a forward optical flow field and a reverse optical flow field.
  • the computer equipment obtains a set of candidate pixels by connecting the forward optical flow field and the reverse optical flow field in series, and optimizes the candidate pixel set based on the optical flow trajectory to obtain the pixels to be repaired in the area to be repaired.
  • the candidate pixels of the pixels to be repaired in the area to be repaired can be fused with the effective pixels in the image frame to be repaired, and the pixels to be repaired in the area to be repaired can be pixel optimized to realize the repair of the area to be repaired. Obtain the optimized image frame corresponding to the image frame to be repaired.
  • Figure 9 is a schematic diagram of another repair method provided by an embodiment of the present application.
  • the computer device can obtain the image frame sequence 901 through the target media repair model, including b image frames, such as the preamble image frame 9011, the preamble image frame 9012, and the image frame to be repaired 9013 in Figure 9.
  • b is a positive integer.
  • the image frame sequence 901 is processed respectively to obtain block fusion features corresponding to the u block sizes respectively, where u is a positive integer.
  • the computer device can obtain the first feature map, the second feature map, and the content feature map respectively corresponding to each image frame in the image frame sequence 901. Among them, the first feature map and the second feature map are used for attention processing. Take a block size as an example.
  • the i-th block size can be used to obtain the first feature map 9021 from the first feature maps corresponding to the d image frames, and the i-th block size can be used to obtain the first feature map from the second feature map corresponding to the d image frames.
  • i is a positive integer less than or equal to u
  • h is the height of the image frame
  • w is the width of the image frame
  • r 1 * r 2 refers to the corresponding block size.
  • Regional similarity 903 is obtained through the first block feature 9021 and the second block feature 9022.
  • content block features 9023 are obtained from the content feature maps corresponding to the d image frames.
  • block fusion features corresponding to u block sizes can be obtained.
  • repair methods can also be used to repair the image frame to be repaired to obtain an optimized image frame, which is not limited here.
  • the area prediction method shown in step S501 in Figure 5 can also be used; to repair the repaired image sample and obtain the sample optimized image, the method shown in Figure 5 can be used The repair method shown in step S502 in 5, etc.
  • the image frame to be repaired can be obtained, the image frame to be repaired is predicted based on the target area prediction model, and the area to be repaired in the image frame to be repaired is obtained; the area to be repaired in the image frame to be repaired is based on the target media repair model Repair is performed to obtain the optimized image frame corresponding to the image frame to be repaired; the target area prediction model and the target media repair model are obtained through joint training.
  • joint training and use of multi-tasks are achieved to achieve mutual adjustment and promotion between different tasks, fully learn complementary information and similar information in different tasks, obtain mutual gain effects, and improve model training. efficiency, saving computing resources. Since different tasks can provide each other with enhanced effective information to promote model performance of different tasks, mutually improve the accuracy of the output results of different models, it is conducive to the improvement of model design and effects, thereby improving the accuracy of data repair.
  • the computer device for model training i.e., the computer device shown in Figure 3
  • the computer device for model prediction i.e., the computer device shown in Figure 5
  • the computer device for model training i.e., the computer device shown in Figure 3
  • the computer device for model prediction i.e., the computer device shown in Figure 5
  • This application can be applied to any scenario that requires media repair, such as a video data repair scene or an image repair scene, etc.
  • the computer device can respond to a repair request for video data, obtain M image frames that make up the video data, use the above-mentioned processes shown in Figure 5 to repair the M image frames, and obtain the corresponding M image frames respectively.
  • of optimized image frames converting M Optimized image frames are composed of optimized video data.
  • the repair request for video data is sent by the business device to the computer device, when the computer device obtains the optimized video data, it can also send the optimized video data to the business device.
  • the computer device obtains an upload request for video data
  • M image frames that make up the video data can be obtained, and the M images can be processed using the processes shown in Figure 5 above.
  • the frames are repaired to obtain optimized image frames corresponding to the M image frames, the M optimized image frames are composed of optimized video data, and the optimized video data is uploaded.
  • FIG. 10 is a schematic diagram of a data repair device provided by an embodiment of the present application.
  • the data repair device may be a computer program (including program code, etc.) running in a computer device.
  • the data repair device may be an application software; the device may be used to perform corresponding steps in the method provided by the embodiments of the present application.
  • the data repair apparatus 1000 can be used in the computer equipment in the embodiment corresponding to Figure 3.
  • the device may include: a sample acquisition module 11 , a sample area prediction module 12 , a sample repair module 13 and a model adjustment module 14 .
  • the sample acquisition module 11 is used to acquire the repaired image sample to be repaired, the repair area label corresponding to the repaired image sample, and the original image sample;
  • the sample area prediction module 12 is configured to use the first area prediction model to predict the area to be repaired of the repaired image sample, and obtain the sample predicted repair area;
  • the sample repair module 13 is configured to use the first media repair model to repair the sample predicted repair area in the repaired image sample, and obtain a sample optimized image corresponding to the repaired image sample;
  • the model adjustment module 14 is used to jointly adjust the parameters of the first regional prediction model and the first media repair model based on the sample predicted repair area, repair area label, original image sample and sample optimized image to obtain the corresponding parameters of the first regional prediction model. a target area prediction model, and a target media repair model corresponding to the first media repair model.
  • the device 1000 also includes: an initial prediction module 15, a first adjustment module 16, a first repair module 17, and a repair model generation module 18.
  • the initial prediction module 15 is used to input the repaired image sample into the second area prediction model for prediction, and obtain the initial predicted repaired area in the repaired image sample;
  • the first adjustment module 16 is configured to generate a first loss function based on the initial predicted repair area and the repair area label, and adjust the parameters of the second area prediction model through the first loss function to obtain the first area prediction model;
  • the first repair module 17 is used to input the repaired image sample and the initial predicted repair area into the second media repair model for repair, and obtain the initial optimized image corresponding to the repaired image sample;
  • the repair model generation module 18 is configured to generate a second loss function based on the initial optimized image and the original image sample, and adjust the parameters of the second media repair model through the second loss function to obtain the first media repair model.
  • the repaired image sample is one sample image frame among the N sample image frames that make up the video sample, and N is a positive integer.
  • the device 1000 also includes a preamble acquisition module 19, which is used to obtain the preamble image samples of the repaired image samples in the N sample image frames, and obtain the preamble sample repair area corresponding to the preamble image sample.
  • a preamble acquisition module 19 which is used to obtain the preamble image samples of the repaired image samples in the N sample image frames, and obtain the preamble sample repair area corresponding to the preamble image sample.
  • the sample area prediction module 12 is specifically used to input the pre-order image sample, the repair image sample and the pre-order sample repair area into the first area prediction model, predict the area to be repaired of the repair image sample, and obtain the sample predicted repair area.
  • the sample repair module 13 is specifically used to: input the pre-sequence image sample, the repair image sample, the sample prediction repair area and the pre-sequence sample repair area into the first media repair model to repair the repair image sample and obtain the repair image sample. Corresponding sample optimized image.
  • the device 1000 also includes: a trajectory generation module 20, a data fusion module 21, and a sample generation module 22.
  • the trajectory generation module 20 is used to obtain foreground object samples and conventional video data, perform simulated motion processing on the foreground object samples, and obtain object motion trajectories.
  • the data fusion module 21 is used to fuse foreground object samples and conventional video data based on object motion trajectories to obtain fused video data.
  • the sample generation module 22 is used to perform scene rendering optimization on the fused video data and generate video samples.
  • the model adjustment module 14 includes: a first loss generation unit 141, a second loss generation unit 142, a loss combination unit 143, and a joint adjustment unit 144.
  • the first loss generation unit 141 is used to predict the repair area and the repair area label according to the sample to generate a third loss function
  • the second loss generation unit 142 is configured to generate a fourth loss function based on the original image sample and the sample optimized image;
  • the loss combining unit 143 is used to functionally combine the third loss function and the fourth loss function to obtain a joint loss function
  • the joint adjustment unit 144 is configured to jointly adjust the parameters of the first region prediction model and the first media repair model through a joint loss function to obtain a target region prediction model corresponding to the first region prediction model and a target region prediction model corresponding to the first media repair model. target media repair model.
  • the repaired image sample is one sample image frame among the N sample image frames that make up the video sample, and N is a positive integer.
  • the preamble acquisition module 19 is also used to obtain the preamble image samples of the repaired image samples in the N sample image frames, and obtain the preamble sample repair area corresponding to the preamble image samples.
  • the first loss generation unit 141 includes: a first prediction sub-unit 1411, a second prediction sub-unit 1412, an auxiliary loss generation sub-unit 1413, and a region loss generation sub-unit 1414.
  • the first prediction subunit 1411 is used to input the pre-sample repair area and the sample optimized image into the first area prediction model, predict the area to be repaired in the sample optimized image, and obtain the first prediction area;
  • the second prediction sub-unit 1412 is used to input the repair area of the previous sample and the original image sample into the first area prediction model, predict the area to be repaired of the original image sample, and obtain the second prediction area;
  • the auxiliary loss generation subunit 1413 is used to generate an auxiliary loss function according to the first prediction area and the second prediction area.
  • the regional loss generation subunit 1414 is used to predict the difference data between the repair area and the repair area label based on the sample, and generate a regional difference loss function.
  • the first loss combination subunit 1415 is used to generate a third loss function based on the auxiliary loss function and the regional difference loss function.
  • the second loss generation unit 142 includes: an image loss generation subunit 1421, a result determination subunit 1422, a determination loss generation subunit 1423, and a second loss combination subunit 1424.
  • the image loss generation subunit 1421 is used to determine image difference data between the original image sample and the sample optimized image, and generate an image difference loss function based on the image difference data.
  • the result discrimination subunit 1422 is used to input the original image sample into the first discriminator for detection to obtain the original discrimination result corresponding to the original image sample, and input the sample optimized image into the first discriminator for detection to obtain the optimization corresponding to the sample optimized image. Discrimination results.
  • the discrimination loss generation subunit 1423 is used to generate a discrimination loss function based on the original discrimination result and the optimized discrimination result.
  • the second loss combination subunit 1424 is used to combine the image difference loss function and the discrimination loss function to obtain a fourth loss function.
  • the first regional prediction model includes a regional separation model and a regional identification model.
  • the device 1000 also includes: a separation prediction module 23, Identify the prediction module 24, the loss acquisition module 25, and the model generation module 26.
  • the separation prediction module 23 is used to input the repaired image sample into the initial region separation model for prediction, obtain a binary prediction image, and obtain the separation repair region from the binary prediction image.
  • the recognition prediction module 24 is used to input the repaired image sample into the initial area recognition model for prediction, obtain the predicted border in the repaired image sample, and determine the area corresponding to the predicted border in the repaired image sample as the identified repair area.
  • the loss acquisition module 25 is configured to generate a first area loss function based on the separated repair area and the repair area label, generate a second area loss function based on the identified repair area and the repair area label, and generate a third area loss function based on the separated repair area and the identified repair area. .
  • the model generation module 26 is used to jointly adjust the parameters of the initial region separation model and the initial region identification model according to the first region loss function, the second region loss function and the third region loss function to obtain the region corresponding to the initial region separation model. separation model, and the region recognition model corresponding to the initial region recognition model.
  • Embodiments of the present application provide a data repair device, which can obtain a repaired image sample to be repaired, a repair region label corresponding to the repaired image sample, and an original image sample; and use a first region prediction model to predict the repaired image sample to be repaired.
  • area to obtain the sample predicted repair area use the first media repair model to repair the sample predicted repair area in the repair image sample, and obtain the sample optimized image corresponding to the repair image sample; predict the repair area, repair area label, and original image based on the sample
  • Samples and sample optimization images are used to jointly adjust the parameters of the first area prediction model and the first media repair model to obtain the target area prediction model corresponding to the first area prediction model and the target media repair corresponding to the first media repair model.
  • the image can be repaired based on the target area prediction model and the target media repair model.
  • joint training and use of multi-tasks are achieved to achieve mutual adjustment and promotion between different tasks, fully learn complementary information and similar information in different tasks, obtain mutual gain effects, and improve model training. efficiency, saving computing resources. Since different tasks can provide each other with enhanced effective information to promote model performance of different tasks, mutually improve the accuracy of the output results of different models, it is conducive to the improvement of model design and effects, thereby improving the accuracy of data repair.
  • Figure 11 is a schematic diagram of another data repair device provided by an embodiment of the present application.
  • the data repair device may be a computer program (including program code, etc.) running in the computer device.
  • the data repair device can be an application software.
  • the device can be used to perform corresponding steps in the method provided by the embodiments of the present application.
  • the data repair device 1100 can be used in the computer equipment in the embodiment corresponding to Figure 5.
  • the device can include: an image acquisition module 31, a region prediction module 32 and a data repair module 33.
  • the image acquisition module 31 is used to acquire image frames to be repaired
  • the area prediction module 32 is used to predict the image frame to be repaired based on the target area prediction model, and obtain the area to be repaired of the image frame to be repaired;
  • the data repair module 33 is used to repair the area to be repaired in the image frame to be repaired based on the target media repair model, and obtain the optimized image frame corresponding to the image frame to be repaired, wherein the target area prediction model and the target media repair model are jointly trained owned.
  • the image frame to be repaired is one of the M image frames that make up the video data, and M is a positive integer.
  • the region prediction module 32 includes: a preorder acquisition unit 321 and a region prediction unit 322.
  • the preamble acquisition unit 321 is used to obtain the preamble image frame of the image frame to be repaired among the M image frames, and obtain the preamble repair area corresponding to the preamble image frame.
  • the area prediction unit 322 is used to input the previous repair area, the previous image frame and the image frame to be repaired into the target area prediction model for prediction, Obtain the area to be repaired corresponding to the image frame to be repaired.
  • the data repair module 33 is specifically used to: input the pre-order image frame, the image frame to be repaired, the pre-order repair area and the area to be repaired into the target media repair model for repair, and obtain an optimized image frame of the image frame to be repaired.
  • the region prediction unit 322 includes: a data input sub-unit 3221, an initial prediction sub-unit 3222, and a region adjustment sub-unit 3223.
  • the data input subunit 3221 is used to input the previous repair area, the previous image frame and the image frame to be repaired into the target area prediction model.
  • the initial prediction subunit 3222 is used to predict the image frame to be repaired based on the image continuity between the previous image frame and the image frame to be repaired through the target area prediction model, and obtain the initial prediction area corresponding to the image frame to be repaired.
  • the area adjustment subunit 3223 is used to adjust the initial prediction area through the target area prediction model and based on the area continuity of the previous repair area to obtain the area to be repaired corresponding to the image frame to be repaired.
  • the data repair module 33 includes: a model input unit 331, an image combination unit 332, an atlas acquisition unit 333, a feature fusion unit 334, a repair acquisition unit 335, and an image repair unit 336.
  • the model input unit 331 is used to input the previous image frame, the image frame to be repaired, the previous repair area, and the area to be repaired into the target media repair model.
  • the image combination unit 332 is used to combine the pre-order image frames and the pre-order repair area in the target media repair model to obtain the pre-order combined image.
  • the map acquisition unit 333 is configured to obtain the pixel feature map and semantic feature map of the previous combined image from the previous combined image, and obtain the pixel feature map and semantic feature map of the image frame to be repaired from the image frame to be repaired.
  • the feature fusion unit 334 is used to perform feature fusion on the pixel feature map of the pre-order combined image and the pixel feature map of the image frame to be repaired to obtain an attention map.
  • the repair acquisition unit 335 is configured to obtain semantic repair data from the semantic feature map of the pre-order combined image according to the attention map.
  • the image repair unit 336 is configured to obtain the semantic feature map of the region to be repaired from the semantic feature map of the image frame to be repaired, and perform repair processing on the semantic feature map of the region to be repaired based on the semantic repair data to obtain an optimized image frame of the image frame to be repaired.
  • the region prediction module 32 includes: a data pooling unit 323, a feature convolution unit 324, and a feature prediction unit 325.
  • the data pooling unit 323 is used to use k pooling parameters in the target area prediction model to perform pooling processing on the pre-order repair area, the pre-order image frame and the image frame to be repaired, respectively, to obtain the pre-order repair area, the pre-order repair area, and the pre-order image frame.
  • the k pooling features corresponding to the image frame and the image frame to be repaired respectively, k is a positive integer.
  • the feature convolution unit 324 is used to perform convolution processing on k pooled features respectively to obtain k convolution features.
  • the feature prediction unit 325 is used to perform feature fusion prediction on k convolution features to obtain the area to be repaired of the image frame to be repaired.
  • Figure 12 is a schematic structural diagram of a computer device provided by an embodiment of the present application.
  • the computer device in this embodiment of the present application may include: one or more processors 1201, a memory 1202, and an input and output interface 1203.
  • the processor 1201, the memory 1202 and the input/output interface 1203 are connected through a bus 1204.
  • the memory 1202 is used to store computer programs, which include program instructions.
  • the input and output interface 1203 is used to receive data and output data, such as for data interaction between computer equipment and terminal equipment; the processor 1201 is used to execute the memory 1202 Stored program instructions.
  • the processor 1201 can perform the following operations:
  • the parameters of the first area prediction model and the first media repair model are jointly adjusted to obtain the target area prediction model corresponding to the first area prediction model, and a target media repair model corresponding to the first media repair model.
  • the processor 1201 can perform the following operations:
  • the area to be repaired in the image frame to be repaired is repaired based on the target media repair model to obtain the optimized image frame corresponding to the image frame to be repaired.
  • the target area prediction model and the target media repair model are obtained through joint training.
  • the image frame to be repaired is one of the M image frames that make up the video data, and M is a positive integer.
  • the processor 1201 can perform the following operations:
  • the pre-order image frame, the image frame to be repaired, the pre-order repair area and the area to be repaired are input into the target media repair model for repair, and an optimized image frame of the image frame to be repaired is obtained.
  • the processor 1201 can perform the following operations:
  • the image frame to be repaired is predicted to obtain the initial prediction area corresponding to the image frame to be repaired;
  • the initial prediction area is adjusted to obtain the area to be repaired corresponding to the image frame to be repaired.
  • the processor 1201 can perform the following operations:
  • the pre-order image frame and the pre-order repair area are combined to obtain the pre-order combined image
  • the semantic repair data is obtained from the semantic feature map of the pre-order combined image
  • the semantic feature map of the area to be repaired is obtained from the semantic feature map of the image frame to be repaired, and the area to be repaired is based on the semantic repair data.
  • the semantic feature map is repaired to obtain the optimized image frame of the image frame to be repaired.
  • the processor 1201 when predicting the image frame to be repaired based on the target area prediction model and obtaining the area to be repaired of the image frame to be repaired, the processor 1201 can perform the following operations:
  • k pooling parameters are used to pool the pre-order repair area, pre-order image frame and to-be-repaired image frame respectively to obtain the pre-order repair area, pre-order image frame and to-be-repaired image frame.
  • the corresponding k pooling features respectively, k is a positive integer;
  • the processor 1201 can be a central processing unit (CPU).
  • the processor can also be other general-purpose processors, digital signal processors (DSP), special-purpose integrated processors, etc. Circuit (application specific integrated circuit, ASIC), off-the-shelf programmable gate array (field-programmable gate array, FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc.
  • a general-purpose processor may be a microprocessor or the processor may be any conventional processor, etc.
  • the memory 1202 may include read-only memory and random access memory, and provides instructions and data to the processor 1201 and the input-output interface 1203. A portion of memory 1202 may also include non-volatile random access memory. For example, memory 1202 may also store device type information.
  • the computer device can execute the implementation provided by each step in Figure 3 or Figure 5 through its built-in functional modules.
  • Embodiments of the present application provide a computer device, including: a processor, an input and output interface, and a memory.
  • the processor obtains the computer program in the memory and executes each step of the method shown in Figure 3 or Figure 5 to perform data repair. operate.
  • the embodiment of the present application realizes that the repaired image sample to be repaired, the repaired area label corresponding to the repaired image sample and the original image sample can be obtained; the first area prediction model is used to predict the area to be repaired of the repaired image sample, and the sample predicted repaired area is obtained; Use the first media repair model to repair the sample predicted repair area in the repaired image sample to obtain the sample optimized image corresponding to the repaired image sample; based on the sample predicted repair area, repair area label, original image sample and sample optimized image, perform the repair on the first image sample Parameters of a region prediction model and a first media repair model are jointly adjusted to obtain a target region prediction model corresponding to the first region prediction model and a target media repair model corresponding to the first media repair model.
  • the image can be repaired based on the target area prediction model and the target media repair model.
  • joint training and use of multi-tasks are achieved to achieve mutual adjustment and promotion between different tasks, fully learn complementary information and similar information in different tasks, obtain mutual gain effects, and improve model training. efficiency, saving computing resources. Since different tasks can provide each other with enhanced effective information to promote model performance of different tasks, mutually improve the accuracy of the output results of different models, it is conducive to the improvement of model design and effects, thereby improving the accuracy of data repair.
  • Embodiments of the present application also provide a computer-readable storage medium that stores a computer program.
  • the computer program is adapted to be loaded by the processor and perform the data repair provided by each step in Figure 3 or Figure 5
  • the computer program is adapted to be loaded by the processor and perform the data repair provided by each step in Figure 3 or Figure 5
  • the implementation provided by each step in Figure 3 or Figure 5 please refer to the implementation provided by each step in Figure 3 or Figure 5, and will not be described again here.
  • the description of the beneficial effects of using the same method will not be described again.
  • a computer program may be deployed to execute on one computer device, or on multiple computer devices located at one location, or on multiple computer devices distributed across multiple locations and interconnected by a communications network. implement.
  • the computer-readable storage medium may be the data repair device provided in any of the foregoing embodiments or an internal storage unit of the computer device. Elements, such as the hard drive or memory of a computer device.
  • the computer-readable storage medium can also be an external storage device of the computer device, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card equipped on the computer device, Flash card, etc.
  • the computer-readable storage medium may also include both an internal storage unit of the computer device and an external storage device.
  • the computer-readable storage medium is used to store the computer program and other programs and data required by the computer device.
  • the computer-readable storage medium can also be used to temporarily store data that has been output or is to be output.
  • Embodiments of the present application also provide a computer program product or computer program.
  • the computer program product or computer program includes computer instructions, and the computer instructions are stored in a computer-readable storage medium.
  • the processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the method provided in various optional ways in Figure 3 or Figure 5, thereby realizing the Joint training and use of multi-tasks to achieve mutual adjustment and promotion between different tasks, fully learn complementary information and similar information in different tasks, and obtain mutual gain effects, that is, different tasks can provide each other with
  • the enhanced effective information can promote the performance of models for different tasks, mutually improve the accuracy of the output results of different models, and is conducive to the design and effect of the model, thereby improving the accuracy of data repair.
  • each process and/or the method flowcharts and/or structural schematic diagrams can be implemented by computer program instructions. or blocks, and combinations of processes and/or blocks in flowcharts and/or block diagrams.
  • These computer program instructions may be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data recovery device to produce a machine such that the instructions executed by the processor of the computer or other programmable data recovery device produce a use A device for realizing the functions specified in one process or multiple processes in the flowchart and/or one block or multiple blocks in the structural diagram.
  • These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data repair device to operate in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including the instruction means, the instructions
  • the device implements the functions specified in one process or multiple processes in the flowchart and/or in one block or multiple blocks in the structural diagram.
  • These computer program instructions may also be loaded onto a computer or other programmable data recovery device, causing a series of operational steps to be performed on the computer or other programmable device to produce a computer-implemented process, thereby executing on the computer or other programmable device. Instructions provide steps for implementing the functions specified in a process or processes of a flowchart and/or a block or blocks of a structural representation.

Landscapes

  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Image Processing (AREA)
  • Television Signal Processing For Recording (AREA)

Abstract

Disclosed in embodiments of the present application are a data recovery method and device, a computer, and a readable storage medium. The method comprises: acquiring a recovery image sample to be recovered, a recovery area label corresponding to the recovery image sample, and an original image sample; using a first area prediction model to predict an area to be recovered of the recovery image sample to obtain a sample prediction recovery area; using a first media recovery model to recover the sample prediction recovery area in the recovery image sample to obtain a sample optimization image corresponding to the recovery image sample; and jointly adjusting parameters of the first area prediction model and the first media recovery model according to the sample prediction recovery area, the recovery area label, the original image sample, and the sample optimization image to obtain a target area prediction model corresponding to the first area prediction model and a target media recovery model corresponding to the first media recovery model. By using the present application, the accuracy of data recovery can be improved.

Description

数据修复方法、装置、计算机及可读存储介质Data recovery method, device, computer and readable storage medium
本申请要求2022年04月24日提交的申请号为202210448573.5、发明名称为“数据修复方法、装置、计算机及可读存储介质”的中国专利申请的优先权。This application claims the priority of the Chinese patent application with application number 202210448573.5 and the invention name "data repair method, device, computer and readable storage medium" submitted on April 24, 2022.
技术领域Technical field
本申请涉及计算机技术领域,尤其涉及一种数据修复方法、装置、计算机及可读存储介质。The present application relates to the field of computer technology, and in particular, to a data repair method, device, computer and readable storage medium.
背景技术Background technique
随着深度学习的发展与应用,对于图像的修复也逐渐开始采用深度学习的方式实现。目前,一般是通过将待修复的图像输入到模型中,进行图像的修复处理。这也就使得在该模型中,需要对该待修复的图像进行更为全面的信息识别。也就是说,需要训练更多的参数,用于对图像进行修复处理。With the development and application of deep learning, image repair has gradually begun to be implemented using deep learning. At present, image repair processing is generally performed by inputting the image to be repaired into the model. This also requires more comprehensive information recognition of the image to be repaired in this model. In other words, more parameters need to be trained for image repair.
发明内容Contents of the invention
本申请实施例提供了一种数据修复方法、装置、计算机及可读存储介质,可以提高对数据修复的准确性。Embodiments of the present application provide a data repair method, device, computer and readable storage medium, which can improve the accuracy of data repair.
本申请实施例一方面提供了一种数据修复方法,该方法包括:On the one hand, embodiments of the present application provide a data repair method, which method includes:
获取待修复的修复图像样本、修复图像样本所对应的修复区域标签及原始图像样本;Obtain the repaired image sample to be repaired, the repair area label corresponding to the repaired image sample, and the original image sample;
使用第一区域预测模型预测修复图像样本的待修复区域,得到样本预测修复区域;Use the first area prediction model to predict the area to be repaired of the repaired image sample, and obtain the sample predicted repair area;
使用第一媒体修复模型对所述修复图像样本中的样本预测修复区域进行修复,得到修复图像样本所对应的样本优化图像;Use the first media repair model to repair the sample predicted repair area in the repaired image sample to obtain a sample optimized image corresponding to the repaired image sample;
根据样本预测修复区域、修复区域标签、原始图像样本及样本优化图像,对第一区域预测模型及第一媒体修复模型的参数进行联合调整,得到第一区域预测模型所对应的目标区域预测模型,以及第一媒体修复模型所对应的目标媒体修复模型。According to the sample predicted repair area, repair area label, original image sample and sample optimized image, the parameters of the first area prediction model and the first media repair model are jointly adjusted to obtain the target area prediction model corresponding to the first area prediction model, and a target media repair model corresponding to the first media repair model.
本申请实施例一方面提供了一种数据修复方法,该方法包括:On the one hand, embodiments of the present application provide a data repair method, which method includes:
获取待修复图像帧,基于目标区域预测模型对待修复图像帧进行预测,得到待修复图像帧的待修复区域;Obtain the image frame to be repaired, predict the image frame to be repaired based on the target area prediction model, and obtain the area to be repaired in the image frame to be repaired;
基于目标媒体修复模型对待修复图像帧中的待修复区域进行修复,得到待修复图像帧所对应的优化图像帧,其中,目标区域预测模型与目标媒体修复模型是通过联合训练得到的。The area to be repaired in the image frame to be repaired is repaired based on the target media repair model to obtain the optimized image frame corresponding to the image frame to be repaired. The target area prediction model and the target media repair model are obtained through joint training.
本申请实施例一方面提供了一种数据修复装置,该装置包括:On the one hand, embodiments of the present application provide a data repair device, which includes:
样本获取模块,用于获取待修复的修复图像样本、修复图像样本所对应的修复区域标签及原始图像样本;The sample acquisition module is used to obtain the repaired image sample to be repaired, the repair area label corresponding to the repaired image sample, and the original image sample;
样本区域预测模块,用于使用第一区域预测模型预测修复图像样本的待修复区域,得到样本预测修复区域;The sample area prediction module is used to use the first area prediction model to predict the area to be repaired of the repaired image sample, and obtain the sample predicted repair area;
样本修复模块,用于使用第一媒体修复模型对所述修复图像样本中的样本预测修复区域进行修复,得 到修复图像样本所对应的样本优化图像;The sample repair module is used to use the first media repair model to repair the sample predicted repair area in the repair image sample, to obtain Optimize the image to the sample corresponding to the repaired image sample;
模型调整模块,用于根据样本预测修复区域、修复区域标签、原始图像样本及样本优化图像,对第一区域预测模型及第一媒体修复模型的参数进行联合调整,得到第一区域预测模型所对应的目标区域预测模型,以及第一媒体修复模型所对应的目标媒体修复模型。The model adjustment module is used to jointly adjust the parameters of the first area prediction model and the first media repair model based on the sample prediction repair area, repair area label, original image sample and sample optimized image, and obtain the corresponding parameters of the first area prediction model. a target area prediction model, and a target media repair model corresponding to the first media repair model.
本申请实施例一方面提供了一种数据修复装置,该装置包括:On the one hand, embodiments of the present application provide a data repair device, which includes:
图像获取模块,用于获取待修复图像帧;Image acquisition module, used to acquire image frames to be repaired;
区域预测模块,用于基于目标区域预测模型对待修复图像帧进行预测,得到待修复图像帧的待修复区域;The area prediction module is used to predict the image frame to be repaired based on the target area prediction model and obtain the area to be repaired of the image frame to be repaired;
数据修复模块,用于基于目标媒体修复模型对待修复图像帧中的待修复区域进行修复,得到待修复图像帧所对应的优化图像帧,其中,目标区域预测模型与目标媒体修复模型是通过联合训练得到的。The data repair module is used to repair the area to be repaired in the image frame to be repaired based on the target media repair model, and obtain the optimized image frame corresponding to the image frame to be repaired. The target area prediction model and the target media repair model are jointly trained. owned.
本申请实施例一方面提供了一种计算机设备,包括处理器、存储器、输入输出接口;On the one hand, embodiments of the present application provide a computer device, including a processor, a memory, and an input and output interface;
处理器分别与存储器和输入输出接口相连,其中,输入输出接口用于接收数据及输出数据,存储器用于存储计算机程序,处理器用于调用该计算机程序,以使包含该处理器的计算机设备执行本申请实施例一方面中的数据修复方法。The processor is connected to the memory and the input and output interface respectively. The input and output interface is used to receive data and output data. The memory is used to store the computer program. The processor is used to call the computer program so that the computer device containing the processor executes the computer program. The data repair method in one aspect of the application embodiment.
本申请实施例一方面提供了一种计算机可读存储介质,计算机可读存储介质存储有计算机程序,该计算机程序适于由处理器加载并执行,以使得具有该处理器的计算机设备执行本申请实施例一方面中的数据修复方法。On the one hand, embodiments of the present application provide a computer-readable storage medium. The computer-readable storage medium stores a computer program. The computer program is adapted to be loaded and executed by a processor, so that a computer device having the processor executes the present application. The data repair method in one aspect of the embodiment.
本申请实施例一方面提供了一种计算机程序产品或计算机程序,该计算机程序产品或计算机程序包括计算机指令,该计算机指令存储在计算机可读存储介质中。计算机设备的处理器从计算机可读存储介质读取该计算机指令,处理器执行该计算机指令,使得该计算机设备执行本申请实施例一方面中的各种可选方式中提供的方法。In one aspect, embodiments of the present application provide a computer program product or computer program. The computer program product or computer program includes computer instructions, and the computer instructions are stored in a computer-readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the methods provided in various optional ways in one aspect of the embodiments of the present application.
实施本申请实施例,将具有如下有益效果:Implementing the embodiments of this application will have the following beneficial effects:
在本申请实施例中,可以获取待修复的修复图像样本、修复图像样本所对应的修复区域标签及原始图像样本;使用第一区域预测模型预测修复图像样本的待修复区域,得到样本预测修复区域;使用第一媒体修复模型对修复图像样本中的样本预测修复区域进行修复,得到修复图像样本所对应的样本优化图像;根据样本预测修复区域、修复区域标签、原始图像样本及样本优化图像,对第一区域预测模型及第一媒体修复模型的参数进行联合调整,得到第一区域预测模型所对应的目标区域预测模型,以及第一媒体修复模型所对应的目标媒体修复模型。进一步地,可以基于目标区域预测模型及目标媒体修复模型对图像进行修复处理。通过以上过程,实现了对第一区域预测模型和第一媒体修复模型的多任务联合训练及使用,以实现不同任务之间的相互调整及促进,充分学习不同任务中的互补信息及相似信息等,得到互相增益的效果,提高了模型训练的效率,节省了计算资源。由于不同任务之间可以互相提供增进的有效信息,以促进不同任务的模型表现,相互提升不同模型的输出结果的精确性,有利于模型的设计和效果的提升,从而提高数据修复的准确性。In the embodiment of the present application, the repaired image sample to be repaired, the repaired area label corresponding to the repaired image sample, and the original image sample can be obtained; the first area prediction model is used to predict the area to be repaired of the repaired image sample, and the sample predicted repaired area is obtained ;Use the first media repair model to repair the sample predicted repair area in the repaired image sample to obtain the sample optimized image corresponding to the repaired image sample; based on the sample predicted repair area, repair area label, original image sample and sample optimized image, perform The parameters of the first region prediction model and the first media repair model are jointly adjusted to obtain a target region prediction model corresponding to the first region prediction model and a target media repair model corresponding to the first media repair model. Further, the image can be repaired based on the target area prediction model and the target media repair model. Through the above process, the multi-task joint training and use of the first regional prediction model and the first media repair model are realized to realize mutual adjustment and promotion between different tasks, and fully learn complementary information and similar information in different tasks, etc. , obtain mutual gain effects, improve the efficiency of model training, and save computing resources. Since different tasks can provide each other with enhanced effective information to promote model performance of different tasks, mutually improve the accuracy of the output results of different models, it is conducive to the improvement of model design and effects, thereby improving the accuracy of data repair.
附图说明Description of the drawings
为了更清楚地说明本申请实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要 使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to more clearly explain the technical solutions in the embodiments of the present application or the prior art, the following will describe the technical solutions required in the embodiments or the prior art. The drawings used are used for brief introduction. Obviously, the drawings in the following description are only some embodiments of the present application. For those of ordinary skill in the art, without exerting creative efforts, they can also make drawings based on these drawings. Figure obtains additional drawings.
图1是本申请实施例提供的一种数据修复的网络交互架构图;Figure 1 is a network interaction architecture diagram of data repair provided by an embodiment of the present application;
图2是本申请实施例提供的一种数据修复场景示意图;Figure 2 is a schematic diagram of a data repair scenario provided by an embodiment of the present application;
图3是本申请实施例提供的一种模型训练的方法流程图;Figure 3 is a flow chart of a model training method provided by an embodiment of the present application;
图4是本申请实施例提供的一种多步训练方法示意图;Figure 4 is a schematic diagram of a multi-step training method provided by an embodiment of the present application;
图5是本申请实施例提供的一种数据修复的方法流程图;Figure 5 is a flow chart of a data repair method provided by an embodiment of the present application;
图6是本申请实施例提供的一种区域预测方法示意图;Figure 6 is a schematic diagram of a regional prediction method provided by an embodiment of the present application;
图7是本申请实施例提供的另一种区域预测方法示意图;Figure 7 is a schematic diagram of another regional prediction method provided by an embodiment of the present application;
图8是本申请实施例提供的一种修复方法示意图;Figure 8 is a schematic diagram of a repair method provided by an embodiment of the present application;
图9是本申请实施例提供的另一种修复方法示意图;Figure 9 is a schematic diagram of another repair method provided by an embodiment of the present application;
图10是本申请实施例提供的一种数据修复装置示意图;Figure 10 is a schematic diagram of a data repair device provided by an embodiment of the present application;
图11是本申请实施例提供的另一种数据修复装置示意图;Figure 11 is a schematic diagram of another data repair device provided by an embodiment of the present application;
图12是本申请实施例提供的一种计算机设备的结构示意图。Figure 12 is a schematic structural diagram of a computer device provided by an embodiment of the present application.
具体实施方式Detailed ways
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only some of the embodiments of the present application, rather than all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by those of ordinary skill in the art without creative efforts fall within the scope of protection of this application.
在本申请实施例中,请参见图1,图1是本申请实施例提供的一种数据修复的网络交互架构图。其中,计算机设备101可以与终端设备之间进行数据交互,不同的终端设备之间也可以互相进行数据交互等。其中,该终端设备的数量可以为一个或至少两个。例如终端设备的数量为3个,如图1中所示的终端设备102a、终端设备102b及终端设备102c等。也可以只存在计算机设备101。其中,计算机设备101可以从计算机设备101自身的存储空间中获取修复图像样本,也可以从任意一个或多个终端设备中获取修复图像样本等,在此不做限制。计算机设备101可以基于获取到的修复图像样本,进行模型训练。具体的,计算机设备101可以对第一区域预测模型及第一媒体修复模型进行联合训练,得到第一区域预测模型所对应的目标区域预测模型,以及第一媒体修复模型所对应的目标媒体修复模型等。进一步地,计算机设备101可以基于训练好的目标区域预测模型及目标媒体修复模型,进行数据修复。数据修复例如是视频补全。视频补全是指依据未缺失区域的纹理信息和时序信息,来补全视频中的缺失位置信息或者欲抠除区域。In this embodiment of the present application, please refer to Figure 1. Figure 1 is a network interaction architecture diagram of data repair provided by an embodiment of the present application. Among them, the computer device 101 can perform data exchange with the terminal device, and different terminal devices can also perform data exchange with each other. The number of terminal devices may be one or at least two. For example, the number of terminal devices is three, such as the terminal device 102a, the terminal device 102b, the terminal device 102c, etc. shown in FIG. 1 . It is also possible that only the computer device 101 is present. Among them, the computer device 101 can obtain the repaired image sample from the storage space of the computer device 101 itself, or can obtain the repaired image sample from any one or more terminal devices, etc., which is not limited here. The computer device 101 can perform model training based on the obtained repaired image samples. Specifically, the computer device 101 can jointly train the first region prediction model and the first media repair model to obtain the target region prediction model corresponding to the first region prediction model and the target media repair model corresponding to the first media repair model. wait. Further, the computer device 101 can perform data repair based on the trained target area prediction model and target media repair model. Data repair is, for example, video completion. Video completion refers to completing the missing position information or the area to be cut out in the video based on the texture information and timing information of the non-missing area.
其中,本申请可以涉及人工智能领域的机器学习技术,通过机器学习技术对模型的训练样本进行扩充,以及对模型进行训练等。Among them, this application may involve machine learning technology in the field of artificial intelligence, using machine learning technology to expand the training samples of the model, and to train the model, etc.
其中,人工智能(Artificial Intelligence,AI)是利用数字计算机或者数字计算机控制的机器模拟、延伸和扩展人的智能,感知环境、获取知识并使用知识获得最佳结果的理论、方法、技术及应用系统。换句话说,人工智能是计算机科学的一个综合技术,它企图了解智能的实质,并生产出一种新的能以人类智能相似的方式做出反应的智能机器。人工智能也就是研究各种智能机器的设计原理与实现方法,使机器具有感知、推理与决策的功能。 Among them, artificial intelligence (AI) is the theory, method, technology and application system that uses digital computers or digital computer-controlled machines to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results. . In other words, artificial intelligence is a comprehensive technology of computer science that attempts to understand the essence of intelligence and produce a new intelligent machine that can respond in a similar way to human intelligence. Artificial intelligence is the study of the design principles and implementation methods of various intelligent machines, so that the machines have the functions of perception, reasoning and decision-making.
人工智能技术是一门综合学科,涉及领域广泛,既有硬件层面的技术也有软件层面的技术。人工智能基础技术一般包括如传感器、专用人工智能芯片、云计算、分布式存储、大数据处理技术、操作/交互系统、机电一体化等技术。人工智能软件技术主要包括计算机视觉技术、语音处理技术、自然语言处理技术以及机器学习/深度学习、自动驾驶、智慧交通等几大方向。Artificial intelligence technology is a comprehensive subject that covers a wide range of fields, including both hardware-level technology and software-level technology. Basic artificial intelligence technologies generally include technologies such as sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, big data processing technology, operation/interaction systems, mechatronics and other technologies. Artificial intelligence software technology mainly includes computer vision technology, speech processing technology, natural language processing technology, machine learning/deep learning, autonomous driving, smart transportation and other major directions.
机器学习(Machine Learning,ML)是一门多领域交叉学科,涉及概率论、统计学、逼近论、凸分析、算法复杂度理论等多门学科。专门研究计算机怎样模拟或实现人类的学习行为,以获取新的知识或技能,重新组织已有的知识结构使之不断改善自身的性能。机器学习是人工智能的核心,是使计算机具有智能的根本途径,其应用遍及人工智能的各个领域。机器学习和深度学习通常包括人工神经网络、置信网络、强化学习、迁移学习、归纳学习、式教学习等技术。例如,本申请中对于目标区域预测模型及目标媒体修复模型等的训练及使用等,通过对模型进行训练,以使得模型不断学习新的知识或技能,进而得到训练好的模型,以用于数据修复。Machine Learning (ML) is a multi-field interdisciplinary subject involving probability theory, statistics, approximation theory, convex analysis, algorithm complexity theory and other disciplines. It specializes in studying how computers can simulate or implement human learning behavior to acquire new knowledge or skills, and reorganize existing knowledge structures to continuously improve their performance. Machine learning is the core of artificial intelligence and the fundamental way to make computers intelligent. Its applications cover all fields of artificial intelligence. Machine learning and deep learning usually include artificial neural networks, belief networks, reinforcement learning, transfer learning, inductive learning, teaching learning and other technologies. For example, in this application, for the training and use of target area prediction models and target media repair models, the models are trained to continuously learn new knowledge or skills, and then the trained models are obtained for use in data repair.
随着人工智能技术研究和进步,人工智能技术在多个领域展开研究和应用,例如常见的智能家居、智能穿戴设备、虚拟助理、智能音箱、智能营销、无人驾驶、自动驾驶、无人机、机器人、智能医疗、智能客服、车联网、自动驾驶、智慧交通等,相信随着技术的发展,人工智能技术将在更多的领域得到应用,并发挥越来越重要的价值。With the research and progress of artificial intelligence technology, artificial intelligence technology has been researched and applied in many fields, such as common smart homes, smart wearable devices, virtual assistants, smart speakers, smart marketing, driverless driving, autonomous driving, and drones. , robots, smart medical care, smart customer service, Internet of Vehicles, autonomous driving, smart transportation, etc. It is believed that with the development of technology, artificial intelligence technology will be applied in more fields and play an increasingly important role.
具体的,请参见图2,图2是本申请实施例提供的一种数据修复场景示意图。Specifically, please refer to Figure 2. Figure 2 is a schematic diagram of a data repair scenario provided by an embodiment of the present application.
如图2所示,本申请进行了多任务的模型联合训练,以及基于联合训练后的模型的使用。如图2所示,计算机设备可以获取修复图像,并基于修复图像,对区域预测模型与媒体修复模型进行模型训练及预测使用。举例来说,在进行模型训练时,该修复图像是指待修复的修复图像样本。将修复图像样本输入至第一区域预测模型中进行预测,得到该修复图像样本对应的待修复的样本预测修复区域。在图2中的区域预测模型用于表示第一区域预测模型,修复区域用于表示样本预测修复区域。进一步地,计算机设备可以将修复区域作为第一媒体修复模型的输入,例如,将修复图像样本与样本预测修复区域输入第一媒体修复模型中进行修复,得到修复图像样本所对应的样本优化图像。其中,在进行模型训练时,还包括图2中虚线所指示的部分。例如,模型训练进一步可以对第一区域预测模型与第一媒体修复模型的参数进行联合调整,得到第一区域预测模型所对应的目标区域预测模型,以及第一媒体修复模型所对应的目标媒体修复模型。其中,在模型使用过程中,该修复图像可以是待修复的图像帧,区域预测模型是指目标区域预测模型,修复区域是指待修复区域,媒体修复模型是指目标媒体修复模型,优化图像是指优化图像帧。计算机设备可以将待修复图像帧输入目标区域预测模型,基于目标区域预测模型进行预测,得到待修复图像帧的待修复区域。基于目标媒体修复模型对待修复图像帧中的待修复区域进行修复,得到待修复图像帧所对应的优化图像帧。通过对多任务的模型进行联合训练,可以互相提升模型的输出结果的准确性,不同任务之间提供互相增进的有效信息,以促进不同任务的模型表现,可以提高模型训练的效率,节省计算资源,进而提高了数据修复的准确性。As shown in Figure 2, this application conducts multi-task model joint training and uses the model based on the joint training. As shown in Figure 2, the computer device can obtain the repaired image, and based on the repaired image, model training and prediction use of the regional prediction model and the media repair model. For example, during model training, the repaired image refers to the repaired image sample to be repaired. The repaired image sample is input into the first region prediction model for prediction, and a sample predicted repairing area to be repaired corresponding to the repaired image sample is obtained. The regional prediction model in Figure 2 is used to represent the first regional prediction model, and the repair area is used to represent the sample prediction repair area. Further, the computer device can use the repair area as an input to the first media repair model. For example, the repair image sample and the sample predicted repair area are input into the first media repair model for repair, and a sample optimized image corresponding to the repair image sample is obtained. Among them, during model training, the part indicated by the dotted line in Figure 2 is also included. For example, the model training can further jointly adjust the parameters of the first region prediction model and the first media repair model to obtain a target region prediction model corresponding to the first region prediction model and a target media repair model corresponding to the first media repair model. Model. Among them, during the use of the model, the repaired image can be an image frame to be repaired, the area prediction model refers to the target area prediction model, the repair area refers to the area to be repaired, the media repair model refers to the target media repair model, and the optimized image is Refers to optimizing image frames. The computer device can input the image frame to be repaired into the target area prediction model, perform prediction based on the target area prediction model, and obtain the area to be repaired of the image frame to be repaired. The area to be repaired in the image frame to be repaired is repaired based on the target media repair model to obtain an optimized image frame corresponding to the image frame to be repaired. Through joint training of multi-task models, the accuracy of the model's output results can be mutually improved. Different tasks provide mutually reinforcing effective information to promote the model performance of different tasks, which can improve the efficiency of model training and save computing resources. , thereby improving the accuracy of data repair.
可以理解的是,本申请实施例中所提及的计算机设备包括但不限于终端设备或服务器。换句话说,计算机设备可以是服务器或终端设备,也可以是由服务器和终端设备组成的系统。其中,以上所提及的终端设备可以是一种电子设备,包括但不限于手机、平板电脑、台式电脑、笔记本电脑、掌上电脑、车载设备、增强现实/虚拟现实(Augmented Reality/Virtual Reality,AR/VR)设备、头盔显示器、可穿戴设备、智能音 箱、数码相机、摄像头及其他具备网络接入能力的移动互联网设备(mobile internet device,MID)等。其中,以上所提及的服务器可以是独立的物理服务器,也可以是多个物理服务器构成的服务器集群或者分布式系统,还可以是提供云服务、云数据库、云计算、云函数、云存储、网络服务、云通信、中间件服务、域名服务、安全服务、车路协同、内容分发网络(Content Delivery Network,CDN)、以及大数据和人工智能平台等基础云计算服务的云服务器。It can be understood that the computer equipment mentioned in the embodiments of this application includes but is not limited to terminal equipment or servers. In other words, the computer device can be a server or a terminal device, or it can be a system composed of a server and a terminal device. Among them, the above-mentioned terminal device can be an electronic device, including but not limited to a mobile phone, a tablet computer, a desktop computer, a notebook computer, a handheld computer, a vehicle-mounted device, an augmented reality/virtual reality (AR) /VR) equipment, helmet-mounted displays, wearable devices, smart speakers boxes, digital cameras, cameras and other mobile internet devices (mobile internet devices, MID) with network access capabilities, etc. Among them, the server mentioned above can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or it can provide cloud services, cloud databases, cloud computing, cloud functions, cloud storage, Cloud servers for basic cloud computing services such as network services, cloud communications, middleware services, domain name services, security services, vehicle-road collaboration, Content Delivery Network (CDN), and big data and artificial intelligence platforms.
本申请实施例中所涉及的数据可以存储在计算机设备或终端设备中的任意一个设备或至少两个设备中,或者可以基于云存储技术或区块链网络对该数据进行存储,在此不做限制。The data involved in the embodiments of this application can be stored in any one or at least two devices of computer equipment or terminal equipment, or the data can be stored based on cloud storage technology or blockchain network, which will not be done here. limit.
进一步地,请参见图3,图3是本申请实施例提供的一种模型训练的方法流程图。如图3所示,该模型训练的方法包括如下步骤:Further, please refer to Figure 3, which is a flow chart of a model training method provided by an embodiment of the present application. As shown in Figure 3, the model training method includes the following steps:
步骤S301,获取待修复的修复图像样本、修复图像样本所对应的修复区域标签及原始图像样本。Step S301: Obtain the repaired image sample to be repaired, the repair area label corresponding to the repaired image sample, and the original image sample.
在本申请实施例中,计算机设备可以获取修复图像样本。修复图像样本是指待修复的图像样本。其中,该修复图像样本可以是图像,也可以是组成视频样本的N个样本图像帧中的一个样本图像帧,N为正整数。当该修复图像样本是图像时,计算机设备可以获取该修复图像样本所对应的修复区域标签及原始图像样本。当该修复图像样本是组成视频样本的N个样本图像帧中的一个样本图像帧时,计算机设备可以例如从视频样本中直接获取该修复图像样本所对应的修复区域标签及原始图像样本。修复区域标签例如是通过人工标注生成的修复图像样本中的待修复区域。在本申请中,标签可以是用于表示图像样本或图像帧中像素位置的数值,可以是二值中的一个值。例如,在修复图像样本中,待修复区域中的像素位置的数值用具有二值中的一个值(例如,1)的修复区域标签表示,其余区域中的像素位置的数值用二值中的另一个值(例如,0)表示。所述二值还可以是其他值,例如,1和100,等In the embodiment of the present application, the computer device can obtain the repaired image sample. The repaired image sample refers to the image sample to be repaired. Wherein, the repaired image sample may be an image, or may be one sample image frame among N sample image frames that constitute the video sample, where N is a positive integer. When the repaired image sample is an image, the computer device can obtain the repaired area label and the original image sample corresponding to the repaired image sample. When the repaired image sample is one of the N sample image frames that make up the video sample, the computer device can, for example, directly obtain the repaired area label and the original image sample corresponding to the repaired image sample from the video sample. The repair area label is, for example, the area to be repaired in the repair image sample generated through manual annotation. In this application, the label may be a numerical value used to represent the position of a pixel in an image sample or image frame, and may be one of two values. For example, in the inpainted image sample, the numerical value of the pixel position in the area to be repaired is represented by a repair area label with one of the binary values (for example, 1), and the numerical value of the pixel position in the remaining areas is represented by the other of the binary values. represented by a value (for example, 0). The binary value can also be other values, for example, 1 and 100, etc.
或者,计算机设备可以从其内部存储器或外部查找该修复图像样本所对应的修复区域标签。若查找到该修复区域标签,则计算机设备可以直接获取该修复区域标签。若未查找到该修复区域标签,则计算机设备可以基于该修复图像样本的前序图像样本,预测该修复图像样本的修复区域标签。例如,视频样本中可以包括N个样本图像帧,其中,存在首位图像帧的修复区域标签及关键图像帧的修复区域标签。该首位图像帧是位于N个样本图像帧中的首位的图像帧,N个样本图像帧包括关键图像帧。首位图像帧的修复区域标签及关键图像帧的修复区域标签例如是通过人工标注生成的,用于表示首位图像帧中的待修复区域和关键图像帧中的待修复区域。其中,当该修复图像样本是组成视频样本的N个样本图像帧中的一个样本图像帧时,获取修复图像样本在N个样本图像帧中的前序图像样本,获取前序图像样本所对应的前序样本修复区域。Alternatively, the computer device may search the repaired area label corresponding to the repaired image sample from its internal memory or externally. If the repair area label is found, the computer device can directly obtain the repair area label. If the repair area label is not found, the computer device can predict the repair area label of the repair image sample based on the previous image sample of the repair image sample. For example, the video sample may include N sample image frames, in which there are repair area labels of the first image frame and repair area labels of the key image frames. The first image frame is the first image frame among N sample image frames, and the N sample image frames include key image frames. The repair area label of the first image frame and the repair area label of the key image frame are generated by manual annotation, for example, and are used to represent the area to be repaired in the first image frame and the area to be repaired in the key image frame. Among them, when the repaired image sample is one of the N sample image frames that make up the video sample, the preamble image sample of the repaired image sample in the N sample image frames is obtained, and the preamble image sample corresponding to the preamble image sample is obtained. Preamble sample repair area.
计算机设备可以直接从数据集中获取修复图像样本,或者,可以从互联网等获取修复图像样本,或者,可以生成修复图像样本等,在此不做限制。即计算机设备也可以通过其他方式获取到修复图像样本。本申请中可以采用以上任意一种方式,或多种方式结合的方式,获取到修复图像样本。举例来说,在生成修复图像样本时,计算机设备可以获取原始图像样本,对原始图像样本进行损坏处理,得到修复图像样本。该损坏处理可以包括但不限于添加水印、擦除部分区域、添加区域噪声或区域模糊处理等。通过一个原始图像样本可以生成一个或至少两个相对应的修复图像样本。The computer equipment can directly obtain the repaired image sample from the data set, or can obtain the repaired image sample from the Internet, etc., or can generate the repaired image sample, etc., which are not limited here. That is, computer equipment can also obtain repaired image samples through other methods. In this application, any one of the above methods, or a combination of multiple methods, can be used to obtain the repaired image sample. For example, when generating a repaired image sample, the computer device can obtain the original image sample, perform damage processing on the original image sample, and obtain a repaired image sample. The damage processing may include but is not limited to adding watermarks, erasing part of the area, adding area noise or area blur processing, etc. One or at least two corresponding repaired image samples can be generated from an original image sample.
其中,当修复图像样本是组成视频样本的N个样本图像帧中的一个图像帧时,计算机设备可以通过以下操作生成视频样本。计算机设备可以先获取前景对象样本及常规视频数据,对前景对象样本进行模拟运 动处理,得到对象运动轨迹。该前景对象样本可以是但不限于区域噪声、区域擦除蒙版、物体对象或区域模糊蒙版等。然后,计算机设备基于对象运动轨迹,将前景对象样本与常规视频数据进行融合,得到融合视频数据。接着,计算机设备对融合视频数据进行场景渲染优化,生成视频样本。该场景渲染优化包括但不限于色调调整或光照处理等。通过对融合视频数据进行色调调整或光照处理等后处理,使得得到的视频样本更像真实场景,提高视频样本的真实性。其中,该常规视频数据可以认为是视频样本所对应的原始样本。组成常规视频数据的N个常规视频帧是组成视频样本的N个样本图像帧的原始图像样本。例如,N个常规视频帧中的第一个常规视频帧,是N个样本图像帧中的第一个样本图像帧的原始图像样本等。Wherein, when the repaired image sample is one image frame among N sample image frames that constitute the video sample, the computer device can generate the video sample through the following operations. The computer equipment can first obtain foreground object samples and conventional video data, and then perform simulation operations on the foreground object samples. Motion processing is performed to obtain the object motion trajectory. The foreground object sample may be, but is not limited to, area noise, area erasure mask, object object or area blur mask, etc. Then, the computer device fuses the foreground object samples with conventional video data based on the object's motion trajectory to obtain fused video data. Next, the computer device performs scene rendering optimization on the fused video data to generate video samples. The scene rendering optimization includes but is not limited to tone adjustment or lighting processing. By performing post-processing such as tone adjustment or lighting processing on the fused video data, the obtained video samples are more like real scenes and the authenticity of the video samples is improved. Among them, the conventional video data can be considered as the original sample corresponding to the video sample. The N regular video frames that make up the regular video data are the original image samples that make up the N sample image frames of the video sample. For example, the first regular video frame among N regular video frames is the original image sample of the first sample image frame among N sample image frames, etc.
步骤S302,基于第一区域预测模型预测修复图像样本的待修复区域,得到样本预测修复区域。Step S302: Predict the area to be repaired of the repaired image sample based on the first area prediction model to obtain the sample predicted repair area.
在本申请实施例中,计算机设备可以将修复图像样本输入第一区域预测模型进行预测,得到样本预测修复区域。样本预测修复区域是修复图像样本中待修复的区域,例如为待移除前景的区域。当修复图像样本是组成视频样本的N个样本图像帧中的一个样本图像帧时,计算机设备可以将前序图像样本、修复图像样本及前序样本修复区域输入第一区域预测模型,预测修复图像样本的待修复区域,得到样本预测修复区域。前序样本修复区域例如是前序图像样本中待修复的区域。所述预测得到的样本预测修复区域中的像素位置的数值例如是用与标签对应的二值中的一个值(例如,1)表示的。In this embodiment of the present application, the computer device can input the repaired image sample into the first area prediction model for prediction, and obtain the sample predicted repair area. The sample predicted repair area is the area to be repaired in the repair image sample, for example, the area to be removed foreground. When the repaired image sample is one of the N sample image frames that make up the video sample, the computer device can input the pre-order image sample, the repaired image sample and the pre-order sample repair area into the first region prediction model to predict the repaired image The area to be repaired of the sample is obtained to obtain the predicted repair area of the sample. The preamble sample repair area is, for example, the area to be repaired in the preamble image sample. The predicted value of the pixel position in the sample prediction repair area is, for example, represented by one of the two values corresponding to the label (for example, 1).
该前序图像样本的数量可以为p,p为小于或等于前序数量阈值的自然数。对于N个样本图像帧中的首位图像帧来说,不存在前序图像样本。计算机设备可以将N个样本图像帧中位于修复图像样本之前的样本图像帧,确定为该修复图像样本的前序图像样本。或者,计算机设备可以在N个样本图像帧中,获取位于修复图像样本之前的样本图像帧的样本图像帧数。若该样本图像帧数小于或等于前序数量阈值,则计算机设备将位于修复图像样本之前的样本图像帧,确定为该修复图像样本的前序图像样本。若该样本图像帧数大于前序数量阈值,则计算机设备在N个样本图像帧中,以修复图像样本为基础,依次向前获取前序数量阈值所对应的样本图像帧(前序数量阈值个样本图像帧),作为该修复图像样本的前序图像样本。或者,计算机设备可以对视频样本进行语义解析,得到N个样本图像帧分别对应的样本图像语义信息。计算机设备基于样本图像语义信息将N个样本图像帧分为一个或至少两个样本集群,每个样本集群中所包括的样本图像帧在视频样本中连续且样本图像语义信息的相似度大于图像相似阈值。计算机设备可以获取修复图像样本所在的目标样本集群,将目标样本集群中位于该修复图像样本之前的样本图像帧,确定为该修复图像样本的前序图像样本。The number of preorder image samples may be p, where p is a natural number less than or equal to the preorder quantity threshold. For the first image frame among the N sample image frames, there is no preceding image sample. The computer device may determine a sample image frame located before the repaired image sample among the N sample image frames as a preceding image sample of the repaired image sample. Alternatively, the computer device may obtain the sample image frame number of the sample image frame located before the repaired image sample among the N sample image frames. If the number of sample image frames is less than or equal to the preamble number threshold, the computer device determines the sample image frame located before the repaired image sample as the preamble image sample of the repaired image sample. If the number of sample image frames is greater than the pre-order quantity threshold, the computer device will sequentially obtain the sample image frames corresponding to the pre-order quantity threshold (pre-order quantity threshold) based on the repaired image samples among the N sample image frames. sample image frame), as the preamble image sample of the repaired image sample. Alternatively, the computer device can perform semantic analysis on the video samples to obtain sample image semantic information corresponding to N sample image frames. The computer device divides the N sample image frames into one or at least two sample clusters based on the sample image semantic information. The sample image frames included in each sample cluster are continuous in the video sample and the similarity of the sample image semantic information is greater than the image similarity. threshold. The computer device can obtain the target sample cluster where the repaired image sample is located, and determine the sample image frame located before the repaired image sample in the target sample cluster as the preceding image sample of the repaired image sample.
举例来说,假定该修复图像样本是N个样本图像帧中的第t个样本图像帧。可以将该修复图像样本记作Xt,将该修复图像样本的前序图像样本的数量记作p,得到该修复图像样本的前序图像样本为(Xt-p,…,Xt-2,Xt-1),p为小于或等于前序数量阈值的自然数。也就是说,当该修复图像样本为视频样本的首位图像帧时,修复图像样本不存在前序图像样本。当该修复图像样本为视频样本的第二个图像帧时,修复图像样本存在一个前序图像样本等。上述前序图像样本(Xt-p,…,Xt-2,Xt-1)仅为一种可能的表现形式。在该例子下,前序图像样本的数量为至少三个。将前序图像样本Xt-p的前序样本修复区域记作Bt-p,…,将前序图像样本Xt-2的前序样本修复区域记作Bt-2,将前序图像样本Xt-1的前序样本修复区域记作Bt-1等。计算机设备可以将前序图像样本、修复图像样本及前序图像样本的前序样本修复区域,即(Xt-p,…,Xt-2,Xt-1,Xt,Bt-p,…,Bt-2,Bt-1),输入第一区域预测模型进行预测,得到样本预测修复区域,记作前序图像样本、修复图像样本与前序图像样本的前序样本修复区域的排列顺序,可以根据模型需要进行调整,在此不 做限制。该前序样本修复区域是指对应的前序图像样本的前序修复区域标签。若视频样本中存在首位图像帧的修复区域标签及关键图像帧的修复区域标签,则可以基于第一区域预测模型,预测前序常规图像样本的前序样本修复区域。该前序常规图像样本是该前序图像样本中,除首位图像帧及关键图像帧之外的图像帧。For example, assume that the repaired image sample is the t-th sample image frame among N sample image frames. The repaired image sample can be recorded as t-1 ), p is a natural number less than or equal to the preorder quantity threshold. That is to say, when the repaired image sample is the first image frame of the video sample, there is no preceding image sample in the repaired image sample. When the repaired image sample is the second image frame of the video sample, the repaired image sample has a preamble image sample, etc. The above-mentioned pre-order image samples (X tp , ..., X t-2 , X t-1 ) are only one possible expression form. In this example, the number of preamble image samples is at least three. Let the preamble sample repair area of the preamble image sample The pre-sequence sample repair area of 1 is denoted as B t-1 and so on. The computer device can process the preamble image sample, the repaired image sample and the preamble sample repair area of the preamble image sample, that is, (X tp ,..., X t-2 , X t-1 , X t , B tp ,..., B t-2 , B t-1 ), input the first area prediction model for prediction, and obtain the sample predicted repair area, denoted as The order in which the pre-order image samples, repaired image samples and pre-order sample repair areas of the pre-order image samples are arranged can be adjusted according to the needs of the model and will not be discussed here. Make restrictions. The pre-order sample repair area refers to the pre-order repair area label of the corresponding pre-order image sample. If there is a repair area label of the first image frame and a repair area label of the key image frame in the video sample, the repair area of the previous sample of the previous regular image sample can be predicted based on the first area prediction model. The preamble regular image sample is an image frame in the preamble image sample except the first image frame and the key image frame.
步骤S303,使用第一媒体修复模型对修复图像样本中的样本预测修复区域进行修复,得到修复图像样本所对应的样本优化图像。Step S303: Use the first media repair model to repair the sample predicted repair area in the repaired image sample to obtain a sample optimized image corresponding to the repaired image sample.
在本申请实施例中,计算机设备可以将样本预测修复区域及修复图像样本输入第一媒体修复模型进行修复,得到修复图像样本所对应的样本优化图像。当修复图像样本是组成视频样本的N个样本图像帧中的一个样本图像帧时,可以将前序图像样本、修复图像样本、样本预测修复区域及前序样本修复区域,例如(Xt-p,…,Xt-2,Xt-1,Xt,Bt-p,…,Bt-2,Bt-1),输入第一媒体修复模型,以对修复图像样本进行修复,得到修复图像样本所对应的样本优化图像。其中,前序图像样本、修复图像样本、样本预测修复区域及前序图像样本的前序样本修复区域的排列顺序,可以根据模型需要进行调整,在此不做限制。In this embodiment of the present application, the computer device can input the sample predicted repair area and the repaired image sample into the first media repair model for repair, and obtain a sample optimized image corresponding to the repaired image sample. When the repaired image sample is one of the N sample image frames that make up the video sample, the preamble image sample, the repaired image sample, the sample prediction repair area and the preamble sample repair area can be combined, for example (X tp ,… ,X t-2 ,X t-1 ,X t ,B tp ,…,B t-2 ,B t-1 , ), input the first media repair model to repair the repaired image sample, and obtain a sample optimized image corresponding to the repaired image sample. Among them, the order of arrangement of the pre-order image samples, repaired image samples, sample prediction repair areas and pre-order sample repair areas of the pre-order image samples can be adjusted according to the needs of the model, and is not limited here.
步骤S304,根据样本预测修复区域、修复区域标签、原始图像样本及样本优化图像,对第一区域预测模型及第一媒体修复模型的参数进行联合调整,得到第一区域预测模型所对应的目标区域预测模型,以及第一媒体修复模型所对应的目标媒体修复模型。Step S304: Jointly adjust the parameters of the first region prediction model and the first media repair model based on the sample predicted repair area, repair area label, original image sample, and sample optimized image to obtain the target area corresponding to the first area prediction model. a prediction model, and a target media repair model corresponding to the first media repair model.
在本申请实施例中,计算机设备可以根据样本预测修复区域及修复区域标签生成第三损失函数,根据原始图像样本及样本优化图像生成第四损失函数。其中,该第三损失函数可以是h1个第一模型损失函数中的任意一个,或由h1个第一模型损失函数中的至少两个组合得到,或由h1个第一模型损失函数中的至少两个加权组合得到。h1为正整数。该h1个第一模型损失函数可以包括如公式①所示的损失函数:
In this embodiment of the present application, the computer device can generate a third loss function based on the sample prediction of the repair area and the repair area label, and a fourth loss function based on the original image sample and the sample optimized image. Wherein, the third loss function can be any one of h 1 first model loss functions, or be obtained by a combination of at least two of h 1 first model loss functions, or be obtained by h 1 first model loss functions Obtained by weighted combination of at least two of . h 1 is a positive integer. The h 1 first model loss function can include the loss function shown in formula ①:
如公式①所示,LCE用于表示一种第一模型损失函数,Bgt用于表示该修复图像样本的修复区域标签(用于表示修复图像样本中真实的待修复区域),用于表示样本预测修复区域。As shown in formula ①, L CE is used to represent a first model loss function, B gt is used to represent the repair area label of the repair image sample (used to represent the real area to be repaired in the repair image sample), Used to represent the sample predicted repair area.
该h1个第一模型损失函数还可以包括如公式②所示的损失函数:
The h 1 first model loss function can also include the loss function shown in formula ②:
如公式②所示,Lfocal用于表示一种第一模型损失函数,Bgt用于表示该修复图像样本的修复区域标签(用于表示修复图像样本中真实的待修复区域),用于表示样本预测修复区域。γ是一种指数参数,可以是基于经验值得到的,也可以是常用的参数值等。As shown in formula ②, L focal is used to represent a first model loss function, B gt is used to represent the repair area label of the repair image sample (used to represent the real area to be repaired in the repair image sample), Used to represent the sample predicted repair area. γ is an exponential parameter, which can be obtained based on empirical values or commonly used parameter values.
其中,以上公式①及公式②是例举的可能的第一模型损失函数。h1个第一模型损失函数也可以包括其他的损失函数,如交并比损失(intersection over union loss,IoU loss)及广义交并比损失(Generalized Intersection over Union,GIoU loss)等,在此不做限制。Among them, the above formula ① and formula ② are examples of possible first model loss functions. h 1 first model loss function can also include other loss functions, such as intersection over union loss (IoU loss) and generalized intersection over union loss (GIoU loss), etc., which are not mentioned here. Make restrictions.
修复图像样本是组成视频样本的N个样本图像帧中的一个样本图像帧。可以将h1个第一模型损失函数中的任意一个第一模型损失函数,确定为第三损失函数。或者,可以将h1个第一模型损失函数中的至少两个第一模型损失函数进行组合,得到第三损失函数。或者,可以将h1个第一模型损失函数中的至少两个第一模型损失函数进行加权求和,得到第三损失函数。或者,可以基于样本预测修复区域及修复区域标签之间的差异数据,生成区域差异损失函数,基于第二判别器对第一区域预测模型进行判别检测,得到辅助损失函数,基于区域差异损失函数与辅助损失函数生成第三损失函数。具体的,可以将前序样本修复区域 及样本优化图像输入第一区域预测模型进行预测(预测样本优化图像的待修复区域),得到第一预测区域。可以在前序图像样本中获取与修复图像样本相邻的邻接图像样本,将该邻接图像样本的前序样本修复区域及样本优化图像输入第一区域预测模型进行预测,得到第一预测区域。将前序样本修复区域及原始图像样本输入第一区域预测模型进行预测(预测原始图像样本的待修复区域),得到第二预测区域。可以将邻接图像样本的前序样本修复区域及原始图像样本输入第一区域预测模型进行预测,得到第二预测区域。根据第一预测区域及第二预测区域,生成辅助损失函数。该辅助损失函数的一种可能的生成方式可以参见公式③所示:
The repaired image sample is one sample image frame among the N sample image frames that make up the video sample. Any one of the h 1 first model loss functions can be determined as the third loss function. Alternatively, at least two first model loss functions among h 1 first model loss functions may be combined to obtain a third loss function. Alternatively, at least two first model loss functions among h 1 first model loss functions can be weighted and summed to obtain a third loss function. Alternatively, a regional difference loss function can be generated based on the difference data between the sample prediction repair area and the repair area label, and the second discriminator is used to perform discriminant detection on the first regional prediction model to obtain an auxiliary loss function. Based on the regional difference loss function and The auxiliary loss function generates a third loss function. Specifically, the pre-sequence sample repair area can be And the sample optimized image is input into the first region prediction model for prediction (predicting the area to be repaired in the sample optimized image), and the first prediction region is obtained. The adjacent image sample adjacent to the repaired image sample can be obtained from the pre-order image sample, and the pre-order sample repair area and the sample optimized image of the adjacent image sample are input into the first area prediction model for prediction, and the first prediction area is obtained. The pre-sequence sample repair area and the original image sample are input into the first area prediction model for prediction (predicting the area to be repaired of the original image sample), and a second prediction area is obtained. The pre-sequence sample repair area and the original image sample of the adjacent image sample can be input into the first area prediction model for prediction to obtain the second prediction area. An auxiliary loss function is generated based on the first prediction area and the second prediction area. A possible way to generate this auxiliary loss function can be found in formula ③:
如公式③所示,LDS用于表示辅助损失函数,DS用于表示第二判别器,NetS用于表示第一区域预测模型,Yt用于表示原始图像样本,Bt-1用于表示邻接图像样本的前序样本修复区域,用于表示样本优化图像。也就是说,NetS(Yt,Bt-1)用于表示第二预测区域,用于表示第一预测区域。进一步地,可以将第一预测区域输入第二判别器进行检测,得到第一区域检测结果,将第二预测区域输入第二判别器进行检测,得到第二区域检测结果,根据第一区域检测结果与第二区域检测结果的差异数据,生成辅助损失函数。通过第一媒体修复模型的相关数据对第一区域预测模型进行参数调整,使得第一区域预测模型的输出结果更适用且有利于第一媒体修复模型的任务执行,实现了不同模型之间的相互促进优化,提高了模型训练的速度,节省了计算资源,进而提高数据修复的准确性。As shown in formula ③, L DS is used to represent the auxiliary loss function, D S is used to represent the second discriminator, NetS is used to represent the first region prediction model, Y t is used to represent the original image sample, and B t-1 is used to represent Represents the preorder sample repair area of adjacent image samples, Used to represent sample optimization images. That is to say, NetS(Y t ,B t-1 ) is used to represent the second prediction area, Used to represent the first prediction area. Further, the first prediction area can be input into the second discriminator for detection to obtain the first area detection result, and the second prediction area can be input into the second discriminator for detection to obtain the second area detection result. According to the first area detection result The difference data from the second region detection results generates an auxiliary loss function. The parameters of the first region prediction model are adjusted through the relevant data of the first media repair model, so that the output results of the first region prediction model are more applicable and beneficial to the task execution of the first media repair model, and the interaction between different models is realized. It promotes optimization, improves the speed of model training, saves computing resources, and thereby improves the accuracy of data repair.
进一步地,可以根据样本预测修复区域及修复区域标签之间的差异数据,生成区域差异损失函数。其中,该区域差异损失函数可以是根据h1个第一模型损失函数所生成的。例如区域差异损失函数可以是h1个第一模型损失函数中的任意一个,或由h1个第一模型损失函数中的至少两个组合得到,或由h1个第一模型损失函数中的至少两个加权组合得到。可以根据辅助损失函数与区域差异损失函数,生成第三损失函数。Furthermore, a regional difference loss function can be generated based on the difference data between the sample prediction repair area and the repair area label. Wherein, the regional difference loss function may be generated based on h 1 first model loss functions. For example, the regional difference loss function can be any one of h 1 first model loss functions, or be obtained by a combination of at least two of h 1 first model loss functions, or be obtained by a combination of h 1 first model loss functions. At least two weighted combinations are obtained. The third loss function can be generated based on the auxiliary loss function and the regional difference loss function.
其中,可以将该第三损失函数记作Lseg。例如,该Lseg=LCE,或者,Lseg=Lfocal,或者,Lseg=LCE+…+Lfocal,或者,Lseg=λLCE+…+μLfocal等,在此不做限制,其中,λ及μ等用于表示对应的第一模型损失函数的函数权重。当修复图像样本是组成视频样本的N个样本图像帧中的一个样本图像帧时,第三损失函数还可以包括辅助损失函数,如,Lseg=LCE+…+Lfocal+LDS等。Wherein, the third loss function can be recorded as L seg . For example, L seg =L CE , or L seg =L focal , or L seg =L CE +...+L focal , or L seg =λL CE +...+μL focal , etc., which are not limited here. Among them, λ, μ, etc. are used to represent the function weight of the corresponding first model loss function. When the repaired image sample is one of the N sample image frames that make up the video sample, the third loss function may also include an auxiliary loss function, such as L seg =L CE +...+L focal +L DS , etc.
进一步地,可以根据h2个第二模型损失函数生成第四损失函数。该第四损失函数可以是h2个第二模型损失函数中的任意一个,或由h2个第二模型损失函数中的至少两个组合得到,或由h2个第二模型损失函数中的至少两个加权组合得到。h2为正整数。该h2个第二模型损失函数可以包括如公式④所示的损失函数:
Further, a fourth loss function can be generated according to h 2 second model loss functions. The fourth loss function may be any one of the h 2 second model loss functions, or be obtained by a combination of at least two of the h 2 second model loss functions, or be obtained by a combination of the h 2 second model loss functions. At least two weighted combinations are obtained. h 2 is a positive integer. The h 2 second model loss function can include the loss function shown in formula ④:
如公式④所示,Lsec用于表示一种第二模型损失函数,Yt用于表示原始图像样本,用于表示样本优化图像。“||||2”用于表示一种运算符号。As shown in formula ④, L sec is used to represent a second model loss function, Y t is used to represent the original image sample, Used to represent sample optimization images. "|||| 2 " is used to represent an operation symbol.
该h2个第二模型损失函数可以包括如公式⑤所示的损失函数:
The h 2 second model loss function can include a loss function as shown in formula ⑤:
如公式⑤所示,Lstyle用于表示一种第二模型损失函数,F可以是一种神经网络,如视觉几何群网络(Visual Geometry Group Network,VGG)等。 As shown in formula ⑤, L style is used to represent a second model loss function, and F can be a neural network, such as Visual Geometry Group Network (VGG), etc.
该h2个第二模型损失函数可以包括如公式⑥所示的损失函数:
The h 2 second model loss function can include a loss function as shown in formula ⑥:
如公式⑥所示,Lgan用于表示一种第二模型损失函数,D用于表示第一判别器。As shown in formula ⑥, Lgan is used to represent a second model loss function, and D is used to represent the first discriminator.
其中,以上公式④至公式⑥是例举的可能的第二模型损失函数。h2个第二模型损失函数也可以包括其他的损失函数,如交叉熵损失函数或逐点差异损失函数等,在此不做限制。Among them, the above formula ④ to formula ⑥ are examples of possible second model loss functions. The h 2 second model loss function can also include other loss functions, such as cross-entropy loss function or point-by-point difference loss function, etc., which are not limited here.
一种示例的第四损失函数生成方式中,可以获取原始图像样本与样本优化图像之间的图像差异数据,根据图像差异数据生成图像差异损失函数,可以参见公式④及公式⑤等。将原始图像样本输入第一判别器进行检测,得到原始图像样本所对应的原始判别结果,将样本优化图像输入第一判别器进行检测,得到样本优化图像所对应的优化判别结果,根据原始判别结果与优化判别结果,生成判别损失函数。可以参见公式⑥所示,其中,D(Yt)用于表示原始判别结果,用于表示优化判别结果。对图像差异损失函数与判别损失函数进行组合,得到第四损失函数。其中,可以将第四损失函数记作Linput,如,Linput=Lsec,或Linput=Lstyle,或Linput=Lsec+Lgan等。In an example fourth loss function generation method, the image difference data between the original image sample and the sample optimized image can be obtained, and the image difference loss function is generated based on the image difference data. See formula ④ and formula ⑤, etc. The original image sample is input into the first discriminator for detection, and the original discrimination result corresponding to the original image sample is obtained. The sample optimized image is input into the first discriminator for detection, and the optimized discrimination result corresponding to the sample optimized image is obtained. According to the original discrimination result and optimize the discrimination results to generate a discrimination loss function. It can be seen as shown in formula ⑥, where D(Y t ) is used to represent the original discrimination result, Used to represent optimization discrimination results. The image difference loss function and the discrimination loss function are combined to obtain the fourth loss function. Among them, the fourth loss function can be recorded as L input , for example, L input =L sec , or L input =L style , or L input =L sec +L gan , etc.
进一步地,可以对第三损失函数与第四损失函数进行函数结合,得到联合损失函数,记作LALL。通过联合损失函数对第一区域预测模型及第一媒体修复模型的参数进行联合调整,得到第一区域预测模型所对应的目标区域预测模型,以及第一媒体修复模型所对应的目标媒体修复模型。Furthermore, the third loss function and the fourth loss function can be functionally combined to obtain a joint loss function, denoted as L ALL . The parameters of the first region prediction model and the first media repair model are jointly adjusted through a joint loss function to obtain a target region prediction model corresponding to the first region prediction model and a target media repair model corresponding to the first media repair model.
在本申请实施例中,可以获取待修复的修复图像样本、修复图像样本所对应的修复区域标签及原始图像样本;使用第一区域预测模型预测修复图像样本的待修复区域,得到样本预测修复区域;使用第一媒体修复模型对修复图像样本中的样本预测修复区域进行修复,得到修复图像样本所对应的样本优化图像;根据样本预测修复区域、修复区域标签、原始图像样本及样本优化图像,对第一区域预测模型及第一媒体修复模型的参数进行联合调整,得到第一区域预测模型所对应的目标区域预测模型,以及第一媒体修复模型所对应的目标媒体修复模型。进一步地,可以基于目标区域预测模型及目标媒体修复模型对图像进行修复处理。通过以上过程,实现了对多任务的联合训练及使用,以实现不同任务之间的相互调整及促进,充分学习不同任务中的互补信息及相似信息等,得到互相增益的效果,也就是说,不同任务之间可以互相提供增进的有效信息,以促进不同任务的模型表现,相互提升不同模型的输出结果的精确性,有利于模型的设计和效果的提升,可以提高模型训练的效率,节省计算资源,同时提高了数据修复的准确性。In the embodiment of the present application, the repaired image sample to be repaired, the repaired area label corresponding to the repaired image sample, and the original image sample can be obtained; the first area prediction model is used to predict the area to be repaired of the repaired image sample, and the sample predicted repaired area is obtained ;Use the first media repair model to repair the sample predicted repair area in the repaired image sample to obtain the sample optimized image corresponding to the repaired image sample; based on the sample predicted repair area, repair area label, original image sample and sample optimized image, perform The parameters of the first region prediction model and the first media repair model are jointly adjusted to obtain a target region prediction model corresponding to the first region prediction model and a target media repair model corresponding to the first media repair model. Further, the image can be repaired based on the target area prediction model and the target media repair model. Through the above process, the joint training and use of multiple tasks is achieved to achieve mutual adjustment and promotion between different tasks, fully learn the complementary information and similar information in different tasks, and obtain the effect of mutual gain, that is to say, Different tasks can provide each other with enhanced effective information to promote model performance of different tasks, mutually improve the accuracy of the output results of different models, which is beneficial to the design and effect of the model, can improve the efficiency of model training, and save calculations resources while improving the accuracy of data repair.
计算机设备可以直接获取到第一区域预测模型及第一媒体修复模型,或者,可以进行初步调整,得到第一区域预测模型及第一媒体修复模型。具体的,计算机设备可以获取第二区域预测模型及第二媒体修复模型,将第二区域预测模型确定为第一区域预测模型,将第二媒体修复模型确定为第一媒体修复模型;或者,可以采用修复图像样本对第二区域预测模型进行参数调整,得到第一区域预测模型,采用修复图像样本对第二媒体修复模型进行参数调整,得到第一媒体修复模型等。该第一区域预测模型的数量可以为d个,d为正整数。The computer device can directly obtain the first regional prediction model and the first media repair model, or can perform preliminary adjustments to obtain the first regional prediction model and the first media repair model. Specifically, the computer device can obtain the second regional prediction model and the second media repair model, determine the second regional prediction model as the first regional prediction model, and determine the second media repair model as the first media repair model; or, it can The repaired image sample is used to adjust the parameters of the second region prediction model to obtain the first region prediction model, and the repaired image sample is used to adjust the parameters of the second media repair model to obtain the first media repair model, etc. The number of the first region prediction models may be d, and d is a positive integer.
通过初步调整,得到第一区域预测模型及第一媒体修复模型的过程可以参见图4,图4是本申请实施例提供的一种多步训练方法示意图。如图4所示,该过程可以包括如下步骤:The process of obtaining the first region prediction model and the first media repair model through preliminary adjustments can be seen in Figure 4. Figure 4 is a schematic diagram of a multi-step training method provided by an embodiment of the present application. As shown in Figure 4, the process may include the following steps:
步骤S401,获取待修复的修复图像样本、修复图像样本所对应的修复区域标签及原始图像样本。Step S401: Obtain the repaired image sample to be repaired, the repair area label corresponding to the repaired image sample, and the original image sample.
在本申请实施例中,可以参见图3的步骤S301的相关描述,在此不再进行赘述。In this embodiment of the present application, reference may be made to the relevant description of step S301 in Figure 3 , which will not be described again here.
步骤S402,进行初步调整,得到第一区域预测模型及第一媒体修复模型。 Step S402: Perform preliminary adjustments to obtain a first regional prediction model and a first media repair model.
在本申请实施例中,计算机设备可以获取第二区域预测模型及第二媒体修复模型,采用修复图像样本对第二区域预测模型进行参数调整,得到第一区域预测模型,采用修复图像样本对第二媒体修复模型进行参数调整,得到第一媒体修复模型等。第二区域预测模型例如为初始区域预测模型。第二媒体修复模型例如为初始媒体修复模型。In this embodiment of the present application, the computer device can acquire the second regional prediction model and the second media repair model, use the repaired image sample to adjust parameters of the second regional prediction model, and obtain the first regional prediction model, and use the repaired image sample to adjust the parameters of the second regional prediction model. The parameters of the second media repair model are adjusted to obtain the first media repair model, etc. The second regional prediction model is, for example, the initial regional prediction model. The second media repair model is, for example, the initial media repair model.
具体的,将修复图像样本输入第二区域预测模型进行预测,得到修复图像样本中的初始预测修复区域;根据初始预测修复区域与修复区域标签生成第一损失函数,通过第一损失函数对第二区域预测模型进行参数调整,得到第一区域预测模型。根据所述初始预测修复区域与所述修复区域标签生成第一损失函数包括:根据所述修复区域标签确定所述修复图像样本中真实的待修复区域,根据该真实的待修复区域与所述初始预测修复区域,生成所述第一损失函数。其中,该第一损失函数的生成可以参见第三损失函数的生成方式。在第三损失函数中是基于修复区域标签及样本预测修复区域所得到的,而第一损失函数是基于修复区域标签及初始预测修复区域所得到的,即将第三损失函数中的样本预测修复区域更改为初始预测修复区域,即可以表示第一损失函数的生成方式。将修复图像样本及初始预测修复区域输入第二媒体修复模型进行修复,得到修复图像样本所对应的初始优化图像;根据初始优化图像与原始图像样本生成第二损失函数,通过第二损失函数对第二媒体修复模型进行参数调整,得到第一媒体修复模型。其中,第二损失函数的生成可以参见第四损失函数的生成方式,其中,第四损失函数是基于样本优化图像及原始图像样本所得到的,第二损失函数是基于初始优化图像与原始图像样本所得到的。Specifically, the repaired image sample is input into the second area prediction model for prediction, and the initial predicted repaired area in the repaired image sample is obtained; the first loss function is generated based on the initial predicted repaired area and the repaired area label, and the second loss function is calculated through the first loss function. The parameters of the regional prediction model are adjusted to obtain the first regional prediction model. Generating a first loss function based on the initial predicted repair area and the repair area label includes: determining the real area to be repaired in the repair image sample based on the repair area label, and based on the real area to be repaired and the initial area to be repaired. Predict the repair area and generate the first loss function. Wherein, the generation of the first loss function can refer to the generation method of the third loss function. The third loss function is obtained by predicting the repair area based on the repair area label and the sample, while the first loss function is obtained based on the repair area label and the initial prediction of the repair area, that is, the sample in the third loss function predicts the repair area. Changing to the initial predicted repair area can represent how the first loss function is generated. Input the repaired image sample and the initial predicted repair area into the second media repair model for repair, and obtain the initial optimized image corresponding to the repaired image sample; generate a second loss function based on the initial optimized image and the original image sample, and use the second loss function to The parameters of the second media repair model are adjusted to obtain the first media repair model. For the generation of the second loss function, please refer to the generation method of the fourth loss function, where the fourth loss function is obtained based on the sample optimized image and the original image sample, and the second loss function is based on the initial optimized image and the original image sample. what you get.
该第一区域预测模型的数量可以为d个,d为正整数。例如,第一区域预测模型可以包括区域分离模型及区域识别模型。可以将修复图像样本输入初始区域分离模型进行预测,得到二值预测图像,从二值预测图像中获取分离修复区域。在将修复图像样本输入初始区域分离模型时,还可以同时输入前序修复区域、前序图像帧。所述二值预测图像中,待修复区域中的各像素位置的数值可以用二值中的其中一个值(例如,1)表示,其余区域中的各像素位置的数值用二值中的另一个值(例如,0)表示。将修复图像样本输入初始区域识别模型进行预测,得到修复图像样本中的预测边框,将预测边框在修复图像样本中所对应的区域确定为识别修复区域。根据分离修复区域与修复区域标签生成第一区域损失函数,根据识别修复区域与修复区域标签生成第二区域损失函数,根据分离修复区域与识别修复区域生成第三区域损失函数。根据第一区域损失函数、第二区域损失函数及第三区域损失函数,对初始区域分离模型及初始区域识别模型的参数进行联合调整,得到初始区域分离模型所对应的区域分离模型,以及初始区域识别模型所对应的区域识别模型。d个第一区域预测模型可以包括区域分离模型、区域识别模型或物体检测模型等中的任意一个或多个。由于d个第一区域预测模型的作用均是为了识别修复图像样本中需要进行修复的区域,因此,在理论上,各个第一区域预测模型针对修复图像样本所得到的结果均有一定的相似性,可以对d个第一区域预测模型进行联合训练,以基于预测结果进行相互调整,从而提高需要修复的区域的预测准确性。The number of the first region prediction models may be d, and d is a positive integer. For example, the first region prediction model may include a region separation model and a region identification model. The repaired image sample can be input into the initial region separation model for prediction to obtain a binary prediction image, and the separated repair area can be obtained from the binary prediction image. When inputting the repaired image sample into the initial region separation model, you can also input the pre-order repair area and the pre-order image frame at the same time. In the binary prediction image, the value of each pixel position in the area to be repaired can be represented by one of the two values (for example, 1), and the value of each pixel position in the remaining areas is represented by the other of the two values. value (for example, 0). Input the repaired image sample into the initial area recognition model for prediction, obtain the predicted border in the repaired image sample, and determine the area corresponding to the predicted border in the repaired image sample as the identified repair area. The first area loss function is generated based on the separation of the repair area and the repair area label, the second area loss function is generated based on the identification of the repair area and the repair area label, and the third area loss function is generated based on the separation of the repair area and the identification of the repair area. According to the first regional loss function, the second regional loss function and the third regional loss function, the parameters of the initial regional separation model and the initial regional identification model are jointly adjusted to obtain the regional separation model corresponding to the initial regional separation model, and the initial regional The region recognition model corresponding to the recognition model. The d first region prediction models may include any one or more of a region separation model, a region recognition model, an object detection model, etc. Since the function of the d first area prediction models is to identify the areas that need to be repaired in the repaired image samples, in theory, the results obtained by each first area prediction model for the repaired image samples have certain similarities. , the d first region prediction models can be jointly trained to make mutual adjustments based on the prediction results, thereby improving the prediction accuracy of the regions that need to be repaired.
步骤S403,使用第一区域预测模型预测修复图像样本的待修复区域,得到样本预测修复区域。Step S403: Use the first area prediction model to predict the area to be repaired of the repaired image sample, and obtain the sample predicted repair area.
在本申请实施例中,可以参见图3的步骤S302的相关描述,在此不再进行赘述。In this embodiment of the present application, reference may be made to the relevant description of step S302 in Figure 3 , which will not be described again here.
步骤S404,使用第一媒体修复模型对修复图像样本中的样本预测修复区域进行修复,得到修复图像样本所对应的样本优化图像。Step S404: Use the first media repair model to repair the sample predicted repair area in the repaired image sample to obtain a sample optimized image corresponding to the repaired image sample.
在本申请实施例中,可以参见图3的步骤S303的相关描述,在此不再进行赘述。In this embodiment of the present application, reference may be made to the relevant description of step S303 in Figure 3 , which will not be described again here.
步骤S405,根据样本预测修复区域、修复区域标签、原始图像样本及样本优化图像,对第一区域预测 模型及第一媒体修复模型的参数进行联合调整,得到第一区域预测模型所对应的目标区域预测模型,以及第一媒体修复模型所对应的目标媒体修复模型。Step S405: Predict the repair area, the repair area label, the original image sample and the sample optimized image based on the sample, and predict the first area The parameters of the model and the first media repair model are jointly adjusted to obtain a target area prediction model corresponding to the first area prediction model and a target media repair model corresponding to the first media repair model.
在本申请实施例中,可以参见图3的步骤S304的相关描述,在此不再进行赘述。In this embodiment of the present application, reference may be made to the relevant description of step S304 in Figure 3 , which will not be described again here.
进一步地,可以参见图5,图5是本申请实施例提供的一种数据修复的方法流程图。如图5所示,该方法可以包括如下步骤:Further, please refer to FIG. 5 , which is a flow chart of a data repair method provided by an embodiment of the present application. As shown in Figure 5, the method may include the following steps:
步骤S501,获取待修复图像帧,基于目标区域预测模型对待修复图像帧进行预测,得到待修复图像帧的待修复区域。Step S501: Obtain the image frame to be repaired, predict the image frame to be repaired based on the target area prediction model, and obtain the area to be repaired of the image frame to be repaired.
在本申请实施例中,计算机设备可以将待修复图像帧输入目标区域预测模型进行预测,得到待修复图像帧的待修复区域。其中,一种区域预测方式下,可以在目标区域预测模型中,采用k个池化参数,分别对待修复图像帧进行池化处理,得到待修复图像帧所对应的k个池化特征,k为正整数。对k个池化特征分别进行卷积处理,得到k个卷积特征。对k个卷积特征进行特征融合预测,得到待修复图像帧的待修复区域。In this embodiment of the present application, the computer device can input the image frame to be repaired into the target area prediction model for prediction, and obtain the area to be repaired of the image frame to be repaired. Among them, in a region prediction method, k pooling parameters can be used in the target region prediction model to perform pooling processing on the image frames to be repaired respectively, and k pooling features corresponding to the image frames to be repaired are obtained, and k is Positive integer. Perform convolution processing on k pooled features respectively to obtain k convolution features. Perform feature fusion prediction on k convolution features to obtain the area to be repaired in the image frame to be repaired.
举例来说,可以参见图6,图6是本申请实施例提供的一种区域预测方法示意图。如图6所示,计算机设备可以将待修复图像帧601输入目标区域预测模型中,得到初始图像特征602。计算机设备采用k个池化参数,分别对待修复图像帧的初始图像特征602进行池化处理,得到待修复图像帧所对应的k个池化特征,如池化特征6031、池化特征6032及池化特征6033等。进一步地,计算机设备可以对k个池化特征分别进行卷积处理,得到k个卷积特征,如池化特征6031所对应的卷积特征6041、池化特征6032所对应的卷积特征6042,及池化特征6033所对应的卷积特征6043等。计算机设备可以对k个卷积特征进行特征融合预测,得到待修复图像帧的待修复区域。具体的,计算机设备可以基于初始图像特征602的初始特征尺寸,分别对k个卷积特征进行上采样处理,得到k个卷积特征分别对应的上采样特征。计算机设备对初始图像特征602与k个上采样特征进行特征融合,得到融合特征605。或者,计算机设备对k个上采样特征进行特征融合,得到融合特征605。对融合特征605进行预测,得到预测结果606。该预测结果606包括待修复图像帧的待修复区域6061。For example, please refer to FIG. 6 , which is a schematic diagram of a region prediction method provided by an embodiment of the present application. As shown in Figure 6, the computer device can input the image frame 601 to be repaired into the target area prediction model to obtain the initial image features 602. The computer equipment uses k pooling parameters to perform pooling processing on the initial image features 602 of the image frame to be repaired, and obtains k pooling features corresponding to the image frame to be repaired, such as pooling features 6031, pooling features 6032, and pooling features. Features 6033, etc. Further, the computer device can perform convolution processing on the k pooling features respectively to obtain k convolution features, such as the convolution feature 6041 corresponding to the pooling feature 6031 and the convolution feature 6042 corresponding to the pooling feature 6032. And the convolution feature 6043 corresponding to the pooling feature 6033, etc. The computer equipment can perform feature fusion prediction on k convolution features to obtain the area to be repaired of the image frame to be repaired. Specifically, the computer device can perform upsampling processing on k convolution features based on the initial feature size of the initial image feature 602 to obtain upsampling features corresponding to the k convolution features. The computer device performs feature fusion on the initial image feature 602 and k upsampling features to obtain a fused feature 605. Alternatively, the computer device performs feature fusion on the k upsampled features to obtain the fused feature 605. Predict the fused features 605 to obtain prediction results 606. The prediction result 606 includes the area to be repaired 6061 of the image frame to be repaired.
一种区域预测方式下,可以通过目标区域预测模型,获取待修复图像帧的初始图像特征,对该初始图像特征进行卷积处理,得到初始卷积特征。对该初始卷积特征进行池化处理,得到编码池化特征,以增大感受野。其中,感受野是指特征图上的某个点在输入空间所受影响的区域,例如,特征图上的像素点映射回输入图像上的区域大小。进一步地,对编码池化特征进行反卷积处理,得到解码卷积特征。对该解码卷积特征进行上采样处理,得到该待修复图像帧的预测特征图谱。对该预测特征图谱进行激活处理,得到待修复图像帧的待修复区域。In a region prediction method, the initial image features of the image frame to be repaired can be obtained through the target region prediction model, and the initial image features are convolved to obtain the initial convolution features. The initial convolutional features are pooled to obtain the encoded pooling features to increase the receptive field. Among them, the receptive field refers to the area affected by a certain point on the feature map in the input space. For example, the pixel points on the feature map are mapped back to the size of the area on the input image. Further, the encoded pooling features are deconvolved to obtain the decoded convolution features. The decoded convolution features are upsampled to obtain the prediction feature map of the image frame to be repaired. The prediction feature map is activated to obtain the area to be repaired of the image frame to be repaired.
一种区域预测方式下,可以通过目标区域预测模型,获取待修复图像帧的初始图像特征,对该初始图像特征进行卷积处理,得到初始卷积特征。对该初始卷积特征进行池化处理,得到编码池化特征。对该编码池化特征进行连续卷积处理,即通过r个卷积层,依次对该编码池化特征进行卷积处理,预测得到待修复图像帧的待修复区域,其中,r为正整数。举例来说,参见图7,图7是本申请实施例提供的另一种区域预测方法示意图。如图7所示,计算机设备可以获取待修复图像帧的初始图像特征701,对该初始图像特征701进行卷积处理,得到初始卷积特征702。然后计算机设备可以对该初始卷积特征进行池化处理,得到编码池化特征703。接着计算机设备对该编码池化特征进行连续卷积处理,即通过r个卷积层,依次对 该编码池化特征进行卷积处理,预测得到待修复图像帧704的待修复区域7041。In a region prediction method, the initial image features of the image frame to be repaired can be obtained through the target region prediction model, and the initial image features are convolved to obtain the initial convolution features. The initial convolution feature is pooled to obtain the encoded pooling feature. Perform continuous convolution processing on the coding pooling features, that is, perform convolution processing on the coding pooling features sequentially through r convolution layers, and predict the area to be repaired of the image frame to be repaired, where r is a positive integer. For example, see FIG. 7 , which is a schematic diagram of another regional prediction method provided by an embodiment of the present application. As shown in Figure 7, the computer device can obtain the initial image feature 701 of the image frame to be repaired, and perform convolution processing on the initial image feature 701 to obtain the initial convolution feature 702. The computer device can then pool the initial convolutional features to obtain encoded pooled features 703. Then the computer device performs continuous convolution processing on the encoded pooling features, that is, through r convolution layers, sequentially The coding pooling feature is subjected to convolution processing, and the region to be repaired 7041 of the image frame 704 to be repaired is predicted.
一种区域预测方式下,可以通过目标区域预测模型,获取待修复图像帧的初始图像特征,采用s个卷积尺寸,分别对初始图像特征进行空洞卷积采样,得到s个空洞卷积特征,s为正整数。对s个空洞卷积特征进行特征融合,得到空洞融合特征。对该空洞融合特征进行多尺度特征提取,得到全局特征及局部特征。基于全局特征及局部特征进行预测,得到待修复图像帧中的待修复区域。In a region prediction method, the initial image features of the image frame to be repaired can be obtained through the target region prediction model, and s convolution sizes are used to perform atrous convolution sampling on the initial image features to obtain s atrous convolution features. s is a positive integer. Perform feature fusion on s dilated convolution features to obtain dilated fusion features. Multi-scale feature extraction is performed on the hole fusion feature to obtain global features and local features. Prediction is performed based on global features and local features to obtain the area to be repaired in the image frame to be repaired.
以上仅为例举的几种示例的区域预测方式,也可以采用其他方式预测待修复图像帧中的待修复区域,在此不做限制。The above are just a few examples of region prediction methods. Other methods can also be used to predict the region to be repaired in the image frame to be repaired, and are not limited here.
待修复图像帧是组成视频数据的M个图像帧中的一个图像帧,M为正整数。计算机设备可以在M个图像帧中获取待修复图像帧的前序图像帧,获取前序图像帧所对应的前序修复区域;将前序修复区域、前序图像帧及待修复图像帧输入目标区域预测模型进行预测,得到待修复图像帧所对应的待修复区域。该前序图像帧的数量可以为小于或等于前序数量阈值的自然数。这是由于对于M个图像帧中位于首位的图像帧来说,不存在前序图像帧。具体的,计算机设备可以将M个图像帧中位于待修复图像帧之前的图像帧,确定为该待修复图像帧的前序图像帧。或者,计算机设备可以在M个图像帧中,获取位于待修复图像帧之前的图像帧的图像帧数。若该图像帧数小于或等于前序数量阈值,则计算机设备将位于待修复图像帧之前的图像帧,确定为该待修复图像帧的前序图像帧。若该图像帧数大于前序数量阈值,则在M个图像帧中,计算机设备以待修复图像帧为基础,依次向前获取前序数量阈值所对应的图像帧,作为该待修复图像帧的前序图像帧。或者,计算机设备可以对视频样本进行语义解析,得到M个图像帧分别对应的图像语义信息。计算机设备基于图像语义信息将M个图像帧分为一个或至少两个图像集群,每个图像集群中所包括的图像帧在视频样本中连续且图像语义信息的相似度大于图像相似阈值。计算机设备可以获取待修复图像帧所在的目标图像集群,将目标图像集群中位于该待修复图像帧之前的图像帧,确定为该待修复图像帧的前序图像帧。The image frame to be repaired is one of the M image frames that make up the video data, and M is a positive integer. The computer device can obtain the pre-order image frame of the image frame to be repaired in the M image frames, and obtain the pre-order repair area corresponding to the pre-order image frame; input the pre-order repair area, the pre-order image frame and the pre-order image frame to the target The area prediction model predicts and obtains the area to be repaired corresponding to the image frame to be repaired. The number of pre-order image frames may be a natural number less than or equal to the pre-order number threshold. This is because there is no preceding image frame for the first image frame among the M image frames. Specifically, the computer device may determine the image frame located before the image frame to be repaired among the M image frames as the preceding image frame of the image frame to be repaired. Alternatively, the computer device may obtain the image frame number of the image frame located before the image frame to be repaired among the M image frames. If the number of image frames is less than or equal to the preamble number threshold, the computer device determines the image frame located before the image frame to be repaired as the preamble image frame of the image frame to be repaired. If the number of image frames is greater than the previous number threshold, then among the M image frames, based on the image frame to be repaired, the computer device sequentially acquires the image frames corresponding to the previous number threshold as the image frame to be repaired. Preamble image frame. Alternatively, the computer device can perform semantic analysis on the video samples to obtain image semantic information corresponding to the M image frames. The computer device divides the M image frames into one or at least two image clusters based on the image semantic information, the image frames included in each image cluster are continuous in the video sample and the similarity of the image semantic information is greater than the image similarity threshold. The computer device can obtain the target image cluster in which the image frame to be repaired is located, and determine the image frame in the target image cluster that is located before the image frame to be repaired as the preceding image frame of the image frame to be repaired.
具体的,计算机设备可以将前序修复区域、前序图像帧及待修复图像帧输入目标区域预测模型。一种区域预测方式下,通过目标区域预测模型,基于前序图像帧与待修复图像帧之间的图像连续性,对待修复图像帧进行预测,得到待修复图像帧所对应的初始预测区域。通过目标区域预测模型,基于前序修复区域的区域连续性,对初始预测区域进行调整,得到待修复图像帧所对应的待修复区域。例如,在目标区域预测模型中,采用k个池化参数,分别对前序修复区域、前序图像帧及待修复图像帧进行池化处理,得到前序修复区域、前序图像帧及待修复图像帧分别对应的k个池化特征,k为正整数;对k个池化特征分别进行卷积处理,得到k个卷积特征;对k个卷积特征进行特征融合预测,得到待修复图像帧的待修复区域。Specifically, the computer device can input the previous repair area, the previous image frame, and the image frame to be repaired into the target area prediction model. In one area prediction method, the image frame to be repaired is predicted based on the image continuity between the previous image frame and the image frame to be repaired through the target area prediction model, and the initial prediction area corresponding to the image frame to be repaired is obtained. Through the target area prediction model, based on the regional continuity of the pre-order repair area, the initial prediction area is adjusted to obtain the area to be repaired corresponding to the image frame to be repaired. For example, in the target area prediction model, k pooling parameters are used to perform pooling processing on the pre-order repair area, the pre-order image frame and the image frame to be repaired respectively, and the pre-order repair area, the pre-order image frame and the image frame to be repaired are obtained. K pooling features corresponding to the image frames respectively, k is a positive integer; perform convolution processing on the k pooling features respectively to obtain k convolution features; perform feature fusion prediction on the k convolution features to obtain the image to be repaired The area of the frame to be repaired.
或者,计算机设备可以采用上述任意一种区域预测方式,预测待修复图像帧所对应的待修复区域。具体的,在任意一种区域预测方式中,当计算机设备获取待修复图像帧的初始图像特征时,可以通过目标区域预测模型,对该前序修复区域、前序图像帧及待修复图像帧进行特征融合提取,得到初始图像特征。例如,计算机设备可以分别获取前序修复区域、前序图像帧及待修复图像帧的特征图谱,对前序修复区域、前序图像帧及待修复图像帧的特征图谱进行特征融合处理,得到初始图像特征。或者,计算机设备可以对前序修复区域、前序图像帧及待修复图像帧进行拼接,得到输入数据,获取输入数据的初始图像特征。Alternatively, the computer device can use any of the above-mentioned area prediction methods to predict the area to be repaired corresponding to the image frame to be repaired. Specifically, in any region prediction method, when the computer device obtains the initial image features of the image frame to be repaired, the pre-repair region, the pre-order image frame and the image frame to be repaired can be processed through the target region prediction model. Feature fusion extraction is used to obtain initial image features. For example, the computer device can obtain the feature maps of the pre-order repair area, the pre-order image frame and the image frame to be repaired respectively, and perform feature fusion processing on the feature maps of the pre-order repair area, the pre-order image frame and the image frame to be repaired to obtain the initial Image features. Alternatively, the computer device can splice the pre-order repair area, the pre-order image frame and the image frame to be repaired to obtain the input data and obtain the initial image features of the input data.
该目标区域预测模型的数量可以为d个,d为正整数,如目标区域分离模型或目标区域识别模型等。计算机设备可以基于d个目标区域预测模型分别预测该待修复图像帧的单体预测区域,对d个单体预测区 域进行融合调整,得到待修复图像帧的待修复区域。The number of target area prediction models can be d, where d is a positive integer, such as a target area separation model or a target area identification model. The computer device can respectively predict the individual prediction areas of the image frame to be repaired based on d target area prediction models, and predict the d individual prediction areas. The areas are fused and adjusted to obtain the area to be repaired of the image frame to be repaired.
步骤S502,基于目标媒体修复模型对待修复图像帧中的待修复区域进行修复,得到待修复图像帧所对应的优化图像帧。Step S502: Repair the area to be repaired in the image frame to be repaired based on the target media repair model to obtain an optimized image frame corresponding to the image frame to be repaired.
在本申请实施例中,目标区域预测模型与目标媒体修复模型是通过联合训练得到的。计算机设备可以将待修复图像帧及待修复区域输入目标区域预测模型进行修复,得到待修复图像帧所对应的优化图像帧。具体的,计算机设备可以通过目标媒体修复模型,基于待修复区域确定该待修复图像帧中的有效区域,基于有效区域中的有效图像信息,对该待修复区域进行修复处理,得到待修复图像帧所对应的优化图像帧。或者,计算机设备可以通过目标媒体修复模型,获取待修复图像帧的待修复图像特征,基于待修复区域对该待修复图像特征进行特征解析,得到待修复图像帧的待修复语义特征及待修复渲染特征等。计算机设备可以对该待修复语义特征及待修复渲染特征进行修复处理,得到优化语义特征及优化渲染特征。计算机设备可以对该优化语义特征及优化渲染特征进行特征融合处理,得到优化特征图谱,将优化特征图谱转换为优化图像帧。其中,待修复语义特征是指用于表示待修复图像帧中的图像内容的相关特征。待修复渲染特征是指用于表示待修复图像帧中的光照及色调等的分布及变化等的相关特征。In this embodiment of the present application, the target area prediction model and the target media repair model are obtained through joint training. The computer device can input the image frame to be repaired and the area to be repaired into the target area prediction model for repair, and obtain an optimized image frame corresponding to the image frame to be repaired. Specifically, the computer device can determine the effective area in the image frame to be repaired based on the area to be repaired through the target media repair model, and perform repair processing on the area to be repaired based on the effective image information in the effective area to obtain the image frame to be repaired. The corresponding optimized image frame. Alternatively, the computer device can obtain the image features to be repaired of the image frame to be repaired through the target media repair model, perform feature analysis on the image features to be repaired based on the area to be repaired, and obtain the semantic features to be repaired and the rendering to be repaired of the image frame to be repaired. Features etc. The computer device can perform repair processing on the semantic features to be repaired and the rendering features to be repaired, to obtain optimized semantic features and optimized rendering features. The computer equipment can perform feature fusion processing on the optimized semantic features and the optimized rendering features to obtain an optimized feature map, and convert the optimized feature map into an optimized image frame. Among them, the semantic features to be repaired refer to the relevant features used to represent the image content in the image frame to be repaired. The rendering features to be repaired refer to related features used to represent the distribution and changes of lighting, hue, etc. in the image frame to be repaired.
其中,待修复图像帧是组成视频数据的M个图像帧中的一个图像帧,M为正整数。可以将前序图像帧、待修复图像帧、前序修复区域及待修复区域输入目标媒体修复模型进行修复,得到待修复图像帧的优化图像帧。一种修复方式下,可以将前序图像帧、待修复图像帧、前序修复区域及待修复区域输入目标媒体修复模型中;在目标媒体修复模型中,对前序图像帧与前序修复区域进行组合,得到前序组合图像;从所述前序组合图像中获取(例如,提取)前序组合图像的像素特征图谱及语义特征图谱,从所述待修复图像帧中获取(例如,提取)待修复图像帧的像素特征图谱及语义特征图谱;对前序组合图像的像素特征图谱及待修复图像帧的像素特征图谱进行特征融合,得到注意力图谱;根据注意力图谱,从前序组合图像的语义特征图谱中获取语义修复数据;从待修复图像帧的语义特征图谱中获取待修复区域的语义特征图谱,基于语义修复数据对待修复区域的语义特征图谱进行修复处理,得到待修复图像帧的优化图像帧。Among them, the image frame to be repaired is one of the M image frames that make up the video data, and M is a positive integer. The pre-order image frame, the image frame to be repaired, the pre-order repair area and the area to be repaired can be input into the target media repair model for repair, and an optimized image frame of the image frame to be repaired can be obtained. In one repair method, the pre-order image frame, the image frame to be repaired, the pre-order repair area and the area to be repaired can be input into the target media repair model; in the target media repair model, the pre-order image frame and the pre-order repair area are Combine to obtain a pre-order combined image; obtain (for example, extract) the pixel feature map and semantic feature map of the pre-order combined image from the pre-order combined image, and obtain (e.g., extract) from the image frame to be repaired The pixel feature map and semantic feature map of the image frame to be repaired; the pixel feature map of the pre-order combined image and the pixel feature map of the image frame to be repaired are feature fused to obtain the attention map; based on the attention map, the pixel feature map of the pre-order combined image is obtained Obtain semantic repair data from the semantic feature map; obtain the semantic feature map of the area to be repaired from the semantic feature map of the image frame to be repaired, perform repair processing on the semantic feature map of the area to be repaired based on the semantic repair data, and obtain the optimization of the image frame to be repaired image frame.
举例来说,可以参见图8,图8是本申请实施例提供的一种修复方法示意图。如图8所示,计算机设备在目标媒体修复模型中,可以对前序图像帧与前序修复区域进行组合,得到前序组合图像802,如图8中所示的前序组合图像8021及前序组合图像8022等。获取前序组合图像802的像素特征图谱及语义特征图谱,如前序组合图像8021的像素特征图谱及语义特征图谱,及前序组合图像8022的像素特征图谱及语义特征图谱等。获取待修复图像帧801的像素特征图谱8031及语义特征图谱8032。对前序组合图像802的像素特征图谱及待修复图像帧801的像素特征图谱8031进行特征融合,得到注意力图谱;根据注意力图谱,从前序组合图像的语义特征图谱中获取语义修复数据。获取待修复区域在待修复图像帧中的语义特征图谱804,基于语义修复数据对待修复区域的语义特征图谱进行修复处理,得到待修复图像帧的优化图像帧805。For example, please refer to FIG. 8 , which is a schematic diagram of a repair method provided by an embodiment of the present application. As shown in Figure 8, in the target media repair model, the computer device can combine the pre-order image frame and the pre-order repair area to obtain a pre-order combined image 802, such as the pre-order combined image 8021 and the pre-order combined image shown in Figure 8. Sequentially combined image 8022, etc. Obtain the pixel feature map and semantic feature map of the preamble combined image 802, such as the pixel feature map and semantic feature map of the preamble combined image 8021, and the pixel feature map and semantic feature map of the preamble combined image 8022, etc. Obtain the pixel feature map 8031 and semantic feature map 8032 of the image frame 801 to be repaired. Feature fusion is performed on the pixel feature map 8031 of the pre-order combined image 802 and the pixel feature map 8031 of the image frame 801 to be repaired to obtain an attention map; according to the attention map, the semantic repair data is obtained from the semantic feature map of the pre-order combined image. Obtain the semantic feature map of the area to be repaired in the image frame to be repaired 804, perform repair processing on the semantic feature map of the area to be repaired based on the semantic repair data, and obtain the optimized image frame of the image frame to be repaired 805.
一种修复方式下,计算机设备可以通过目标媒体修复模型,获取前序图像帧与待修复图像帧中的相邻帧及一组非相邻帧的前向光流和反向光流,基于待修复区域对该前向光流及反向光流进行修复,得到优化光流场。进一步,计算机设备可以基于优化光流场中的光流轨迹,为待修复区域中的待修复像素点传播候选像素。具体的,该优化光流场可以包括前向光流场及反向光流场。计算机设备通过串联前向光流场及反向光流场,得到候选像素集合,基于光流轨迹对候选像素集合进行优化,得到待修复区域中的待修复像素 点的候选像素。进一步地,可以对待修复区域中的待修复像素点的候选像素与待修复图像帧中的有效像素进行融合,对该待修复区域中的待修复像素点进行像素优化,实现对待修复区域的修复,得到待修复图像帧所对应的优化图像帧。In one repair method, the computer device can obtain the forward optical flow and reverse optical flow of the pre-order image frame and the adjacent frames in the image frame to be repaired and a group of non-adjacent frames through the target media repair model, based on the to-be-repaired image frame. The forward optical flow and reverse optical flow are repaired in the repair area to obtain an optimized optical flow field. Further, the computer device can propagate candidate pixels for the pixels to be repaired in the area to be repaired based on the optical flow trajectory in the optimized optical flow field. Specifically, the optimized optical flow field may include a forward optical flow field and a reverse optical flow field. The computer equipment obtains a set of candidate pixels by connecting the forward optical flow field and the reverse optical flow field in series, and optimizes the candidate pixel set based on the optical flow trajectory to obtain the pixels to be repaired in the area to be repaired. Candidate pixels for points. Further, the candidate pixels of the pixels to be repaired in the area to be repaired can be fused with the effective pixels in the image frame to be repaired, and the pixels to be repaired in the area to be repaired can be pixel optimized to realize the repair of the area to be repaired. Obtain the optimized image frame corresponding to the image frame to be repaired.
一种修复方式下,可以参见图9,图9是本申请实施例提供的另一种修复方法示意图。如图9所示,计算机设备可以通过目标媒体修复模型,获取图像帧序列901,包括b个图像帧,如图9中的前序图像帧9011、前序图像帧9012及待修复图像帧9013等,b为正整数。采用u个块尺寸,分别对图像帧序列901进行处理,得到u个块尺寸分别对应的块融合特征,其中,u为正整数。对u个块融合特征进行卷积融合处理,得到序列融合特征,对序列融合特征进行特征还原处理,得到图像帧序列901所对应的优化图像帧序列904,如前序图像帧9011所对应的优化图像帧9041、前序图像帧9012所对应的优化图像帧9042及待修复图像帧9013所对应的优化图像帧9043等。具体的,计算机设备可以获取图像帧序列901中的每个图像帧分别对应的第一特征图谱、第二特征图谱及内容特征图谱。其中,第一特征图谱与第二特征图谱用于进行注意力处理。以一个块尺寸为例。可以采用第i个块尺寸,从d个图像帧分别对应的第一特征图谱中获取第一块特征9021,采用第i个块尺寸,从d个图像帧分别对应的第二特征图谱中获取第二块特征9022。其中,第一块特征9021可以认为是由b*h/r1*w/r2个r1*r2的特征组成的,第二块特征9022可以认为是由b*h/r1*w/r2个r1*r2的特征组成的。其中,i为小于或等于u的正整数,h为图像帧的高度,w为图像帧的宽度,r1*r2是指对应的块尺寸。通过第一块特征9021与第二块特征9022获取区域相似性903。采用第i个块尺寸,从d个图像帧分别对应的内容特征图谱中获取内容块特征9023。对区域相似性903与内容块特征9023进行特征融合处理,得到第i个块尺寸所对应的块融合特征。同理,可以得到u个块尺寸分别对应的块融合特征。In one repair method, see Figure 9 , which is a schematic diagram of another repair method provided by an embodiment of the present application. As shown in Figure 9, the computer device can obtain the image frame sequence 901 through the target media repair model, including b image frames, such as the preamble image frame 9011, the preamble image frame 9012, and the image frame to be repaired 9013 in Figure 9. , b is a positive integer. Using u block sizes, the image frame sequence 901 is processed respectively to obtain block fusion features corresponding to the u block sizes respectively, where u is a positive integer. Perform convolution fusion processing on u block fusion features to obtain sequence fusion features. Perform feature restoration processing on the sequence fusion features to obtain an optimized image frame sequence 904 corresponding to the image frame sequence 901, such as the optimization corresponding to the pre-order image frame 9011. The image frame 9041, the optimized image frame 9042 corresponding to the previous image frame 9012, the optimized image frame 9043 corresponding to the image frame 9013 to be repaired, and so on. Specifically, the computer device can obtain the first feature map, the second feature map, and the content feature map respectively corresponding to each image frame in the image frame sequence 901. Among them, the first feature map and the second feature map are used for attention processing. Take a block size as an example. The i-th block size can be used to obtain the first feature map 9021 from the first feature maps corresponding to the d image frames, and the i-th block size can be used to obtain the first feature map from the second feature map corresponding to the d image frames. Two block features 9022. Among them, the first feature 9021 can be considered to be composed of b*h/r 1 *w/r 2 features r 1 *r 2 , and the second feature 9022 can be considered to be composed of b*h/r 1 *w /r consists of 2 features of r 1 * r 2 . Among them, i is a positive integer less than or equal to u, h is the height of the image frame, w is the width of the image frame, and r 1 * r 2 refers to the corresponding block size. Regional similarity 903 is obtained through the first block feature 9021 and the second block feature 9022. Using the i-th block size, content block features 9023 are obtained from the content feature maps corresponding to the d image frames. Perform feature fusion processing on the regional similarity 903 and the content block feature 9023 to obtain the block fusion feature corresponding to the i-th block size. In the same way, block fusion features corresponding to u block sizes can be obtained.
其中,以上仅为例举的几种示例的修复方式,也可以采用其他方式对待修复图像帧进行修复,得到优化图像帧,在此不做限制。Among them, the above are just a few examples of repair methods. Other methods can also be used to repair the image frame to be repaired to obtain an optimized image frame, which is not limited here.
预测修复图像样本的待修复区域,得到样本预测修复区域的方式,也可以采用图5中的步骤S501所示的区域预测方式;对修复图像样本进行修复,得到样本优化图像的方式,可以采用图5中的步骤S502所示的修复方式等。To predict the area to be repaired of the repaired image sample and obtain the sample to predict the repaired area, the area prediction method shown in step S501 in Figure 5 can also be used; to repair the repaired image sample and obtain the sample optimized image, the method shown in Figure 5 can be used The repair method shown in step S502 in 5, etc.
在本申请实施例中,可以获取待修复图像帧,基于目标区域预测模型对待修复图像帧进行预测,得到待修复图像帧的待修复区域;基于目标媒体修复模型对待修复图像帧中的待修复区域进行修复,得到待修复图像帧所对应的优化图像帧;目标区域预测模型与目标媒体修复模型是通过联合训练得到的。通过以上过程,实现了对多任务的联合训练及使用,以实现不同任务之间的相互调整及促进,充分学习不同任务中的互补信息及相似信息等,得到互相增益的效果,提高了模型训练的效率,节省了计算资源。由于不同任务之间可以互相提供增进的有效信息,以促进不同任务的模型表现,相互提升不同模型的输出结果的精确性,有利于模型的设计和效果的提升,从而提高数据修复的准确性。In the embodiment of the present application, the image frame to be repaired can be obtained, the image frame to be repaired is predicted based on the target area prediction model, and the area to be repaired in the image frame to be repaired is obtained; the area to be repaired in the image frame to be repaired is based on the target media repair model Repair is performed to obtain the optimized image frame corresponding to the image frame to be repaired; the target area prediction model and the target media repair model are obtained through joint training. Through the above process, joint training and use of multi-tasks are achieved to achieve mutual adjustment and promotion between different tasks, fully learn complementary information and similar information in different tasks, obtain mutual gain effects, and improve model training. efficiency, saving computing resources. Since different tasks can provide each other with enhanced effective information to promote model performance of different tasks, mutually improve the accuracy of the output results of different models, it is conducive to the improvement of model design and effects, thereby improving the accuracy of data repair.
本申请中进行模型训练的计算机设备(即图3所示的计算机设备)与模型预测的计算机设备(即图5所示的计算机设备)可以是相同的设备,也可以是不同的设备。In this application, the computer device for model training (i.e., the computer device shown in Figure 3) and the computer device for model prediction (i.e., the computer device shown in Figure 5) may be the same device, or they may be different devices.
本申请可以应用于任意一个需要进行媒体修复的场景中,如对视频数据的修复场景或对图像的修复场景等。例如,计算机设备可以响应针对视频数据的修复请求,获取组成该视频数据的M个图像帧,采用上述图5所示的各个过程,对M个图像帧进行修复处理,得到M个图像帧分别对应的优化图像帧,将M个 优化图像帧组成优化视频数据。当该针对视频数据的修复请求是由业务设备发送至计算机设备的时,计算机设备在得到优化视频数据时,还可以将该优化视频数据发送至该业务设备。或者,假定计算机设备获取到针对视频数据的上传请求,若检测到该视频数据存在异常,则可以获取组成该视频数据的M个图像帧,采用上述图5所示的各个过程,对M个图像帧进行修复处理,得到M个图像帧分别对应的优化图像帧,将M个优化图像帧组成优化视频数据,对该优化视频数据进行上传处理。This application can be applied to any scenario that requires media repair, such as a video data repair scene or an image repair scene, etc. For example, the computer device can respond to a repair request for video data, obtain M image frames that make up the video data, use the above-mentioned processes shown in Figure 5 to repair the M image frames, and obtain the corresponding M image frames respectively. of optimized image frames, converting M Optimized image frames are composed of optimized video data. When the repair request for video data is sent by the business device to the computer device, when the computer device obtains the optimized video data, it can also send the optimized video data to the business device. Alternatively, assuming that the computer device obtains an upload request for video data, if an abnormality is detected in the video data, M image frames that make up the video data can be obtained, and the M images can be processed using the processes shown in Figure 5 above. The frames are repaired to obtain optimized image frames corresponding to the M image frames, the M optimized image frames are composed of optimized video data, and the optimized video data is uploaded.
进一步地,请参见图10,图10是本申请实施例提供的一种数据修复装置示意图。该数据修复装置可以是运行于计算机设备中的一个计算机程序(包括程序代码等),例如该数据修复装置可以为一个应用软件;该装置可以用于执行本申请实施例提供的方法中的相应步骤。如图10所示,该数据修复装置1000可以用于图3所对应实施例中的计算机设备。该装置可以包括:样本获取模块11、样本区域预测模块12、样本修复模块13及模型调整模块14。Further, please refer to FIG. 10 , which is a schematic diagram of a data repair device provided by an embodiment of the present application. The data repair device may be a computer program (including program code, etc.) running in a computer device. For example, the data repair device may be an application software; the device may be used to perform corresponding steps in the method provided by the embodiments of the present application. . As shown in Figure 10, the data repair apparatus 1000 can be used in the computer equipment in the embodiment corresponding to Figure 3. The device may include: a sample acquisition module 11 , a sample area prediction module 12 , a sample repair module 13 and a model adjustment module 14 .
样本获取模块11用于获取待修复的修复图像样本、修复图像样本所对应的修复区域标签及原始图像样本;The sample acquisition module 11 is used to acquire the repaired image sample to be repaired, the repair area label corresponding to the repaired image sample, and the original image sample;
样本区域预测模块12用于使用第一区域预测模型预测修复图像样本的待修复区域,得到样本预测修复区域;The sample area prediction module 12 is configured to use the first area prediction model to predict the area to be repaired of the repaired image sample, and obtain the sample predicted repair area;
样本修复模块13用于使用第一媒体修复模型对修复图像样本中的样本预测修复区域进行修复,得到修复图像样本所对应的样本优化图像;The sample repair module 13 is configured to use the first media repair model to repair the sample predicted repair area in the repaired image sample, and obtain a sample optimized image corresponding to the repaired image sample;
模型调整模块14用于根据样本预测修复区域、修复区域标签、原始图像样本及样本优化图像,对第一区域预测模型及第一媒体修复模型的参数进行联合调整,得到第一区域预测模型所对应的目标区域预测模型,以及第一媒体修复模型所对应的目标媒体修复模型。The model adjustment module 14 is used to jointly adjust the parameters of the first regional prediction model and the first media repair model based on the sample predicted repair area, repair area label, original image sample and sample optimized image to obtain the corresponding parameters of the first regional prediction model. a target area prediction model, and a target media repair model corresponding to the first media repair model.
其中,该装置1000还包括:初始预测模块15、第一调整模块16、第一修复模块17、修复模型生成模块18。Among them, the device 1000 also includes: an initial prediction module 15, a first adjustment module 16, a first repair module 17, and a repair model generation module 18.
初始预测模块15用于将修复图像样本输入第二区域预测模型进行预测,得到修复图像样本中的初始预测修复区域;The initial prediction module 15 is used to input the repaired image sample into the second area prediction model for prediction, and obtain the initial predicted repaired area in the repaired image sample;
第一调整模块16用于根据初始预测修复区域与修复区域标签生成第一损失函数,通过第一损失函数对第二区域预测模型进行参数调整,得到第一区域预测模型;The first adjustment module 16 is configured to generate a first loss function based on the initial predicted repair area and the repair area label, and adjust the parameters of the second area prediction model through the first loss function to obtain the first area prediction model;
第一修复模块17用于将修复图像样本及初始预测修复区域输入第二媒体修复模型进行修复,得到修复图像样本所对应的初始优化图像;The first repair module 17 is used to input the repaired image sample and the initial predicted repair area into the second media repair model for repair, and obtain the initial optimized image corresponding to the repaired image sample;
修复模型生成模块18用于根据初始优化图像与原始图像样本生成第二损失函数,通过第二损失函数对第二媒体修复模型进行参数调整,得到第一媒体修复模型。The repair model generation module 18 is configured to generate a second loss function based on the initial optimized image and the original image sample, and adjust the parameters of the second media repair model through the second loss function to obtain the first media repair model.
其中,修复图像样本是组成视频样本的N个样本图像帧中的一个样本图像帧,N为正整数。Among them, the repaired image sample is one sample image frame among the N sample image frames that make up the video sample, and N is a positive integer.
该装置1000还包括前序获取模块19,用于获取修复图像样本在N个样本图像帧中的前序图像样本,获取前序图像样本所对应的前序样本修复区域。The device 1000 also includes a preamble acquisition module 19, which is used to obtain the preamble image samples of the repaired image samples in the N sample image frames, and obtain the preamble sample repair area corresponding to the preamble image sample.
该样本区域预测模块12具体用于:将前序图像样本、修复图像样本及前序样本修复区域输入第一区域预测模型,预测所述修复图像样本的待修复区域,得到样本预测修复区域。The sample area prediction module 12 is specifically used to input the pre-order image sample, the repair image sample and the pre-order sample repair area into the first area prediction model, predict the area to be repaired of the repair image sample, and obtain the sample predicted repair area.
该样本修复模块13具体用于:将前序图像样本、修复图像样本、样本预测修复区域及前序样本修复区域,输入第一媒体修复模型,以对修复图像样本进行修复,得到修复图像样本所对应的样本优化图像。 The sample repair module 13 is specifically used to: input the pre-sequence image sample, the repair image sample, the sample prediction repair area and the pre-sequence sample repair area into the first media repair model to repair the repair image sample and obtain the repair image sample. Corresponding sample optimized image.
其中,该装置1000还包括:轨迹生成模块20、数据融合模块21、样本生成模块22。Among them, the device 1000 also includes: a trajectory generation module 20, a data fusion module 21, and a sample generation module 22.
轨迹生成模块20用于获取前景对象样本及常规视频数据,对前景对象样本进行模拟运动处理,得到对象运动轨迹。The trajectory generation module 20 is used to obtain foreground object samples and conventional video data, perform simulated motion processing on the foreground object samples, and obtain object motion trajectories.
数据融合模块21用于基于对象运动轨迹,将前景对象样本与常规视频数据进行融合,得到融合视频数据。The data fusion module 21 is used to fuse foreground object samples and conventional video data based on object motion trajectories to obtain fused video data.
样本生成模块22用于对融合视频数据进行场景渲染优化,生成视频样本。The sample generation module 22 is used to perform scene rendering optimization on the fused video data and generate video samples.
其中,该模型调整模块14,包括:第一损失生成单元141、第二损失生成单元142、损失结合单元143、联合调整单元144。Among them, the model adjustment module 14 includes: a first loss generation unit 141, a second loss generation unit 142, a loss combination unit 143, and a joint adjustment unit 144.
第一损失生成单元141用于根据样本预测修复区域及修复区域标签生成第三损失函数;The first loss generation unit 141 is used to predict the repair area and the repair area label according to the sample to generate a third loss function;
第二损失生成单元142用于根据原始图像样本及样本优化图像生成第四损失函数;The second loss generation unit 142 is configured to generate a fourth loss function based on the original image sample and the sample optimized image;
损失结合单元143用于对第三损失函数与第四损失函数进行函数结合,得到联合损失函数;The loss combining unit 143 is used to functionally combine the third loss function and the fourth loss function to obtain a joint loss function;
联合调整单元144用于通过联合损失函数对第一区域预测模型及第一媒体修复模型的参数进行联合调整,得到第一区域预测模型所对应的目标区域预测模型,以及第一媒体修复模型所对应的目标媒体修复模型。The joint adjustment unit 144 is configured to jointly adjust the parameters of the first region prediction model and the first media repair model through a joint loss function to obtain a target region prediction model corresponding to the first region prediction model and a target region prediction model corresponding to the first media repair model. target media repair model.
其中,修复图像样本是组成视频样本的N个样本图像帧中的一个样本图像帧,N为正整数。Among them, the repaired image sample is one sample image frame among the N sample image frames that make up the video sample, and N is a positive integer.
该前序获取模块19还用于获取修复图像样本在N个样本图像帧中的前序图像样本,获取前序图像样本所对应的前序样本修复区域。The preamble acquisition module 19 is also used to obtain the preamble image samples of the repaired image samples in the N sample image frames, and obtain the preamble sample repair area corresponding to the preamble image samples.
该第一损失生成单元141,包括:第一预测子单元1411、第二预测子单元1412、辅助损失生成子单元1413、区域损失生成子单元1414。The first loss generation unit 141 includes: a first prediction sub-unit 1411, a second prediction sub-unit 1412, an auxiliary loss generation sub-unit 1413, and a region loss generation sub-unit 1414.
第一预测子单元1411用于将前序样本修复区域及样本优化图像输入第一区域预测模型,预测样本优化图像的待修复区域,得到第一预测区域;The first prediction subunit 1411 is used to input the pre-sample repair area and the sample optimized image into the first area prediction model, predict the area to be repaired in the sample optimized image, and obtain the first prediction area;
第二预测子单元1412用于将前序样本修复区域及原始图像样本输入第一区域预测模型,预测所述原始图像样本的待修复区域,得到第二预测区域;The second prediction sub-unit 1412 is used to input the repair area of the previous sample and the original image sample into the first area prediction model, predict the area to be repaired of the original image sample, and obtain the second prediction area;
辅助损失生成子单元1413用于根据第一预测区域及第二预测区域,生成辅助损失函数。The auxiliary loss generation subunit 1413 is used to generate an auxiliary loss function according to the first prediction area and the second prediction area.
区域损失生成子单元1414用于根据样本预测修复区域及修复区域标签之间的差异数据,生成区域差异损失函数。The regional loss generation subunit 1414 is used to predict the difference data between the repair area and the repair area label based on the sample, and generate a regional difference loss function.
第一损失组合子单元1415用于根据辅助损失函数与区域差异损失函数,生成第三损失函数。The first loss combination subunit 1415 is used to generate a third loss function based on the auxiliary loss function and the regional difference loss function.
其中,该第二损失生成单元142,包括:图像损失生成子单元1421、结果判别子单元1422、判别损失生成子单元1423、第二损失组合子单元1424。The second loss generation unit 142 includes: an image loss generation subunit 1421, a result determination subunit 1422, a determination loss generation subunit 1423, and a second loss combination subunit 1424.
图像损失生成子单元1421用于确定原始图像样本与样本优化图像之间的图像差异数据,根据图像差异数据生成图像差异损失函数。The image loss generation subunit 1421 is used to determine image difference data between the original image sample and the sample optimized image, and generate an image difference loss function based on the image difference data.
结果判别子单元1422用于将原始图像样本输入第一判别器进行检测,得到原始图像样本所对应的原始判别结果,将样本优化图像输入第一判别器进行检测,得到样本优化图像所对应的优化判别结果。The result discrimination subunit 1422 is used to input the original image sample into the first discriminator for detection to obtain the original discrimination result corresponding to the original image sample, and input the sample optimized image into the first discriminator for detection to obtain the optimization corresponding to the sample optimized image. Discrimination results.
判别损失生成子单元1423用于根据原始判别结果与优化判别结果,生成判别损失函数。The discrimination loss generation subunit 1423 is used to generate a discrimination loss function based on the original discrimination result and the optimized discrimination result.
第二损失组合子单元1424用于对图像差异损失函数与判别损失函数进行组合,得到第四损失函数。The second loss combination subunit 1424 is used to combine the image difference loss function and the discrimination loss function to obtain a fourth loss function.
其中,第一区域预测模型包括区域分离模型及区域识别模型,该装置1000还包括:分离预测模块23、 识别预测模块24、损失获取模块25、模型生成模块26。Among them, the first regional prediction model includes a regional separation model and a regional identification model. The device 1000 also includes: a separation prediction module 23, Identify the prediction module 24, the loss acquisition module 25, and the model generation module 26.
分离预测模块23用于将修复图像样本输入初始区域分离模型进行预测,得到二值预测图像,从二值预测图像中获取分离修复区域。The separation prediction module 23 is used to input the repaired image sample into the initial region separation model for prediction, obtain a binary prediction image, and obtain the separation repair region from the binary prediction image.
识别预测模块24用于将修复图像样本输入初始区域识别模型进行预测,得到修复图像样本中的预测边框,将预测边框在修复图像样本中所对应的区域确定为识别修复区域。The recognition prediction module 24 is used to input the repaired image sample into the initial area recognition model for prediction, obtain the predicted border in the repaired image sample, and determine the area corresponding to the predicted border in the repaired image sample as the identified repair area.
损失获取模块25用于根据分离修复区域与修复区域标签生成第一区域损失函数,根据识别修复区域与修复区域标签生成第二区域损失函数,根据分离修复区域与识别修复区域生成第三区域损失函数。The loss acquisition module 25 is configured to generate a first area loss function based on the separated repair area and the repair area label, generate a second area loss function based on the identified repair area and the repair area label, and generate a third area loss function based on the separated repair area and the identified repair area. .
模型生成模块26用于根据第一区域损失函数、第二区域损失函数及第三区域损失函数,对初始区域分离模型及初始区域识别模型的参数进行联合调整,得到初始区域分离模型所对应的区域分离模型,以及初始区域识别模型所对应的区域识别模型。The model generation module 26 is used to jointly adjust the parameters of the initial region separation model and the initial region identification model according to the first region loss function, the second region loss function and the third region loss function to obtain the region corresponding to the initial region separation model. separation model, and the region recognition model corresponding to the initial region recognition model.
本申请实施例提供了一种数据修复装置,该装置可以获取待修复的修复图像样本、修复图像样本所对应的修复区域标签及原始图像样本;使用第一区域预测模型预测修复图像样本的待修复区域,得到样本预测修复区域;使用第一媒体修复模型对修复图像样本中的样本预测修复区域进行修复,得到修复图像样本所对应的样本优化图像;根据样本预测修复区域、修复区域标签、原始图像样本及样本优化图像,对第一区域预测模型及第一媒体修复模型的参数进行联合调整,得到第一区域预测模型所对应的目标区域预测模型,以及第一媒体修复模型所对应的目标媒体修复模型。进一步地,可以基于目标区域预测模型及目标媒体修复模型对图像进行修复处理。通过以上过程,实现了对多任务的联合训练及使用,以实现不同任务之间的相互调整及促进,充分学习不同任务中的互补信息及相似信息等,得到互相增益的效果,提高了模型训练的效率,节省了计算资源。由于不同任务之间可以互相提供增进的有效信息,以促进不同任务的模型表现,相互提升不同模型的输出结果的精确性,有利于模型的设计和效果的提升,从而提高数据修复的准确性。Embodiments of the present application provide a data repair device, which can obtain a repaired image sample to be repaired, a repair region label corresponding to the repaired image sample, and an original image sample; and use a first region prediction model to predict the repaired image sample to be repaired. area to obtain the sample predicted repair area; use the first media repair model to repair the sample predicted repair area in the repair image sample, and obtain the sample optimized image corresponding to the repair image sample; predict the repair area, repair area label, and original image based on the sample Samples and sample optimization images are used to jointly adjust the parameters of the first area prediction model and the first media repair model to obtain the target area prediction model corresponding to the first area prediction model and the target media repair corresponding to the first media repair model. Model. Further, the image can be repaired based on the target area prediction model and the target media repair model. Through the above process, joint training and use of multi-tasks are achieved to achieve mutual adjustment and promotion between different tasks, fully learn complementary information and similar information in different tasks, obtain mutual gain effects, and improve model training. efficiency, saving computing resources. Since different tasks can provide each other with enhanced effective information to promote model performance of different tasks, mutually improve the accuracy of the output results of different models, it is conducive to the improvement of model design and effects, thereby improving the accuracy of data repair.
进一步地,请参见图11,图11是本申请实施例提供的另一种数据修复装置示意图。该数据修复装置可以是运行于计算机设备中的一个计算机程序(包括程序代码等)。例如该数据修复装置可以为一个应用软件。该装置可以用于执行本申请实施例提供的方法中的相应步骤。如图11所示,该数据修复装置1100可以用于图5所对应实施例中的计算机设备,具体的,该装置可以包括:图像获取模块31、区域预测模块32及数据修复模块33。Further, please refer to Figure 11, which is a schematic diagram of another data repair device provided by an embodiment of the present application. The data repair device may be a computer program (including program code, etc.) running in the computer device. For example, the data repair device can be an application software. The device can be used to perform corresponding steps in the method provided by the embodiments of the present application. As shown in Figure 11, the data repair device 1100 can be used in the computer equipment in the embodiment corresponding to Figure 5. Specifically, the device can include: an image acquisition module 31, a region prediction module 32 and a data repair module 33.
图像获取模块31用于获取待修复图像帧;The image acquisition module 31 is used to acquire image frames to be repaired;
区域预测模块32用于基于目标区域预测模型对待修复图像帧进行预测,得到待修复图像帧的待修复区域;The area prediction module 32 is used to predict the image frame to be repaired based on the target area prediction model, and obtain the area to be repaired of the image frame to be repaired;
数据修复模块33用于基于目标媒体修复模型对待修复图像帧中的待修复区域进行修复,得到待修复图像帧所对应的优化图像帧,其中,目标区域预测模型与目标媒体修复模型是通过联合训练得到的。The data repair module 33 is used to repair the area to be repaired in the image frame to be repaired based on the target media repair model, and obtain the optimized image frame corresponding to the image frame to be repaired, wherein the target area prediction model and the target media repair model are jointly trained owned.
其中,待修复图像帧是组成视频数据的M个图像帧中的一个图像帧,M为正整数。Among them, the image frame to be repaired is one of the M image frames that make up the video data, and M is a positive integer.
该区域预测模块32,包括:前序获取单元321、区域预测单元322。The region prediction module 32 includes: a preorder acquisition unit 321 and a region prediction unit 322.
前序获取单元321用于在M个图像帧中获取待修复图像帧的前序图像帧,获取前序图像帧所对应的前序修复区域。The preamble acquisition unit 321 is used to obtain the preamble image frame of the image frame to be repaired among the M image frames, and obtain the preamble repair area corresponding to the preamble image frame.
区域预测单元322用于将前序修复区域、前序图像帧及待修复图像帧输入目标区域预测模型进行预测, 得到待修复图像帧所对应的待修复区域。The area prediction unit 322 is used to input the previous repair area, the previous image frame and the image frame to be repaired into the target area prediction model for prediction, Obtain the area to be repaired corresponding to the image frame to be repaired.
该数据修复模块33具体用于:将前序图像帧、待修复图像帧、前序修复区域及待修复区域输入目标媒体修复模型进行修复,得到待修复图像帧的优化图像帧。The data repair module 33 is specifically used to: input the pre-order image frame, the image frame to be repaired, the pre-order repair area and the area to be repaired into the target media repair model for repair, and obtain an optimized image frame of the image frame to be repaired.
其中,区域预测单元322,包括:数据输入子单元3221、初始预测子单元3222、区域调整子单元3223。Among them, the region prediction unit 322 includes: a data input sub-unit 3221, an initial prediction sub-unit 3222, and a region adjustment sub-unit 3223.
数据输入子单元3221用于将前序修复区域、前序图像帧及待修复图像帧输入目标区域预测模型。The data input subunit 3221 is used to input the previous repair area, the previous image frame and the image frame to be repaired into the target area prediction model.
初始预测子单元3222用于通过目标区域预测模型,基于前序图像帧与待修复图像帧之间的图像连续性,对待修复图像帧进行预测,得到待修复图像帧所对应的初始预测区域。The initial prediction subunit 3222 is used to predict the image frame to be repaired based on the image continuity between the previous image frame and the image frame to be repaired through the target area prediction model, and obtain the initial prediction area corresponding to the image frame to be repaired.
区域调整子单元3223用于通过目标区域预测模型,基于前序修复区域的区域连续性,对初始预测区域进行调整,得到待修复图像帧所对应的待修复区域。The area adjustment subunit 3223 is used to adjust the initial prediction area through the target area prediction model and based on the area continuity of the previous repair area to obtain the area to be repaired corresponding to the image frame to be repaired.
其中,该数据修复模块33,包括:模型输入单元331、图像组合单元332、图谱获取单元333、特征融合单元334、修复获取单元335、图像修复单元336。Among them, the data repair module 33 includes: a model input unit 331, an image combination unit 332, an atlas acquisition unit 333, a feature fusion unit 334, a repair acquisition unit 335, and an image repair unit 336.
模型输入单元331用于将前序图像帧、待修复图像帧、前序修复区域及待修复区域输入目标媒体修复模型中。The model input unit 331 is used to input the previous image frame, the image frame to be repaired, the previous repair area, and the area to be repaired into the target media repair model.
图像组合单元332用于在目标媒体修复模型中,对前序图像帧与前序修复区域进行组合,得到前序组合图像。The image combination unit 332 is used to combine the pre-order image frames and the pre-order repair area in the target media repair model to obtain the pre-order combined image.
图谱获取单元333用于从所述前序组合图像中获取前序组合图像的像素特征图谱及语义特征图谱,从所述待修复图像帧中获取待修复图像帧的像素特征图谱及语义特征图谱。The map acquisition unit 333 is configured to obtain the pixel feature map and semantic feature map of the previous combined image from the previous combined image, and obtain the pixel feature map and semantic feature map of the image frame to be repaired from the image frame to be repaired.
特征融合单元334用于对前序组合图像的像素特征图谱及待修复图像帧的像素特征图谱进行特征融合,得到注意力图谱。The feature fusion unit 334 is used to perform feature fusion on the pixel feature map of the pre-order combined image and the pixel feature map of the image frame to be repaired to obtain an attention map.
修复获取单元335用于根据注意力图谱,从前序组合图像的语义特征图谱中获取语义修复数据。The repair acquisition unit 335 is configured to obtain semantic repair data from the semantic feature map of the pre-order combined image according to the attention map.
图像修复单元336用于从待修复图像帧的语义特征图谱中获取待修复区域的语义特征图谱,基于语义修复数据对待修复区域的语义特征图谱进行修复处理,得到待修复图像帧的优化图像帧。The image repair unit 336 is configured to obtain the semantic feature map of the region to be repaired from the semantic feature map of the image frame to be repaired, and perform repair processing on the semantic feature map of the region to be repaired based on the semantic repair data to obtain an optimized image frame of the image frame to be repaired.
其中,该区域预测模块32,包括:数据池化单元323、特征卷积单元324、特征预测单元325。Among them, the region prediction module 32 includes: a data pooling unit 323, a feature convolution unit 324, and a feature prediction unit 325.
数据池化单元323用于在目标区域预测模型中,采用k个池化参数,分别对前序修复区域、前序图像帧及待修复图像帧进行池化处理,得到前序修复区域、前序图像帧及待修复图像帧分别对应的k个池化特征,k为正整数。The data pooling unit 323 is used to use k pooling parameters in the target area prediction model to perform pooling processing on the pre-order repair area, the pre-order image frame and the image frame to be repaired, respectively, to obtain the pre-order repair area, the pre-order repair area, and the pre-order image frame. The k pooling features corresponding to the image frame and the image frame to be repaired respectively, k is a positive integer.
特征卷积单元324用于对k个池化特征分别进行卷积处理,得到k个卷积特征。The feature convolution unit 324 is used to perform convolution processing on k pooled features respectively to obtain k convolution features.
特征预测单元325用于对k个卷积特征进行特征融合预测,得到待修复图像帧的待修复区域。The feature prediction unit 325 is used to perform feature fusion prediction on k convolution features to obtain the area to be repaired of the image frame to be repaired.
参见图12,图12是本申请实施例提供的一种计算机设备的结构示意图。如图12所示,本申请实施例中的计算机设备可以包括:一个或多个处理器1201、存储器1202和输入输出接口1203。该处理器1201、存储器1202和输入输出接口1203通过总线1204连接。存储器1202用于存储计算机程序,该计算机程序包括程序指令,输入输出接口1203用于接收数据及输出数据,如用于计算机设备与终端设备等之间进行数据交互;处理器1201用于执行存储器1202存储的程序指令。Referring to Figure 12, Figure 12 is a schematic structural diagram of a computer device provided by an embodiment of the present application. As shown in Figure 12, the computer device in this embodiment of the present application may include: one or more processors 1201, a memory 1202, and an input and output interface 1203. The processor 1201, the memory 1202 and the input/output interface 1203 are connected through a bus 1204. The memory 1202 is used to store computer programs, which include program instructions. The input and output interface 1203 is used to receive data and output data, such as for data interaction between computer equipment and terminal equipment; the processor 1201 is used to execute the memory 1202 Stored program instructions.
其中,该处理器1201可以执行如下操作:Among them, the processor 1201 can perform the following operations:
获取待修复的修复图像样本、修复图像样本所对应的修复区域标签及原始图像样本;Obtain the repaired image sample to be repaired, the repair area label corresponding to the repaired image sample, and the original image sample;
使用第一区域预测模型预测修复图像样本的待修复区域,得到样本预测修复区域; Use the first area prediction model to predict the area to be repaired of the repaired image sample, and obtain the sample predicted repair area;
使用第一媒体修复模型对修复图像样本中的样本预测修复区域进行修复,得到修复图像样本所对应的样本优化图像;Use the first media repair model to repair the sample predicted repair area in the repaired image sample to obtain a sample optimized image corresponding to the repaired image sample;
根据样本预测修复区域、修复区域标签、原始图像样本及样本优化图像,对第一区域预测模型及第一媒体修复模型的参数进行联合调整,得到第一区域预测模型所对应的目标区域预测模型,以及第一媒体修复模型所对应的目标媒体修复模型。According to the sample predicted repair area, repair area label, original image sample and sample optimized image, the parameters of the first area prediction model and the first media repair model are jointly adjusted to obtain the target area prediction model corresponding to the first area prediction model, and a target media repair model corresponding to the first media repair model.
其中,该处理器1201可以执行如下操作:Among them, the processor 1201 can perform the following operations:
获取待修复图像帧,基于目标区域预测模型对待修复图像帧进行预测,得到待修复图像帧的待修复区域;Obtain the image frame to be repaired, predict the image frame to be repaired based on the target area prediction model, and obtain the area to be repaired of the image frame to be repaired;
基于目标媒体修复模型对待修复图像帧中的待修复区域进行修复,得到待修复图像帧所对应的优化图像帧,其中,目标区域预测模型与目标媒体修复模型是通过联合训练得到的。The area to be repaired in the image frame to be repaired is repaired based on the target media repair model to obtain the optimized image frame corresponding to the image frame to be repaired. The target area prediction model and the target media repair model are obtained through joint training.
其中,待修复图像帧是组成视频数据的M个图像帧中的一个图像帧,M为正整数。Among them, the image frame to be repaired is one of the M image frames that make up the video data, and M is a positive integer.
在基于目标区域预测模型对待修复图像帧进行预测,得到待修复图像帧的待修复区域时,该处理器1201可以执行如下操作:When predicting the image frame to be repaired based on the target area prediction model and obtaining the area to be repaired of the image frame to be repaired, the processor 1201 can perform the following operations:
从M个图像帧中获取待修复图像帧的前序图像帧,获取前序图像帧所对应的前序修复区域;Obtain the preceding image frame of the image frame to be repaired from M image frames, and obtain the preceding repair area corresponding to the preceding image frame;
将前序修复区域、前序图像帧及待修复图像帧输入目标区域预测模型进行预测,得到待修复图像帧所对应的待修复区域;Input the pre-order repair area, the pre-order image frame and the image frame to be repaired into the target area prediction model for prediction, and obtain the area to be repaired corresponding to the image frame to be repaired;
基于目标媒体修复模型对待修复图像帧中的待修复区域进行修复,得到待修复图像帧所对应的优化图像帧,包括:Repair the area to be repaired in the image frame to be repaired based on the target media repair model, and obtain the optimized image frame corresponding to the image frame to be repaired, including:
将前序图像帧、待修复图像帧、前序修复区域及待修复区域输入目标媒体修复模型进行修复,得到待修复图像帧的优化图像帧。The pre-order image frame, the image frame to be repaired, the pre-order repair area and the area to be repaired are input into the target media repair model for repair, and an optimized image frame of the image frame to be repaired is obtained.
其中,在将前序修复区域、前序图像帧及待修复图像帧输入目标区域预测模型进行预测,得到待修复图像帧所对应的待修复区域时,该处理器1201可以执行如下操作:Among them, when the pre-order repair area, the pre-order image frame and the image frame to be repaired are input into the target area prediction model for prediction, and the area to be repaired corresponding to the image frame to be repaired is obtained, the processor 1201 can perform the following operations:
将前序修复区域、前序图像帧及待修复图像帧输入目标区域预测模型;Input the pre-order repair area, pre-order image frame and image frame to be repaired into the target area prediction model;
在目标区域预测模型中,基于前序图像帧与待修复图像帧之间的图像连续性,对待修复图像帧进行预测,得到待修复图像帧所对应的初始预测区域;In the target area prediction model, based on the image continuity between the previous image frame and the image frame to be repaired, the image frame to be repaired is predicted to obtain the initial prediction area corresponding to the image frame to be repaired;
在目标区域预测模型中,基于前序修复区域的区域连续性,对初始预测区域进行调整,得到待修复图像帧所对应的待修复区域。In the target area prediction model, based on the regional continuity of the pre-order repair area, the initial prediction area is adjusted to obtain the area to be repaired corresponding to the image frame to be repaired.
其中,在将前序图像帧、待修复图像帧、前序修复区域及待修复区域输入目标媒体修复模型进行修复,得到待修复图像帧的优化图像帧时,该处理器1201可以执行如下操作:Among them, when the pre-order image frame, the image frame to be repaired, the pre-order repair area and the area to be repaired are input into the target media repair model for repair, and the optimized image frame of the image frame to be repaired is obtained, the processor 1201 can perform the following operations:
将前序图像帧、待修复图像帧、前序修复区域及待修复区域输入目标媒体修复模型中;Input the pre-order image frame, the image frame to be repaired, the pre-order repair area and the area to be repaired into the target media repair model;
在目标媒体修复模型中,对前序图像帧与前序修复区域进行组合,得到前序组合图像;In the target media repair model, the pre-order image frame and the pre-order repair area are combined to obtain the pre-order combined image;
从所述前序组合图像中获取前序组合图像的像素特征图谱及语义特征图谱,从所述待修复图像帧中获取待修复图像帧的像素特征图谱及语义特征图谱;Obtain the pixel feature map and semantic feature map of the pre-order combined image from the pre-order combined image, and obtain the pixel feature map and semantic feature map of the image frame to be repaired from the image frame to be repaired;
对前序组合图像的像素特征图谱及待修复图像帧的像素特征图谱进行特征融合,得到注意力图谱;Perform feature fusion on the pixel feature map of the pre-order combined image and the pixel feature map of the image frame to be repaired to obtain the attention map;
根据注意力图谱,从前序组合图像的语义特征图谱中获取语义修复数据;According to the attention map, the semantic repair data is obtained from the semantic feature map of the pre-order combined image;
从待修复图像帧的语义特征图谱中获取待修复区域的语义特征图谱,基于语义修复数据对待修复区域 的语义特征图谱进行修复处理,得到待修复图像帧的优化图像帧。The semantic feature map of the area to be repaired is obtained from the semantic feature map of the image frame to be repaired, and the area to be repaired is based on the semantic repair data. The semantic feature map is repaired to obtain the optimized image frame of the image frame to be repaired.
其中,在基于目标区域预测模型对待修复图像帧进行预测,得到待修复图像帧的待修复区域时,该处理器1201可以执行如下操作:Wherein, when predicting the image frame to be repaired based on the target area prediction model and obtaining the area to be repaired of the image frame to be repaired, the processor 1201 can perform the following operations:
在目标区域预测模型中,采用k个池化参数,分别对前序修复区域、前序图像帧及待修复图像帧进行池化处理,得到前序修复区域、前序图像帧及待修复图像帧分别对应的k个池化特征,k为正整数;In the target area prediction model, k pooling parameters are used to pool the pre-order repair area, pre-order image frame and to-be-repaired image frame respectively to obtain the pre-order repair area, pre-order image frame and to-be-repaired image frame. The corresponding k pooling features respectively, k is a positive integer;
对k个池化特征分别进行卷积处理,得到k个卷积特征;Perform convolution processing on k pooled features respectively to obtain k convolution features;
对k个卷积特征进行特征融合预测,得到待修复图像帧的待修复区域。Perform feature fusion prediction on k convolution features to obtain the area to be repaired in the image frame to be repaired.
在一些可行的实施方式中,该处理器1201可以是中央处理单元(central processing unit,CPU),该处理器还可以是其他通用处理器、数字信号处理器(digital signal processor,DSP)、专用集成电路(application specific integrated circuit,ASIC)、现成可编程门阵列(field-programmable gate array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件等。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。In some feasible implementations, the processor 1201 can be a central processing unit (CPU). The processor can also be other general-purpose processors, digital signal processors (DSP), special-purpose integrated processors, etc. Circuit (application specific integrated circuit, ASIC), off-the-shelf programmable gate array (field-programmable gate array, FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or the processor may be any conventional processor, etc.
该存储器1202可以包括只读存储器和随机存取存储器,并向处理器1201和输入输出接口1203提供指令和数据。存储器1202的一部分还可以包括非易失性随机存取存储器。例如,存储器1202还可以存储设备类型的信息。The memory 1202 may include read-only memory and random access memory, and provides instructions and data to the processor 1201 and the input-output interface 1203. A portion of memory 1202 may also include non-volatile random access memory. For example, memory 1202 may also store device type information.
具体实现中,该计算机设备可通过其内置的各个功能模块执行如该图3或图5中各个步骤所提供的实现方式,具体可参见该图3或图5中各个步骤所提供的实现方式,在此不再赘述。In specific implementation, the computer device can execute the implementation provided by each step in Figure 3 or Figure 5 through its built-in functional modules. For details, please refer to the implementation provided by each step in Figure 3 or Figure 5. I won’t go into details here.
本申请实施例通过提供一种计算机设备,包括:处理器、输入输出接口、存储器,通过处理器获取存储器中的计算机程序,执行该图3或图5中所示方法的各个步骤,进行数据修复操作。本申请实施例实现了可以获取待修复的修复图像样本、修复图像样本所对应的修复区域标签及原始图像样本;使用第一区域预测模型预测修复图像样本的待修复区域,得到样本预测修复区域;使用第一媒体修复模型对修复图像样本中的样本预测修复区域进行修复,得到修复图像样本所对应的样本优化图像;根据样本预测修复区域、修复区域标签、原始图像样本及样本优化图像,对第一区域预测模型及第一媒体修复模型的参数进行联合调整,得到第一区域预测模型所对应的目标区域预测模型,以及第一媒体修复模型所对应的目标媒体修复模型。进一步地,可以基于目标区域预测模型及目标媒体修复模型对图像进行修复处理。通过以上过程,实现了对多任务的联合训练及使用,以实现不同任务之间的相互调整及促进,充分学习不同任务中的互补信息及相似信息等,得到互相增益的效果,提高了模型训练的效率,节省了计算资源。由于不同任务之间可以互相提供增进的有效信息,以促进不同任务的模型表现,相互提升不同模型的输出结果的精确性,有利于模型的设计和效果的提升,从而提高数据修复的准确性。Embodiments of the present application provide a computer device, including: a processor, an input and output interface, and a memory. The processor obtains the computer program in the memory and executes each step of the method shown in Figure 3 or Figure 5 to perform data repair. operate. The embodiment of the present application realizes that the repaired image sample to be repaired, the repaired area label corresponding to the repaired image sample and the original image sample can be obtained; the first area prediction model is used to predict the area to be repaired of the repaired image sample, and the sample predicted repaired area is obtained; Use the first media repair model to repair the sample predicted repair area in the repaired image sample to obtain the sample optimized image corresponding to the repaired image sample; based on the sample predicted repair area, repair area label, original image sample and sample optimized image, perform the repair on the first image sample Parameters of a region prediction model and a first media repair model are jointly adjusted to obtain a target region prediction model corresponding to the first region prediction model and a target media repair model corresponding to the first media repair model. Further, the image can be repaired based on the target area prediction model and the target media repair model. Through the above process, joint training and use of multi-tasks are achieved to achieve mutual adjustment and promotion between different tasks, fully learn complementary information and similar information in different tasks, obtain mutual gain effects, and improve model training. efficiency, saving computing resources. Since different tasks can provide each other with enhanced effective information to promote model performance of different tasks, mutually improve the accuracy of the output results of different models, it is conducive to the improvement of model design and effects, thereby improving the accuracy of data repair.
本申请实施例还提供一种计算机可读存储介质,该计算机可读存储介质存储有计算机程序,该计算机程序适于由该处理器加载并执行图3或图5中各个步骤所提供的数据修复方法,具体可参见该图3或图5中各个步骤所提供的实现方式,在此不再赘述。另外,对采用相同方法的有益效果描述,也不再进行赘述。对于本申请所涉及的计算机可读存储介质实施例中未披露的技术细节,请参照本申请方法实施例的描述。作为示例,计算机程序可被部署为在一个计算机设备上执行,或者在位于一个地点的多个计算机设备上执行,又或者,在分布在多个地点且通过通信网络互连的多个计算机设备上执行。Embodiments of the present application also provide a computer-readable storage medium that stores a computer program. The computer program is adapted to be loaded by the processor and perform the data repair provided by each step in Figure 3 or Figure 5 For details of the method, please refer to the implementation provided by each step in Figure 3 or Figure 5, and will not be described again here. In addition, the description of the beneficial effects of using the same method will not be described again. For technical details not disclosed in the computer-readable storage medium embodiments involved in this application, please refer to the description of the method embodiments in this application. As examples, a computer program may be deployed to execute on one computer device, or on multiple computer devices located at one location, or on multiple computer devices distributed across multiple locations and interconnected by a communications network. implement.
该计算机可读存储介质可以是前述任一实施例提供的数据修复装置或者该计算机设备的内部存储单 元,例如计算机设备的硬盘或内存。该计算机可读存储介质也可以是该计算机设备的外部存储设备,例如该计算机设备上配备的插接式硬盘,智能存储卡(smart media card,SMC),安全数字(secure digital,SD)卡,闪存卡(flash card)等。进一步地,该计算机可读存储介质还可以既包括该计算机设备的内部存储单元也包括外部存储设备。该计算机可读存储介质用于存储该计算机程序以及该计算机设备所需的其他程序和数据。该计算机可读存储介质还可以用于暂时地存储已经输出或者将要输出的数据。The computer-readable storage medium may be the data repair device provided in any of the foregoing embodiments or an internal storage unit of the computer device. Elements, such as the hard drive or memory of a computer device. The computer-readable storage medium can also be an external storage device of the computer device, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card equipped on the computer device, Flash card, etc. Further, the computer-readable storage medium may also include both an internal storage unit of the computer device and an external storage device. The computer-readable storage medium is used to store the computer program and other programs and data required by the computer device. The computer-readable storage medium can also be used to temporarily store data that has been output or is to be output.
本申请实施例还提供了一种计算机程序产品或计算机程序,该计算机程序产品或计算机程序包括计算机指令,该计算机指令存储在计算机可读存储介质中。计算机设备的处理器从计算机可读存储介质读取该计算机指令,处理器执行该计算机指令,使得该计算机设备执行图3或图5中的各种可选方式中所提供的方法,实现了对多任务的联合训练及使用,以实现不同任务之间的相互调整及促进,充分学习不同任务中的互补信息及相似信息等,得到互相增益的效果,也就是说,不同任务之间可以互相提供增进的有效信息,以促进不同任务的模型表现,相互提升不同模型的输出结果的精确性,有利于模型的设计和效果的提升,从而提高数据修复的准确性。Embodiments of the present application also provide a computer program product or computer program. The computer program product or computer program includes computer instructions, and the computer instructions are stored in a computer-readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the method provided in various optional ways in Figure 3 or Figure 5, thereby realizing the Joint training and use of multi-tasks to achieve mutual adjustment and promotion between different tasks, fully learn complementary information and similar information in different tasks, and obtain mutual gain effects, that is, different tasks can provide each other with The enhanced effective information can promote the performance of models for different tasks, mutually improve the accuracy of the output results of different models, and is conducive to the design and effect of the model, thereby improving the accuracy of data repair.
本申请实施例的说明书和权利要求书及附图中的术语“第一”、“第二”等是用于区别不同对象,而非用于描述特定顺序。此外,术语“包括”以及它们任何变形,意图在于覆盖不排他的包含。例如包含了一系列步骤或单元的过程、方法、装置、产品或设备没有限定于已列出的步骤或模块,而是可选地还包括没有列出的步骤或模块,或可选地还包括对于这些过程、方法、装置、产品或设备固有的其他步骤单元。The terms “first”, “second”, etc. in the description, claims, and drawings of the embodiments of this application are used to distinguish different objects, rather than describing a specific sequence. Furthermore, the term "includes" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, device, product or equipment that includes a series of steps or units is not limited to the listed steps or modules, but optionally also includes unlisted steps or modules, or optionally also includes Other step units inherent to such processes, methods, apparatus, products or equipment.
本领域普通技术人员可以意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、计算机软件或者二者的结合来实现,为了清楚地说明硬件和软件的可互换性,在该说明中已经按照功能一般性地描述了各示例的组成及步骤。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。Those of ordinary skill in the art can appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented with electronic hardware, computer software, or a combination of both. In order to clearly illustrate the relationship between hardware and software Interchangeability, in this description the composition and steps of each example have been generally described according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Skilled artisans may implement the described functionality using different methods for each specific application, but such implementations should not be considered beyond the scope of this application.
本申请实施例提供的方法及相关装置是参照本申请实施例提供的方法流程图和/或结构示意图来描述的,具体可由计算机程序指令实现方法流程图和/或结构示意图的每一流程和/或方框、以及流程图和/或方框图中的流程和/或方框的结合。这些计算机程序指令可提供到通用计算机、专用计算机、嵌入式处理机或其他可编程数据修复设备的处理器以产生一个机器,使得通过计算机或其他可编程数据修复设备的处理器执行的指令产生用于实现在流程图一个流程或多个流程和/或结构示意图一个方框或多个方框中指定的功能的装置。这些计算机程序指令也可存储在能引导计算机或其他可编程数据修复设备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的指令产生包括指令装置的制造品,该指令装置实现在流程图一个流程或多个流程和/或结构示意图一个方框或多个方框中指定的功能。这些计算机程序指令也可装载到计算机或其他可编程数据修复设备上,使得在计算机或其他可编程设备上执行一系列操作步骤以产生计算机实现的处理,从而在计算机或其他可编程设备上执行的指令提供用于实现在流程图一个流程或多个流程和/或结构示意一个方框或多个方框中指定的功能的步骤。 The methods and related devices provided by the embodiments of the present application are described with reference to the method flowcharts and/or structural schematic diagrams provided by the embodiments of the present application. Specifically, each process and/or the method flowcharts and/or structural schematic diagrams can be implemented by computer program instructions. or blocks, and combinations of processes and/or blocks in flowcharts and/or block diagrams. These computer program instructions may be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data recovery device to produce a machine such that the instructions executed by the processor of the computer or other programmable data recovery device produce a use A device for realizing the functions specified in one process or multiple processes in the flowchart and/or one block or multiple blocks in the structural diagram. These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data repair device to operate in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including the instruction means, the instructions The device implements the functions specified in one process or multiple processes in the flowchart and/or in one block or multiple blocks in the structural diagram. These computer program instructions may also be loaded onto a computer or other programmable data recovery device, causing a series of operational steps to be performed on the computer or other programmable device to produce a computer-implemented process, thereby executing on the computer or other programmable device. Instructions provide steps for implementing the functions specified in a process or processes of a flowchart and/or a block or blocks of a structural representation.

Claims (17)

  1. 一种数据修复方法,其特征在于,所述方法包括:A data repair method, characterized in that the method includes:
    获取待修复的修复图像样本、所述修复图像样本所对应的修复区域标签及原始图像样本;Obtain the repaired image sample to be repaired, the repaired area label corresponding to the repaired image sample, and the original image sample;
    使用第一区域预测模型预测所述修复图像样本的待修复区域,得到样本预测修复区域;Use the first area prediction model to predict the area to be repaired of the repaired image sample, and obtain the sample predicted repair area;
    使用第一媒体修复模型对所述修复图像样本中的所述样本预测修复区域进行修复,得到所述修复图像样本所对应的样本优化图像;Use the first media repair model to repair the sample predicted repair area in the repaired image sample to obtain a sample optimized image corresponding to the repaired image sample;
    根据所述样本预测修复区域、所述修复区域标签、所述原始图像样本及所述样本优化图像,对所述第一区域预测模型及所述第一媒体修复模型的参数进行联合调整,得到所述第一区域预测模型所对应的目标区域预测模型,以及所述第一媒体修复模型所对应的目标媒体修复模型。According to the sample predicted repair area, the repair area label, the original image sample and the sample optimized image, the parameters of the first area prediction model and the first media repair model are jointly adjusted to obtain the a target area prediction model corresponding to the first area prediction model, and a target media repair model corresponding to the first media repair model.
  2. 如权利要求1所述的方法,其特征在于,所述方法还包括:The method of claim 1, further comprising:
    将所述修复图像样本输入第二区域预测模型进行预测,得到所述修复图像样本中的初始预测修复区域;Input the repaired image sample into a second area prediction model for prediction, and obtain an initial predicted repaired area in the repaired image sample;
    根据所述初始预测修复区域与所述修复区域标签生成第一损失函数,通过所述第一损失函数对所述第二区域预测模型进行参数调整,得到所述第一区域预测模型;Generate a first loss function according to the initial predicted repair area and the repair area label, and adjust parameters of the second area prediction model through the first loss function to obtain the first area prediction model;
    将所述修复图像样本及所述初始预测修复区域输入第二媒体修复模型进行修复,得到所述修复图像样本所对应的初始优化图像;Input the repaired image sample and the initial predicted repair area into a second media repair model for repair, and obtain an initial optimized image corresponding to the repaired image sample;
    根据所述初始优化图像与所述原始图像样本生成第二损失函数,通过所述第二损失函数对所述第二媒体修复模型进行参数调整,得到所述第一媒体修复模型。A second loss function is generated according to the initial optimized image and the original image sample, and parameters of the second media repair model are adjusted through the second loss function to obtain the first media repair model.
  3. 如权利要求1所述的方法,其特征在于,所述修复图像样本是组成视频样本的N个样本图像帧中的一个样本图像帧,N为正整数;所述方法还包括:The method of claim 1, wherein the repaired image sample is one sample image frame among N sample image frames that make up the video sample, and N is a positive integer; the method further includes:
    获取所述修复图像样本在所述N个样本图像帧中的前序图像样本,获取所述前序图像样本所对应的前序样本修复区域;Obtain the preceding image sample of the repaired image sample in the N sample image frames, and obtain the preceding sample repair area corresponding to the preceding image sample;
    所述使用第一区域预测模型预测所述修复图像样本的待修复区域,得到样本预测修复区域,包括:The use of the first area prediction model to predict the area to be repaired of the repaired image sample to obtain the sample predicted repair area includes:
    将所述前序图像样本、所述修复图像样本及所述前序样本修复区域输入第一区域预测模型,预测所述修复图像样本的待修复区域,得到样本预测修复区域;Input the preamble image sample, the repaired image sample and the preamble sample repair area into a first area prediction model, predict the area to be repaired of the repaired image sample, and obtain the sample predicted repair area;
    所述使用第一媒体修复模型对所述修复图像样本中的所述样本预测修复区域进行修复,得到所述修复图像样本所对应的样本优化图像,包括:The method of using the first media repair model to repair the sample predicted repair area in the repaired image sample to obtain a sample optimized image corresponding to the repaired image sample includes:
    将所述前序图像样本、所述修复图像样本、所述样本预测修复区域及所述前序样本修复区域,输入第一媒体修复模型,以对所述修复图像样本进行修复,得到所述修复图像样本所对应的样本优化图像。The preamble image sample, the repaired image sample, the sample predicted repair area and the preamble sample repair area are input into the first media repair model to repair the repaired image sample to obtain the repair The image sample corresponds to the sample optimized image.
  4. 如权利要求3所述的方法,其特征在于,所述方法还包括:The method of claim 3, further comprising:
    获取前景对象样本及常规视频数据,对所述前景对象样本进行模拟运动处理,得到对象运动轨迹;Obtain foreground object samples and conventional video data, perform simulated motion processing on the foreground object samples, and obtain object motion trajectories;
    基于所述对象运动轨迹,将所述前景对象样本与所述常规视频数据进行融合,得到融合视频数据;Based on the object motion trajectory, fuse the foreground object sample with the conventional video data to obtain fused video data;
    对所述融合视频数据进行场景渲染优化,生成所述视频样本。Perform scene rendering optimization on the fused video data to generate the video samples.
  5. 如权利要求1所述的方法,其特征在于,所述根据所述样本预测修复区域、所述修复区域标签、所述原始图像样本及所述样本优化图像,对所述第一区域预测模型及所述第一媒体修复模型的参数进行联合调整,得到所述第一区域预测模型所对应的目标区域预测模型,以及所述第一媒体修复模型所对应的目标媒体修复模型,包括: The method of claim 1, wherein the repair region is predicted based on the sample, the repair region label, the original image sample and the sample optimized image, and the first region prediction model and The parameters of the first media repair model are jointly adjusted to obtain a target area prediction model corresponding to the first area prediction model and a target media repair model corresponding to the first media repair model, including:
    根据所述样本预测修复区域及所述修复区域标签生成第三损失函数,根据所述原始图像样本及所述样本优化图像生成第四损失函数;Generate a third loss function based on the sample to predict the repair area and the repair area label, and generate a fourth loss function based on the original image sample and the sample optimized image;
    对所述第三损失函数与所述第四损失函数进行函数结合,得到联合损失函数;Functionally combine the third loss function and the fourth loss function to obtain a joint loss function;
    通过所述联合损失函数对所述第一区域预测模型及所述第一媒体修复模型的参数进行联合调整,得到所述第一区域预测模型所对应的目标区域预测模型,以及所述第一媒体修复模型所对应的目标媒体修复模型。The parameters of the first region prediction model and the first media repair model are jointly adjusted through the joint loss function to obtain a target region prediction model corresponding to the first region prediction model and the first media repair model. The target media repair model corresponding to the repair model.
  6. 如权利要求5所述的方法,其特征在于,所述修复图像样本是组成视频样本的N个样本图像帧中的一个样本图像帧,N为正整数;所述方法还包括:The method of claim 5, wherein the repaired image sample is one sample image frame among N sample image frames that make up the video sample, and N is a positive integer; the method further includes:
    获取所述修复图像样本在所述N个样本图像帧中的前序图像样本,获取所述前序图像样本所对应的前序样本修复区域;Obtain the preceding image sample of the repaired image sample in the N sample image frames, and obtain the preceding sample repair area corresponding to the preceding image sample;
    所述根据所述样本预测修复区域及所述修复区域标签生成第三损失函数,包括:The predicting the repair area and the repair area label according to the sample to generate a third loss function includes:
    将所述前序样本修复区域及所述样本优化图像输入所述第一区域预测模型,预测所述样本优化图像的待修复区域,得到第一预测区域;Input the pre-sequence sample repair area and the sample optimized image into the first area prediction model, predict the area to be repaired in the sample optimized image, and obtain the first prediction area;
    将所述前序样本修复区域及所述原始图像样本输入所述第一区域预测模型,预测所述原始图像样本的待修复区域,得到第二预测区域;Input the preamble sample repair area and the original image sample into the first area prediction model, predict the area to be repaired of the original image sample, and obtain a second prediction area;
    根据所述第一预测区域及所述第二预测区域,生成辅助损失函数;Generate an auxiliary loss function according to the first prediction area and the second prediction area;
    根据所述样本预测修复区域及所述修复区域标签之间的差异数据,生成区域差异损失函数;Generate a regional difference loss function based on the difference data between the sample predicted repair area and the repair area label;
    根据所述辅助损失函数与所述区域差异损失函数,生成第三损失函数。A third loss function is generated according to the auxiliary loss function and the regional difference loss function.
  7. 如权利要求5所述的方法,其特征在于,所述根据所述原始图像样本及所述样本优化图像生成第四损失函数,包括:The method of claim 5, wherein generating a fourth loss function based on the original image sample and the sample optimized image includes:
    确定所述原始图像样本与所述样本优化图像之间的图像差异数据,根据所述图像差异数据生成图像差异损失函数;Determine image difference data between the original image sample and the sample optimized image, and generate an image difference loss function based on the image difference data;
    将所述原始图像样本输入第一判别器进行检测,得到所述原始图像样本所对应的原始判别结果,将所述样本优化图像输入所述第一判别器进行检测,得到所述样本优化图像所对应的优化判别结果;The original image sample is input into the first discriminator for detection, and the original discrimination result corresponding to the original image sample is obtained. The sample optimized image is input into the first discriminator for detection, and the sample optimized image is obtained. Corresponding optimization judgment results;
    根据所述原始判别结果与所述优化判别结果,生成判别损失函数;Generate a discrimination loss function based on the original discrimination result and the optimized discrimination result;
    对所述图像差异损失函数与所述判别损失函数进行组合,得到第四损失函数。The image difference loss function and the discrimination loss function are combined to obtain a fourth loss function.
  8. 如权利要求1所述的方法,其特征在于,所述第一区域预测模型包括区域分离模型及区域识别模型,所述方法还包括:The method of claim 1, wherein the first region prediction model includes a region separation model and a region identification model, and the method further includes:
    将所述修复图像样本输入初始区域分离模型进行预测,得到二值预测图像,从所述二值预测图像中获取分离修复区域;Input the repaired image sample into an initial region separation model for prediction to obtain a binary prediction image, and obtain the separated repair area from the binary prediction image;
    将所述修复图像样本输入初始区域识别模型进行预测,得到所述修复图像样本中的预测边框,将所述预测边框在所述修复图像样本中所对应的区域确定为识别修复区域;Input the repaired image sample into an initial area recognition model for prediction, obtain a predicted border in the repaired image sample, and determine the area corresponding to the predicted border in the repaired image sample as the identified repair area;
    根据所述分离修复区域与所述修复区域标签生成第一区域损失函数,根据所述识别修复区域与所述修复区域标签生成第二区域损失函数,根据所述分离修复区域与所述识别修复区域生成第三区域损失函数;A first area loss function is generated based on the separated repair area and the repair area label, a second area loss function is generated based on the identified repair area and the repair area label, and a second area loss function is generated based on the separated repair area and the identified repair area. Generate the third region loss function;
    根据所述第一区域损失函数、所述第二区域损失函数及所述第三区域损失函数,对所述初始区域分离模型及所述初始区域识别模型的参数进行联合调整,得到所述初始区域分离模型所对应的所述区域分离模 型,以及所述初始区域识别模型所对应的所述区域识别模型。According to the first region loss function, the second region loss function and the third region loss function, the parameters of the initial region separation model and the initial region identification model are jointly adjusted to obtain the initial region The regional separation model corresponding to the separation model type, and the region recognition model corresponding to the initial region recognition model.
  9. 一种数据修复方法,其特征在于,所述方法包括:A data repair method, characterized in that the method includes:
    获取待修复图像帧,基于目标区域预测模型对所述待修复图像帧进行预测,得到所述待修复图像帧的待修复区域;Obtain the image frame to be repaired, predict the image frame to be repaired based on the target area prediction model, and obtain the area to be repaired of the image frame to be repaired;
    基于目标媒体修复模型对所述待修复图像帧中的待修复区域进行修复,得到所述待修复图像帧所对应的优化图像帧,其中,所述目标区域预测模型与所述目标媒体修复模型是通过联合训练得到的。Repair the area to be repaired in the image frame to be repaired based on the target media repair model to obtain the optimized image frame corresponding to the image frame to be repaired, wherein the target area prediction model and the target media repair model are Obtained through joint training.
  10. 如权利要求9所述的方法,其特征在于,所述待修复图像帧是组成视频数据的M个图像帧中的一个图像帧,M为正整数;The method of claim 9, wherein the image frame to be repaired is one of M image frames that make up the video data, and M is a positive integer;
    所述基于目标区域预测模型对所述待修复图像帧进行预测,得到所述待修复图像帧的待修复区域,包括:从所述M个图像帧中获取所述待修复图像帧的前序图像帧,获取所述前序图像帧所对应的前序修复区域;将所述前序修复区域、所述前序图像帧及所述待修复图像帧输入目标区域预测模型进行预测,得到所述待修复图像帧所对应的待修复区域;The method of predicting the image frame to be repaired based on the target area prediction model and obtaining the area to be repaired of the image frame to be repaired includes: obtaining the preceding image of the image frame to be repaired from the M image frames. frame, obtain the pre-order repair area corresponding to the pre-order image frame; input the pre-order repair area, the pre-order image frame and the to-be-repaired image frame into the target area prediction model for prediction, and obtain the to-be-repaired area. Repair the area to be repaired corresponding to the image frame;
    所述基于目标媒体修复模型对所述待修复图像帧中的待修复区域进行修复,得到所述待修复图像帧所对应的优化图像帧,包括:将所述前序图像帧、所述待修复图像帧、所述前序修复区域及所述待修复区域输入目标媒体修复模型进行修复,得到所述待修复图像帧的优化图像帧。The method of repairing the area to be repaired in the image frame to be repaired based on the target media repair model to obtain the optimized image frame corresponding to the image frame to be repaired includes: combining the preceding image frame and the image frame to be repaired. The image frame, the pre-order repair area and the area to be repaired are input into the target media repair model for repair, and an optimized image frame of the image frame to be repaired is obtained.
  11. 如权利要求10所述的方法,其特征在于,所述将所述前序修复区域、所述前序图像帧及所述待修复图像帧输入目标区域预测模型进行预测,得到所述待修复图像帧所对应的待修复区域,包括:The method according to claim 10, characterized in that the pre-order repair area, the pre-order image frame and the to-be-repaired image frame are input into a target area prediction model for prediction to obtain the to-be-repaired image. The area to be repaired corresponding to the frame includes:
    将所述前序修复区域、所述前序图像帧及所述待修复图像帧输入目标区域预测模型;Input the pre-order repair area, the pre-order image frame and the to-be-repaired image frame into a target area prediction model;
    在所述目标区域预测模型中,基于所述前序图像帧与所述待修复图像帧之间的图像连续性,对所述待修复图像帧进行预测,得到所述待修复图像帧所对应的初始预测区域;In the target area prediction model, based on the image continuity between the preceding image frame and the image frame to be repaired, the image frame to be repaired is predicted to obtain the image frame corresponding to the image frame to be repaired. Initial prediction area;
    在所述目标区域预测模型中,基于所述前序修复区域的区域连续性,对所述初始预测区域进行调整,得到所述待修复图像帧所对应的待修复区域。In the target area prediction model, based on the area continuity of the pre-order repair area, the initial prediction area is adjusted to obtain the area to be repaired corresponding to the image frame to be repaired.
  12. 如权利要求10所述的方法,其特征在于,所述将所述前序图像帧、所述待修复图像帧、所述前序修复区域及所述待修复区域输入目标媒体修复模型进行修复,得到所述待修复图像帧的优化图像帧,包括:The method of claim 10, wherein the preamble image frame, the image frame to be repaired, the preamble repair area and the to-be-repaired area are input into a target media repair model for repair, Obtaining the optimized image frame of the image frame to be repaired includes:
    将所述前序图像帧、所述待修复图像帧、所述前序修复区域及所述待修复区域输入目标媒体修复模型中;Input the preamble image frame, the image frame to be repaired, the preamble repair area and the to be repaired area into the target media repair model;
    在所述目标媒体修复模型中,对所述前序图像帧与所述前序修复区域进行组合,得到前序组合图像;In the target media repair model, the preamble image frame and the preamble repair area are combined to obtain a preamble combined image;
    从所述前序组合图像中获取所述前序组合图像的像素特征图谱及语义特征图谱,从所述待修复图像帧中获取所述待修复图像帧的像素特征图谱及语义特征图谱;Obtain the pixel feature map and semantic feature map of the pre-sequence combined image from the pre-sequence combined image, and obtain the pixel feature map and semantic feature map of the to-be-repaired image frame from the to-be-repaired image frame;
    对所述前序组合图像的像素特征图谱及所述待修复图像帧的像素特征图谱进行特征融合,得到注意力图谱;Perform feature fusion on the pixel feature map of the pre-order combined image and the pixel feature map of the image frame to be repaired to obtain an attention map;
    根据所述注意力图谱,从所述前序组合图像的语义特征图谱中获取语义修复数据;According to the attention map, obtain semantic repair data from the semantic feature map of the pre-order combined image;
    从所述待修复图像帧的语义特征图谱中获取所述待修复区域的语义特征图谱,基于所述语义修复数据对所述待修复区域的语义特征图谱进行修复处理,得到所述待修复图像帧的优化图像帧。Obtain the semantic feature map of the region to be repaired from the semantic feature map of the image frame to be repaired, and perform repair processing on the semantic feature map of the region to be repaired based on the semantic repair data to obtain the image frame to be repaired. of optimized image frames.
  13. 如权利要求10所述的方法,其特征在于,所述基于目标区域预测模型对所述待修复图像帧进行预测,得到所述待修复图像帧的待修复区域,包括: The method of claim 10, wherein the step of predicting the image frame to be repaired based on a target area prediction model to obtain the area to be repaired of the image frame to be repaired includes:
    在目标区域预测模型中,采用k个池化参数,分别对所述前序修复区域、所述前序图像帧及所述待修复图像帧进行池化处理,得到所述前序修复区域、所述前序图像帧及所述待修复图像帧分别对应的k个池化特征,k为正整数;In the target area prediction model, k pooling parameters are used to perform pooling processing on the pre-order repair area, the pre-order image frame and the image frame to be repaired, respectively, to obtain the pre-order repair area, the pre-order repair area, the pre-order image frame and the to-be-repaired image frame. The k pooling features corresponding to the preceding image frame and the image frame to be repaired respectively, k is a positive integer;
    对所述k个池化特征分别进行卷积处理,得到k个卷积特征;Perform convolution processing on the k pooled features respectively to obtain k convolution features;
    对所述k个卷积特征进行特征融合预测,得到所述待修复图像帧的待修复区域。Feature fusion prediction is performed on the k convolution features to obtain the area to be repaired of the image frame to be repaired.
  14. 一种数据修复装置,其特征在于,所述装置包括:A data repair device, characterized in that the device includes:
    样本获取模块,用于获取待修复的修复图像样本、所述修复图像样本所对应的修复区域标签及原始图像样本;A sample acquisition module, used to acquire the repaired image sample to be repaired, the repair area label corresponding to the repaired image sample, and the original image sample;
    样本区域预测模块,用于使用第一区域预测模型预测所述修复图像样本的待修复区域,得到样本预测修复区域;A sample area prediction module, configured to use the first area prediction model to predict the area to be repaired of the repaired image sample, and obtain the sample predicted repair area;
    样本修复模块,用于使用第一媒体修复模型对所述修复图像样本中的所述样本预测修复区域进行修复,得到所述修复图像样本所对应的样本优化图像;A sample repair module, configured to use the first media repair model to repair the sample predicted repair area in the repaired image sample, and obtain a sample optimized image corresponding to the repaired image sample;
    模型调整模块,用于根据所述样本预测修复区域、所述修复区域标签、所述原始图像样本及所述样本优化图像,对所述第一区域预测模型及所述第一媒体修复模型的参数进行联合调整,得到所述第一区域预测模型所对应的目标区域预测模型,以及所述第一媒体修复模型所对应的目标媒体修复模型。A model adjustment module configured to predict the repair area, the repair area label, the original image sample, and the sample optimized image based on the sample, and to predict the parameters of the first area prediction model and the first media repair model. Joint adjustment is performed to obtain a target area prediction model corresponding to the first area prediction model and a target media repair model corresponding to the first media repair model.
  15. 一种数据修复装置,其特征在于,所述装置包括:A data repair device, characterized in that the device includes:
    图像获取模块,用于获取待修复图像帧;Image acquisition module, used to acquire image frames to be repaired;
    区域预测模块,用于基于目标区域预测模型对所述待修复图像帧进行预测,得到所述待修复图像帧的待修复区域;A region prediction module, used to predict the image frame to be repaired based on the target region prediction model, and obtain the region to be repaired of the image frame to be repaired;
    数据修复模块,用于基于目标媒体修复模型对所述待修复图像帧中的待修复区域进行修复,得到所述待修复图像帧所对应的优化图像帧,其中,所述目标区域预测模型与所述目标媒体修复模型是通过联合训练得到的。The data repair module is used to repair the area to be repaired in the image frame to be repaired based on the target media repair model, and obtain the optimized image frame corresponding to the image frame to be repaired, wherein the target area prediction model is consistent with the image frame to be repaired. The above target media repair model is obtained through joint training.
  16. 一种计算机设备,其特征在于,包括处理器、存储器、输入输出接口;A computer device, characterized by including a processor, a memory, and an input and output interface;
    所述处理器分别与所述存储器和所述输入输出接口相连,其中,所述输入输出接口用于接收数据及输出数据,所述存储器用于存储计算机程序,所述处理器用于调用所述计算机程序,以使得所述计算机设备执行权利要求1-8任一项所述的方法,或者执行权利要求9-13任一项所述的方法。The processor is connected to the memory and the input-output interface respectively, wherein the input-output interface is used to receive data and output data, the memory is used to store computer programs, and the processor is used to call the computer Program, so that the computer device performs the method described in any one of claims 1-8, or performs the method described in any one of claims 9-13.
  17. 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质存储有计算机程序,所述计算机程序适于由处理器加载并执行,以使得具有所述处理器的计算机设备执行权利要求1-8任一项所述的方法,或者执行权利要求9-13任一项所述的方法。 A computer-readable storage medium, characterized in that the computer-readable storage medium stores a computer program, and the computer program is adapted to be loaded and executed by a processor, so that a computer device having the processor executes the claims The method described in any one of claims 1-8, or the method described in any one of claims 9-13.
PCT/CN2023/089718 2022-04-24 2023-04-21 Data recovery method and device, computer, and storage medium WO2023207778A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202210448573.5A CN114549369B (en) 2022-04-24 2022-04-24 Data restoration method and device, computer and readable storage medium
CN202210448573.5 2022-04-24

Publications (1)

Publication Number Publication Date
WO2023207778A1 true WO2023207778A1 (en) 2023-11-02

Family

ID=81667324

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2023/089718 WO2023207778A1 (en) 2022-04-24 2023-04-21 Data recovery method and device, computer, and storage medium

Country Status (2)

Country Link
CN (1) CN114549369B (en)
WO (1) WO2023207778A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117474807A (en) * 2023-12-27 2024-01-30 科大讯飞股份有限公司 Image restoration method, device, equipment and storage medium

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114549369B (en) * 2022-04-24 2022-07-12 腾讯科技(深圳)有限公司 Data restoration method and device, computer and readable storage medium
CN117649358B (en) * 2024-01-30 2024-04-16 腾讯科技(深圳)有限公司 Image processing method, device, equipment and storage medium

Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111325699A (en) * 2020-03-20 2020-06-23 腾讯科技(深圳)有限公司 Image restoration method and training method of image restoration model
CN112184585A (en) * 2020-09-29 2021-01-05 中科方寸知微(南京)科技有限公司 Image completion method and system based on semantic edge fusion
WO2021077140A2 (en) * 2021-02-05 2021-04-22 Innopeak Technology, Inc. Systems and methods for prior knowledge transfer for image inpainting
CN113168670A (en) * 2018-11-07 2021-07-23 光谱Optix有限公司 Bright spot removal using neural networks
CN113284073A (en) * 2021-07-08 2021-08-20 腾讯科技(深圳)有限公司 Image restoration method, device and storage medium
CN113689356A (en) * 2021-09-14 2021-11-23 三星电子(中国)研发中心 Image restoration method and device
US20210383242A1 (en) * 2018-11-13 2021-12-09 Samsung Electronics Co., Ltd. Joint unsupervised object segmentation and inpainting
CN113888431A (en) * 2021-09-30 2022-01-04 Oppo广东移动通信有限公司 Training method and device of image restoration model, computer equipment and storage medium
CN114049280A (en) * 2021-11-25 2022-02-15 广州华多网络科技有限公司 Image erasing and repairing method and device, equipment, medium and product thereof
CN114549369A (en) * 2022-04-24 2022-05-27 腾讯科技(深圳)有限公司 Data restoration method and device, computer and readable storage medium

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107993210A (en) * 2017-11-30 2018-05-04 北京小米移动软件有限公司 Image repair method, device and computer-readable recording medium
KR20210066366A (en) * 2019-11-28 2021-06-07 삼성전자주식회사 Method and device for restoring image
CN113689341A (en) * 2020-05-18 2021-11-23 京东方科技集团股份有限公司 Image processing method and training method of image processing model
CN111783605B (en) * 2020-06-24 2024-05-24 北京百度网讯科技有限公司 Face image recognition method, device, equipment and storage medium
KR20220047141A (en) * 2020-10-08 2022-04-15 에스케이텔레콤 주식회사 Method and Apparatus for Video Inpainting
CN113436100B (en) * 2021-06-28 2023-11-28 北京百度网讯科技有限公司 Method, apparatus, device, medium, and article for repairing video

Patent Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113168670A (en) * 2018-11-07 2021-07-23 光谱Optix有限公司 Bright spot removal using neural networks
US20210383242A1 (en) * 2018-11-13 2021-12-09 Samsung Electronics Co., Ltd. Joint unsupervised object segmentation and inpainting
CN111325699A (en) * 2020-03-20 2020-06-23 腾讯科技(深圳)有限公司 Image restoration method and training method of image restoration model
CN112184585A (en) * 2020-09-29 2021-01-05 中科方寸知微(南京)科技有限公司 Image completion method and system based on semantic edge fusion
WO2021077140A2 (en) * 2021-02-05 2021-04-22 Innopeak Technology, Inc. Systems and methods for prior knowledge transfer for image inpainting
CN113284073A (en) * 2021-07-08 2021-08-20 腾讯科技(深圳)有限公司 Image restoration method, device and storage medium
CN113689356A (en) * 2021-09-14 2021-11-23 三星电子(中国)研发中心 Image restoration method and device
CN113888431A (en) * 2021-09-30 2022-01-04 Oppo广东移动通信有限公司 Training method and device of image restoration model, computer equipment and storage medium
CN114049280A (en) * 2021-11-25 2022-02-15 广州华多网络科技有限公司 Image erasing and repairing method and device, equipment, medium and product thereof
CN114549369A (en) * 2022-04-24 2022-05-27 腾讯科技(深圳)有限公司 Data restoration method and device, computer and readable storage medium

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117474807A (en) * 2023-12-27 2024-01-30 科大讯飞股份有限公司 Image restoration method, device, equipment and storage medium
CN117474807B (en) * 2023-12-27 2024-05-31 科大讯飞股份有限公司 Image restoration method, device, equipment and storage medium

Also Published As

Publication number Publication date
CN114549369B (en) 2022-07-12
CN114549369A (en) 2022-05-27

Similar Documents

Publication Publication Date Title
WO2023207778A1 (en) Data recovery method and device, computer, and storage medium
US10726304B2 (en) Refining synthetic data with a generative adversarial network using auxiliary inputs
WO2021218786A1 (en) Data processing system, object detection method and apparatus thereof
CN113704531A (en) Image processing method, image processing device, electronic equipment and computer readable storage medium
CN112037142B (en) Image denoising method, device, computer and readable storage medium
CN110705412A (en) Video target detection method based on motion history image
CN112232346A (en) Semantic segmentation model training method and device and image semantic segmentation method and device
WO2023212997A1 (en) Knowledge distillation based neural network training method, device, and storage medium
CN111382647B (en) Picture processing method, device, equipment and storage medium
CN111079507A (en) Behavior recognition method and device, computer device and readable storage medium
CN114863539A (en) Portrait key point detection method and system based on feature fusion
WO2023246912A1 (en) Image character structured output method and apparatus, and electronic device and storage medium
JP2022090633A (en) Method, computer program product and computer system for improving object detection within high-resolution image
CN115223020A (en) Image processing method, image processing device, electronic equipment and readable storage medium
Yi et al. Elanet: effective lightweight attention-guided network for real-time semantic segmentation
US20220207913A1 (en) Method and device for training multi-task recognition model and computer-readable storage medium
CN113095506A (en) Machine learning method, system and medium based on end, edge and cloud cooperation
CN115439881A (en) Image processing method and device based on multi-task learning and intelligent equipment
CN112926585A (en) Cross-domain semantic segmentation method based on regenerative kernel Hilbert space
CN113840169A (en) Video processing method and device, computing equipment and storage medium
Das et al. Object Detection on Scene Images: A Novel Approach
Peng et al. Multitarget Detection in Depth‐Perception Traffic Scenarios
EP4195163A1 (en) Method, apparatus, and computer program product for identifying an object of interest within an image from a digital signature generated by a signature encoding module including a hypernetwork
Fan et al. Autonomous Vehicle Vision 2021: ICCV Workshop Summary
WO2024092590A1 (en) Image processing method and apparatus, model training method and apparatus, and terminal device

Legal Events

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

Ref document number: 23795211

Country of ref document: EP

Kind code of ref document: A1