Video blurring method and device, computer readable medium and electronic equipment

By determining the shooting scene in the mobile terminal and using the pre-trained model to perform image blur processing, the problem of insufficient real-time and accuracy in the video blur scene in the existing technology is solved, and the blur effect is improved.

CN118540596APending Publication Date: 2024-08-23GUANGDONG OPPO MOBILE TELECOMMUNICATIONS CORP LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310157082.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-02-21
Publication Date
2024-08-23

AI Technical Summary

Technical Problem

Existing mobile terminals cannot meet the real-time requirements in video blur scenes, and the accuracy of depth estimation results is low, resulting in poor video blur effects.

Method used

By obtaining the image frame to be processed, the shooting scene is determined, and the pre-trained shooting subject segmentation model is selected according to the scene to perform image blur processing to improve the accuracy and clarity of the blur results.

Benefits of technology

It is possible to improve the accuracy and image clarity of video blurring results and improve the video display quality after blurring while ensuring the real-time performance of the video blurred scene.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118540596A
    Figure CN118540596A
Patent Text Reader

Abstract

The invention provides a video blurring method and device, a computer readable medium and electronic equipment, and relates to the technical field of image processing. The method comprises the following steps: acquiring a to-be-processed image frame; determining a shooting scene corresponding to the to-be-processed image frame; determining a pre-trained shooting subject segmentation model according to the shooting scene, and inputting the to-be-processed image frame into the shooting subject segmentation model to obtain a shooting subject area corresponding to the to-be-processed image frame; and performing image blurring processing on the to-be-processed image frame based on the shooting main body area to obtain the to-be-processed image frame after image blurring. According to the invention, real-time video blurring processing can be realized, the accuracy of portrait segmentation can be effectively ensured, the definition of the edge of the portrait region obtained through segmentation is improved, the accuracy of video blurring is improved, and the quality of a video blurring result is ensured.
Need to check novelty before this filing date? Find Prior Art

Description

Background Art

[0002] In the field of photography or image processing, an image may include a foreground and a background. The foreground may usually be the main subject that needs to be highlighted in the image. For example, the portrait area in a user's selfie may be the foreground of the image, while the background is the part of the image that sets off the main subject. By blurring the background, the blurring effect of a SLR camera can be simulated, thereby effectively highlighting the main subject and improving the image's performance.

[0003] At present, without using the optical module and body of a SLR camera, smaller mobile terminals such as smart phones generally use dual-camera photo blur and single-camera photo blur. However, the calculation amount of dual-camera photo blur and single-camera photo blur is large, which cannot meet the real-time requirements of video blur scenes, and the depth estimation result is less accurate, and the video blur effect is poor. Summary of the invention

[0004] The purpose of the present disclosure is to provide a video blurring method, a video blurring device, a computer-readable medium and an electronic device, thereby effectively improving the accuracy of the video blurring result and the clarity of the blurred image, and improving the display quality of the blurred video while ensuring the real-time requirements of the video blurring scene.

[0005] According to a first aspect of the present disclosure, a video blurring method is provided, comprising:

[0006] Get the image frame to be processed;

[0007] Determining a shooting scene corresponding to the image frame to be processed;

[0008] Determine a pre-trained subject segmentation model according to the shooting scene, and input the image frame to be processed into the subject segmentation model to obtain a subject area corresponding to the image frame to be processed;

[0009] The image frame to be processed is subjected to image blurring processing based on the photographed subject area to obtain the image frame to be processed after image blurring.

[0010] According to a second aspect of the present disclosure, a video blurring device is provided, comprising:

[0011] An image acquisition module, used for acquiring image frames to be processed;

[0012] A shooting scene determination module, used to determine the shooting scene corresponding to the image frame to be processed;

[0013] A region segmentation module, used to determine a pre-trained subject segmentation model according to the shooting scene, and input the image frame to be processed into the subject segmentation model to obtain a subject region corresponding to the image frame to be processed;

[0014] The image blur module is used to perform image blur processing on the image frame to be processed based on the photographed subject area to obtain the image frame to be processed after the image blurring.

[0015] According to a third aspect of the present disclosure, a computer-readable medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the above method is implemented.

[0016] According to a fourth aspect of the present disclosure, there is provided an electronic device, characterized in that it includes:

[0017] Processor; and

[0018] The memory is used to store one or more programs. When the one or more programs are executed by one or more processors, the one or more processors implement the above method.

[0019] A video blurring method provided by an embodiment of the present disclosure can obtain an image frame to be processed, determine the shooting scene corresponding to the image frame to be processed, and then determine a pre-trained shooting subject segmentation model according to the shooting scene, and input the image frame to be processed into the shooting subject segmentation model to obtain the shooting subject area corresponding to the image frame to be processed, and then perform image blurring processing on the image frame to be processed based on the shooting subject area to obtain the image frame to be processed after the image blurring. On the one hand, the shooting subject area in the image frame to be processed is determined by the shooting subject segmentation model, and the image blurring processing of the image frame to be processed is realized by the shooting subject area. Compared with depth estimation, it can effectively improve the efficiency of image blurring processing and meet the real-time requirements in the video blurring scene; on the other hand, according to different shooting scenes, the shooting subject segmentation model trained by the corresponding scene enhancement can effectively improve the accuracy of the shooting subject area and the edge clarity, thereby improving the accuracy of the image frame to be processed obtained after blurring processing, improving the performance effect of the video blurring processing result, and ensuring the quality of video blurring.

[0020] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] The drawings herein are incorporated into the specification and constitute a part of the specification, showing embodiments consistent with the present disclosure, and together with the specification, are used to explain the principles of the present disclosure. Obviously, the drawings described below are only some embodiments of the present disclosure, and for ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work. In the drawings:

[0022] Figure 1 A schematic diagram showing an exemplary system architecture to which embodiments of the present disclosure may be applied;

[0023] Figure 2 A schematic diagram schematically illustrates a flow chart of a video blurring method in an exemplary embodiment of the present disclosure;

[0024] Figure 3 A schematic diagram schematically illustrates a flow chart of a first pre-training process in an exemplary embodiment of the present disclosure;

[0025] Figure 4 A schematic diagram of a process of performing data enhancement on sample data in an exemplary embodiment of the present disclosure is schematically shown;

[0026] Figure 5 A schematic diagram schematically illustrates a principle of data enhancement for sample data in an exemplary embodiment of the present disclosure;

[0027] Figure 6 A schematic diagram schematically illustrates the effect of a subject segmentation model in a portrait occlusion shooting scene in an exemplary embodiment of the present disclosure;

[0028] Figure 7 A schematic diagram schematically illustrates a flow chart of a second pre-training process in an exemplary embodiment of the present disclosure;

[0029] Figure 8 Another flowchart of performing data enhancement on sample data in an exemplary embodiment of the present disclosure is schematically shown;

[0030] Fig. 9 A schematic diagram schematically illustrates another principle of data enhancement for sample data in an exemplary embodiment of the present disclosure;

[0031] Fig.10 A schematic diagram schematically shows the effect of a subject segmentation model in a hand-occluded shooting scene in an exemplary embodiment of the present disclosure;

[0032] Fig.11 A schematic diagram of a process of guiding and enhancing an image frame to be processed in a scene where an edge face cuts in an exemplary embodiment of the present disclosure is schematically shown;

[0033] Fig.12A schematic diagram schematically shows the effect of guidance enhancement in a scene where a face on the edge cuts in according to an exemplary embodiment of the present disclosure;

[0034] Fig.13 A schematic diagram schematically illustrates an effect of edge enhancement of a photographing subject area in an exemplary embodiment of the present disclosure;

[0035] Fig.14 A schematic diagram schematically shows the composition of a video blurring device in an exemplary embodiment of the present disclosure;

[0036] Fig.15 A schematic diagram of an electronic device to which the embodiments of the present disclosure can be applied is shown. DETAILED DESCRIPTION

[0037] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in a variety of forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that the disclosure will be more comprehensive and complete and to fully convey the concepts of the example embodiments to those skilled in the art. The described features, structures, or characteristics may be combined in any suitable manner in one or more embodiments.

[0038] In addition, the accompanying drawings are only schematic illustrations of the present disclosure and are not necessarily drawn to scale. The same reference numerals in the figures represent the same or similar parts, and their repeated description will be omitted. Some of the block diagrams shown in the accompanying drawings are functional entities and do not necessarily correspond to physically or logically independent entities. These functional entities can be implemented in software form, or implemented in one or more hardware modules or integrated circuits, or implemented in different networks and / or processor devices and / or microcontroller devices.

