Method, apparatus, system, device and medium for video processing

By retaining the target object in the target frame and erasing the visual content information in the mask frame of the relevant frame, the problem of limited compression capabilities of existing video coding algorithms is solved, and efficient compression and bandwidth optimization of video data are achieved.

CN117152658BActive Publication Date: 2024-10-01VASTAI TECH (SHANGHAI) INC
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311095385.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-05-10
Publication Date
2024-10-01
Estimated Expiration
2043-05-10

AI Technical Summary

Technical Problem

Existing video coding algorithms have limited compression capabilities when compressing video data, resulting in increased demand for video transmission bandwidth, which is particularly difficult to ensure stability in mobile network environments.

Method used

The target object is retained in the target frame, and the visual content information of the target object is erased in the mask frame of the relevant frame, and the scene information is retained. Then, when the video is restored, the relevant frame is reconstructed based on the visual information of the target frame, realizing video data Compression reduces storage space and transmission bandwidth requirements.

Benefits of technology

Without affecting the video image quality, the storage space and transmission bandwidth requirements of video data are reduced, and the efficiency of video processing is improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117152658B_ABST
    Figure CN117152658B_ABST
Patent Text Reader

Abstract

The present disclosure provides a method, apparatus, system, device and medium for video processing. The implementation scheme is: based on a first preset rule, determine a target frame and a related frame corresponding to the target frame in a video to be processed, wherein the related frame includes at least one target object appearing in the target frame; segment the related frame to obtain a first segmentation result; based on the first segmentation result, obtain a first mask frame corresponding to the related frame, wherein the first mask frame includes a first target area corresponding to the at least one target object, and the pixel value of each pixel in the first target area indicates that the pixel corresponding to the position in the related frame belongs to the at least one target object; and replace the related frame of the video to be processed with the corresponding first mask frame.
Need to check novelty before this filing date? Find Prior Art

Description

[0001] Division Statement

[0002] This application is a divisional application of the Chinese invention patent application with the application date of May 10, 2023, the invention name of “Methods, devices, systems, equipment and media for video processing”, and the application number: 202310521076.8. Technical Field

[0003] The present disclosure relates to the fields of image processing technology, video processing technology and artificial intelligence technology, and in particular to a method, electronic device and storage medium for video processing. Background Art

[0004] The transmission of video content has brought pressure and challenges to the Internet's network bandwidth. The industry is committed to developing new video encoding standards to reduce bandwidth requirements. The increase in video resolution and frame rate has further increased the bandwidth requirements for video transmission. In addition, the end point of the Internet is the mobile network, and even for 5G mobile networks, the bandwidth cannot be guaranteed to be stable.

[0005] Artificial intelligence and deep learning are widely used in various fields such as image / video processing and generation, computer vision, automatic speech recognition, and autonomous driving. With the increasing performance of graphics processing units (GPUs) and artificial intelligence (AI) application-specific integrated circuits (ASICs), AI computing resources are becoming more powerful and the cost is becoming lower and lower.

[0006] The methods described in this section are not necessarily methods that have been previously conceived or employed. Unless otherwise indicated, it should not be assumed that any method described in this section is considered to be prior art simply because it is included in this section. Similarly, unless otherwise indicated, the issues mentioned in this section should not be considered to have been recognized in any prior art. Summary of the invention

[0007] According to one aspect of the present disclosure, a method for video processing is provided. The method includes: determining a target frame and a related frame corresponding to the target frame in a video to be processed based on a first preset rule, wherein the related frame includes at least one target object appearing in the target frame; segmenting the related frame to obtain a first segmentation result; acquiring a first mask frame corresponding to the related frame based on the first segmentation result, wherein the first mask frame includes a first target area corresponding to at least one target object, and the pixel value of each pixel in the first target area indicates the target object to which the pixel corresponding to the position in the related frame belongs; and replacing the related frame of the video to be processed with the corresponding first mask frame to obtain a video to be restored.

[0008] According to one aspect of the present disclosure, a method for video processing is provided. The method includes: determining a target frame and a first mask frame corresponding to the target frame in a video to be restored, wherein the target frame includes at least one target object, the first mask frame includes a first target area corresponding to the at least one target object, and the pixel value of each pixel in the first target area indicates the target object to which the pixel belongs; restoring the first mask frame based on the target frame to obtain a restored related frame corresponding to the first mask frame, wherein the pixel values ​​of the pixels in the area corresponding to the first target area position in the related frame are restored based on the pixel values ​​of the pixels in the area corresponding to the at least one target object in the target frame; and replacing the first mask frame of the video to be restored with the restored related frame.

[0009] According to one aspect of the present disclosure, a device for video processing is provided. The device includes: a first determination unit, configured to determine a target frame and a related frame corresponding to the target frame in a video to be processed based on a first preset rule, wherein the related frame includes at least one target object appearing in the target frame; a segmentation unit, configured to segment the related frame to obtain a first segmentation result; an acquisition unit, configured to acquire a first mask frame corresponding to the related frame based on the first segmentation result, wherein the first mask frame includes a first target area corresponding to at least one target object, and the pixel value of each pixel in the first target area indicates the target object to which the pixel corresponding to the position in the related frame belongs; and a first replacement unit, configured to replace the related frame of the video to be processed with the corresponding first mask frame to obtain a video to be restored.

[0010] According to one aspect of the present disclosure, a device for video processing is provided. The device includes: a second determination unit, configured to determine a target frame and a first mask frame corresponding to the target frame in a video to be restored, wherein the target frame includes at least one target object, the first mask frame includes a first target area corresponding to the at least one target object, and the pixel value of each pixel in the first target area indicates the target object to which the pixel belongs; a restoration unit, configured to restore the first mask frame based on the target frame to obtain a restored related frame corresponding to the first mask frame, wherein the pixel values ​​of the pixels in the area corresponding to the first target area position in the related frame are restored based on the pixel values ​​of the pixels in the area corresponding to the at least one target object in the target frame; and a second replacement unit, replacing the first mask frame of the video to be restored with the restored related frame.

[0011] According to one aspect of the present disclosure, a system for video processing is provided, which includes the two aforementioned devices for video processing.

[0012] According to another aspect of the present disclosure, an electronic device is provided, including: a processor; and a memory storing a program, wherein the program includes instructions, and when the instructions are executed by the processor, the processor executes the above method.

[0013] According to another aspect of the present disclosure, a non-transitory computer-readable storage medium storing a program is provided, including instructions, which, when executed by a processor of an electronic device, cause the electronic device to execute the above method.

[0014] According to another aspect of the present disclosure, a computer program product is provided, comprising a computer program, which implements the above method when executed by a processor.

[0015] According to an embodiment of the present disclosure, by retaining the target object in the target frame, erasing the visual content information of the target object in the mask frame corresponding to the related frame and retaining the situational information (for example, position, shape, category) of the target object, the related frames can be reconstructed based on the visual information of the target frame when restoring the video, thereby compressing the video data in the video storage and transmission links without affecting the image quality of the video, reducing the size of the storage space occupied by the video data and reducing the bandwidth demand during the transmission process.

[0016] These and other aspects of the disclosure will be apparent from and elucidated with reference to the embodiments described hereinafter. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] The accompanying drawings exemplarily illustrate the embodiments and constitute a part of the specification, and together with the text description of the specification, are used to explain the exemplary implementation of the embodiments. The embodiments shown are for illustrative purposes only and do not limit the scope of the claims. In all drawings, the same reference numerals refer to similar but not necessarily identical elements.

[0018] Figure 1 is a schematic diagram showing an exemplary system in which various methods described herein may be implemented according to an exemplary embodiment of the present disclosure and a schematic diagram of processing a target frame and a related frame;

