Portrait-related video coding method, system and device and storage medium

By using two models for adversarial processing and parameter adjustment, the problem of insufficient reliability of portrait coding in videos is solved, and more efficient privacy protection is achieved.

CN119316666APending Publication Date: 2025-01-14SHENZHEN BROADTON COMM TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411570321.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-06
Publication Date
2025-01-14

AI Technical Summary

Technical Problem

In the prior art, the reliability of portrait coding in videos is insufficient, and it is easy to miss coding, resulting in the risk of privacy leakage.

Method used

Two pre-trained models are used for adversarial processing. The first model is used for portrait blurring, and the second model is used to identify missed coding situations, and ensure the complete coding of portraits in the video through mutual correction and dynamic parameters adjustment. .

Benefits of technology

It improves the reliability of portrait coding in videos, reduces the risk of privacy leakage, and enhances the protection of personal information.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119316666A_ABST
    Figure CN119316666A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of video coding processing, in particular to a portrait-related video coding method, system and device and a storage medium. The method comprises the following steps: analyzing a to-be-processed target video to obtain a target video clip including a portrait in the target video; inputting the target video clip into a first model, and performing portrait fuzzification; inputting the target video clip output by the first model into a second model, and analyzing and capturing an unprocessed frame; if the unprocessed frames exist, all the captured unprocessed frames serve as input of the first model, and the step 2 to the step 3 are executed until the unprocessed frames do not exist; and step 5, if the unprocessed frame does not exist, merging the finally output target video clip after the portrait fuzzification into the target video and then outputting the target video. The method and the device can realize the beneficial effect of improving the portrait coding reliability in the video.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of video coding processing, and in particular to a method, system, device and storage medium for coding a video involving a portrait. Background Art

[0002] In the digital age, the protection of personal information has become particularly important. The portraits in the video often contain a lot of personal information, such as identity, appearance characteristics, etc. If it is not coded, this information may be used by criminals for various illegal activities, such as fraud, identity theft, etc. Coding can effectively prevent the leakage of personal information and protect personal privacy from infringement. This is crucial for public figures, minors, and anyone who wants to protect their privacy. At present, the coding of the original video is usually combined with face recognition and image processing to code each frame of the portrait in the video. However, in actual operation, the portrait may be missed during the face recognition process. If the coding is missed and it is not recognized in the subsequent manual review (especially in long videos), it may lead to a series of adverse conditions such as privacy leakage.

[0003] Based on this, how to improve the reliability of portrait coding in videos is a technical problem that needs to be solved urgently. Summary of the invention

[0004] The present application provides a method, system, device and storage medium for coding a video involving a portrait, so as to achieve the beneficial effect of improving the reliability of coding a portrait in a video.

[0005] In a first aspect, the present application provides a method for coding a video involving a portrait, the method comprising: Step 1, parsing the target video to be processed to obtain a target video segment including a portrait in the target video; Step 2, inputting the target video clip into a pre-trained first model, and blurring the portrait of the currently input target video clip; Step 3, inputting the target video segment output by the first model into the pre-trained second model, parsing the target video segment after portrait blurring and capturing unprocessed frames, wherein the unprocessed frames are frames including portraits; Step 4: If the unprocessed frames exist, all captured unprocessed frames are used as inputs of the first model, and steps 2 to 3 are executed until the unprocessed frames do not exist; Step 5: If the unprocessed frame does not exist, the target video segment after the portrait is blurred is merged into the target video and then outputted.

[0006] By adopting the above technical scheme, the part with the portrait, i.e., the target video clip, is first parsed from the target video to be processed, and the target video clip is input into the pre-trained first model to blur the portrait, i.e., the first coding. After coding, it is not directly output, but the target video clip output by the first model is recognized by the pre-trained second model to obtain the number of frames in which the portrait can be recognized in the video clip processed by the first model, i.e., the unprocessed frames; if the number of unprocessed frames obtained is not 0, the clip containing the unprocessed frames is used as the new input of the first model, and is recognized by the second model again until there are no unprocessed frames; if the number of unprocessed frames obtained is 0, the video clip output after processing replaces the corresponding clip in the target video to complete the coding of the clip.