[0039] Figure 1 A schematic diagram of a system architecture of an exemplary application environment in which a video blurring method and apparatus according to an embodiment of the present disclosure can be applied is shown.

[0040] like Figure 1 As shown, the system architecture 100 may include one or more of terminal devices 101, 102, 103, a network 104, and a server 105. The network 104 is used to provide a medium for communication links between the terminal devices 101, 102, 103 and the server 105. The network 104 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc. The terminal devices 101, 102, 103 may be various electronic devices with image acquisition functions and artificial intelligence (AI) computing capabilities, including but not limited to smart phones, smart cameras, and smart robots, etc. It should be understood that Figure 1The number of terminal devices, networks and servers in the embodiment is only for illustration. According to the implementation requirements, there may be any number of terminal devices, networks and servers. For example, the server 105 may be a server cluster composed of multiple servers.

[0041] The video blurring method provided in the embodiment of the present disclosure is generally executed by the terminal devices 101, 102, and 103, and accordingly, the video blurring device is generally disposed in the terminal devices 101, 102, and 103. However, it is easy for a person skilled in the art to understand that the video blurring method provided in the embodiment of the present disclosure can also be executed by the server 105, and accordingly, the video blurring device can also be disposed in the server 105, and this is not particularly limited in the present exemplary embodiment. For example, in an exemplary embodiment, a user may collect and obtain an image frame to be processed through the terminal devices 101, 102, and 103, and then upload the image frame to be processed to the server 105. After the server generates an image frame to be processed after image blurring through the video blurring method provided in the embodiment of the present disclosure, the image frame to be processed after image blurring is transmitted to the terminal devices 101, 102, and 103, etc.

[0042] First, an embodiment of the present disclosure first provides a video blurring method. Taking a terminal device executing the method as an example, the video blurring method and video blurring device of the exemplary implementation mode of the present disclosure are specifically described below.

[0043] Figure 2 A schematic flow chart of a video blurring method in this exemplary embodiment is shown, which may include the following steps S210 to S240:

[0044] In step S210, an image frame to be processed is obtained.

[0045] In an exemplary embodiment, the image frame to be processed refers to an image frame that has not been blurred and is captured by an image capture unit of a terminal device. For example, the image frame to be processed may be an image frame captured by a single camera of the terminal device. If the terminal device is a smart phone, the image frame to be processed may be obtained through the front camera of the smart phone (such as a scenario in which real-time video calls are realized through the front camera), or through any one of the rear cameras of the smart phone. Of course, in some scenarios, the image frame to be processed may also be at least two image frames captured by at least two cameras of the terminal device at the same time. If the terminal device is a smart phone, the image frame to be processed may be obtained by fusing two image frames captured by at least two of the rear cameras of the smart phone (such as a main camera and an ultra-wide-angle camera). This example does not specifically limit the method for acquiring the image frame to be processed.

[0046] The image frames to be processed may be acquired in real time by the terminal device through its own camera, or may be acquired in real time through transmission from other terminal devices that are in communication with the terminal device. This example embodiment does not specifically limit the source of the image frames to be processed.

[0047] For the sake of ease of explanation, the video blurring method in the disclosed embodiment describes the process of blurring one or more image frames to be processed in a video. Although the number of image frames to be processed is not limited here, those skilled in the art will appreciate that the image frames to be processed can select one frame, multiple consecutive frames, or multiple frames at intervals for processing according to different processing steps, and this should not impose any special limitations on this example embodiment.

[0048] In step S220, the shooting scene corresponding to the image frame to be processed is determined.

[0049] In an exemplary embodiment, the shooting scene refers to different types of scenes corresponding to the image content in the image frame to be processed. For example, the image frame to be processed may be a human object, and the shooting scene may be a portrait occlusion shooting scene, that is, a scene in which the portrait area in the image frame to be processed is obstructed by an occluding object; the shooting scene may also be a hand occlusion shooting scene, that is, a scene in which the hand area of ​​the portrait in the image frame to be processed is obstructed by an occluding object; of course, the shooting scene may also be an edge portrait cut-in scene, that is, a scene in which multiple faces suddenly cut in from the edge of the image in the image frame to be processed. The type of shooting scene may also be customized according to actual needs. This exemplary embodiment does not specifically limit the type of shooting scene.

[0050] The corresponding shooting scene can be determined by the image content in the image frame to be processed. For example, the portrait occlusion shooting scene can be determined by the ratio of the face frame area in the image frame to be processed to the total area of ​​the detected portrait area; the hand occlusion shooting scene can be determined by the ratio of the face frame area in the image frame to be processed to the detected hand frame area; and the edge portrait cut-in scene can also be determined by the number of face frames in the image frame to be processed. Of course, the detection methods for different shooting scenes are not the same, and can be customized according to the scene characteristics of the set shooting scene. This example embodiment does not specifically limit this.

[0051] In step S230, a pre-trained subject segmentation model is determined according to the shooting scene, and the image frame to be processed is input into the subject segmentation model to obtain a subject area corresponding to the image frame to be processed.

[0052] In an exemplary embodiment, the subject segmentation model refers to a pre-trained deep learning model for segmenting image content in an image frame to be processed. For example, the subject segmentation model can be a deep learning model built based on a convolutional neural network (CNN), such as a U-net network for portrait segmentation, or a deep learning model built based on a generative adversarial network (GAN). This exemplary embodiment does not impose any special limitation on the type of the subject segmentation model.

[0053] The photographed subject area refers to the image area segmented from the image frame to be processed by the photographed subject segmentation model. For example, if a human object is photographed, then the photographed subject of the image frame to be processed can be considered as a human object, and the photographed subject area segmented from the image frame to be processed can be a portrait area; if an object is photographed, then the photographed subject of the image frame to be processed can be considered as an object object. For example, if the object object is a vehicle, then the photographed subject area segmented from the image frame to be processed can be a vehicle area. This example embodiment does not specifically limit the type of the photographed subject area.

[0054] According to the scene characteristics of different shooting scenes, sample data enhanced for the shooting scenes can be set in advance, and the basic shooting subject segmentation model can be enhanced and trained according to the enhanced sample data, so as to obtain the shooting subject segmentation model corresponding to the different shooting scenes. After determining the shooting scene corresponding to the image frame to be processed, the shooting subject segmentation model corresponding to the shooting scene can be matched, and then the image frame to be processed of the corresponding shooting scene can be detected and identified by the enhanced trained shooting subject segmentation model, so as to obtain the shooting subject area corresponding to the image frame to be processed.

[0055] By setting different subject segmentation models for different shooting scenes, the subject segmentation model can be effectively enhanced to focus on the difficult pixels in different shooting scenes. During the training process, pixels with relatively large Loss values ​​are selected for back propagation, which can effectively improve the recognition and detection ability of the subject segmentation model, improve the accuracy and precision of the subject area segmented in different shooting scenes, and thus improve the display quality of the video blur results.

[0056] In step S240, the image frame to be processed is subjected to image blur processing based on the photographed subject area to obtain the image frame to be processed after image blur.

[0057] In an exemplary embodiment, image blur processing refers to the process of blurring the image background to simulate the shooting effect of a SLR camera focusing on the shooting subject by adjusting parameters such as aperture, focal length and object distance. For example, image blur processing can be a process of selecting a suitable blur convolution kernel according to a preset blur degree, and blurring the image background through the blur convolution kernel; image blur processing can also be a process of filling the image with a preset blur background to achieve blurring by filling the image background; of course, image blur processing can also be other processing methods that can achieve blurring of image content, and this exemplary embodiment does not specifically limit this.

[0058] After determining the shooting subject area, the image background area except the shooting subject area in the image frame to be processed can be blurred by a preset image blur processing method to obtain the image frame to be processed after the image blur.

[0059] By selecting the corresponding scene to enhance the trained subject segmentation model in different shooting scenes, the accuracy of the subject area and the edge clarity can be effectively improved, thereby improving the accuracy of the image frames to be processed after blurring, improving the performance of the video blurring results, and ensuring the quality of video blurring.

[0060] The technical contents in step S210 to step S240 are described in detail below.