[0019] Figure 2 is a flow chart illustrating a method for video processing according to an exemplary embodiment;

[0020] Figure 3 is a flow chart illustrating a method for video processing according to an exemplary embodiment;

[0021] Figure 4 is a flow chart illustrating a method for video processing according to an exemplary embodiment;

[0022] Figure 5 is a flow chart illustrating a method for video processing according to an exemplary embodiment;

[0023] Figure 6 is a flow chart illustrating a method for video processing according to an exemplary embodiment;

[0024] Figure 7 is a block diagram showing a structure of an apparatus for video processing according to an exemplary embodiment;

[0025] Figure 8 is a block diagram showing a structure of an apparatus for video processing according to an exemplary embodiment;

[0026] Fig. 9 is a block diagram showing a system for video processing according to an exemplary embodiment; and

[0027] Fig.10 is a block diagram illustrating an example of an electronic device according to an exemplary embodiment of the present disclosure. DETAILED DESCRIPTION

[0028] In the present disclosure, unless otherwise specified, the use of the terms "first", "second", etc. to describe various elements is not intended to limit the positional relationship, timing relationship, or importance relationship of these elements, and such terms are only used to distinguish one element from another element. In some examples, the first element and the second element may refer to the same instance of the element, and in some cases, based on the description of the context, they may also refer to different instances.

[0029] The terms used in the description of various examples in this disclosure are only for the purpose of describing specific examples and are not intended to be limiting. Unless the context clearly indicates otherwise, if the number of elements is not specifically limited, the element can be one or more. In addition, the term "and / or" used in this disclosure covers any one of the listed items and all possible combinations.

[0030] In the related art, existing video coding algorithms can achieve inter-frame prediction by using motion compensation methods, but this method has strong limitations and limited compression capabilities.

[0031] To solve the above problems, the present invention retains the target object in the target frame, erases the visual content information of the target object in the mask frame corresponding to the related frame and retains the situational information (for example, position, shape, category) of the target object, so that when restoring the video, the related frames can be reconstructed based on the visual information of the target frame, thereby compressing the video data in the video storage and transmission links without affecting the image quality of the video, reducing the size of the storage space occupied by the video data and reducing the bandwidth demand during the transmission process.

[0032] The embodiments of the present disclosure will be described in detail below with reference to the accompanying drawings.

[0033] Figure 1 Part (a) of FIG. 1 shows a schematic diagram of an exemplary system 100 in which various methods and apparatuses described herein may be implemented according to exemplary embodiments of the present disclosure. Figure 1 In part (a) of the system, the system includes a first client device 110 , a server 120 , a second client device 130 , and a communication network 140 between the first client device 110 , the server 120 , and the second client device 130 .

[0034] In an embodiment of the present disclosure, the first client device 110 and the server 120 may run one or more services or software applications that enable the execution of a method for video processing. Specifically, the first client device 110 may run a service or software application that enables the execution of a video processing method that replaces a relevant frame in a video to be processed with a mask frame, and the server 120 may run a service or software application that enables the execution of a video processing method that restores a mask frame of a video to be processed to a relevant frame.

[0035] In some embodiments, the first client device 110 may send the processed video or video stream to the server 120 via the communication network 140. The server 120 may send feedback data to the first client device 110 via the communication network 140 to instruct the first client device 110 to adjust the parameters used in the video processing process.

[0036] In some embodiments, the second client device 130 can run one or more services or software applications that enable the execution of the method for video broadcasting. Specifically, the server 120 can send the restored video or video stream to the second client 130 via the communication network 140, and the second client 130 can play the restored video or video stream received from the server 120 in response to receiving a video playback instruction from the user. Although only one second client device that receives and plays a video is described in the exemplary system 100, it will be appreciated by those skilled in the art that the present disclosure can support any number of second client devices. Similarly, the present disclosure can support any number of first client devices that process the video, and these first client devices each transmit video data to the server 120, and the server 120 uses the computing resources thereon to restore the video data.

[0037] The first client device 110 and the second client device 130 may include various types of computer devices, such as portable handheld devices, general-purpose computers (such as personal computers and laptop computers), workstation computers, wearable devices, gaming systems, sensors or other sensing devices, etc. These computer devices can run various types and versions of software applications and operating systems. Portable handheld devices may include cellular phones, smart phones, tablet computers, personal digital assistants (PDAs), etc. Wearable devices may include head-mounted displays and other devices. Gaming systems may include various handheld gaming devices, Internet-enabled gaming devices, etc. In particular, the first client device 110 may include a camera to capture raw video or video streams. The first client device 110 may process the raw video or video stream using the computing power on the terminal, and send the processed video or video stream to the server 120 using the communication unit thereon.