[0007] More specifically, the first model and the second model are used for adversarial processing. The first model is used to code the portraits involved in the video, and the second model is used to identify whether the portrait can be detected in the video after the coding process. If the portrait is detected, it means that there is a lack of coding in the output of the first model. The captured part is supplemented by the first model until the second model fails to capture the portrait and then outputs it. In this process, the first model and the second model also correct each other to form dynamic adjustment of parameters, thereby further achieving the beneficial effect of improving the reliability of portrait coding in the video.

[0008] Optionally, after the step of parsing the target video to be processed to obtain a target video segment including a portrait in the target video, the method includes: According to a preset partitioning condition, the target video segment is divided into a plurality of target video sub-segments; According to the timeline sequence of the target video, the target video sub-segment which is at the front of the timeline is input into the first model; After executing steps 2 to 5 for the currently input target video sub-segment, a target video sub-segment for the next time period is selected as the output of the first model until there is no unprocessed target video sub-segment.

[0009] Optionally, if the unprocessed frames exist, the step of taking all captured unprocessed frames as input of the first model includes: Obtaining an error rate corresponding to the first execution of step S4 by the target video segment, wherein the error rate is determined according to the unprocessed frames and all the to-be-processed frames of the target video segment; Determining whether the error rate reaches a preset error rate threshold; If the error rate reaches the error rate threshold, the parameters of the first model are dynamically adjusted according to the output result of the second model.

[0010] Optionally, if the unprocessed frames exist, all captured unprocessed frames are used as inputs of the first model, and steps 2 to 3 are performed until there are no unprocessed frames. The method further includes: Obtaining the number of iterations of iteratively executing step S4 of the target video segment; Determining whether the number of iterations reaches a preset iteration number threshold; If the number of iterations reaches the iteration number threshold, a first prompt message is sent.

[0011] Optionally, the first model adopts a convolutional neural network CNN, including a convolution layer, a pooling layer, a fully connected layer and an output layer. The number of convolution layers is 5, the number of pooling layers is 2, the number of fully connected layers is 2, the activation function is ReLU, the loss function is cross entropy loss, the optimizer is Adam, and the learning rate is set to 0.001.

[0012] Optionally, the second model adopts a long short-term memory network LSTM, including a hidden layer, the number of hidden layer units is 108, the number of layers is 2, the activation function is tanh, the loss function is binary cross entropy loss, the optimizer is Adam, and the learning rate is set to 0.001.

[0013] Optionally, before the step of inputting the target video segment into a pre-trained first model and blurring the portrait of the currently input target video segment, the method further includes: Cleaning the target video segment; The cleaned target video segment is input into the first model.

[0014] In a second aspect, the present application provides a video coding system involving portraits, including: A target video parsing module is used to parse the target video to be processed and obtain a target video segment including a portrait in the target video; A video portrait processing module, used for inputting the target video segment into a pre-trained first model, and blurring the portrait of the currently input target video segment; a coding result verification module, configured to input the target video segment output by the first model into a pre-trained second model, parse the target video segment after portrait blurring, and capture unprocessed frames, wherein the unprocessed frames are frames including portraits; A video complement processing module, configured to, if the unprocessed frame exists, use all the captured unprocessed frames as input of the first model, and execute step 2 to step 3 until the unprocessed frame does not exist; The coded video output module is used to merge the target video segment with the blurred portrait output finally into the target video and then output it if the unprocessed frame does not exist.

[0015] In a third aspect, the present application provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the above method when executing the computer program.

[0016] In a fourth aspect, the present application provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the steps of the method described above are implemented.