[0061] In an exemplary embodiment, the shooting subject may be a human object, and accordingly, the shooting scene may include a portrait occlusion shooting scene. The portrait occlusion shooting scene refers to a scene in which the portrait area in the image frame to be processed is blocked by an occluding object. For example, if the portrait area in the image frame to be processed is blocked by a large area of ​​occluding objects, but the occluding object may be the shooting subject integrated with the portrait, such as a shooting scene in which the human object stands behind a bouquet of flowers, and the bouquet of flowers may also be the shooting subject that the user wants, it is possible that the shooting subject area cannot be accurately identified.

[0062] Specifically, the shooting scene corresponding to the image frame to be processed can be determined by the following steps:

[0063] Face detection can be performed on the image frames to be processed, and a first ratio of the number of image frames with faces in a preset time period to the total number of image frames can be determined; if it is determined that the first ratio is greater than or equal to a preset ratio threshold, the shooting scene corresponding to the image frame to be processed can be determined as a portrait occlusion shooting scene.

[0064] Among them, the preset time period refers to a pre-set time range for monitoring the image frames to be processed, that is, the total duration between the image frames to be processed at the historical moment and the image frames to be processed at the current moment. For example, the preset time period can be 10 seconds or 1 minute. Of course, the preset time period can also be determined by the number of monitored image frames to be processed. For example, the preset time period can be the duration of 100 frames of image frames to be processed. This example embodiment does not impose any special limitation on the length of the preset time period for monitoring the shooting scene.

[0065] The preset ratio threshold refers to a preset value used to filter out portrait occlusion shooting scenes. For example, the preset ratio threshold can be 0.5 or 0.7, etc. It can be customized according to actual conditions, and this example embodiment does not make any special limitations on this.

[0066] Face detection can be performed on the image frames to be processed within a preset time period, and the number of image frames with face frames can be determined, and the total number of image frames within the preset time period can be determined, and the ratio of the number of image frames with face frames to the total number of image frames can be used as the first ratio. When it is determined that the first ratio is greater than or equal to the preset ratio threshold, the shooting scene corresponding to the image frame to be processed can be determined as a portrait occlusion shooting scene; when it is determined that the first ratio is less than the preset ratio threshold, the shooting scene corresponding to the image frame to be processed can be determined as a normal shooting scene.

[0067] Optionally, the ratio of the area of ​​the face frame to the area of ​​the detected portrait area can be determined to further determine the portrait occlusion shooting scene. Generally speaking, the ratio of the area of ​​the head area to the area of ​​the entire body area of ​​the portrait appearing in the camera's field of view is relatively fixed. When it is determined that the first ratio is greater than or equal to a preset ratio threshold, and the ratio of the area of ​​the face frame to the area of ​​the detected portrait area satisfies the head-to-body ratio range, it can be considered that the shooting scene corresponding to the image frame to be processed is determined to be a portrait occlusion shooting scene.

[0068] By setting a preset ratio threshold, or a preset ratio threshold and a head-to-body ratio range, the recognition accuracy of the shooting scene can be effectively improved, thereby improving the accuracy of the video blur results.

[0069] In an exemplary embodiment, the subject segmentation model corresponding to the portrait occlusion shooting scene can be obtained by Figure 3 The first pre-training process shown in Figure 3 As shown, the first pre-training process may specifically include:

[0070] Step S310, acquiring sample data, the sample data including a sample photographed portrait and a sample portrait area corresponding to the sample photographed portrait;

[0071] Step S320, obtaining an obstruction image and an obstruction region corresponding to the obstruction image;

[0072] Step S330, performing data enhancement on the sample data according to the occlusion image and the occlusion region to obtain data enhanced sample data;

[0073] Step S340: performing deep learning training on the initial subject segmentation model based on the data-enhanced sample data to obtain a trained subject segmentation model for the portrait occlusion shooting scene.

[0074] Among them, the initial subject segmentation model refers to a general image segmentation model obtained by training ordinary sample images and corresponding subject areas. For example, the initial subject segmentation model can perform image segmentation on portrait images in ordinary standard scenes and determine the portrait area in the portrait image. It can also perform image segmentation on vehicle images in ordinary standard scenes and determine the vehicle area in the vehicle image.

[0075] After data enhancement is performed on the sample data through occlusion images and occlusion regions, the initial subject segmentation model can be further deep-learned and trained based on the data-enhanced sample data. In this way, the enhanced trained subject segmentation model can achieve better image segmentation for portrait occlusion shooting scenes, effectively improving the accuracy of image segmentation results.

[0076] Optionally, you can Figure 4 The steps in the implementation of data enhancement of sample data based on occluder images and occluder regions are as follows. Figure 4 As shown, it may specifically include:

[0077] Step S410, obtaining the obstruction image, and scaling the obstruction image according to the image ratio of the sample portrait;

[0078] Step S420, performing image fusion of the scaled occlusion image and the sample photographed portrait to determine at least one sample enhanced portrait image;

[0079] Step S430, scaling the occluder region according to the image ratio, and fusing the scaled occluder region with the sample portrait region according to the fusion position of the occluder image, to determine a sample enhanced portrait region corresponding to at least one sample enhanced portrait image;

[0080] Step S440: Use the sample enhanced portrait image and the sample enhanced portrait area as sample data after data enhancement.

[0081] Among them, the sample enhanced portrait image refers to a sample image obtained by fusing the scaled occlusion image into the sample shot portrait to simulate a scene where part of the portrait is occluded. The occlusion image can be fused into different parts of the sample shot portrait in different proportions to obtain a sample enhanced portrait image.

[0082] After obtaining the sample enhanced portrait image, the occluded area scaled according to the same scaling ratio can be fused with the sample portrait area according to the fusion position of the occluded image, so that the fused sample enhanced portrait area can correspond to the sample enhanced portrait image, which can improve the accuracy and training efficiency of the initial subject segmentation model. In addition, the subject segmentation model obtained by training the enhanced sample data simulating the portrait occlusion shooting scene can make the subject segmentation model focus on the recognition of difficult-to-recognize pixels in the portrait occlusion shooting scene, which can effectively improve the accurate segmentation of the subject area of ​​the image frame to be processed in the portrait occlusion shooting scene, thereby improving the accuracy of image blur.

[0083] Figure 5 A schematic diagram schematically illustrates a principle of data enhancement for sample data in an exemplary embodiment of the present disclosure.

[0084] refer to Figure 5 As shown, for the sample photographed portrait 510, and the sample portrait area 520 corresponding to the sample photographed portrait 510, data enhancement can be performed on the sample photographed portrait 510 through the occlusion image 530, and data enhancement can be performed on the sample portrait area 520 through the occlusion area 540 corresponding to the occlusion image 530. For example, the occlusion image 530 can be scaled according to the image ratio of the sample portrait 510, and then fused with the sample portrait 510 at different fusion positions to obtain at least one sample enhanced portrait image 550; correspondingly, the occlusion area 540 can be scaled according to the image ratio, and then fused with the sample portrait area 520 according to the fusion position of the occlusion image 530 in the sample portrait 510 to obtain at least one sample enhanced portrait area 560, and at least one sample enhanced portrait image 550 corresponds to at least one sample enhanced portrait area 560, and the sample enhanced portrait image 550 and the sample enhanced portrait area 560 are used as enhanced sample data of the portrait occlusion shooting scene to perform enhanced training on the initial subject segmentation model, thereby effectively improving the segmentation accuracy of the subject area in the image frame to be processed in the portrait occlusion shooting scene.

[0085] Figure 6 The effect diagram of a subject segmentation model in a portrait occlusion shooting scene in an exemplary embodiment of the present disclosure is schematically shown.

[0086] refer to Figure 6 As shown, for the image frame 610 to be processed in the portrait occlusion shooting scene, if the subject segmentation model that has not been enhanced and trained by this embodiment is used, the obtained subject area 620 obviously has the problem of inaccurate and unclear subject area. Similarly, for the image frame 630 to be processed with the same image content, the subject segmentation model enhanced and trained in the portrait occlusion shooting scene is used, and the obtained subject area 640 is more accurate than the subject area 620, and the edge contour of the area is also clearer, which can improve the accuracy of the image blur result.

[0087] In an exemplary embodiment, the photographed subject may be a human object, and accordingly, the shooting scene may include a hand occlusion shooting scene. The hand occlusion shooting scene refers to a scene in which the hand area of ​​the portrait in the image frame to be processed is blocked by an occluding object. For example, if the photographed human object holds an occluding object, such as a scene in which the human object holds a bottle, a bouquet, etc. to block the hand area, the hand area of ​​the portrait in the image frame to be processed will be blocked over a large area, resulting in a situation in which the hand area of ​​the human object cannot be accurately identified, which in turn causes the segmented photographed subject area to be incomplete.