[0038] The server 120 may include one or more general purpose computers, dedicated server computers (e.g., PC (personal computer) servers, UNIX servers, mid-range servers), blade servers, mainframe computers, server clusters, or any other suitable arrangement and / or combination. The server 120 may include one or more virtual machines running virtual operating systems, or other computing architectures involving virtualization (e.g., one or more flexible pools of logical storage devices that may be virtualized to maintain a server's virtual storage device).

[0039] The communication network 140 may be any type of network known to those skilled in the art that may support data communications using any of a variety of available protocols, including but not limited to TCP / IP, SNA, IPX, etc. By way of example only, the communication network 140 may be a local area network (LAN), an Ethernet-based network, a wide area network (WAN), the Internet, a virtual network, a virtual private network (VPN), an intranet, an extranet, a wireless network (e.g., Bluetooth, WIFI), and / or any combination of these and / or other networks.

[0040] Figure 1 The system 100 of part (a) in FIG. 1 may be configured and operated in various ways to enable the application of various methods and apparatuses described in accordance with the present disclosure.

[0041] Understandably, Figure 1 The system 100 in part (a) is merely exemplary and is not intended to limit the scope of the present disclosure. In some embodiments, the first client device can directly send the processed video or video stream to the second client device, and the second client device uses the computing power on the terminal to restore and play the received video or video stream. In other embodiments, the video processed by the first client device can be stored locally or in the cloud, and when it needs to be watched, it can be retrieved and restored from the local or cloud, thereby saving storage space.

[0042] For ease of description, the present disclosure uses "second terminal" to refer to an execution subject of a method that executes a step of replacing a relevant frame in a to-be-processed video with a mask frame, and uses "first terminal" to refer to an execution subject of a method that executes a step of restoring a mask frame in a to-be-processed video to obtain a relevant frame. It is understandable that the first terminal and the second terminal may also be the same terminal device, or different units on the same terminal device, which is not limited here.

[0043] Figure 1 Part (b) of FIG. 1 shows a schematic diagram of processing a target frame and related frames according to an exemplary embodiment of the present disclosure. Figure 1 As shown in part (b) of FIG. 1 , the second terminal is on the left side of the dotted line and the first terminal is on the right side of the dotted line. The target frame 152 in the second terminal is directly sent to the first terminal without being processed to obtain a target frame 158 in the first terminal. The related frame 154 in the second terminal is processed to obtain a first mask frame 156, and the first mask frame 156 is sent to the second terminal to obtain a first mask frame 160 in the second terminal. The second terminal processes the target frame 158 and the first mask frame 160 using an image restoration neural network 170 to obtain a restored related frame 162.

[0044] According to one aspect of the present disclosure, a method for video processing is provided. Figure 2 As shown, the method includes: step S201, based on a first preset rule, determining a target frame and related frames corresponding to the target frame in a video to be processed, wherein the related frame includes at least one target object appearing in the target frame; step S202, segmenting the related frame to obtain a first segmentation result; step S203, based on the first segmentation result, acquiring a first mask frame corresponding to the related frame, wherein the first mask frame includes a first target area corresponding to at least one target object, and the pixel value of each pixel in the first target area indicates that the pixel corresponding to the position in the related frame belongs to the at least one target object; and step S204, replacing the related frame of the video to be processed with the corresponding first mask frame.

[0045] Therefore, by retaining the target object in the target frame, erasing the visual content information of the target object in the mask frame corresponding to the related frame and retaining the situational information (for example, position, shape, category) of the target object, the related frames can be reconstructed based on the visual information of the target frame when restoring the video, thereby compressing the video data in the video storage and transmission links without affecting the image quality of the video, reducing the size of the storage space occupied by the video data and reducing the bandwidth demand during the transmission process.

[0046] In step S201, based on a first preset rule, a target frame and related frames corresponding to the target frame are determined in a video to be processed.

[0047] The video to be processed may be, for example, a video frame captured in real time by an image acquisition unit of the second terminal (e.g., a mobile phone camera) or an image acquisition device connected to the second terminal (e.g., a camera connected to a computer), or may be a video stored on the second terminal.

[0048] According to some embodiments, the first preset rule may include at least one of the following: determining the first frame in the video to be processed as the target frame; determining a video frame with a scene different from the previous video frame as the target frame; and determining a video frame whose interval with the previous target frame is greater than a preset interval as the target frame.

[0049] In some embodiments, the preset interval can be determined based on the available upload bandwidth of the second terminal and the available computing resources when the first terminal restores the video. When the available upload bandwidth of the second terminal is small or the available computing resources of the first terminal are sufficient, a longer preset interval can be set to further reduce the amount of information in the video.

[0050] According to some embodiments, the video to be processed may include a plurality of target frames. The first preset rule may further include: determining a video frame between a current target frame and a next target frame as a related frame corresponding to the current target frame.

[0051] Therefore, through the above-mentioned first preset rule, it can be ensured that there is a similar relationship between the relevant frame and the corresponding target frame, so that the first terminal can use its computing power to reconstruct the target object in the relevant frame to achieve high-quality restoration of the relevant frame.

[0052] In some embodiments, the target object may be, for example, a physical object appearing in the video, such as a person, a vehicle, an animal, a building, or an environment such as the sky, the ground, or the ocean. Different objects of the same category may be different target objects. In an exemplary embodiment, a plurality of different people in an image may have different clothing, different appearances, and different visual features, and therefore may be identified as different target objects. The target object may also be a pixel block or image area that does not have a specific meaning, which is not limited here.

[0053] The target object may be an object that appears in both the target frame and the related frame. Therefore, when restoring a video including a target frame and a video replaced by a mask frame, the target object in the related frame may be reconstructed based on the visual information of the target object in the target frame and the situational information such as the position, shape, and category of the target object in the mask frame to obtain a restored related frame, as will be described below.

[0054] In step S202, the relevant frame is segmented to obtain a first segmentation result;

[0055] According to some embodiments, segmenting the related frames may include segmenting the related frames using image segmentation methods such as semantic segmentation, clustering, and superpixels to obtain multiple non-intersecting image regions. Features such as color, brightness, geometric shape, texture, and semantic information in the same image region may show consistency or similarity, while in different image regions, these features show obvious differences. Image segmentation can simplify the representation of an image, thereby reducing the amount of data required to represent the image.

[0056] In some embodiments, the relevant frames may be segmented using semantic segmentation to obtain an original mask image of the relevant frame, i.e., a first segmentation result. The pixel value of each pixel in the original mask image indicates the semantic category of the pixel corresponding to the position in the relevant frame (e.g., the object to which the pixel belongs or the pixel does not belong to any object), and all pixels indicating the same semantic category constitute the original region corresponding to the object.

[0057] According to some embodiments, a semantic segmentation neural network may be used to perform semantic segmentation, so as to quickly obtain accurate semantic segmentation results.

[0058] According to some embodiments, semantic segmentation may be performed on a portion of objects included in the video to be processed. Figure 3As shown, the video processing method may further include: Step S302, determining a plurality of objects to be processed included in the video to be processed. The plurality of objects to be processed include at least one target object. Figure 3 The operations and technical effects of steps S301, S303-S305 are respectively Figure 2 The operations and technical effects of steps S201 to S204 are similar and will not be described in detail here.

[0059] In an exemplary embodiment, the scene of the video to be processed includes objects such as roads with vehicles, pedestrians, and buildings. Considering that the roads and buildings in different video frames will basically not change, they can be determined as objects to be processed; although the vehicle will move, its shape remains basically the same, so the vehicle can also be determined as an object to be processed; and the movements of pedestrians in different video frames vary greatly, and there are obvious differences under different observation angles, so they can be excluded from the objects to be processed. It can be understood that the above is only an exemplary way to determine the objects to be processed among multiple objects, and it is not intended to limit the scope of the present disclosure. In some embodiments, the first terminal has limited computing resources, and at the same time detects that the uplink bandwidth of the second terminal is only occupied by a small amount, then the vehicle can also be excluded from the objects to be processed. In some embodiments, the first terminal has a strong computing power, which can realize the reconstruction of pedestrians in the relevant frames based on the visual information of the pedestrians in the target frame and the scene information of the pedestrians in the first mask frame, then the pedestrians can also be determined as objects to be processed, which is not limited here.

[0060] Therefore, by flexibly setting the object to be processed, the uplink bandwidth of the second terminal or the computing power of the first terminal can be fully utilized, thereby improving the image quality of the restored related frames.

[0061] As described above, the object to be processed can be determined by determining the available upload bandwidth of the first terminal and the image restoration capability (i.e., available computing resources) of the second terminal. In addition to the object to be processed, other parameters involved in the video processing process can also be determined based on the two, as will be described below. In addition, the computing resources used by the second terminal for restoring the image can also be adjusted according to the available upload bandwidth of the first terminal, as will be described below.

[0062] In some embodiments, the pixel value of each pixel in the original mask image may indicate the subordinate relationship between the pixel corresponding to the position in the relevant frame and the multiple objects to be processed. In some embodiments, the subordinate relationship between each pixel and the multiple objects to be processed may be one-hot, that is, each pixel belongs to only one object to be processed.

[0063] In step S304, a first mask frame corresponding to the relevant frame is acquired based on the first segmentation result.

[0064] The first mask frame may include a first target region corresponding to at least one target object, and the pixel value of each pixel in the first target region indicates that the pixel corresponding to the position in the related frame belongs to the at least one target object. In some embodiments, the original mask image may be directly determined as the corresponding first mask frame. In some embodiments, the first target region may include at least one first target sub-region corresponding to each of the at least one target object.

[0065] According to some embodiments, step S304 may include: for each of a plurality of objects to be processed, in response to determining that the object to be processed belongs to at least one target object, based on a second preset rule, determining at least one target pixel among the pixels belonging to the object to be processed in the original mask image; and determining an area in the first mask frame corresponding to the position of the at least one target pixel as a first target sub-area in the first mask frame corresponding to the object to be processed.

[0066] Therefore, by determining the target pixels used to constitute the first target sub-region from the pixels corresponding to the target object in the original mask image, the first target sub-region can be set more flexibly, so that some techniques can be used to record part of the visual information in the target object using a small amount of data, so as to significantly improve the image quality of the restored related frames.

[0067] In some exemplary embodiments, the target object has rich details or changes greatly between different frames, so if the visual information of the target object is erased for all pixels in the area corresponding to the target object in the relevant frame, it is a challenging task for the first terminal to reconstruct the target object. In such an embodiment, some pixels in the original area corresponding to the target object can be determined as the first target sub-area, and the visual information of another part of the pixels is retained in the first mask frame to provide reference and constraints for the reconstruction of the target object.

[0068] According to some embodiments, the second preset rule may include: whether the total number of at least one target pixel corresponding to each of the at least one target object reaches a preset number. The preset number may be the product of the number of pixels in the original area corresponding to the target object and a preset ratio. By determining the preset number of pixels in the original area of ​​the target pixel as the target pixel, part of the visual information of the target object can be retained in the first mask frame, thereby improving the image quality of the restored related frame.

[0069] It is understandable that the specific value of the preset number can be set according to demand. In some embodiments, if the available upload bandwidth of the second terminal is small, a larger preset number can be set; if the image restoration capability of the first terminal is weak, or the complexity and reconstruction difficulty of the target object are high, a smaller preset number can be set.

[0070] Although various bases and methods for determining the preset number are described here, the preset number should be set to as large a value as possible. This is because in most target objects, only a small number of areas are difficult to reconstruct (for example, faces with rich facial expressions). Therefore, by excluding these areas with high reconstruction difficulty from the corresponding first target sub-area, the image quality of the restored related frames can be significantly improved.

[0071] In some embodiments, the second preset rule may also include which pixels in the target object are specifically determined as the first target sub-region. In an exemplary embodiment, the edge portion of the target object interacts with other objects (e.g., animal hair and grass), and a certain degree of overlap and fusion occurs between the objects, then the middle portion of the target object can be determined as the first target sub-region, thereby excluding the edge region that is difficult to reconstruct. In some embodiments, the middle portion of the target object varies greatly between different frames (e.g., a laptop computer), then the edge portion of the target object can be determined as the first target sub-region. In some embodiments, the reconstruction difficulty of different parts may not be considered, but multiple pixel blocks may be determined regularly (e.g., in a grid form) or randomly in the original area corresponding to the target object, and these pixel blocks are determined as the first target sub-region or excluded from the first target sub-region, so that each part of the target object has pixels whose visual information is erased and pixels that retain visual information.

[0072] It is understandable that other methods may be used to determine target pixels corresponding to each target object in the original mask image to form the first target area, which is not limited here.

[0073] According to some embodiments, the first segmentation result may further include a confidence level of the subordinate relationship. The second preset rule may include: whether the corresponding confidence level of the pixels belonging to the at least one target object in the original mask image is greater than a preset confidence level.

[0074] In some embodiments, when segmenting related frames, the semantic segmentation neural network can predict the confidence of each pixel's affiliation with each target object, and the confidence information can be used to determine the target pixels corresponding to each target object. For example, pixels with confidence higher than a preset confidence are determined as target pixels, so that pixels that reduce the difficulty of reconstructing the target object are retained as much as possible with a limited amount of data, thereby improving the image quality of the restored related frames.

[0075] It is understandable that the specific value of the preset reliability can be set according to demand and is not limited here.

[0076] In some embodiments, after determining the first target area in the above manner, each first target sub-region can also be processed using image morphological methods such as dilation and erosion to eliminate scattered pixel points and small holes in connected areas, so that the processed first target sub-region is more coherent, avoiding the situation where pixels in the first target sub-region and pixels in other areas are mixed with each other, thereby reducing the complexity of subsequent encoding and reducing the difficulty of the first terminal to restore related frames.

[0077] According to some embodiments, any two pixels in the same first target sub-region have the same pixel value, and two pixels taken from different first target sub-regions have different pixel values. In this way, different target objects can be distinguished and the amount of data required to store the first mask frame can be greatly reduced.

[0078] According to some embodiments, the first mask frame includes a first non-target area that does not overlap with the first target area, that is, an area that does not correspond to the target object. In some embodiments, the first non-target area can be treated as a special object, and the visual information of all or part of the pixels therein can be erased. When the non-target area does not have obvious or specific semantic meaning but has a single image feature, using such an approach can further reduce the amount of information in the first mask frame.

[0079] In some embodiments, the reconstruction difficulty of the first non-target area is greater than that of the first target area, and therefore the pixel value of each pixel in the first non-target area can be determined based on the pixel value of the pixel corresponding to the position in the relevant frame. In an exemplary embodiment, the size of the first mask frame is smaller than the size of the relevant frame, and one pixel in the first mask frame corresponds to multiple pixels in the relevant frame, and then the pixel value of each pixel in the first non-target area can be determined based on the pixel values ​​of the multiple pixels corresponding to the position. In an exemplary embodiment, the size of the first mask frame and the relevant frame is the same, and then the pixel value of the pixel corresponding to the position in the relevant frame can be directly determined as the pixel value of the pixel in the first non-target area in the first mask frame. Thus, by retaining the visual information of all pixels in the first non-target area, the image quality of the corresponding area in the restored relevant frame can be guaranteed.

[0080] In step S305, the relevant frame of the video to be processed is replaced with the corresponding first mask frame.

[0081] In some embodiments, compared to the related frames, the first mask frame may have a smaller size and a simpler color mode, thereby further reducing the amount of data in the replaced video. When there are fewer target frames in the video to be processed (for example, the preset interval is long and the scene changes are small), and the first mask frame does not include or only includes a small number of pixels retained from the related frames, such a first mask frame can be used, and then the target frame and the first mask frame in the video are compressed and stored or transmitted.

[0082] According to some embodiments, the size and color mode of the first mask frame may be the same as the size and color mode of the associated frame. By generating a first mask image with the same size as the associated frame, more information can be retained. In addition, the first mask frame and the associated frame have the same size and color mode, which makes it easier to encode the replaced video to be processed, thereby further reducing the size of the video file or the bandwidth required for transmission.

[0083] In some embodiments, the color used by each first target sub-region in the first mask frame may be a color that is not used or is used less in the video to be processed, thereby avoiding confusion between the first target sub-region and other pixels due to the same color.

[0084] According to some embodiments, Figure 3As shown, the method for video processing also includes: step S306, video encoding the replaced video to be processed to obtain a target video or video stream; and step S307, sending the target video or video stream to the first terminal. Thus, by encoding the replaced continuous video frames, the amount of video data can be further reduced. In addition, since the first mask frame is used to replace the relevant frame, the replaced video has a large area of ​​color blocks, and adjacent frames include similarly positioned color blocks of the same color, so that the effects of coding modes such as intra-frame prediction and inter-frame prediction can be significantly improved during video coding, thereby improving coding efficiency and reducing the amount of data of the encoded video.

[0085] It is understandable that the present disclosure does not limit the video encoding standard used, and schemes for encoding the processed video using various encoding standards such as H.264, H.265, AVI, etc. all fall within the scope of the present disclosure.

[0086] In some embodiments, the second terminal may send the target video to the first terminal after completely processing the video to be processed, or may process the video to be processed in real time and send the video frames to the first terminal in the form of a video stream, which is not limited here.

[0087] As described above, information can be exchanged between the first terminal and the second terminal so that the second terminal can learn about the image restoration capability and available computing resources of the first terminal, and the first terminal can learn about the available upload bandwidth, video processing parameters (e.g., target frame preset interval, objects to be processed for segmentation) and specific conditions of the video to be processed of the second terminal. In an exemplary embodiment, before the first terminal processes the video to be processed, it first sends a sample of the video to be processed (which may include the original sample and the sample processed by the steps included in the method of the present disclosure) and video processing parameters to the second terminal, and the first terminal sends feedback information for adjusting the video processing parameters to the second terminal based on the sample and the computing capability on the terminal (e.g., restoring the processed sample and evaluating the restoration result), and then the second terminal further adjusts the video processing parameters based on the received feedback information and the available upload bandwidth, so that under the current available upload bandwidth, the processed video can retain the most effective image information (including visual information and scenario information), and can maximize the use of the image restoration capability of the first terminal to process the received video to obtain a high-quality restored video.

[0088] According to some embodiments, Figure 3 As shown, the method for video processing further includes: step S308, in response to receiving a request from the first terminal to retain one of the target objects in the first mask frame, removing one of the target objects from the multiple objects to be processed.

[0089] In some embodiments, when the first terminal detects that the reconstruction effect of a target object is poor during restoration, it can send a request to the second terminal to retain the target object in the first mask frame. After receiving the request, the first terminal removes the target object from the objects to be processed, so that the target area corresponding to the object is not generated after semantic segmentation, thereby improving the image quality of the restored related frames.

[0090] According to some embodiments, Figure 3 As shown, the method for video processing further includes: step S309, in response to receiving a request for adjusting the first target area from the first terminal, updating the second preset rule.

[0091] In some embodiments, the first terminal may also specifically determine which part of the target object has a poor reconstruction effect during restoration, and provide feedback to the second terminal to request adjustment of the first target area. After receiving the request, the second terminal may adjust the first target area according to the specific content of the request, for example, excluding the edge portion of the corresponding target object from the first target sub-area of ​​the target object, thereby improving the image quality of the restored related frame.

[0092] In some embodiments, the request to adjust the first target area may not be directed to a specific target object. In an exemplary embodiment, when the first terminal detects that the overall effect of the restored related frames is poor during restoration, a request to reduce the above-mentioned preset number or increase the above-mentioned preset confidence may be sent to the second terminal. In another exemplary embodiment, when the first terminal detects that the computing resources are not fully utilized, a request to increase the above-mentioned preset number or increase the above-mentioned preset confidence may be sent to the second terminal. It can be understood that the request sent by the first terminal to the second terminal may also be non-specific, for example, only instructing the second terminal to retain more or less visual information, and the first terminal makes adjustments based on the request and other circumstances (for example, the hard upper limit of the available transmission bandwidth).

[0093] According to another aspect of the present disclosure, a method for video processing is also provided. Figure 4As shown, the method for video processing includes: step S401, determining a target frame and a first mask frame corresponding to the target frame in a video to be processed, wherein the target frame includes at least one target object, the first mask frame includes a first target area corresponding to the at least one target object, and the pixel value of each pixel in the first target area indicates that the pixel belongs to the at least one target object, step S402, restoring the first mask frame based on the target frame to obtain a restored related frame corresponding to the first mask frame, wherein the pixel values ​​of pixels in an area corresponding to the first target area position in the related frame are restored based on the pixel values ​​of pixels in an area corresponding to the at least one target object in the target frame; and step S403, replacing the first mask frame of the video to be processed with the restored related frame.

[0094] Therefore, by determining the target frame and the corresponding first mask frame in the video to be processed, in which the visual content information of the target object is erased and the scene information of the target object is retained, and reconstructing the target object in the relevant frames corresponding to the first mask frame according to the visual information of the target object in the target frame and the scene information of the target object in the first mask frame, the corresponding relevant frames can be restored and the original video to be processed can be further restored, thereby achieving compression of video data in video storage and transmission without affecting the image quality of the video, reducing the size of the storage space occupied by the video data, and reducing the demand for bandwidth during transmission.

[0095] According to some embodiments, Figure 5 As shown, the method for video processing may further include: step S501, receiving a target video or video stream from a second terminal; and step S502, decoding the target video or video stream to obtain continuous video frames. Figure 5 The operations and technical effects of steps S503 to S505 in Figure 4 The operations and technical effects of step S401 to step S403 in are similar, and are not described in detail here. Thus, continuous video frames, ie, the video to be processed, can be decoded from the target video or video stream received from the second terminal.

[0096] In step S503, a target frame and a first mask frame corresponding to the target frame are determined in the video to be processed.

[0097] In some embodiments, the video to be processed includes identifiers indicating the target frame and the first mask frame, and these identifiers can be used to determine the category of each frame in the video to be processed. In some embodiments, since the first mask frame includes obvious monochrome connected areas, the category of each frame can also be determined by identifying these areas in the video frame, which is not limited here.

[0098] In step S504, the first mask frame is restored based on the target frame to obtain a restored related frame corresponding to the first mask frame.

[0099] In some embodiments, pixel values ​​of pixels in an area corresponding to the first target area position in the relevant frame may be restored based on pixel values ​​of pixels in an area corresponding to at least one target object in the target frame.

[0100] According to some embodiments, step S504, restoring the first mask frame based on the target frame to obtain a restored related frame corresponding to the first mask frame may include: inputting the target frame and the first mask frame into an image restoration neural network to obtain a restored related frame. Thus, by using the image restoration neural network, an accurate restored related frame can be quickly obtained.

[0101] The image restoration neural network is a neural network with image restoration capabilities. In some embodiments, an existing image reconstruction or image restoration neural network can be used, such as a network using a UNet architecture, or a corresponding neural network can be designed by oneself, which is not limited here.

[0102] In some embodiments, the target frame and the first mask frame have the same size, and they can be spliced ​​along the color channel direction and input into the image restoration neural network. In some embodiments, the first mask frame has a smaller size, and the first mask frame can be upsampled and spliced ​​with the target frame, or the target frame can be downsampled to the same size as the first mask frame using the initial convolutional layer of the neural network, and then the two can be spliced ​​and sent to the deep structure of the neural network. It is understandable that the first mask frame and the target frame can also be input into the neural network in other ways, which are not limited here.

[0103] According to some embodiments, Figure 6 As shown, the method for video processing may further include: step S602, segmenting the target frame to obtain a second segmentation result; step S603, acquiring a second mask frame corresponding to the target frame based on the second segmentation result. The second mask frame includes a second target area corresponding to at least one target object, and the pixel value of each pixel in the second target area indicates that the pixel corresponding to the position in the target frame belongs to the at least one target object. Figure 6 The operations and technical effects of steps S601, S604-S605 are respectively Figure 4 The operations and technical effects of steps S401 to S403 are similar and are not limited here.

[0104] In some embodiments, step S605, inputting the target frame and the first mask frame into the neural network to obtain a restored related frame may include: inputting the target frame, the first mask frame, and the second mask frame into the neural network to obtain a restored related frame.

[0105] Therefore, by inputting the second mask frame corresponding to the target frame into the image restoration neural network together with the target frame and the first mask frame, the explicit segmentation information of the target frame can be used to further constrain the reconstruction of the target object and the restoration of related frames, thereby improving the image quality of the restored related frames.

[0106] It is understandable that the way in which the second mask frame is input into the neural network is similar to the way in which the first mask frame is input into the neural network, and will not be elaborated here.

[0107] Back to Figure 5 According to some embodiments, step S504, inputting the target frame and the first mask frame into the neural network to obtain the restored related frames may include: in response to determining that one or more prior first mask frames between the first mask frame and the target frame have been restored, inputting the first mask frame, the target frame, and one or more restored prior related frames corresponding to the one or more prior first mask frames into the neural network to obtain the restored related frames.

[0108] Therefore, by using one or more restored prior second mask frames, richer visual information about the target object is provided for the restoration process of the first mask frame, and timing constraints are provided, thereby further improving the image quality of the restored related frames output by the neural network.

[0109] In step S505, the first mask frame of the video to be processed is replaced with the restored related frame.

[0110] In some embodiments, when the first terminal is a server, the final video can be encoded and sent to other terminals for playback, and when the first terminal is a client, the final video can be directly played on the first terminal.

[0111] As described above, information exchange can be performed between the first terminal and the second terminal.

[0112] According to some embodiments, the at least one target object comprises a plurality of target objects. Figure 5 As shown, the method for video processing also includes: step S506, in response to determining that the restoration quality of any target object in the restored related frame does not meet the preset standard, sending a request to the second terminal to retain the target object in the related frame.

[0113] Therefore, by feeding back information that a target object in the relevant frame has a poor restoration effect to the second terminal, the second terminal can retain the target object in the subsequent first mask frame, thereby improving the image quality of the restored relevant frame.

[0114] According to some embodiments, Figure 5 As shown, the method for video processing also includes: step S507, in response to determining that the restoration quality of at least one target object in the restored related frame does not reach or exceed a preset standard, sending a request to adjust the first target area to the second terminal.

[0115] Therefore, by feeding back information that the restoration quality of at least one target object in the relevant frame does not meet the standard or exceeds the standard to the second terminal, the second terminal can reduce or expand the first target area in the subsequent first mask frame, so that the image quality of the repaired relevant frame meets the standard and the computing resources of the second terminal can be fully utilized.

[0116] It is understandable that the above-mentioned restoration quality evaluation method and preset standard can be set according to needs and are not limited here. In an exemplary embodiment, the confidence of each pixel can be output when restoring the first mask frame, and then the average confidence of the pixels corresponding to the first target area is used as the restoration quality evaluation method, and the corresponding confidence threshold is set as the preset standard.

[0117] In some embodiments, the preset standard may also be a range, and step S507 may be to send a request to the second terminal to adjust the first target area in response to determining that the restoration quality of at least one target object in the restored related frame does not reach the lower limit of the preset standard or exceeds the upper limit of the preset standard.

[0118] In some embodiments, in response to detecting that the restoration quality of the relevant frame does not meet the preset standard, or in response to determining that the upload bandwidth of the second terminal is small, the computing resources of the first terminal can be expanded to improve its image restoration capability. Similarly, in response to detecting that the restoration quality of the relevant frame exceeds the preset standard, or in response to determining that the upload bandwidth of the second terminal is large, the computing resources of the first terminal can be tightened to improve its resource utilization efficiency. Thus, by adjusting the computing resources of the first terminal based on the restoration quality of the first terminal or the situation of the second terminal, the computing resource utilization of the first terminal can be improved, thereby improving the overall efficiency and parallelism of the first terminal when interacting with multiple second terminals.

[0119] According to another aspect of the present disclosure, a device for video processing is also provided. Figure 7As shown, the device 700 includes: a first determination unit 710, configured to determine a target frame and a related frame corresponding to the target frame in a video to be processed based on a first preset rule, wherein the related frame includes at least one target object appearing in the target frame; a segmentation unit 720, configured to segment the related frame to obtain a first segmentation result; an acquisition unit 730, configured to acquire a first mask frame corresponding to the related frame based on the first segmentation result, wherein the first mask frame includes a first target area corresponding to at least one target object, and the pixel value of each pixel in the first target area indicates that the pixel corresponding to the position in the related frame belongs to the at least one target object; and a first replacement unit 740, configured to replace the related frame of the video to be processed with the corresponding first mask frame.

[0120] It can be understood that the operations and technical effects of units 710-740 in device 700 are respectively Figure 2 The operations and technical effects of steps S201 to S204 are similar and will not be described in detail here.

[0121] According to another aspect of the present disclosure, a device for video processing is also provided. Figure 8 As shown, the device 800 includes: a second determination unit 810, configured to determine a target frame and a first mask frame corresponding to the target frame in a video to be processed, wherein the target frame includes at least one target object, the first mask frame includes a first target area corresponding to the at least one target object, and the pixel value of each pixel in the first target area indicates that the pixel belongs to the at least one target object; a restoration unit 820, configured to restore the first mask frame based on the target frame to obtain a restored related frame corresponding to the first mask frame, wherein the pixel values ​​of the pixels in the area corresponding to the first target area position in the related frame are restored based on the pixel values ​​of the pixels in the area corresponding to the at least one target object in the target frame; and a second replacement unit 830, replacing the first mask frame of the video to be processed with the restored related frame.

[0122] It is understood that the operations and technical effects of units 810-830 in device 800 are respectively Figure 4 The operations and technical effects of steps S401 to S403 are similar and will not be described in detail here.

[0123] According to another aspect of the present disclosure, a system for video processing is also provided. Fig. 9 As shown, the system 900 includes: the above-mentioned apparatus 700 for video processing and the above-mentioned apparatus 800 for video processing.

[0124] According to another aspect of the present disclosure, there is also provided an electronic device, including: a processor; and a memory storing a program, wherein the program includes instructions, and when the instructions are executed by the processor, the processor executes the above-mentioned image processing method.

[0125] According to another aspect of the present disclosure, a non-transitory computer-readable storage medium storing a program is also provided. The program includes instructions, which, when executed by a processor of an electronic device, cause the electronic device to perform the above-mentioned image processing method.

[0126] According to another aspect of the present disclosure, a computer program product is also provided, including a computer program, and the computer program implements the above-mentioned image processing method when executed by a processor.

[0127] Fig.10 is a block diagram showing an example of an electronic device according to an exemplary embodiment of the present disclosure. Fig.10 The structure shown is only an example. According to the specific implementation, the electronic device of the present disclosure may only include Fig.10 One or more of the components shown.

[0128] The electronic device 1000 may be, for example, a general-purpose computer (eg, a laptop computer, a tablet computer, etc.), a mobile phone, or a personal digital assistant. According to some embodiments, the electronic device 1000 may be a cloud computing device or a smart device.

[0129] According to some embodiments, the electronic device 1000 may be configured to process at least one of an image, text, and audio, and transmit the processing result to an output device and provide it to a user. The output device may be, for example, a display screen, a device including a display screen, or a sound output device such as a headset, a speaker, or an oscillator. For example, the electronic device 1000 may be configured to perform target detection on an image, transmit the target detection result to a display device for display, and the electronic device 1000 may also be configured to perform enhanced processing on the image, and transmit the enhanced result to the display device for display. The electronic device 1000 may also be configured to recognize the text in the image, and transmit the recognition result to the display device for display and / or convert the recognition result into sound data and transmit it to the sound output device for playback. The electronic device 2000 may also be configured to recognize and process the audio, and transmit the recognition result to the display device for display and / or convert the processing result into sound data and transmit it to the sound output device for playback.

[0130] The electronic device 1000 may include an image processing circuit 1003, and the image processing circuit 1003 may be configured to perform various image processing on the image. For example, the image processing circuit 1003 may be configured to perform at least one of the following image processing on the image: denoising the image, geometrically correcting the image, extracting features from the image, detecting and / or identifying objects in the image, enhancing the image, and detecting and / or identifying text contained in the image, etc.

[0131] The electronic device 1000 may further include a text recognition circuit 1004, which is configured to perform text detection and / or recognition (e.g., OCR processing) on ​​a text area in an image, thereby obtaining text data. The text recognition circuit 1004 may be implemented, for example, by a dedicated chip. The electronic device 1000 may further include a sound conversion circuit 1005, which is configured to convert the text data into sound data. The sound conversion circuit 1005 may be implemented, for example, by a dedicated chip.

[0132] The electronic device 1000 may further include an audio processing circuit 1006, which is configured to convert audio into text, thereby obtaining text data corresponding to the audio. The audio processing circuit 1006 may also be configured to process the text data corresponding to the audio, for example, including keyword extraction, intent recognition, intelligent recommendation, and intelligent question and answer, etc. The audio processing circuit 1006 may be implemented, for example, by a dedicated chip. The sound conversion circuit 1005 may also be configured to convert the audio processing result into sound data, so as to be suitable for application scenarios such as voice assistants or virtual customer service.

[0133] The various circuits described above (for example, one or more of the image processing circuit 1003, the text recognition circuit 1004, the sound conversion circuit 1005, and the audio processing circuit 1006) may use customized hardware, and / or may be implemented using hardware, software, firmware, middleware, microcode, hardware description language, or any combination thereof. For example, one or more of the various circuits described above may be implemented by programming hardware (for example, a programmable logic circuit including a field programmable gate array (FPGA) and / or a programmable logic array (PLA)) in assembly language or a hardware programming language (such as VERILOG, VHDL, C++) using the logic and algorithms according to the present disclosure.

[0134] According to some embodiments, the electronic device 1000 may further include an output device 1007, which may be any type of device for presenting information, including but not limited to a display screen, a terminal with a display function, headphones, a speaker, a vibrator and / or a printer, etc.

[0135] According to some embodiments, the electronic device 1000 may also include an input device 1008, which may be any type of device for inputting information into the electronic device 1000, and may include but is not limited to various sensors, mice, keyboards, touch screens, buttons, joysticks, microphones and / or remote controls, etc.

[0136] According to some embodiments, the electronic device 1000 may also include a communication device 1009, which may be any type of device or system that enables communication with an external device and / or with a network, and may include but is not limited to a modem, a network card, an infrared communication device, a wireless communication device and / or a chipset, such as a Bluetooth device, an 802.11 device, a WiFi device, a WiMax device, a cellular communication device and / or the like.

[0137] According to some embodiments, the electronic device 1000 may further include a processor 1001. The processor 1001 may be any type of processor, and may include but is not limited to one or more general-purpose processors and / or one or more dedicated processors (e.g., special processing chips). The processor 1001 may be, for example, but is not limited to, a central processing unit CPU, a graphics processor GPU, or various dedicated artificial intelligence (AI) computing chips, etc.

[0138] The electronic device 1000 may also include a working memory 1002 and a storage device 1011. The processor 1001 may be configured to be able to obtain and execute computer-readable instructions stored in the working memory 1002, the storage device 1011 or other computer-readable media, such as program codes of an operating system 1002a, program codes of an application 1002b, etc. The working memory 1002 and the storage device 1011 are examples of computer-readable storage media for storing instructions, and the stored instructions can be executed by the processor 1001 to implement the various functions described above. The working memory 1002 may include both volatile memory and non-volatile memory (e.g., RAM, ROM, etc.). The storage device 1011 may include a hard disk drive, a solid-state drive, a removable medium, including external and removable drives, memory cards, flash memory, floppy disks, optical disks (e.g., CDs, DVDs), storage arrays, network attached storage, storage area networks, etc. The working memory 1002 and the storage device 1011 may all be collectively referred to herein as memory or computer-readable storage media, and may be non-transitory media capable of storing computer-readable, processor-executable program instructions as computer program code, which may be executed by the processor 1001 as a specific machine configured to implement the operations and functions described in the examples of this document.

[0139] According to some embodiments, the processor 1001 may control and schedule at least one of the image processing circuit 1003, the text recognition circuit 1004, the sound conversion circuit 1005, the audio processing circuit 1006, and other various devices and circuits included in the electronic device 1000. According to some embodiments, Fig.10 At least some of the various components described in the embodiment may be interconnected and / or communicate with each other via the bus 1010 .

[0140] Software elements (programs) may be located in the working memory 1002 , including but not limited to an operating system 1002 a , one or more application programs 1002 b , drivers, and / or other data and codes.

[0141] According to some embodiments, instructions for performing the aforementioned control and scheduling may be included in the operating system 1002a or one or more application programs 1002b.

[0142] According to some embodiments, performing the method steps of the present disclosure (e.g. Figure 2-Figure 6 The instructions of the method steps shown in the flowchart of the embodiment of the present invention may be included in one or more applications 1002b, and the various modules of the electronic device 1000 may be implemented by reading and executing the instructions of one or more applications 1002b by the processor 1001. In other words, the electronic device 1000 may include a processor 1001 and a memory (e.g., a working memory 1002 and / or a storage device 1011) storing a program, wherein the program includes instructions, and when the instructions are executed by the processor 1001, the processor 1001 executes the method described in various embodiments of the present disclosure.

[0143] According to some embodiments, part or all of the operations performed by at least one of the image processing circuit 1003, the text recognition circuit 1004, the sound conversion circuit 1005, and the audio processing circuit 2007 can be implemented by the processor 1001 reading and executing instructions of one or more applications 1002b.

[0144] The executable code or source code of the instructions of the software element (program) can be stored in a non-transitory computer-readable storage medium (e.g., the storage device 1011), and can be stored in the working memory 1002 (possibly compiled and / or installed) when executed. Therefore, the present disclosure provides a computer-readable storage medium storing a program, wherein the program includes instructions, and when the instructions are executed by a processor of an electronic device, the electronic device performs the method as described in various embodiments of the present disclosure. According to another embodiment, the executable code or source code of the instructions of the software element (program) can also be downloaded from a remote location.

[0145] It should also be understood that various modifications may be made according to specific requirements. For example, custom hardware may also be used, and / or each circuit, unit, module or element may be implemented using hardware, software, firmware, middleware, microcode, hardware description language or any combination thereof. For example, some or all of the circuits, units, modules or elements included in the disclosed method and apparatus may be implemented by programming hardware (e.g., a programmable logic circuit including a field programmable gate array (FPGA) and / or a programmable logic array (PLA)) using logic and algorithms according to the present disclosure in an assembly language or a hardware programming language (such as VERILOG, VHDL, C++).

[0146] According to some embodiments, the processor 1001 in the electronic device 1000 can be distributed on the network. For example, one processor can be used to perform some processing, while another processor away from the one processor can perform other processing. Other modules of the electronic device 1000 can also be distributed similarly. In this way, the electronic device 1000 can be interpreted as a distributed computing system that performs processing in multiple locations. The processor 1001 of the electronic device 1000 can also be a processor of a cloud computing system, or a processor combined with a blockchain.

[0147] Although the embodiments or examples of the present disclosure have been described with reference to the accompanying drawings, it should be understood that the above-mentioned methods, systems and devices are merely exemplary embodiments or examples, and the scope of the present invention is not limited by these embodiments or examples, but only by the claims after authorization and their equivalent scope. Various elements in the embodiments or examples can be omitted or replaced by their equivalent elements. In addition, each step can be performed in an order different from that described in the present disclosure. Further, the various elements in the embodiments or examples can be combined in various ways. It is important that with the evolution of technology, many elements described herein can be replaced by equivalent elements that appear after the present disclosure.

Claims

1. A method for video processing, characterized in that: The method comprises: Based on a first preset rule, determining a target frame and a related frame corresponding to the target frame in the video to be processed, wherein the related frame includes at least one target object appearing in the target frame; Segmenting the relevant frames to obtain a first segmentation result; Acquire a first mask frame corresponding to the relevant frame based on the first segmentation result, wherein the first mask frame includes a first target region corresponding to the at least one target object, and a pixel value of each pixel in the first target region indicates the target object to which the pixel corresponding to the position in the relevant frame belongs; Replacing the relevant frame of the video to be processed with the corresponding first mask frame to obtain the video to be restored; and The video to be restored is encoded to obtain a target video or a video stream, wherein the target video or the video stream is used for video decoding to obtain the video to be restored, and the video to be restored is used to restore the first target area corresponding to the at least one target object included in the first mask frame based on the target frame to obtain a restored related frame.

2. The method according to claim 1, characterized in that The first target region includes at least one first target sub-region corresponding to each of the at least one target object, wherein any two pixels in the same first target sub-region have the same pixel value, and two pixels taken from different first target sub-regions have different pixel values.

3. The method according to claim 1, characterized in that The first mask frame includes a first non-target area that does not overlap with the first target area, and a pixel value of each pixel in the first non-target area is determined based on a pixel value of a pixel corresponding to a position in the related frame.

4. The method according to any one of claims 1 to 3, characterized in that The first preset rule includes at least one of the following: Determine the first frame in the video to be processed as a target frame; determining a video frame having a different scene from a previous video frame as a target frame; and A video frame whose interval with a previous target frame is greater than a preset interval is determined as a target frame.

5. The method according to any one of claims 1 to 3, characterized in that: The video to be processed includes a plurality of target frames, and the first preset rule includes: The video frames between the current target frame and the next target frame are determined as relevant frames corresponding to the current target frame.

6. The method according to any one of claims 1 to 3, characterized in that The size and color mode of the first mask frame are the same as those of the associated frame.

7. The method according to claim 6, characterized in that The method further comprises: The target video or video stream is sent to the first terminal.

8. The method according to any one of claims 1 to 3, characterized in that The first target area includes at least one first target sub-area corresponding to each of the at least one target object, and the method further includes: Determine a plurality of objects to be processed included in the video to be processed, wherein the plurality of objects to be processed include the at least one target object, The first segmentation result includes an original mask image of the relevant frame, and the pixel value of each pixel in the original mask image indicates the subordinate relationship between the pixel corresponding to the position in the relevant frame and the multiple objects to be processed, wherein acquiring the first mask frame corresponding to the relevant frame based on the first segmentation result includes: For each of the plurality of objects to be processed, in response to determining that the object to be processed belongs to the at least one target object, determining at least one target pixel among the pixels belonging to the object to be processed in the original mask image based on a second preset rule; and An area in the first mask frame corresponding to the at least one target pixel position is determined as a first target sub-area in the first mask frame corresponding to the object to be processed.

9. The method according to claim 8, characterized in that The second preset rule includes whether the total number of at least one target pixel corresponding to each of the at least one target object reaches a preset number.

10. The method according to claim 8, characterized in that The first segmentation result also includes the confidence of the subordinate relationship, The second preset rule includes whether the corresponding confidence of the pixels belonging to the at least one target object in the original mask image is greater than a preset confidence.

11. The method according to claim 8, characterized in that The method further comprises: In response to receiving a request from the first terminal to retain one of the target objects in the first mask frame, the one of the target objects is removed from the multiple objects to be processed.

12. The method according to claim 8, characterized in that The method further comprises: In response to receiving a request to adjust the first target area from the first terminal, the second preset rule is updated.

13. A method for video processing, characterized in that: The method comprises: Performing video decoding on a target video or video stream to obtain a video to be restored, wherein the video to be restored includes a target frame and a first mask frame corresponding to the target frame, wherein the target frame includes at least one target object, the first mask frame includes a first target area corresponding to the at least one target object, and the pixel value of each pixel in the first target area indicates the target object to which the pixel belongs, wherein the target video or video stream is obtained according to the method of any one of claims 1 to 12; Restoring a first target region corresponding to the at least one target object included in the first mask frame based on the target frame to obtain a restored related frame corresponding to the first mask frame, wherein pixel values ​​of pixels in a region corresponding to the position of the first target region in the related frame are restored based on pixel values ​​of pixels in a region corresponding to the at least one target object in the target frame; and The first mask frame of the video to be restored is replaced by the restored related frame.

14. The method according to claim 13, characterized in that The restoring the first mask frame based on the target frame to obtain a restored related frame corresponding to the first mask frame includes: The target frame and the first mask frame are input into an image restoration neural network to obtain the restored related frame.

15. The method according to claim 14, characterized in that The method further comprises: Segmenting the target frame to obtain a second segmentation result; and acquiring a second mask frame corresponding to the target frame based on the second segmentation result, wherein the second mask frame includes a second target region corresponding to the at least one target object, and a pixel value of each pixel in the second target region indicates that the pixel corresponding to the position in the target frame belongs to the at least one target object, The step of inputting the target frame and the first mask frame into an image restoration neural network to obtain the restored related frame comprises: The target frame, the first mask frame, and the second mask frame are input into the image restoration neural network to obtain the restored related frame.

16. The method according to claim 14, characterized in that The step of inputting the target frame and the first mask frame into a neural network to obtain the restored related frame output by the neural network comprises: In response to determining that one or more prior first mask frames between the first mask frame and the target frame have been restored, the first mask frame, the target frame, and one or more restored prior related frames corresponding to the one or more prior first mask frames are input into the neural network to obtain the restored related frames.

17. The method according to claim 13, characterized in that The method further comprises: A target video or video stream is received from a second terminal.

18. The method according to claim 17, characterized in that The at least one target object includes a plurality of target objects, and the method further includes: In response to determining that the restoration quality of any target object in the restored related frame does not meet the preset standard, a request to retain the target object in the related frame is sent to the second terminal.

19. The method according to claim 17, characterized in that The method further comprises: In response to determining that the restoration quality of at least one target object in the restored related frame does not meet or exceed a preset standard, a request to adjust the first target area is sent to the second terminal.

20. A device for video processing, characterized in that: The device comprises: A determination unit is configured to determine a target frame and a related frame corresponding to the target frame in the video to be processed based on a first preset rule, wherein the related frame includes at least one target object appearing in the target frame; a segmentation unit, configured to segment the relevant frame to obtain a first segmentation result; an acquisition unit configured to acquire a first mask frame corresponding to the relevant frame based on the first segmentation result, wherein the first mask frame includes a first target region corresponding to the at least one target object, and a pixel value of each pixel in the first target region indicates a target object to which the pixel corresponding to a position in the relevant frame belongs; a first replacement unit, configured to replace the relevant frame of the video to be processed with a corresponding first mask frame to obtain a video to be restored; and The encoding unit is configured to perform video encoding on the video to be restored to obtain a target video or a video stream, wherein the target video or the video stream is used for video decoding to obtain the video to be restored, and the video to be restored is used to restore the first target area corresponding to the at least one target object included in the first mask frame based on the target frame to obtain a restored related frame.

21. A device for video processing, characterized in that: The device comprises: a decoding unit, configured to perform video decoding on a target video or video stream to obtain a video to be restored, wherein the video to be restored includes a target frame and a first mask frame corresponding to the target frame, wherein the target frame includes at least one target object, the first mask frame includes a first target area corresponding to the at least one target object, and a pixel value of each pixel in the first target area indicates the target object to which the pixel belongs, wherein the target video or video stream is obtained by the apparatus according to claim 20; a restoration unit configured to restore the first target area corresponding to the at least one target object included in the first mask frame based on the target frame to obtain a restored related frame corresponding to the first mask frame, wherein the pixel values ​​of the pixels in the area corresponding to the position of the first target area in the related frame are restored based on the pixel values ​​of the pixels in the area corresponding to the at least one target object in the target frame; and The second replacement unit replaces the first mask frame of the to-be-restored video with the restored related frame.

22. A system for video processing, characterized in that: The system comprises: The apparatus according to claim 20; and The device according to claim 21.

23. An electronic device, characterized in that: The electronic device comprises: At least one processor, wherein each of the at least one processor comprises: Processor cache; and a memory communicatively coupled to the at least one processor, wherein The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 19.

24. A non-transitory computer-readable storage medium storing computer instructions, characterized in that: The computer instructions are used to cause the computer to execute the method according to any one of claims 1-19.

25. A computer program product comprising a computer program, wherein: When the computer program is executed by a processor, the method according to any one of claims 1 to 19 is implemented.