[0017] The beneficial effects of the present application are: adversarial processing is performed using the first model and the second model, the first model is used to code the portraits involved in the video, and the second model is used to identify whether the portrait can be detected in the video after the coding process. If the portrait is detected, it means that there is a lack of coding in the output of the first model. The captured part is supplemented by the first model until the second model fails to capture the portrait and then outputs it. In this process, the first model and the second model also correct each other to form dynamic adjustment of parameters, thereby further achieving the beneficial effect of improving the reliability of portrait coding in the video. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] Figure 1 It is a flowchart of a method for coding a video involving a portrait provided in an embodiment of the present application; Figure 2 Schematic diagram of a model used in a method for coding a video involving a portrait provided in an embodiment of the present application; Figure 3 It is a virtual structural diagram of a video coding device involving a portrait provided by the present application; Figure 4 A schematic diagram of the internal structure of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0019] In order to enable those skilled in the art to better understand the technical solution of the present disclosure, and to fully understand and implement how the present disclosure applies technical means to solve technical problems and achieve the corresponding technical effects, the technical solution in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the drawings in the embodiments of the present disclosure. Obviously, the described embodiments are only embodiments of a part of the present disclosure, not all of the embodiments. The embodiments of the present disclosure and the various features in the embodiments can be combined with each other without conflict, and the technical solutions formed are all within the scope of protection of the present disclosure. Based on the embodiments in the present disclosure, all other embodiments obtained by ordinary technicians in this field without making creative work should fall within the scope of protection of the present disclosure.

[0020] It should be noted that the terms "first", "second", etc. in the specification and claims of the present disclosure and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present disclosure described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product, or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products, or devices.

[0021] It should be noted that the steps shown in the flowcharts of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and that, although a logical order is shown in the flowcharts, in some cases, the steps shown or described can be executed in an order different from that shown here.

[0022] Reference Figure 1 , Figure 1 This is a flow chart of a method for coding a video involving a portrait provided in an embodiment of the present application. Figure 1 Each step of the method provided in this application is described in detail: Step 1: parse the target video to be processed to obtain a target video segment including a portrait in the target video.

[0023] Specifically, the target video to be processed is first parsed to obtain the portion with the portrait, i.e., the target video segment. The portion without the portrait or the video segment with the portrait but the portrait is in the whitelist can be removed to reduce the computational complexity of subsequent data processing.

[0024] Furthermore, in consideration of reasonable resource allocation and meeting actual needs, the embodiment of the present application proposes that after the step of parsing the target video to be processed and obtaining the target video segment including the portrait in the target video, the method includes: According to a preset partitioning condition, the target video segment is divided into a plurality of target video sub-segments; According to the timeline sequence of the target video, the target video sub-segment which is at the front of the timeline is input into the first model; After executing steps 2 to 5 for the currently input target video sub-segment, a target video sub-segment for the next time period is selected as the output of the first model until there is no unprocessed target video sub-segment.

[0025] Specifically, the preset partitioning conditions include but are not limited to preset time intervals, distinctions between different scenes, etc., which can be preset according to the actual needs of relevant personnel. After the target video segment is divided into multiple target video sub-segments based on the preset partitioning conditions, the unprocessed front target video sub-segments are input into the first model according to the playback timeline order of the target video, that is, the video playback order, that is, the front played segments are given priority and centralized processing, thereby reducing the computing power requirements for video segment coding involving portraits, and more refined coding can also be performed.

[0026] More specifically, in the first model, the step of identifying the portrait involved in the input video clip is included. Usually, in order to improve the processing speed, it can be set to take one frame for processing every certain number of frames (for example, every 6 frames). First, the frame is converted into a grayscale image, and then the face detector in Dlib is used to locate the face and draw the face boundary box on the image. In the scheme provided by the present application, when partition processing is adopted, a shorter interval of frames can be set for frame processing, thereby improving the coding accuracy. Among them, it can also be dynamically adjusted according to the number of frames involving the appearance of the portrait. The fewer the portrait appears, the shorter the interval of taking the frame, and vice versa, the longer it is, thereby ensuring the processing time and ensuring the user experience.

[0027] Furthermore, if there is a step of manually reviewing the coded video, the function of playing while coding can be achieved through timeline segmentation processing, so as to improve the review efficiency and the user experience of the reviewer.