[0088] Specifically, the shooting scene corresponding to the image frame to be processed can be determined by the following steps:

[0089] Face detection can be performed on the image frame to be processed to determine the face frame, and hand detection can be performed on the image frame to be processed to determine the hand frame; the area ratio is determined based on the area of ​​the hand frame and the area of ​​the face frame; if the area ratio is less than or equal to a preset area ratio threshold, it is determined that the shooting scene corresponding to the image frame to be processed is a hand occlusion shooting scene.

[0090] The area ratio threshold refers to a preset value for screening hand-occluded shooting scenes. For example, the area ratio threshold can be 0.1 or 0.2. It can be customized according to actual conditions, and this example embodiment does not specifically limit this. When the area ratio between the area of ​​the hand frame and the area of ​​the face frame is less than or equal to the preset area ratio threshold, it can be considered that the hand area is blocked, and the shooting scene is a hand-occluded shooting scene.

[0091] Optionally, a second ratio of the number of image frames with hand frames within a preset time period to the total number of image frames can be determined; if it is determined that the second ratio is greater than or equal to a preset ratio threshold, and the area ratio is less than or equal to a preset area ratio threshold, the shooting scene corresponding to the image frame to be processed is determined as a hand occlusion shooting scene.

[0092] Among them, the preset ratio threshold refers to a pre-set value for filtering out hand-blocking shooting scenes. For example, the preset ratio threshold can be 0.5 or 0.7, etc., and can be customized according to actual conditions. This example embodiment does not make any special limitations on this.

[0093] By setting an area ratio threshold, or presetting a ratio threshold and an area ratio threshold, the recognition accuracy of the shooting scene can be effectively improved, thereby improving the accuracy of the video blur result.

[0094] In an exemplary embodiment, the subject segmentation model corresponding to the hand-occluded shooting scene can be obtained by Figure 7 The second pre-training process shown in Figure 7 As shown, the second pre-training process may specifically include:

[0095] Step S710, acquiring sample data, the sample data including a sample photographed portrait and a sample portrait area corresponding to the sample photographed portrait, the sample photographed portrait including a hand image;

[0096] Step S720, obtaining an obstruction image and an obstruction region corresponding to the obstruction image;

[0097] Step S730, performing data enhancement on the sample data according to the occlusion image and the occlusion region to obtain data enhanced sample data;

[0098] Step S740, performing deep learning training on the initial subject segmentation model based on the data-enhanced sample data to obtain a trained subject segmentation model for the portrait occlusion shooting scene.

[0099] Among them, the initial subject segmentation model refers to a general image segmentation model obtained by training ordinary sample images and corresponding subject areas. For example, the initial subject segmentation model can perform image segmentation on portrait images in ordinary standard scenes and determine the portrait area in the portrait image. It can also perform image segmentation on vehicle images in ordinary standard scenes and determine the vehicle area in the vehicle image.

[0100] After data enhancement is performed on the sample data through occlusion images and occlusion regions, the initial subject segmentation model can be further deep-learned and trained based on the data-enhanced sample data. In this way, the enhanced trained subject segmentation model can achieve better image segmentation for hand-occluded shooting scenes, effectively improving the accuracy of image segmentation results.

[0101] Optionally, you can Figure 8The steps in this paper implement data enhancement of sample data based on occluder images and occluder regions, refer to Figure 8 As shown, it may specifically include:

[0102] Step S810, acquiring the obstruction image, and scaling the obstruction image according to the image ratio of the hand image;

[0103] Step S820, performing image fusion on the scaled occlusion image and the hand image in the sample photographed portrait to determine at least one sample enhanced portrait image;

[0104] Step S830, scaling the occluder region according to the image ratio, and fusing the scaled occluder region with the hand region in the sample portrait region according to the fusion position of the occluder image, to determine a sample enhanced portrait region corresponding to at least one of the sample enhanced portrait images;

[0105] Step S840: Use the sample enhanced portrait image and the sample enhanced portrait area as sample data after data enhancement.

[0106] Among them, the sample enhanced portrait image refers to a sample image obtained by fusing the scaled occlusion image into the hand image of the sample portrait to simulate a scene where the hand image is partially occluded. The occlusion image can be fused to different parts of the hand image in different proportions to obtain a sample enhanced portrait image (sample enhanced hand image).

[0107] After obtaining the sample enhanced portrait image, the occluder area scaled according to the same scaling ratio can be fused with the hand area in the sample portrait area according to the fusion position of the occluder image. In this way, the fused sample enhanced portrait area (sample enhanced hand area) can correspond to the sample enhanced portrait image, which can improve the accuracy and training efficiency of the initial subject segmentation model. In addition, the subject segmentation model obtained by training the enhanced sample data simulating the hand occlusion shooting scene can make the subject segmentation model focus on identifying the difficult-to-recognize pixels in the hand occlusion shooting scene, which can effectively improve the accurate segmentation of the subject area of ​​the image frame to be processed in the hand occlusion shooting scene, thereby improving the accuracy of image blur.

[0108] Fig. 9 A schematic diagram schematically illustrates another principle of performing data enhancement on sample data in an exemplary embodiment of the present disclosure.

[0109] refer to Fig. 9As shown, for the sample shot portrait 910, and the sample portrait area 920 corresponding to the sample shot portrait 910, the sample shot portrait 910 may include a hand image 911, and the sample portrait area 920 may include a hand area. The hand image 911 in the sample shot portrait 910 may be data enhanced by the occlusion image 930, and the hand area in the sample portrait area 920 may be data enhanced by the occlusion area 940 corresponding to the occlusion image 930. For example, the occlusion image 930 can be scaled according to the image ratio of the hand image 911 in the sample portrait 910, and then fused with the hand image 911 at different fusion positions to obtain at least one sample enhanced portrait image (sample enhanced hand image) 950; correspondingly, the occlusion area 940 can be scaled according to the same image ratio, and then fused with the hand area of ​​the sample portrait area 920 according to the fusion position of the occlusion image 930 in the hand image 911 to obtain at least one sample enhanced portrait area (sample enhanced hand area) 960, and at least one sample enhanced portrait image 950 corresponds to at least one sample enhanced portrait area 960 one-to-one, and the sample enhanced portrait image 950 and the sample enhanced portrait area 960 are used as enhanced sample data of the hand occlusion shooting scene to perform enhanced training on the initial subject segmentation model, thereby effectively improving the segmentation accuracy of the subject area in the image frame to be processed in the hand occlusion shooting scene.

[0110] Fig.10 The effect diagram of the subject segmentation model in a hand-occluded shooting scene in an exemplary embodiment of the present disclosure is schematically shown.

[0111] refer to Fig.10 As shown, for the image frame 1010 to be processed in the hand-occluded shooting scene, if the subject segmentation model that has not been enhanced and trained according to this embodiment is used, the obtained subject area 1020 obviously has the problem of inaccurate and unclear hand areas in the subject area. Similarly, for the image frame 1030 to be processed with the same image content, the subject segmentation model enhanced and trained in the hand-occluded shooting scene is used, and the hand area of ​​the obtained subject area 1040 is more accurate than that of the subject area 1020, and the edge contour of the area is also clearer, which can improve the accuracy of the image blur result.

[0112] In an exemplary embodiment, scaling the occluder region according to the image ratio may be achieved through the following steps: the minimum bounding rectangle of the occluder region may be determined, and the minimum bounding rectangle may be scaled according to the image ratio to achieve scaling of the irregular occluder region.

[0113] By determining the minimum bounding rectangle of the irregular occlusion area, the minimum bounding rectangle can be scaled according to the image ratio. In this way, the irregular occlusion area can be scaled, effectively reducing the amount of calculation generated when scaling the irregular occlusion area, while ensuring the accuracy of the scaled occlusion area; for the occlusion area with a regular shape, it can only be scaled, and after the minimum bounding rectangle of the occlusion area is determined, the minimum bounding rectangle can be scaled. This example embodiment does not make any special limitation on this.

[0114] In an exemplary embodiment, the subject of the shooting may be a person object, and accordingly, the shooting scene may also include an edge face cut-in scene. For example, during the real-time video acquisition process, a new face may suddenly be inserted into the edge of the image, and the shooting scene is an edge face cut-in scene. After determining that the shooting scene is an edge face cut-in scene, enhancement processing may be performed through the following steps:

[0115] Face detection and tracking can be performed on the image frame to be processed to determine a newly appeared target face frame; if it is determined that the size of the target face frame is greater than or equal to a preset size threshold, guided enhancement processing is performed on the image to be processed to obtain the image frame to be processed after guided enhancement processing; the image frame to be processed after guided enhancement processing is used as input data of the shooting subject segmentation model.

[0116] Optionally, you can Fig.11 The steps in the figure are used to perform guided enhancement processing on the image to be processed, and the image frame to be processed after guided enhancement processing is obtained. Fig.11 As shown, it may specifically include:

[0117] Step S1110, if it is determined that the image frame to be processed is not the first frame image, a local occlusion image is generated based on the historical shooting subject area of ​​the image frame at the previous moment of the image frame to be processed;

[0118] Step S1120, masking the portrait area corresponding to the original face frame in the image frame to be processed according to the local masking image, to obtain the masked image frame to be processed;

[0119] Step S1130, performing image fusion on the blocked image frame to be processed and the image frame to be processed to obtain the image frame to be processed after guided enhancement processing.

[0120] The original face frame refers to the face frame corresponding to the portrait area that has always existed in the image frame to be processed, and the target face frame refers to the face frame corresponding to the portrait area that newly appears in the image frame to be processed.

[0121] The local occlusion image refers to a mask image generated based on the historical subject area of ​​the image frame at the previous moment for occluding the original portrait area in the image frame to be processed. The occluded image frame to be processed can be fused with the original image frame to be processed to obtain the image frame to be processed after guided enhancement processing.

[0122] By generating a local occlusion image, the portrait area corresponding to the original face frame in the image frame to be processed is occluded, so that the subject segmentation model mainly detects and identifies the portrait area corresponding to the target face frame, thereby improving the accurate recognition of the newly added portrait area in the edge face cutting-in scene. At the same time, the occluded image frame to be processed is fused with the original image to be processed, which can effectively improve the edge clarity of the portrait area and the segmentation accuracy of all portrait areas in the image frame to be processed, thereby improving the accuracy of image blur and ensuring the display quality of the image blur result.

[0123] Optionally, if it is determined that the image frame to be processed is the first frame image, a local occlusion image is generated based on the image frame to be processed. Specifically, a portrait mask area with a single channel of all zeros can be generated based on the image frame to be processed, and the portrait mask area is used as the local occlusion image.

[0124] Fig.12 A schematic diagram schematically illustrates the effect of guided enhancement in a scene where an edge face cuts in according to an exemplary embodiment of the present disclosure.

[0125] refer to Fig.12 As shown, for the image frames to be processed within the preset time period, if the guided enhancement for the edge face cutting-in scenario of this embodiment is not adopted, the subject area 1210 is segmented; while the guided enhancement for the edge face cutting-in scenario of this embodiment is adopted, the subject area 1220 can be segmented. Compared with the subject area 1210, the subject area 1220 can accurately identify the new portrait area with edge cutting-in, effectively improve the segmentation accuracy of the subject area in the edge face cutting-in scenario, thereby improving the accuracy of the image blurring result.

[0126] In an exemplary embodiment, the initial subject segmentation model can be trained by the following steps:

[0127] Sample data may be obtained, and the sample data may include a sample subject image and a sample subject region corresponding to the sample subject image; then, a pre-built subject segmentation model may be deep-learned and trained according to the sample subject image and the sample subject region to obtain an initial subject segmentation model.

[0128] Compared to the sample portrait, the sample subject image can be a sample image with a standard complete subject in any scene, and the sample subject area is the foreground area of ​​the sample subject image. Through the general sample subject image and the sample subject area, a general initial subject segmentation model for any scene can be trained. Then, the initial subject segmentation model can be enhanced and trained according to the scene characteristics of different shooting scenes to obtain a subject segmentation model suitable for different shooting scenes, which can effectively improve the recognition accuracy of the subject area, and the pre-trained initial subject segmentation model can effectively speed up the training efficiency of the enhanced training.

[0129] In an exemplary embodiment, the subject segmentation model may include a cross entropy loss function. For example, the cross entropy loss function may be expressed as equation (1):

[0130]

[0131] Among them, p can represent the probability that the sample is predicted to be positive, can represent sample label data, f can represent a discrete random variable, f i It can represent a value in f.

[0132] When deep learning training is performed on the pre-built subject segmentation model based on the sample subject image and the sample subject area, the following steps can be used to further improve the accuracy of the subject segmentation model in detecting and recognizing the edge of the subject area:

[0133] The sample subject area can be filtered to determine the edge transition area corresponding to the sample subject area; the pre-built subject segmentation model is deep-learned and trained in combination with the cross entropy loss function and the edge transition area to obtain an initial subject segmentation model.

[0134] Among them, filtering processing refers to a processing method used to determine the edge transition area corresponding to the sample shooting subject area. For example, the filtering processing can be a mean filtering processing. Of course, the filtering processing can also be other types of filtering processing methods, such as the filtering processing can be a Gaussian filtering processing. This example embodiment does not make any special limitations on this.

[0135] The cross entropy loss function can be used to select pixels with relatively large loss values ​​for back propagation during model training, thereby focusing on the effect of training difficult pixels. This embodiment performs filtering processing on the sample subject area, determines the edge transition area corresponding to the sample subject area, and combines the cross entropy loss function and the edge transition area to perform deep learning training on the pre-built subject segmentation model, so that the subject segmentation model can focus on identifying and detecting the edges of the subject area, such as the portrait area, effectively improving the edge clarity of the segmented subject area, thereby improving the accuracy of the segmented subject area, improving the accuracy of the image blur result, and ensuring the display quality of the video blur result.

[0136] Fig.13 A schematic diagram schematically illustrates an effect of edge enhancement of a subject area in an exemplary embodiment of the present disclosure.

[0137] refer to Fig.13 As shown, the sample subject area 1310 can be subjected to mean filtering processing to obtain an edge transition area 1320 corresponding to the sample subject area 1310, and the pre-constructed subject segmentation model can be subjected to deep learning training in combination with the cross entropy loss function and the edge transition area 1320. In this way, the trained subject segmentation model can realize the focused recognition of the edge contour of the subject area in each shooting scene, effectively improve the accuracy of the subject segmentation model for the edge contour of the subject area, further improve the accuracy of the image blur result, and improve the display quality of the video blur result.

[0138] In summary, in this exemplary embodiment, the image frame to be processed can be obtained, the shooting scene corresponding to the image frame to be processed can be determined, and then the pre-trained shooting subject segmentation model can be determined according to the shooting scene, and the image frame to be processed can be input into the shooting subject segmentation model to obtain the shooting subject area corresponding to the image frame to be processed, and then the image frame to be processed can be subjected to image blur processing based on the shooting subject area to obtain the image frame to be processed after image blur. On the one hand, the shooting subject area in the image frame to be processed is determined by the shooting subject segmentation model, and the image blur processing of the image frame to be processed is realized by the shooting subject area. Compared with depth estimation, it can effectively improve the efficiency of image blur processing and meet the real-time requirements in the video blur scene; on the other hand, according to different shooting scenes, the shooting subject segmentation model trained by the corresponding scene enhancement can effectively improve the accuracy of the shooting subject area and the edge clarity, thereby improving the accuracy of the image frame to be processed obtained after blur processing, improving the performance effect of the video blur processing result, and ensuring the quality of video blur.

[0139] It should be noted that the above figures are only schematic illustrations of the processes included in the method according to the exemplary embodiments of the present disclosure, and are not intended to be limiting. It is easy to understand that the processes shown in the above figures do not indicate or limit the time sequence of these processes. In addition, it is also easy to understand that these processes can be performed synchronously or asynchronously, for example, in multiple modules.

[0140] For further reference, Fig.14 As shown, in the implementation of this example, a video blurring device 1400 is also provided, including an image acquisition module 1410, a shooting scene determination module 1420, a region segmentation module 1430 and an image blurring module 1440. Among them: the image acquisition module 1410 is used to acquire an image frame to be processed; the shooting scene determination module 1420 is used to determine the shooting scene corresponding to the image frame to be processed; the region segmentation module 1430 is used to determine a pre-trained shooting subject segmentation model according to the shooting scene, and input the image frame to be processed into the shooting subject segmentation model to obtain the shooting subject region corresponding to the image frame to be processed; the image blurring module 1440 is used to perform image blurring processing on the image frame to be processed based on the shooting subject region to obtain the image frame to be processed after image blurring.