[0028] More specifically, the steps of face recognition in the first model include: using the VideoCapture() function in the OpenCV library to load the video file and calculate the frame rate (FPS) of the video so that the video can be kept smooth during subsequent processing; performing face detection on each frame of the video, first converting the frame into a grayscale image, then using the face detector in Dlib to locate the face and draw the face bounding box on the image; using Dlib's face key point predictor to obtain the 68 feature points of the face, which are the basis for face alignment and further recognition; converting the obtained 68 key points into 128D facial descriptors. By calculating the Euclidean distance between these descriptors and the 128D facial descriptors in the local face library, it can be determined whether they are the same person. If the distance is less than a specific threshold, the recognition is considered successful.

[0029] Step 2: input the target video clip into a pre-trained first model to blur the portrait of the currently input target video clip.

[0030] Specifically, refer to Figure 2 , Figure 2This is a schematic diagram of the model used in the video coding method involving portraits provided in the embodiment of the present application. The target video clip is input into the pre-trained first model and then the portrait is blurred, that is, the first model is a model for coding, and the second model described below is a model for identifying the coding result. The first model is not directly output after coding, but is output to the second model for coding verification. The specific steps are described in the following step S3.

[0031] More specifically, in an embodiment of the present application, the first model adopts a convolutional neural network CNN, including a convolutional layer, a pooling layer, a fully connected layer and an output layer. The number of convolutional layers is 5, the number of pooling layers is 2, the number of fully connected layers is 2, the activation function is ReLU, the loss function is cross entropy loss, the optimizer is Adam, and the learning rate is set to 0.001.

[0032] More specifically, in order to cope with the complex background confusion that may exist in the target video, in an embodiment of the present application, before the step of inputting the target video segment into a pre-trained first model and blurring the portrait of the currently input target video segment, the method further includes: Cleaning the target video segment; The cleaned target video segment is input into the first model.

[0033] Specifically, complex backgrounds may be confused with facial features, leading to false detections. For example, some background patterns may be mistaken for faces. After analyzing the target video clip or target video sub-clip, data cleaning can be performed to ensure that the image quality in the dataset is good without blur, distortion or noise. Image processing techniques can be used to enhance image quality, such as denoising and sharpening. In addition, the diversity of data can be increased by applying various image transformations (such as rotation, scaling, translation, flipping, etc.), so that the model can be trained to better adapt to faces with different backgrounds and angles, achieving data enhancement.

[0034] Step 3: input the target video segment output by the first model into a pre-trained second model, parse the target video segment after portrait blurring and capture unprocessed frames, where the unprocessed frames are frames including portraits.

[0035] Specifically, the video is not directly output after coding, but the target video segment output by the first model is recognized by the pre-trained second model to obtain the number of frames in which the portrait can be recognized in the video segment processed by the first model, that is, the unprocessed frames.

[0036] More specifically, in an embodiment of the present application, the second model adopts a long short-term memory network LSTM, including a hidden layer, the number of hidden layer units is 108, the number of layers is 2, the activation function is tanh, the loss function is binary cross entropy loss, the optimizer is Adam, and the learning rate is set to 0.001.

[0037] Step 4: If the unprocessed frames exist, all captured unprocessed frames are used as input of the first model, and steps 2 to 3 are executed until the unprocessed frames do not exist.

[0038] Specifically, if the number of unprocessed frames obtained is not 0, the segment containing the unprocessed frames is used as a new input of the first model and is recognized by the second model again until there are no unprocessed frames.

[0039] More specifically, if step S4 exists, it means that there is a missing code in the coding of the currently input video clip. For this situation, the first model and / or the second model can be corrected and trained respectively, as described in detail below: For the first model, if the unprocessed frames exist, the step of taking all captured unprocessed frames as input of the first model includes: Obtaining an error rate corresponding to the first execution of step S4 by the target video segment, wherein the error rate is determined according to the unprocessed frames and all the to-be-processed frames of the target video segment; Determining whether the error rate reaches a preset error rate threshold; If the error rate reaches the error rate threshold, the parameters of the first model are dynamically adjusted according to the output result of the second model.