[0141] In an exemplary embodiment, the shooting scene may include a portrait occlusion shooting scene, the shooting subject may be a human object, and the shooting scene determination module 1420 may be used to: perform face detection on the image frame to be processed, and determine a first ratio of the number of image frames with faces within a preset time period to the total number of image frames; if it is determined that the first ratio is greater than or equal to a preset ratio threshold, the shooting scene corresponding to the image frame to be processed is determined as the portrait occlusion shooting scene.

[0142] In an exemplary embodiment, a subject segmentation model corresponding to a portrait occlusion shooting scene is obtained through a first pre-training process, and the first pre-training process includes: a first sample acquisition unit, used to acquire sample data, the sample data including a sample portrait and a sample portrait area corresponding to the sample portrait; an interference image acquisition unit, used to acquire an occlusion image and an occlusion area corresponding to the occlusion image; a first sample enhancement unit, used to perform data enhancement on the sample data according to the occlusion image and the occlusion area to obtain the data enhanced sample data; a first model training unit, used to perform deep learning training on the initial subject segmentation model based on the data enhanced sample data to obtain a trained subject segmentation model for the portrait occlusion shooting scene.

[0143] In an exemplary embodiment, the sample enhancement unit may be used to: obtain the occlusion image, and scale the occlusion image according to the image ratio of the sample photographed portrait;

[0144] The scaled occlusion image is fused with the sample photographed portrait to determine at least one sample enhanced portrait image; the occlusion area is scaled according to the image ratio, and the scaled occlusion area is fused with the sample portrait area according to the fusion position of the occlusion image to determine a sample enhanced portrait area corresponding to at least one sample enhanced portrait image; the sample enhanced portrait image and the sample enhanced portrait area are used as sample data after data enhancement.

[0145] In an exemplary embodiment, the shooting scene may include a hand occlusion shooting scene, and the shooting subject is a human object. The shooting scene determination module 1420 may be used to: perform face detection on the image frame to be processed to determine the face frame, and perform hand detection on the image frame to be processed to determine the hand frame; determine the area ratio based on the area of ​​the hand frame and the area of ​​the face frame; if the area ratio is less than or equal to a preset area ratio threshold, determine that the shooting scene corresponding to the image frame to be processed is a hand occlusion shooting scene.

[0146] In an exemplary embodiment, the shooting scene determination module 1420 can also be used to: determine a second ratio of the number of image frames in the hand frame within a preset time period to the total number of image frames; if it is determined that the second ratio is greater than or equal to a preset ratio threshold, and the area ratio is less than or equal to a preset area ratio threshold, then the shooting scene corresponding to the image frame to be processed is determined as the hand occlusion shooting scene.

[0147] In an exemplary embodiment, the subject segmentation model corresponding to the hand occlusion shooting scene is obtained through a second pre-training process, and the second pre-training process may include: a second sample acquisition unit, used to acquire sample data, the sample data including a sample portrait and a sample portrait area corresponding to the sample portrait, the sample portrait including a hand image; an interference image acquisition unit, used to acquire an occlusion image, and an occlusion area corresponding to the occlusion image; a second sample enhancement unit, used to perform data enhancement on the sample data according to the occlusion image and the occlusion area to obtain the data enhanced sample data; a second model training unit, used to perform deep learning training on the initial subject segmentation model based on the data enhanced sample data to obtain a trained subject segmentation model for the portrait occlusion shooting scene.

[0148] In an exemplary embodiment, the second sample enhancement unit can be used to: obtain the occlusion image, and scale the occlusion image according to the image ratio of the hand image; perform image fusion of the scaled occlusion image with the hand image in the sample captured portrait to determine at least one sample enhanced portrait image; scale the occlusion area according to the image ratio, and fuse the scaled occlusion area with the hand area in the sample portrait area according to the fusion position of the occlusion image to determine at least one sample enhanced portrait area corresponding to the sample enhanced portrait image; use the sample enhanced portrait image and the sample enhanced portrait area as sample data after data enhancement.

[0149] In an exemplary embodiment, the video blurring device 1400 further includes an occlusion area scaling unit, which can be used to: determine the minimum bounding rectangle of the occlusion area; and scale the minimum bounding rectangle according to the image ratio to achieve scaling of the irregular occlusion area.

[0150] In an exemplary embodiment, the video blurring device 1400 also includes an edge face guiding enhancement module, which can be used to: perform face detection and tracking on the image frame to be processed to determine a newly appeared target face frame; if it is determined that the size of the target face frame is greater than or equal to a preset size threshold, perform guided enhancement processing on the image frame to be processed to obtain the image frame to be processed after the guided enhancement processing; and use the image frame to be processed after the guided enhancement processing as input data for the subject segmentation model.

[0151] In an exemplary embodiment, the edge face guidance enhancement module can be used to: if it is determined that the image frame to be processed is not the first frame image, generate a local occlusion image based on the historical shooting subject area of ​​the image frame at the previous moment of the image frame to be processed; according to the local occlusion image, the portrait area corresponding to the original face frame in the image frame to be processed is occluded to obtain the image frame to be processed after occlusion; the image frame to be processed after occlusion is fused with the image frame to be processed to obtain the image frame to be processed after guidance enhancement processing.

[0152] In an exemplary embodiment, the edge face guidance enhancement module may be used to: if it is determined that the image frame to be processed is the first frame image, generate a local occlusion image based on the image frame to be processed.

[0153] In an exemplary embodiment, the video blurring device 1400 also includes an initial subject segmentation model training module, which can be used to: obtain sample data, the sample data including a sample subject image, and a sample subject area corresponding to the sample subject image; perform deep learning training on a pre-constructed subject segmentation model according to the sample subject image and the sample subject area to obtain an initial subject segmentation model.

[0154] In an exemplary embodiment, the subject segmentation model may include a cross entropy loss function, and the initial subject segmentation model training module may be used to: perform filtering processing on the sample subject area to determine the edge transition area corresponding to the sample subject area; and perform deep learning training on the pre-constructed subject segmentation model in combination with the cross entropy loss function and the edge transition area to obtain an initial subject segmentation model.

[0155] The specific details of each module in the above device have been described in detail in the implementation method of the method part. The undisclosed details can be found in the implementation method of the method part, so they will not be repeated here.

[0156] Those skilled in the art will appreciate that various aspects of the present disclosure may be implemented as systems, methods or program products. Therefore, various aspects of the present disclosure may be specifically implemented in the following forms, namely: complete hardware implementation, complete software implementation (including firmware, microcode, etc.), or a combination of hardware and software, which may be collectively referred to herein as "circuits", "modules" or "systems".

[0157] The exemplary embodiment of the present disclosure also provides an electronic device. The electronic device may be the above-mentioned terminal devices 101, 102, 103 and server 105. Generally, the electronic device may include a processor and a memory, the memory is used to store executable instructions of the processor, and the processor is configured to execute the above-mentioned video blurring method by executing the executable instructions.

[0158] Below Fig.15 The mobile terminal 1500 in FIG. 1 is taken as an example to exemplify the structure of the electronic device. It should be understood by those skilled in the art that, in addition to the components specifically used for mobile purposes, Fig.15 The construction in can also be applied to fixed type equipment.

[0159] like Fig.15As shown, the mobile terminal 1500 may specifically include: a processor 1501, a memory 1502, a bus 1503, a mobile communication module 1504, an antenna 1, a wireless communication module 1505, an antenna 2, a display screen 1506, a camera module 1507, an audio module 1508, a power module 1509 and a sensor module 1510.

[0160] The processor 1501 may include one or more processing units, for example, the processor 1501 may include an AP (Application Processor), a modem processor, a GPU (Graphics Processing Unit), an ISP (Image Signal Processor), a controller, an encoder, a decoder, a DSP (Digital Signal Processor), a baseband processor and / or an NPU (Neural-Network Processing Unit), etc. The video blurring method in this exemplary embodiment may be executed by an AP, a GPU or a DSP. When the method involves processing related to a neural network, it may be executed by an NPU, for example, the NPU may load neural network parameters and execute algorithm instructions related to the neural network.

[0161] The encoder can encode (i.e. compress) an image or video to reduce the data size for easy storage or transmission. The decoder can decode (i.e. decompress) the encoded data of the image or video to restore the image or video data. The mobile terminal 1500 can support one or more encoders and decoders, for example: image formats such as JPEG (Joint Photographic Experts Group), PNG (Portable Network Graphics), BMP (Bitmap), and video formats such as MPEG (Moving Picture Experts Group) 1, MPEG10, H.1063, H.1064, and HEVC (High Efficiency Video Coding).

[0162] The processor 1501 may be connected to the memory 1502 or other components via a bus 1503 .

[0163] The memory 1502 may be used to store computer executable program codes, which may include instructions. The processor 1501 executes various functional applications and data processing of the mobile terminal 1500 by running the instructions stored in the memory 1502. The memory 1502 may also store application data, such as images, videos, and other files.

[0164] The communication function of the mobile terminal 1500 can be implemented by the mobile communication module 1504, antenna 1, wireless communication module 1505, antenna 2, a modulation and demodulation processor, and a baseband processor. Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals. The mobile communication module 1504 can provide 3G, 4G, 5G and other mobile communication solutions applied to the mobile terminal 1500. The wireless communication module 1505 can provide wireless communication solutions such as wireless LAN, Bluetooth, and near field communication applied to the mobile terminal 1500.

[0165] The display screen 1506 is used to implement display functions, such as displaying a user interface, images, videos, etc. The camera module 1507 is used to implement shooting functions, such as shooting images, videos, etc. The audio module 1508 is used to implement audio functions, such as playing audio, collecting voice, etc. The power module 1509 is used to implement power management functions, such as charging the battery, powering the device, monitoring the battery status, etc.

[0166] The sensor module 1510 may include one or more sensors for implementing corresponding sensing detection functions. For example, the sensor module 1510 may include an inertial sensor for detecting the motion posture of the mobile terminal 1500 and outputting inertial sensing data.

[0167] The exemplary embodiments of the present disclosure also provide a computer-readable storage medium on which a program product capable of implementing the above-mentioned method of the present specification is stored. In some possible implementations, various aspects of the present disclosure may also be implemented in the form of a program product, which includes a program code, and when the program product is run on a terminal device, the program code is used to enable the terminal device to execute the steps according to various exemplary embodiments of the present disclosure described in the above-mentioned "Exemplary Method" section of the present specification.

[0168] For example, the program code is used to enable the terminal device to implement the following video blurring method: obtain an image frame to be processed; determine a shooting scene corresponding to the image frame to be processed; determine a pre-trained shooting subject segmentation model based on the shooting scene, and input the image frame to be processed into the shooting subject segmentation model to obtain a shooting subject area corresponding to the image frame to be processed; perform image blurring processing on the image frame to be processed based on the shooting subject area to obtain the image frame to be processed after image blurring.

[0169] In an exemplary embodiment, the shooting scene includes a portrait occlusion shooting scene, the shooting subject is a human object, and determining the shooting scene corresponding to the image frame to be processed includes: performing face detection on the image frame to be processed, and determining a first ratio of the number of image frames with faces within a preset time period to the total number of image frames; if it is determined that the first ratio is greater than or equal to a preset ratio threshold, determining the shooting scene corresponding to the image frame to be processed as the portrait occlusion shooting scene.

[0170] In an exemplary embodiment, the subject segmentation model corresponding to the portrait occlusion shooting scene is obtained through a first pre-training process, and the first pre-training process includes: obtaining sample data, the sample data including a sample portrait and a sample portrait area corresponding to the sample portrait; obtaining an occlusion image and an occlusion area corresponding to the occlusion image; performing data enhancement on the sample data according to the occlusion image and the occlusion area to obtain data-enhanced sample data; performing deep learning training on the initial subject segmentation model based on the data-enhanced sample data to obtain a trained subject segmentation model for the portrait occlusion shooting scene.

[0171] In an exemplary embodiment, the data enhancement is performed on the sample data according to the occlusion image and the occlusion region to obtain the enhanced sample data, including: acquiring the occlusion image, and scaling the occlusion image according to the image ratio of the sample portrait; fusing the scaled occlusion image with the sample portrait to determine at least one sample enhanced portrait image; scaling the occlusion region according to the image ratio, and fusing the scaled occlusion region with the sample portrait region according to the fusion position of the occlusion image to determine at least one sample enhanced portrait region corresponding to the sample enhanced portrait image; and using the sample enhanced portrait image and the sample enhanced portrait region as the data enhanced sample data.

[0172] In an exemplary embodiment, the shooting scene includes a hand occlusion shooting scene, the shooting subject is a human object, and determining the shooting scene corresponding to the image frame to be processed includes: performing face detection on the image frame to be processed to determine a face frame, and performing hand detection on the image frame to be processed to determine a hand frame; determining an area ratio based on the area of ​​the hand frame and the area of ​​the face frame; if the area ratio is less than or equal to a preset area ratio threshold, determining that the shooting scene corresponding to the image frame to be processed is a hand occlusion shooting scene.

[0173] In an exemplary embodiment, the method also includes: determining a second ratio of the number of image frames in the hand frame within a preset time period to the total number of image frames; if it is determined that the second ratio is greater than or equal to a preset ratio threshold, and the area ratio is less than or equal to a preset area ratio threshold, then the shooting scene corresponding to the image frame to be processed is determined as the hand occlusion shooting scene.

[0174] In an exemplary embodiment, the subject segmentation model corresponding to the hand occlusion shooting scene is obtained through a second pre-training process, and the second pre-training process includes: obtaining sample data, the sample data including a sample portrait and a sample portrait area corresponding to the sample portrait, and the sample portrait including a hand image; obtaining an occlusion image and an occlusion area corresponding to the occlusion image; performing data enhancement on the sample data according to the occlusion image and the occlusion area to obtain data-enhanced sample data; performing deep learning training on the initial subject segmentation model based on the data-enhanced sample data to obtain a trained subject segmentation model for the portrait occlusion shooting scene.

[0175] In an exemplary embodiment, data enhancement is performed on the sample data according to the occlusion image and the occlusion region to obtain enhanced sample data, including: acquiring the occlusion image and scaling the occlusion image according to the image ratio of the hand image; fusing the scaled occlusion image with the hand image in the sample captured portrait to determine at least one sample enhanced portrait image; scaling the occlusion region according to the image ratio and fusing the scaled occlusion region with the hand region in the sample portrait region according to the fusion position of the occlusion image to determine at least one sample enhanced portrait region corresponding to the sample enhanced portrait image; and using the sample enhanced portrait image and the sample enhanced portrait region as the data enhanced sample data.

[0176] In an exemplary embodiment, scaling the occluder region according to the image ratio includes: determining a minimum bounding rectangle of the occluder region; scaling the minimum bounding rectangle according to the image ratio to achieve scaling of the irregular occluder region.

[0177] In an exemplary embodiment, the method further includes: performing face detection and tracking on the image frame to be processed to determine a newly appeared target face frame; if it is determined that the size of the target face frame is greater than or equal to a preset size threshold, performing guided enhancement processing on the image frame to be processed to obtain the image frame to be processed after the guided enhancement processing; and using the image frame to be processed after the guided enhancement processing as input data for the subject segmentation model.

[0178] In an exemplary embodiment, the guided enhancement processing is performed on the image frame to be processed to obtain the image frame to be processed after the guided enhancement processing, including: if it is determined that the image frame to be processed is not the first frame image, a local occlusion image is generated based on the historical shooting subject area of ​​the image frame at the previous moment of the image frame to be processed; according to the local occlusion image, the portrait area corresponding to the original face frame in the image frame to be processed is occluded to obtain the image frame to be processed after occlusion; the image frame to be processed after occlusion is fused with the image frame to be processed to obtain the image frame to be processed after the guided enhancement processing.

[0179] In an exemplary embodiment, the method further includes: if it is determined that the image frame to be processed is a first frame image, generating a local occlusion image based on the image frame to be processed.

[0180] In an exemplary embodiment, the method further includes: acquiring sample data, the sample data including a sample subject image and a sample subject area corresponding to the sample subject image; performing deep learning training on a pre-constructed subject segmentation model according to the sample subject image and the sample subject area to obtain an initial subject segmentation model.