[0040] Specifically, the adjustment of the first model can be combined with the output of the second model. In the embodiment of the present application, it is proposed to use the proportion of the number of frames of the portrait still captured by the second model after the output of the first model in the total number of processed frames as the error rate of the first model, and judge whether the error rate reaches the preset ratio threshold. If it reaches, the corresponding adjustment is triggered to modify the parameters of the first model, and return to the model training step if necessary. Relevant personnel can cancel this restriction or adjust the value of the error rate threshold according to the actual computing power performance. Under the premise of sufficient performance, this trigger condition can be cancelled to continuously adjust dynamically, thereby improving the reliability of the first model.

[0041] For the second model, if the unprocessed frame exists, all the captured unprocessed frames are used as input of the first model, and steps 2 to 3 are performed until there is no unprocessed frame. The method further includes: Obtaining the number of iterations of iteratively executing step S4 of the target video segment; Determining whether the number of iterations reaches a preset iteration number threshold; If the number of iterations reaches the iteration number threshold, a first prompt message is sent.

[0042] Specifically, similar to the above-mentioned adjustment conditions for the first model, the adjustment trigger conditions for the second model are determined according to the number of iterative executions of step S4. The iteration number threshold can be set by relevant personnel. Under the premise of sufficient performance, it can be set that once step S4 is triggered, parameter adjustment for the second model is triggered to ensure the reliability of the second model. The prompt information is set by the relevant personnel themselves, and the corresponding loss function can also be set for dynamic adjustment.

[0043] Step 5: If the unprocessed frame does not exist, the target video segment after the portrait is blurred is merged into the target video and then outputted.

[0044] Specifically, if the number of the obtained unprocessed frames is 0, the video segment output after processing replaces the corresponding segment in the target video, and the coding process of the segment is completed.

[0045] More specifically, the first model and the second model are used for adversarial processing. The first model is used to code the portraits involved in the video, and the second model is used to identify whether the portrait can be detected in the video after the coding process. If the portrait is detected, it means that there is a lack of coding in the output of the first model. The captured part is supplemented by the first model until the second model fails to capture the portrait and then outputs it. In this process, the first model and the second model also correct each other to form dynamic adjustment of parameters, thereby further achieving the beneficial effect of improving the reliability of portrait coding in the video.

[0046] The target video parsing module 100 is used to parse the target video to be processed and obtain a target video segment including a portrait in the target video; The video portrait processing module 200 is used to input the target video segment into a pre-trained first model and perform portrait blurring on the currently input target video segment; The coding result verification module 300 is used to input the target video segment output by the first model into the pre-trained second model, parse the target video segment after the portrait is blurred and capture the unprocessed frame, where the unprocessed frame is a frame including the portrait; The video complement processing module 400 is used for, if the unprocessed frame exists, taking all the captured unprocessed frames as input of the first model, and executing step 2 to step 3 until the unprocessed frame does not exist; The coded video output module 500 is used to merge the target video segment with the blurred portrait that is finally output into the target video and then output it if the unprocessed frame does not exist.

[0047] Reference Figure 3 , Figure 3 It is a virtual structural diagram of a video coding device involving portraits provided by the present application. For the specific definition of a video coding device involving portraits, please refer to the definition of a video coding method involving portraits in the above text, which will not be repeated here. Each module in the above-mentioned video coding device involving portraits can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the device in the form of hardware, or can be stored in the memory in the device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.

[0048] In this embodiment, a computer device is provided. Its internal structure diagram can be shown as follows: Figure 4 As shown. The computer device includes a processor, a memory, a network interface, a display screen and an input device connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program, and the non-volatile storage medium is deployed with a database, which is used to store all data involved in a video coding method involving portraits. The internal memory provides an environment for the operation of the operating system and computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with other computer devices deployed with application software. When the computer program is executed by the processor, a video coding method involving portraits is implemented. The display screen of the computer device can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covered on the display screen, or a key, trackball or touchpad set on the computer device housing, or an external keyboard, touchpad or mouse, etc.

[0049] Those skilled in the art will understand that Figure 4 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0050] In one embodiment, a computer device is provided, including a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the steps of a video coding method involving a portrait described in any of the above embodiments are implemented.