[0181] In an exemplary embodiment, the subject segmentation model includes a cross entropy loss function, and the deep learning training of the pre-constructed subject segmentation model based on the sample subject image and the sample subject area to obtain the initial subject segmentation model includes: filtering the sample subject area to determine the edge transition area corresponding to the sample subject area; and deep learning training of the pre-constructed subject segmentation model in combination with the cross entropy loss function and the edge transition area to obtain the initial subject segmentation model.

[0182] It should be noted that the computer-readable medium shown in the present disclosure may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.

[0183] In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that may be used by or in combination with an instruction execution system, apparatus, or device. In the present disclosure, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium, which may send, propagate, or transmit a program for use by or in combination with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium may be transmitted using any suitable medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.

[0184] In addition, program code for performing the operations of the present disclosure may be written in any combination of one or more programming languages, including object-oriented programming languages ​​such as Java, C++, etc., and conventional procedural programming languages ​​such as "C" or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user device, as a separate software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server. In cases involving a remote computing device, the remote computing device may be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computing device (e.g., through the Internet using an Internet service provider).

[0185] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary technical means in the art that are not disclosed in the present disclosure. The specification and examples are to be considered as exemplary only, and the true scope and spirit of the present disclosure are indicated by the claims.

[0186] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.

Claims

1. A video blurring method, characterized in that: include: Get the image frame to be processed; Determining a shooting scene corresponding to the image frame to be processed; Determine a pre-trained subject segmentation model according to the shooting scene, and input the image frame to be processed into the subject segmentation model to obtain a subject area corresponding to the image frame to be processed; The image frame to be processed is subjected to image blurring processing based on the photographed subject area to obtain the image frame to be processed after image blurring.

2. The method according to claim 1, characterized in that The shooting scene includes a portrait occlusion shooting scene, the shooting subject is a human object, and determining the shooting scene corresponding to the image frame to be processed includes: Performing face detection on the image frames to be processed, and determining a first ratio of the number of image frames containing faces to the total number of image frames within a preset time period; If it is determined that the first ratio is greater than or equal to a preset ratio threshold, the shooting scene corresponding to the image frame to be processed is determined as the portrait occlusion shooting scene.

3. The method according to claim 2, characterized in that The subject segmentation model corresponding to the portrait occlusion shooting scene is obtained through a first pre-training process, and the first pre-training process includes: Acquire sample data, the sample data including a sample photographed portrait and a sample portrait area corresponding to the sample photographed portrait; Acquire an occlusion image and an occlusion area corresponding to the occlusion image; Performing data enhancement on the sample data according to the occlusion image and the occlusion region to obtain data enhanced sample data; Based on the data-enhanced sample data, deep learning training is performed on the initial subject segmentation model to obtain a trained subject segmentation model for the portrait occlusion shooting scene.

4. The method according to claim 3, characterized in that The step of performing data enhancement on the sample data according to the occlusion image and the occlusion region to obtain enhanced sample data includes: Acquire the obstruction image, and scale the obstruction image according to the image ratio of the sample portrait; Performing image fusion of the scaled occlusion image and the sample photographed portrait to determine at least one sample enhanced portrait image; Scaling the occluder region according to the image ratio, and fusing the scaled occluder region with the sample portrait region according to the fusion position of the occluder image, to determine a sample enhanced portrait region corresponding to at least one of the sample enhanced portrait images; The sample enhanced portrait image and the sample enhanced portrait area are used as sample data after data enhancement.

5. The method according to claim 1, characterized in that The shooting scene includes a hand-occluded shooting scene, the shooting subject is a human object, and determining the shooting scene corresponding to the image frame to be processed includes: Performing face detection on the image frame to be processed to determine a face frame, and performing hand detection on the image frame to be processed to determine a hand frame; determining an area ratio based on an area of ​​the hand frame and an area of ​​the face frame; If the area ratio is less than or equal to a preset area ratio threshold, it is determined that the shooting scene corresponding to the image frame to be processed is a hand occlusion shooting scene.

6. The method according to claim 5, characterized in that The method further comprises: Determine a second ratio of the number of image frames in the hand frame to the total number of image frames within a preset time period; If it is determined that the second ratio is greater than or equal to the preset ratio threshold, and the area ratio is less than or equal to the preset area ratio threshold, the shooting scene corresponding to the image frame to be processed is determined as the hand occlusion shooting scene.

7. The method according to claim 5, characterized in that The subject segmentation model corresponding to the hand-occluded shooting scene is obtained through a second pre-training process, and the second pre-training process includes: Acquire sample data, the sample data including a sample photographed portrait and a sample portrait area corresponding to the sample photographed portrait, the sample photographed portrait including a hand image; Acquire an occlusion image and an occlusion area corresponding to the occlusion image; Performing data enhancement on the sample data according to the occlusion image and the occlusion region to obtain data enhanced sample data; Based on the data-enhanced sample data, deep learning training is performed on the initial subject segmentation model to obtain a trained subject segmentation model for the portrait occlusion shooting scene.

8. The method according to claim 7, characterized in that The step of performing data enhancement on the sample data according to the occlusion image and the occlusion region to obtain enhanced sample data includes: Acquire the obstruction image, and scale the obstruction image according to the image ratio of the hand image; Performing image fusion of the scaled occlusion image with the hand image in the sample photographed portrait to determine at least one sample enhanced portrait image; Scaling the occlusion area according to the image ratio, and fusing the scaled occlusion area with the hand area in the sample portrait area according to the fusion position of the occlusion image, to determine a sample enhanced portrait area corresponding to at least one of the sample enhanced portrait images; The sample enhanced portrait image and the sample enhanced portrait area are used as sample data after data enhancement.

9. The method according to claim 4 or 8, characterized in that: Scaling the obstruction area according to the image ratio includes: Determine the minimum circumscribed rectangle of the occluder area; The minimum circumscribed rectangle is scaled according to the image ratio to achieve scaling of the irregular occluder region.

10. The method according to claim 1, characterized in that The method further comprises: Performing face detection and tracking on the image frame to be processed to determine a newly appeared target face frame; If it is determined that the size of the target face frame is greater than or equal to a preset size threshold, performing guided enhancement processing on the image frame to be processed to obtain the image frame to be processed after the guided enhancement processing; The image frame to be processed after the guided enhancement processing is used as input data of the shooting subject segmentation model.

11. The method according to claim 10, characterized in that The step of performing guided enhancement processing on the image frame to be processed to obtain the image frame to be processed after the guided enhancement processing comprises: If it is determined that the image frame to be processed is not the first frame image, generating a local occlusion image based on the historical shooting subject area of ​​the image frame at the previous moment of the image frame to be processed; According to the local occlusion image, a portrait area corresponding to the original face frame in the image frame to be processed is occluded to obtain the occluded image frame to be processed; The blocked image frame to be processed is subjected to image fusion with the image frame to be processed to obtain the image frame to be processed after guided enhancement processing.

12. The method according to claim 11, characterized in that The method further comprises: If it is determined that the image frame to be processed is the first frame image, a local occlusion image is generated based on the image frame to be processed.

13. The method according to any one of claims 1 to 8, characterized in that: The method further comprises: Acquire sample data, where the sample data includes a sample photographing subject image and a sample photographing subject area corresponding to the sample photographing subject image; A pre-constructed subject segmentation model is deep-learned and trained according to the sample subject image and the sample subject region to obtain an initial subject segmentation model.

14. The method according to claim 13, characterized in that The subject segmentation model includes a cross entropy loss function, and the pre-constructed subject segmentation model is deep-learned and trained according to the sample subject image and the sample subject region to obtain an initial subject segmentation model, including: Performing filtering processing on the sample photographing subject area to determine an edge transition area corresponding to the sample photographing subject area; The pre-constructed subject segmentation model is subjected to deep learning training in combination with the cross entropy loss function and the edge transition region to obtain an initial subject segmentation model.

15. A video blurring device, characterized in that: include: An image acquisition module, used for acquiring image frames to be processed; A shooting scene determination module, used to determine the shooting scene corresponding to the image frame to be processed; A region segmentation module, used to determine a pre-trained subject segmentation model according to the shooting scene, and input the image frame to be processed into the subject segmentation model to obtain a subject region corresponding to the image frame to be processed; The image blur module is used to perform image blur processing on the image frame to be processed based on the photographed subject area to obtain the image frame to be processed after the image blurring.

16. A computer readable medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 14 is implemented.

17. An electronic device, characterized in that: include: processor; as well as A memory, configured to store executable instructions of the processor; The processor is configured to perform the method of any one of claims 1 to 14 by executing the executable instructions.