[0051] In this embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps of a video coding method involving a portrait described in any of the above embodiments are implemented.

[0052] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be implemented by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application may include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.

[0053] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0054] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.

Claims

1. A method for coding a video involving a portrait, characterized in that: The method comprises: Step 1, parsing the target video to be processed to obtain a target video segment including a portrait in the target video; Step 2, inputting the target video clip into a pre-trained first model, and blurring the portrait of the currently input target video clip; Step 3, inputting the target video segment output by the first model into the pre-trained second model, parsing the target video segment after portrait blurring and capturing unprocessed frames, wherein the unprocessed frames are frames including portraits; Step 4: If the unprocessed frames exist, all captured unprocessed frames are used as inputs of the first model, and steps 2 to 3 are executed until the unprocessed frames do not exist; Step 5: If the unprocessed frame does not exist, the target video segment after the portrait is blurred is merged into the target video and then outputted.

2. The method for coding a video involving a portrait according to claim 1, characterized in that: After the step of parsing the target video to be processed and obtaining a target video segment including a portrait in the target video, the method includes: According to a preset partitioning condition, the target video segment is divided into a plurality of target video sub-segments; According to the timeline sequence of the target video, the target video sub-segment which is at the front of the timeline is input into the first model; After executing steps 2 to 5 for the currently input target video sub-segment, a target video sub-segment for the next time period is selected as the output of the first model until there is no unprocessed target video sub-segment.

3. The method for coding a video involving a portrait according to claim 1, characterized in that: If the unprocessed frames exist, the step of taking all captured unprocessed frames as input of the first model comprises: Obtaining an error rate corresponding to the first execution of step S4 by the target video segment, wherein the error rate is determined according to the unprocessed frames and all the to-be-processed frames of the target video segment; Determining whether the error rate reaches a preset error rate threshold; If the error rate reaches the error rate threshold, the parameters of the first model are dynamically adjusted according to the output result of the second model.

4. The method for coding a video involving a portrait according to claim 1, characterized in that: If the unprocessed frames exist, all captured unprocessed frames are used as inputs of the first model, and steps 2 to 3 are performed until there are no unprocessed frames. The method further includes: Obtaining the number of iterations of iteratively executing step S4 of the target video segment; Determining whether the number of iterations reaches a preset iteration number threshold; If the number of iterations reaches the iteration number threshold, a first prompt message is sent.

5. The method for coding a video involving a portrait according to claim 1, characterized in that: The first model adopts a convolutional neural network CNN, including a convolutional layer, a pooling layer, a fully connected layer and an output layer. The number of convolutional layers is 5, the number of pooling layers is 2, the number of fully connected layers is 2, the activation function is ReLU, the loss function is cross entropy loss, the optimizer is Adam, and the learning rate is set to 0.

001.

6. The method for coding a video involving a portrait according to claim 1, characterized in that: The second model adopts a long short-term memory network LSTM, including a hidden layer, the number of hidden layer units is 108, the number of layers is 2, the activation function is tanh, the loss function is binary cross entropy loss, the optimizer is Adam, and the learning rate is set to 0.

001.

7. The method for coding a video involving a portrait according to claim 1, characterized in that: Before the step of inputting the target video segment into the pre-trained first model and blurring the portrait of the currently input target video segment, the method further includes: Cleaning the target video segment; The cleaned target video segment is input into the first model.

8. A video coding system involving portraits, characterized in that: include: A target video parsing module is used to parse the target video to be processed and obtain a target video segment including a portrait in the target video; A video portrait processing module, used for inputting the target video segment into a pre-trained first model, and blurring the portrait of the currently input target video segment; a coding result verification module, configured to input the target video segment output by the first model into a pre-trained second model, parse the target video segment after portrait blurring, and capture unprocessed frames, wherein the unprocessed frames are frames including portraits; A video complement processing module, configured to, if the unprocessed frame exists, use all the captured unprocessed frames as input of the first model, and execute step 2 to step 3 until the unprocessed frame does not exist; The coded video output module is used to merge the target video segment with the blurred portrait output finally into the target video and then output it if the unprocessed frame does not exist.

9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.