Video object segmentation method, device and computer equipment
By comparing the attribute differences between the mask image and the calibration mask image of the video frame, the accuracy of the calibration mask image is determined and output, which solves the problem of unstable mask images in dynamic video object segmentation and achieves stable video object segmentation. and accuracy.
Patent Information
- Application Number
- CN202110340973.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-03-30
- Publication Date
- 2024-08-27
- Estimated Expiration
- 2041-03-30
AI Technical Summary
In dynamic video object segmentation scenarios, fast-moving users cause the object segmentation effect of the mask image output in the previous frame to be unstable, affecting the object segmentation results of subsequent video frames, causing objects to be dragged out or the segmentation effect to be poor.
By obtaining the historical mask image of the first video frame and its adjacent historical frames, performing object segmentation processing according to the first segmentation method to obtain the first mask image, and performing calibration processing according to the second segmentation method to obtain the calibration mask image. , compare the attribute differences between the two to determine the accuracy of the calibration mask image. If the calibration conditions are met, the calibration mask image will be output as the target mask image to avoid unreliable mask images to guide the segmentation of the next frame.
It ensures the stability and accuracy of video object segmentation, avoids the deterioration of segmentation results caused by unreliable mask images, and ensures the reliability of video images when they move quickly or are blocked.
Smart Images

Figure CN113066092B
Abstract
Description
Technical Field
[0001] The present application mainly relates to the field of image processing technology, and more specifically to a video object segmentation method, device and computer equipment. Background Art
[0002] With the development of artificial intelligence and image processing technology, artificial intelligence methods are usually applied to video object segmentation. Specifically, the mask image output from the previous frame is used to guide the object segmentation processing of the current video frame, so that the object area can be quickly and accurately segmented from the video to meet subsequent image processing needs.
[0003] However, in practical applications, taking video conferencing as an example, if the users participating in the video conference move quickly, the object segmentation effect of the mask image output in the previous frame will be unstable, thereby disrupting the object segmentation result of the current video frame, causing the object segmentation results of subsequent frames to become increasingly worse, and even other objects in the video conference, such as tables and chairs, to be dragged out.
[0004] It can be seen that in a dynamic video object segmentation scenario, how to accurately implement video object segmentation and ensure the reliability of the output video image has become an urgent problem that technicians need to solve. Summary of the invention
[0005] In view of this, this application provides the following technical solutions:
[0006] On the one hand, the present application proposes a video object segmentation method, the method comprising:
[0007] Acquire a first video frame and historical mask images of historical video frames adjacent to the first video frame;
[0008] According to a first segmentation method, the historical mask image and the first video frame are used to perform object segmentation processing to obtain a first mask image of the first video frame;
[0009] According to a second segmentation method, the first video frame is used to perform object segmentation processing to obtain a calibrated mask image of the first video frame;
[0010] When a comparison result between the calibration mask image and the first mask image satisfies a video segmentation calibration condition, the calibration mask image is output as a target mask image of the first video frame.
[0011] In some embodiments, the comparison process of the first mask image and the calibration mask image includes:
[0012] Acquire first attribute information of the first mask image and second attribute information of the calibration mask image;
[0013] comparing the first attribute information and the second attribute information to obtain attribute differences between respective object segmentation regions of the first mask image and the calibration mask image;
[0014] The comparison result between the calibration mask image and the first mask image satisfies a video segmentation calibration condition, including:
[0015] The attribute difference reaches a video segmentation calibration threshold.
[0016] In some embodiments, the acquiring the first attribute information of the first mask image and the second attribute information of the calibration mask image includes:
[0017] Performing pixel statistics on the object segmentation regions respectively included in the first mask image and the calibration mask image to obtain a first region area of the object segmentation region in the first mask image and a second region area of the object segmentation region in the calibration mask image;
[0018] The comparing the first attribute information and the second attribute information to obtain the attribute difference between the object segmentation regions of the first mask image and the calibration mask image, includes:
[0019] A difference operation is performed on the first region area and the second region area to obtain a region area difference between the object segmentation regions of the first mask image and the calibration mask image.
[0020] In some embodiments, the method further comprises:
[0021] Acquire segmentation status information of the first video frame;
[0022] When the segmentation state information satisfies the video calibration condition, the step of performing object segmentation processing using the first video frame in accordance with the second segmentation manner to obtain a calibration mask image of the first video frame is performed.
[0023] In some embodiments, the segmentation state information satisfies the video calibration condition including:
[0024] Obtaining a calibration time interval corresponding to the first video frame, and determining whether the calibration time interval reaches a video calibration time interval threshold; wherein the calibration time interval refers to a time interval between a time point of obtaining the first video frame and a time point of a previous video calibration;
[0025] or,
[0026] A frame number interval between the first video frame and a video frame of a previous video calibration is obtained, and it is determined that the frame number interval reaches a video calibration frame number interval threshold.
[0027] In some embodiments, the method further comprises:
[0028] When the segmentation state information does not satisfy the video calibration condition, or when the comparison result between the calibration mask image and the first mask image does not satisfy the video segmentation calibration condition, the first mask image is output as a target mask image of the first video frame.
[0029] In some embodiments, performing object segmentation processing using the historical mask image and the first video frame according to the first segmentation mode to obtain a first mask image of the first video frame includes:
[0030] Inputting the historical mask image and the first video frame into a first segmentation model, and outputting a first mask image of the first video frame;
[0031] The step of performing object segmentation processing on the first video frame according to the image segmentation method to obtain a calibration mask image of the first video frame includes:
[0032] Inputting the first video frame into a second segmentation model and outputting a calibrated mask image of the first video frame; or,
[0033] Setting the historical mask image to zero to obtain a target historical mask image;
[0034] The target historical mask image and the first video frame are input into a third segmentation model, and a calibrated mask image of the first video frame is output.
[0035] In some embodiments, when the comparison result between the calibration mask image and the first mask image satisfies the video segmentation calibration condition, the method further includes:
[0036] According to the comparison result between the calibration mask image and the first mask image, and the first video frame, the model parameters of the first segmentation model are adjusted to continue to perform object segmentation processing on the next video frame using the adjusted first segmentation model.
[0037] On the other hand, the present application also proposes a video object segmentation device, the device comprising:
[0038] An acquisition module, used to acquire a first video frame and a historical mask image of a historical video frame adjacent to the first video frame;
[0039] A first segmentation processing module, configured to perform object segmentation processing using the historical mask image and the first video frame in a first segmentation manner to obtain a first mask image of the first video frame;
[0040] A second segmentation processing module, configured to perform object segmentation processing using the first video frame according to a second segmentation method to obtain a calibrated mask image of the first video frame;
[0041] The target mask image output module is used to output the calibration mask image as the target mask image of the first video frame when the comparison result between the calibration mask image and the first mask image meets the video segmentation calibration condition.
[0042] On the other hand, the present application also proposes a computer device, the computer device comprising:
[0043] A memory, used for storing a program for implementing the above-mentioned video object segmentation method;
[0044] The processor is used to load and execute the program stored in the memory to implement the various steps of the above-mentioned video object segmentation method.
[0045] It can be seen that the present application provides a video object segmentation method, apparatus and computer equipment. After acquiring the historical mask images of the first video frame and its adjacent historical video frames, the historical mask image and the first video frame are used to perform object segmentation processing according to the first segmentation method to obtain the first mask image of the first video frame. In order to avoid the first mask image being inaccurate and unreliable and reducing its effect of guiding the object segmentation of the next video frame, the present application will also use the first video frame to perform object segmentation processing according to the second segmentation method to obtain a calibrated mask image of the first video frame, so that the acquisition process of the calibrated mask image does not rely on the historical mask image of the previous video frame, thereby ensuring that the calibrated mask image It is not adversely affected by the historical mask image. In this way, the calibration mask image is compared with the first mask image. When the comparison result meets the video segmentation calibration condition, the first mask image can be considered inaccurate and will no longer guide the object segmentation of the next video frame. The calibration mask image is directly output as the target mask image of the first video frame, thereby ensuring the object segmentation effect of the next video frame guided by the target mask image. This solves the technical problem that when the video object moves quickly or is blocked, only the first segmentation method is used to realize video object segmentation, and the target object cannot be reliably identified, resulting in poor object segmentation effect, and then unable to meet subsequent application requirements for the segmentation results. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying any creative work.
[0047] Figure 1 A flowchart of an optional example of the video object segmentation method proposed in this application;
[0048] Figure 2 A flowchart diagram of another optional example of the video object segmentation method proposed in this application;
[0049] Figure 3 A flowchart diagram of another optional example of the video object segmentation method proposed in this application;
[0050] Figure 4 A flowchart diagram of another optional example of the video object segmentation method proposed in this application;
[0051] Figure 5 A flowchart diagram of another optional example of the video object segmentation method proposed in this application;
[0052] Figure 6 A schematic structural diagram of an optional example of a video object segmentation device proposed in this application;
[0053] Figure 7 A schematic diagram of the hardware structure of an optional example of a computer device applicable to the video object segmentation method and apparatus proposed in the present application;
[0054] Figure 8 A schematic diagram of a video conferencing scenario suitable for the video object segmentation method and apparatus proposed in this application. DETAILED DESCRIPTION
[0055] In response to the technical problems described in the background technology part, the present application proposes to perform reliability verification on the mask image after obtaining the mask image of the current video frame by using the mask image output by the previous frame and the current video frame for object segmentation, so as to determine whether the mask image of the current video frame should be used when performing object segmentation on the next video frame. In this way, if it is verified that the mask image of the current video frame is unreliable, it can be calibrated or cleared in time to avoid the unreliable mask image continuing to guide the object segmentation of subsequent video frames, resulting in the object segmentation effect of subsequent video frames becoming worse and worse, and then causing the output video picture to be abnormal.
[0056] Among them, for the above-mentioned reliability verification process, the present application proposes to use only the current video frame for object segmentation processing, and use the mask image obtained thereby as the calibration mask image. Thereafter, the calibration mask image is compared with the mask image of the current video frame obtained in the above manner. If the comparison result meets the video segmentation conditions, it can be considered that the mask image of the current video frame obtained in the above manner is unreliable. The present application outputs the calibration mask image as the target mask image of the current video frame to guide the object segmentation processing of the next video frame, thereby ensuring the reliability and accuracy of the segmentation result of the next video frame. In this way, when fast-moving objects appear in scenes such as video conferencing, the output video picture can be guaranteed to be stable and reliable.
[0057] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Therefore, for the convenience of description, only the parts related to the relevant inventions are shown in the drawings. In the absence of conflicts, the embodiments in the present application and the features in the embodiments can be combined with each other. Therefore, based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0058] It should be understood that the "system", "device", "unit" and / or "module" used in this application is a method for distinguishing different components, elements, parts, portions or assemblies at different levels. However, if other words can achieve the same purpose, the word can be replaced by other expressions.
[0059] As shown in this application and claims, unless the context clearly indicates an exception, the words "a", "an", "a kind" and / or "the" do not refer to the singular, but also include the plural. Generally speaking, the terms "include" and "comprise" only indicate the inclusion of clearly identified steps and elements, and these steps and elements do not constitute an exclusive list. The method or device may also include other steps or elements. The elements defined by the sentence "includes a..." do not exclude the existence of other identical elements in the process, method, commodity or device that includes the elements.
[0060] Among them, in the description of the embodiments of the present application, unless otherwise specified, " / " means or, for example, A / B can mean A or B; "and / or" in this article is only a description of the association relationship of associated objects, indicating that there can be three relationships, for example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. In addition, in the description of the embodiments of the present application, "multiple" refers to two or more than two. The following terms "first" and "second" are used for descriptive purposes only and cannot be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Therefore, the features defined as "first" and "second" may explicitly or implicitly include one or more of the features.
[0061] In addition, flow charts are used in the present application to illustrate the operations performed by the system according to the embodiments of the present application. It should be understood that the preceding or following operations are not necessarily performed accurately in order. On the contrary, the various steps may be processed in reverse order or simultaneously. At the same time, other operations may also be added to these processes, or a certain step or several steps of operations may be removed from these processes.
[0062] Reference Figure 1 , is a flowchart of an optional example of the video object segmentation method proposed in this application. The method can be applied to computer devices, such as various terminal devices or service devices, etc. This application does not limit the product type of the computer device, which can be determined according to the situation. Moreover, this application is applicable to scenes such as video conferencing that require continuous output of multiple frames of images, such as Figure 1 As shown, in this scenario, the video object segmentation method performed may include but is not limited to the following steps:
[0063] Step S11, obtaining a first video frame and historical mask images of historical video frames adjacent to the first video frame;
[0064] In the embodiment of the present application, the first video frame can be any video frame obtained by the computer device. In different video output scenarios, the computer device can receive video stream data collected and sent by the video source (i.e., the terminal device that collects video images), and at different times, determine the current video frame it receives as the first video frame, so as to implement object segmentation processing of the first video frame according to the video object segmentation method proposed in this embodiment, accurately identify the foreground object in the first video frame, and realize tracking and identification of the same foreground object in continuous video frames, so as to meet the processing requirements of the application scenario for foreground objects or background images. In this case, the computer device can be a service device that implements video stream data transmission between different terminal devices, such as a communication server that supports video conferencing in a video conferencing scenario.
[0065] In some other embodiments, the above-mentioned computer device can be a video source, that is, the computer device directly performs image acquisition, takes the currently acquired video frame as the first video frame, executes the video object segmentation method proposed in this embodiment, and calibrates the directly acquired first video frame to ensure that the content of each video frame output by the computer device is clear and reliable. In this way, in a video conferencing scenario, each computer device participating in the video conference can accurately identify the foreground object in each acquired video frame (such as the user participating in the video conference) according to this processing method, so that the user can replace the background image in the video frame conveniently, and at the same time ensure that the identified foreground object remains unchanged, that is, on the basis of meeting the participation requirements of the video conference, the confidentiality of the user's current environment can be achieved, but it is not limited to the application requirements described in this embodiment, and the present application will not elaborate on them one by one.
[0066] It can be seen that in different application scenarios, the product category of the above-mentioned computer device may be different, and the specific implementation method of the computer device to obtain the first video frame is different, including but not limited to the above-described receiving the first video frame captured and sent by other terminal devices, or directly performing image capture to obtain the first video frame, etc.
[0067] Since video is a dynamic image composed of several consecutive frames of viewing images, in order to segment the target object from the continuously played video frames, compared with the object segmentation requirements of a static frame of image, the present application has higher requirements for object segmentation technology to achieve this purpose. In order to ensure the segmentation accuracy and efficiency, when performing object segmentation on video frames, the present application will adopt an online adaptive video object segmentation method, and use the object segmentation result of the previous video frame and the current video frame (i.e., the 0th video frame) to perform object segmentation, and obtain the object segmentation result of the current video frame, which will guide the object segmentation of the next video frame in turn.
[0068] The object segmentation result of each video frame can be a mask image of the target object in the video frame, such as a mask image of a user's portrait in a video conference scenario. In practical applications, if the target object in the video frame needs to be extracted, the mask image of the target object can be multiplied by the video frame to obtain the target object area. The image value in the target object area remains unchanged, and the image value outside the area is 0. If an object in the video frame needs to be shielded, the mask image of the object can be used to shield the object on the video frame so that it does not participate in subsequent processing or only processes the object. The subsequent processing of the obtained mask image is not described in detail in this application, and it can be determined according to the situation.
[0069] It can be seen that in order to achieve accurate recognition of the foreground object of the first video frame, the mask image of the foreground object output by the previous video frame of the first video frame can be obtained, that is, the historical mask image of a historical video frame adjacent to the first video frame.
[0070] Step S12, performing object segmentation processing using the historical mask image and the first video frame according to a first segmentation method to obtain a first mask image of the first video frame;
[0071] In an embodiment of the present application, the first segmentation method may include but is not limited to the online adaptive video object segmentation method described above. Specifically, a suitable machine learning algorithm or deep learning algorithm in artificial intelligence can be selected according to application requirements. This application does not limit the segmentation algorithm based on which the first segmentation method is implemented.
[0072] Step S13, performing object segmentation processing using the first video frame according to the second segmentation method to obtain a calibrated mask image of the first video frame;
[0073] In the actual application of the present application, if the objects in the video shooting environment move quickly, are obscured, rotate, etc., the first mask image of the foreground object obtained according to the above-mentioned first segmentation method is often unreliable. That is, the object area contained in the first mask image may not contain the complete target object, or in addition to the target object, it may also contain other objects or part of the background area, etc. In this case, if the first mask image continues to guide the object segmentation of the next video frame, the segmentation result will become worse and worse.
[0074] In order to solve the above-mentioned problem, the present application proposes to perform reliability verification on the above-mentioned first mask image. When determining the reference image for realizing the reliability verification, the embodiment of the present application will adopt an object segmentation method suitable for static images to perform object segmentation processing on the image of the first video frame, that is, according to the second segmentation method, the image content contained in the first video frame itself is used to perform object segmentation to obtain the mask image of the foreground object, which is used as the calibration mask image of the first video frame to realize reliability verification or calibration of the first mask image obtained according to the first segmentation method.
[0075] Among them, during the implementation of the above-mentioned second segmentation method, a deep learning / machine learning algorithm can also be used to implement object segmentation processing. Different from the object segmentation method implemented by the above-mentioned first segmentation method, the second segmentation method will not refer to the historical mask image of the previous historical video frame. In this way, even if the historical mask image is unreliable, it will not affect the object segmentation result of the first video frame, that is, avoiding unreliable historical mask images from causing inaccurate object segmentation results of the first video frame, thereby ensuring the relative accuracy and reliability of the calibrated mask image of the first video frame obtained according to the second segmentation method.
[0076] It should be noted that the present application does not elaborate on the specific implementation process of the first segmentation method and the second segmentation method mentioned above, and the segmentation algorithms based on each method can be determined according to the actual situation.
[0077] Step S14: when the comparison result between the calibration mask image and the first mask image satisfies the video segmentation calibration condition, the calibration mask image is output as the target mask image of the first video frame.
[0078] Continuing from the above description, in order to avoid the adverse effect on the segmentation result caused by an unreliable and inaccurate mask image guiding the object segmentation of the next video frame, the present application obtains two mask images of the first video frame, namely, the first mask image and the calibration mask image, according to the above-mentioned different segmentation methods. The present application can compare the first mask image with the calibration mask image to determine whether the first mask image is accurate, and then determine the target mask image of the current output first video frame.
[0079] Specifically, the present application may, based on actual requirements, pre-configure video segmentation calibration conditions to determine that the mask image of the current video frame is inaccurate, and that when guiding the object segmentation of subsequent video frames, the object segmentation effect will become increasingly worse. The specific conditions may depend on the circumstances, and the present application will not elaborate on them here. In this way, when the comparison result between the above-mentioned calibration mask image and the first mask image meets the video segmentation calibration conditions, it can be considered that the first mask image is inaccurate and will reduce the object segmentation effect when guiding the object segmentation of future video frames. Therefore, the present application may no longer continue to output the first mask image, but will output the calibration mask image as the target mask image of the first video frame to guide the object segmentation processing of future frames and improve the accuracy of the object segmentation results.
[0080] It can be understood that after the target mask image of the first video frame is determined in the above manner, the target mask image can be associated with the frame identifier of the first video frame (such as the frame number, etc.) and stored as the historical mask image of the adjacent historical video frame of the next video frame, so as to realize the object segmentation processing of the next video frame. The present application does not limit the specific storage method of the historical mask image.
[0081] In some embodiments, since only the historical mask image of the previous historical video frame is needed for guidance during the object segmentation process, and the historical mask image from a longer time ago is not needed, and the subsequent processing does not require multiple historical frame mask images, in order to save resources, only the target mask image of the current video frame can be retained to guide the object segmentation processing of future video frames, or the mask images of several frames close to the current frame can be updated and retained; of course, in some other embodiments, if the application scenario requires mask images corresponding to multiple consecutive video frames, this embodiment needs to retain these mask images for subsequent application calls when needed. Therefore, the storage method of multiple consecutive mask images of the entire video in this application can be determined according to the situation.
[0082] In summary, in an embodiment of the present application, after obtaining the historical mask images of the first video frame and its adjacent historical video frames, the historical mask image and the first video frame are used to perform object segmentation processing in accordance with the first segmentation method to obtain the first mask image of the first video frame. In order to avoid the first mask image being inaccurate and unreliable and reducing its effect of guiding the object segmentation of the next video frame, the present application will also use the first video frame to perform object segmentation processing in accordance with the second segmentation method to obtain a calibrated mask image of the first video frame, so that the acquisition process of the calibrated mask image does not depend on the historical mask image of the previous video frame, thereby ensuring that the calibrated mask image is not affected by the historical mask image. Adverse effects, in this way, the calibration mask image is compared with the first mask image. When the comparison result meets the video segmentation calibration condition, the first mask image can be considered inaccurate, and will no longer be used to guide the object segmentation of the next video frame. The calibration mask image will be directly output as the target mask image of the first video frame, thereby ensuring the object segmentation effect of the next video frame guided by the target mask image. This solves the technical problem that when the video object moves quickly or is blocked, only the first segmentation method is used to realize video object segmentation, and the target object cannot be reliably identified, resulting in poor object segmentation effect, and thus cannot meet subsequent application requirements for the segmentation results.
[0083] Reference Figure 2 , is a flowchart of another optional example of the video object segmentation method proposed in this application. This embodiment can be an optional refined implementation method of the video object segmentation method described in the above embodiment, specifically a refined description of the above first segmentation method and the second segmentation method, but is not limited to the refined implementation method described in this embodiment. Figure 2 As shown, the video object segmentation method proposed in this embodiment may include:
[0084] Step S21, obtaining a first video frame and historical mask images of historical video frames adjacent to the first video frame;
[0085] For the specific implementation process of step S21, reference may be made to the description of the corresponding part of the above embodiment, which will not be elaborated in this embodiment.
[0086] Step S22, inputting the historical mask image and the first video frame into a first segmentation model, and outputting a first mask image of the first video frame;
[0087] Step S23, inputting the first video frame into the second segmentation model, and outputting a calibrated mask image of the first video frame;
[0088] In combination with the above descriptions of the first segmentation method and the second segmentation method, the present application can use a suitable deep learning / machine learning algorithm for model training to obtain a segmentation model that characterizes the object segmentation rules of the corresponding segmentation method, which is used to implement object segmentation processing for each video frame and output corresponding segmentation results, such as a mask image of the foreground object of the corresponding video frame.
[0089] It can be understood that since the first segmentation method and the second segmentation method are based on different information content in the process of object segmentation processing on video frames, the sample data content input in the process of training the corresponding segmentation model is different. For the convenience of description, the segmentation model corresponding to the first segmentation method is recorded as the first segmentation model, and the segmentation model corresponding to the second segmentation method is recorded as the second segmentation model.
[0090] Specifically, in the training process of the above-mentioned first segmentation model, the model input is multiple sample video frames and multiple sample mask images. The sample mask image of the previous sample video frame and the current sample video frame can be input into the initial segmentation model for training and learning until the training termination conditions are met, such as the preset number of training times or the accuracy of the mask image output by the model reaches the preset requirements, etc. The model finally obtained by training can be recorded as the first segmentation model. It can be seen that the input of the first segmentation model is a four-channel input consisting of mask+RGB of the previous video frame.
[0091] Among them, the initial segmentation model can be a machine learning / deep learning network such as an initial neural network, or a standard segmentation model in the video field. The latter often only requires several training adjustments to obtain the required first segmentation model.
[0092] Similarly, the training process for the second segmentation model is similar, the difference is that when training the second segmentation model, only the sample video frames are input into the initial segmentation model for training and learning until the corresponding training termination conditions are met to obtain the desired second segmentation model. It can be seen that the input of the second segmentation model is RGB three-channel input. It should be noted that this application does not elaborate on the specific training implementation process of the first segmentation model and the second segmentation model, and is not limited to the training method described above.
[0093] Based on the above description of the first segmentation model and the second segmentation model, after obtaining the first video frame, the computer device can query the historical mask image of the adjacent previous historical video frame. Thereafter, the first video frame can be subjected to object segmentation processing in accordance with the above steps S22 and S23, respectively, to obtain two mask images of the first video frame, namely, the first mask image and the calibration mask image.
[0094] It can be understood that when the video object does not move quickly, is not blocked, rotated, etc., object segmentation processing is performed on the video frame similar to a static image. The first mask image output by the above-mentioned first segmentation model may have a better object segmentation effect than the calibrated mask image output by the second segmentation model, and the identified foreground object is more accurate.
[0095] However, when the problems listed in this article occur, the relative positions of foreground objects in adjacent video frames will change significantly. As a result, the recognition accuracy of foreground objects in the historical mask image is not high, and the segmentation effect of the first mask image guided by this will not be ideal. If this continues to guide the object segmentation effect of the next video frame, the effect will be even worse. In order to avoid this situation, the present application proposes to adopt step S23 to obtain a calibration mask image for determining whether the segmentation result of the first mask image is accurate, but is not limited to the implementation method of obtaining the calibration mask image described in step S23.
[0096] Step S24: when the comparison result between the calibration mask image and the first mask image satisfies the video segmentation calibration condition, the calibration mask image is output as the target mask image of the first video frame.
[0097] Regarding the specific implementation process of step S24, reference may be made to the description of the corresponding part of the above embodiment, which will not be elaborated in this embodiment.
[0098] In summary, in the embodiment of the present application, for obtaining the first video frame, different segmentation models will be used for object segmentation processing, that is, the historical mask image and the first video frame are input into the first segmentation model to obtain the first mask image of the foreground object in the first video frame, and the first video frame is input into the second segmentation model to obtain another mask image of the foreground object of the first video frame, which is recorded as the calibration mask image. Afterwards, the two mask images of the foreground object of the first video frame are compared. If the comparison result meets the video segmentation calibration condition, it means that the foreground object segmentation effect of the first mask image obtained by the first segmentation model is not good. The present application will use the calibration mask image as the target mask image output of the first video frame to guide the object segmentation processing of the next video frame. Such progressive processing ensures the object segmentation effect of each video frame, that is, ensures the accuracy of foreground object tracking and recognition, so as to better meet the subsequent application requirements.
[0099] Reference Figure 3 , is a flowchart of another optional example of the video object segmentation method proposed in this application. This embodiment can be another optional refined implementation of the video object segmentation method described in the above embodiment. Specifically, it refines the implementation process of how to compare the calibration mask image with the first mask image in the above embodiment, and how to determine whether the comparison result meets the video segmentation calibration condition, but is not limited to the refined implementation described in this embodiment. Figure 3 As shown, the video object segmentation method proposed in this embodiment may include:
[0100] Step S31, obtaining a first video frame and a historical mask image of a historical video frame adjacent to the first video frame;
[0101] Step S32, inputting the historical mask image and the first video frame into a first segmentation model, and outputting a first mask image of the first video frame;
[0102] Regarding the specific implementation process of step S31 and step S32, reference may be made to the description of the corresponding parts of the above embodiment, which will not be elaborated in this embodiment.
[0103] Step S33, setting the historical mask image to zero to obtain a target historical mask image;
[0104] Step S34, inputting the target historical mask image and the first video frame into a third segmentation model, and outputting a calibrated mask image of the first video frame;
[0105] Based on the above description of the second segmentation method, the present application hopes that when performing object segmentation processing on the first video frame according to the segmentation method, it will not be affected by the historical mask image of the previous historical video frame. Therefore, for the segmentation model with four channels as input, the embodiment of the present application proposes to set the historical mask image to zero, that is, the input of the mask channel is zero, relative to no input mask image. In this way, the zero-input mask and the RGB three-channel data of the first video frame are input into the third segmentation model, and each network layer of the third segmentation model only analyzes and processes the RGB data of the first video frame, thereby avoiding the output of the calibrated mask image of the first video frame from being adversely affected by the historical mask image.
[0106] It can be seen that the input of the third segmentation model of this embodiment and the first segmentation model are both four-channel inputs, and the difference lies in the input content of the input channel where the mask is located. Therefore, in practical applications, the third segmentation model can be the same as the first segmentation model; of course, the present application can also retrain the third segmentation model to make it more suitable for the scene of how to accurately implement object segmentation of video frames without mask data. At this time, the third segmentation model is different from the first segmentation model.
[0107] Step S35, obtaining first attribute information of the first mask image and second attribute information of the calibration mask image;
[0108] Step S36, comparing the first attribute information and the second attribute information to obtain attribute differences between the object segmentation regions of the first mask image and the calibration mask image;
[0109] The embodiment of the present application proposes an optional implementation method for comparing a first mask image with a calibration mask image, that is, comparing the attribute information of each of the two mask images. Since the mask image actually identifies the area where the foreground object is located, the attribute information of the mask image can be the attribute information of the foreground object of the first video frame. The present application does not limit the content of the attribute information, which can be determined according to the circumstances.
[0110] Under normal circumstances, if the video object does not move quickly or is not blocked, the difference in image content between adjacent video frames is very small, and the difference between the two mask images obtained by the above-mentioned different segmentation methods is often small, or even the same. However, if these problems occur, the foreground object identified by the historical mask image may be inaccurate, which will cause the recognition accuracy of the foreground object of the above-mentioned first mask image to be worse, but it does not affect the recognition accuracy of the foreground object of the calibration mask image. Therefore, in this case, there will be a certain difference between the foreground object areas identified by the first mask image and the calibration mask image. In order to quantify the difference, this embodiment proposes to determine it based on the attribute information of the mask image.
[0111] Exemplarily, the attribute information of the mask image may include the shape, area, etc. of the region where the identified target object (such as the foreground object) is located. Thus, when comparing the target object regions of two mask images, the shapes and / or areas of the respective identified target object regions may be compared, thereby determining the difference in object segmentation effects between the two mask images, but this is not limited to the attribute information content listed in this embodiment.
[0112] Step S37, detecting whether the attribute difference reaches the video segmentation calibration threshold, if yes, proceeding to step S38; if no, executing step S39;
[0113] Step S38, outputting the calibrated mask image as the target mask image of the first video frame;
[0114] Step S39: output the first mask image as the target mask image of the first video frame.
[0115] It can be understood that for attribute information of different contents, the content of the above-mentioned video segmentation calibration threshold may be different, and the embodiments of the present application will not list them one by one here.
[0116] In summary, the first video frame is segmented according to different segmentation methods to obtain two mask images, and then the attribute information of the two mask images is compared. If the attribute difference reaches the video segmentation calibration threshold, it is determined that the segmentation result output by the first segmentation model for object segmentation of each video frame is inaccurate, and the segmentation result output by the third segmentation model is used as the object segmentation result of the first video frame, i.e., the target mask image; conversely, if the attribute difference does not reach the video segmentation calibration threshold, it is determined that the segmentation result output by the first segmentation model is accurate, and the first mask image output by it is still used as the target mask image of the first video frame, thereby ensuring the accuracy of the object segmentation result of each video frame and better meeting the subsequent application requirements based on the object segmentation results.
[0117] It can be understood that the implementation method of the above steps S35 to S39 in this embodiment can be used as an optional detailed implementation method of the above steps S14 and S24, that is, replacing the above steps S14 and S24 to obtain some more video object segmentation method embodiments, and the specific implementation process will not be repeated in this application.
[0118] Reference Figure 4 , which is a flowchart of another optional example of the video object segmentation method proposed in the present application. This embodiment can be a further refined implementation method of the video object segmentation method described in the above embodiment, which implements the comparison between the calibration mask image and the first mask image to determine whether the comparison result meets the video segmentation calibration condition, such as Figure 4 As shown, the method may include:
[0119] Step S41, obtaining a first video frame and historical mask images of historical video frames adjacent to the first video frame;
[0120] Step S42, performing object segmentation processing using the historical mask image and the first video frame according to a first segmentation method to obtain a first mask image of the first video frame;
[0121] Step S43, performing object segmentation processing using the first video frame according to the second segmentation method to obtain a calibrated mask image of the first video frame;
[0122] Regarding the specific implementation process of steps S41 to S43, reference may be made to the description of the corresponding parts of the above embodiment, which will not be elaborated in this embodiment.
[0123] Step S44, performing pixel statistics on the object segmentation regions respectively included in the first mask image and the calibration mask image to obtain a first region area of the object segmentation region in the first mask image and a second region area of the object segmentation region in the calibration mask image;
[0124] Step S45, performing a difference operation on the area of the first region and the area of the second region to obtain a region area difference between the object segmentation regions of the first mask image and the calibration mask image;
[0125] Step S46: if the area difference is greater than the video segmentation calibration threshold, the calibration mask image is output as the target mask image of the first video frame.
[0126] It can be seen that in the embodiment of the present application, the area of the target object identified by the attribute information of the above-mentioned mask image is used as an example for explanation. Since the area of the image area can be represented by the number of pixels contained in the area, this embodiment can perform pixel statistics on the object segmentation areas (such as the foreground object area in the first video frame, specifically the portrait area of the conference members in the video conference) contained in the first mask image and the calibration mask image to obtain the area area of the object segmentation areas respectively identified.
[0127] Afterwards, the two statistically obtained areas are compared, which is actually a comparison of the number of pixels contained in the object segmentation areas obtained by the two segmentation methods. Since this application needs to ensure the integrity of the identified segmented objects, under normal circumstances, the first mask image will contain the completed target object. In some abnormal cases, it may also contain unnecessary objects, resulting in the object segmentation area obtained by the first mask image being larger than the target object area.
[0128] Based on this, the embodiment of the present application can subtract the area of the second area from the area of the first area to obtain the area difference, and judge whether the area difference is greater than the video segmentation calibration threshold, that is, whether the area of the first area is greater than the area of the second area, and whether the area is greater than the video segmentation calibration threshold. If so, it can be determined that the first mask image contains non-target objects, and its object segmentation result is inaccurate, and the calibration mask image is output as the target mask image of the first video frame; otherwise, it can be considered that the object segmentation result of the first mask image is accurate, and the first mask image can be output as the target mask image of the first video frame, thereby ensuring the accuracy of the mask image output for each video frame, that is, ensuring the accuracy of the object segmentation result of each video frame.
[0129] Based on the video object segmentation method described in the above embodiments, Figure 5, which is a flowchart of another optional example of the video object segmentation method proposed in this application, and this embodiment can further limit the timing of verifying the reliability or stability of the first mask image of the first video frame obtained by the first segmentation method. Figure 5 As shown, the method may include:
[0130] Step S51, obtaining a first video frame and historical mask images of historical video frames adjacent to the first video frame;
[0131] Step S52, performing object segmentation processing using the historical mask image and the first video frame according to a first segmentation method to obtain a first mask image of the first video frame;
[0132] Regarding the specific implementation process of step S51 and step S52, reference may be made to the description of the corresponding parts of the above embodiment, which will not be elaborated in this embodiment.
[0133] Step S53, obtaining segmentation status information of the first video frame;
[0134] Step S54, detecting whether the segmentation status information meets the video calibration condition, if yes, proceeding to step S55, if no, executing step S59;
[0135] Step S55, performing object segmentation processing using the first video frame according to the second segmentation method to obtain a calibrated mask image of the first video frame;
[0136] In the embodiment of the present application, in order to ensure the accuracy of the object segmentation result of each video frame, each video frame can be processed according to the two segmentation methods in the manner described in the above embodiment to determine the target mask image of the video frame.
[0137] However, the calibration and verification processing method of the above-mentioned embodiment will consume more resources of the computer device in real time. In order to save the computer device resources, and taking into account that not every video frame has an inaccurate object segmentation result obtained according to the first segmentation method, the embodiment of the present application sets a video calibration condition based on this, that is, determining the appropriate condition for calibrating and verifying the object segmentation result (i.e., the first mask image) obtained according to the first segmentation method for the current video frame. The present application does not limit the content of the condition.
[0138] In this way, only when the video calibration condition is met, another segmentation method is used to segment the current video frame, and the object segmentation result is used to calibrate and verify the above object segmentation result. If the video calibration condition is not met, only the processing method of step S52 is needed to obtain the target mask image of the first video frame, and no other segmentation method is needed, thereby saving the occupation of computer equipment resources by executing the other segmentation method, and also improving the efficiency of video frame object segmentation.
[0139] Based on the above analysis, after obtaining the first video frame, the segmentation status information of the first video frame can be directly obtained, or after obtaining the first mask image, the segmentation status information of the first video frame can be obtained. The present application does not limit the execution order of the step S53 and the above step S52. The content of the segmentation status information can be determined according to the content of the video calibration condition, which is not described in detail in the present application.
[0140] In a possible implementation, the present application may execute step S55 at a certain time interval to verify the first mask image obtained in step S52. In this case, the segmentation state information may be the acquisition time point of the first video frame, and the video calibration condition may include that the calibration time interval between the last video calibration time point and the current moment reaches a preset video calibration time interval threshold, and the present application does not limit the value of the video calibration time interval threshold, which may be determined according to the circumstances.
[0141] Based on this, the detection process of the above step S54 may include: obtaining the calibration time interval corresponding to the first video frame, that is, the time interval between the acquisition time point of the first video frame and the last video calibration time point, and then determining whether the calibration time interval reaches the video calibration time interval threshold. If so, it can be considered that the segmentation status information of the first video frame meets the video calibration conditions; if not, it can be considered that the segmentation status information of the first video frame does not meet the video calibration conditions.
[0142] In another possible implementation, different from the above-mentioned timing method, that is, the method of counting the calibration time interval, this embodiment can also count the frame difference between the number of video frames of the last execution of the second segmentation method (which can be determined sequentially based on the total number of video frames contained in the entire video) and the number of first video frames, and determine in turn whether to execute the second segmentation method for the first video frame. In this case, the above-mentioned segmentation state information can be the number of frames of the first video frame, and the above-mentioned video calibration condition can include: the frame number interval between the number of video frames of the last execution of the second segmentation method (that is, the video frame of the last video segmentation calibration) and the number of first video frames reaches the video calibration frame number interval threshold, and the present application does not limit the specific value of the video calibration frame number interval threshold.
[0143] Based on this, the detection process of the above step S54 may include: obtaining the frame number interval between the first video frame and the video frame of the last video calibration, and determining whether the frame number interval reaches the video calibration frame number interval threshold; if so, it can be considered that the segmentation status information of the first video frame meets the video calibration conditions; if not, it can be considered that the segmentation status information of the first video frame does not meet the video calibration conditions.
[0144] It should be noted that the content of the segmentation status information of the video frame of the present application and the content of the corresponding video calibration conditions are not limited to the two implementation methods listed above.
[0145] Step S56, comparing the calibration mask image with the first mask image to obtain a comparison result;
[0146] Step S57, detecting whether the comparison result meets the video segmentation calibration condition, if yes, proceeding to step S58, if no, executing step S59;
[0147] Step S58, outputting the calibrated mask image as the target mask image of the first video frame;
[0148] Step S59: output the first mask image as the target mask image of the first video frame.
[0149] Regarding the specific implementation process of steps S56 to S59, reference may be made to but not limited to the description of the corresponding parts of the above embodiment, which will not be elaborated in this embodiment.
[0150] In some other embodiments, when the above comparison results meet the video segmentation calibration conditions, the present application can also adjust the model parameters of the first segmentation model (refer to the model training process described above) based on the comparison results between the calibration mask image and the first mask image, as well as the first video frame and other data, to improve the accuracy of the object segmentation results output by the model, thereby continuing to perform object segmentation processing on the next video frame using the adjusted first segmentation model. It can be seen that when the comparison results meet the video segmentation calibration conditions, it is not limited to the processing method proposed above in the present application of deleting the first mask image and outputting the calibration mask image as the target mask image of the first video frame.
[0151] In summary, in the process of the computer device performing object segmentation processing according to the first segmentation method using the historical mask image and the first video frame to obtain the first mask image, if it is detected that the segmentation state information of the first video frame meets the video calibration condition, the first video frame will be re-processed for object segmentation according to the second segmentation method to obtain its calibrated mask image to determine whether the object segmentation result of the first mask image is accurate; if it is detected that the segmentation state information of the first video frame does not meet the video calibration condition, the first mask image is directly output, thereby avoiding the situation where the first mask image is accurate and the object segmentation processing of the first video frame is re-performed according to the second segmentation method, resulting in unnecessary consumption of computer device resources.
[0152] Based on the video object segmentation method described in the above embodiments, the video conferencing scene is used as an example for explanation. For a frame of image captured by any terminal device participating in the video, the video object segmentation method proposed in the above embodiments of the present application can be executed to accurately identify the portrait area in the frame of image. In this way, in the face of problems such as rapid movement of users, the object segmentation result obtained by the first segmentation method will include other objects in the user's environment, such as tables and chairs, in addition to the user's portrait area. It can be seen that this object segmentation result is not accurate and cannot meet subsequent application requirements. The present application will adopt the second segmentation method to perform object segmentation processing only on the current frame of image to ensure that the object segmentation result obtained only includes the user's portrait area. Afterwards, by comparing the two object segmentation results, it is determined that the object segmentation result obtained by the first segmentation method is inaccurate, and the inaccurate object segmentation result can be cleared, and the relatively accurate object segmentation result obtained by the second segmentation method is output as the target object segmentation result of the frame of image.
[0153] Based on the target object segmentation results obtained above, if a user does not want other participating users to see certain content in the image, such as the environment occupied by the user, the identified portrait area can be superimposed on another selected background image, so that the user appears to be participating in the video conference in the environment shown in the background image; of course, based on the object segmentation results, it is also possible to block the content of specific areas, etc., which can be determined according to the needs of the specific application scenarios. This application does not elaborate on the processing method based on the object segmentation results.
[0154] Reference Figure 6 FIG. 1 is a schematic diagram of a structure of an optional example of a video object segmentation device proposed in the present application. The device can be applied to the above electronic device, such as Figure 6 As shown, the device may include:
[0155] An acquisition module 61 is used to acquire a first video frame and a historical mask image of a historical video frame adjacent to the first video frame;
[0156] A first segmentation processing module 62 is used to perform object segmentation processing using the historical mask image and the first video frame in a first segmentation manner to obtain a first mask image of the first video frame;
[0157] A second segmentation processing module 63 is used to perform object segmentation processing using the first video frame according to a second segmentation method to obtain a calibrated mask image of the first video frame;
[0158] The first output module 64 is configured to output the calibration mask image as a target mask image of the first video frame if a comparison result between the calibration mask image and the first mask image satisfies a video segmentation calibration condition.
[0159] In some embodiments, the first segmentation processing module 62 may specifically include:
[0160] A first model processing unit, configured to input the historical mask image and the first video frame into a first segmentation model, and output a first mask image of the first video frame;
[0161] The second segmentation processing module 63 may include:
[0162] A second model processing unit, configured to input the first video frame into a second segmentation model and output a calibrated mask image of the first video frame;
[0163] Alternatively, the third model processing unit is used to reset the historical mask image to zero to obtain a target historical mask image, input the target historical mask image and the first video frame into a third segmentation model, and output a calibrated mask image of the first video frame.
[0164] Based on the above description, in some further embodiments, the video object segmentation apparatus proposed in the present application may further include:
[0165] A model adjustment module is used to adjust the model parameters of the first segmentation model according to the comparison result of the calibration mask image and the first mask image and the first video frame when the comparison result of the calibration mask image and the first mask image meets the video segmentation calibration condition, so as to continue to perform object segmentation processing on the next video frame using the adjusted first segmentation model.
[0166] In some embodiments, the target mask image output module 64 may include:
[0167] an attribute information acquiring unit, configured to acquire first attribute information of the first mask image and second attribute information of the calibration mask image;
[0168] an attribute comparison unit, configured to compare the first attribute information with the second attribute information to obtain an attribute difference between the object segmentation regions of the first mask image and the calibration mask image;
[0169] A detection unit, used to detect whether the attribute difference reaches a video segmentation calibration threshold;
[0170] a first output unit, configured to output the calibration mask image as a target mask image of the first video frame when the detection result of the detection unit is yes;
[0171] The second output unit is configured to output the first mask image as the target mask image of the first video frame when the detection result of the detection unit is negative.
[0172] In a possible implementation, the attribute information obtaining unit may include:
[0173] a pixel statistics unit, configured to perform pixel statistics on the video object segmentation regions respectively included in the first mask image and the calibration mask image, to obtain a first region area of the object segmentation region in the first mask image and a second region area of the object segmentation region in the calibration mask image;
[0174] Accordingly, the attribute comparison unit may include:
[0175] The region area difference acquisition unit is used to perform a difference operation on the first region area and the second region area to obtain a region area difference between the object segmentation regions of the first mask image and the calibration mask image.
[0176] In some further embodiments, the video object segmentation apparatus proposed in the present application may further include:
[0177] A segmentation status information acquisition module, used to acquire segmentation status information of the first video frame;
[0178] The detection module is used to detect whether the segmentation state information meets the video calibration condition. If so, the second segmentation processing module 63 is triggered to perform object segmentation processing using the first video frame according to the second segmentation method to obtain a calibration mask image of the first video frame.
[0179] The second output module is used to output the first mask image as the target mask image of the first video frame when the detection result of the detection module is negative.
[0180] Optionally, the detection module may include:
[0181] A time interval acquisition unit, used to acquire a calibration time interval corresponding to the first video frame; wherein the calibration time interval refers to a time interval between an acquisition time point of the first video frame and a previous video calibration time point;
[0182] A first detection unit, configured to detect whether the calibration time interval reaches a video calibration time interval threshold;
[0183] In some further embodiments, the detection module may also include:
[0184] A frame interval acquisition unit, used to acquire a frame interval between the first video frame and a video frame of a previous video calibration;
[0185] The second detection unit is used to detect whether the frame interval reaches a video calibration frame interval threshold.
[0186] It should be noted that the various modules, units, etc. in the above-mentioned device embodiments can be stored in the memory as program modules, and the processor executes the above-mentioned program modules stored in the memory to implement the corresponding functions. For the functions implemented by each program module and its combination, as well as the technical effects achieved, please refer to the description of the corresponding parts of the above-mentioned method embodiments, which will not be repeated in this embodiment.
[0187] The present application also provides a storage medium on which a computer program can be stored. The computer program can be called and loaded by a processor to implement each step of the video object segmentation method described in the above embodiment.
[0188] Reference Figure 7 , is a schematic diagram of an optional example of the hardware structure of a computer device applicable to the video object segmentation method and apparatus proposed in this application, and the computer device may include a terminal device or a service device, which may be determined according to the requirements of a specific application scenario. Figure 7 As shown, the computer device may include: at least one memory 71 and at least one processor 72, wherein:
[0189] The memory 71 can be used to store a program for implementing the video object segmentation method described in the above method embodiment; the processor 72 can be used to load and execute the program stored in the memory 71 to implement the various steps of the video object segmentation method described in the above corresponding method embodiment. The specific implementation process can refer to the description of the corresponding part of the above embodiment, which will not be repeated in this embodiment.
[0190] In conjunction with the above description of computer equipment, refer to Figure 8The schematic diagram of a video conferencing scene suitable for the video object segmentation method and apparatus proposed in the present application is shown. When the computer device is a terminal device, when the terminal device captures any frame image, the target mask image of the frame image can be determined according to the video object segmentation method proposed in the present application, and the target object area in the frame image, such as the portrait area, can be accurately extracted for application requirements such as tracking and identifying the target object or blocking information in a specific area.
[0191] Among them, the terminal device acquires multiple continuous video frames, and after obtaining the target mask image of each video frame according to the video object segmentation method proposed in this application, it can be sent to a communication server that supports the normal operation of the video conference, and the communication server processes it according to the application requirements, and directly feeds back the processed video stream to the output of each terminal device participating in the video conference, or sends it to other terminal devices participating in the video conference for output, so as to realize different video conference interfaces output by this terminal device and other terminal devices. Of course, the above-mentioned video stream can also be directly processed by this terminal device, and then forwarded to other terminal devices for output through the communication server. This application does not limit this and it can be determined according to the situation.
[0192] It can be understood that when the computer device is a terminal device, the computer may include but is not limited to smart phones, tablet computers, wearable devices, personal computers (PCs), netbooks, augmented reality (AR) devices, virtual reality (VR) devices, vehicle-mounted devices, robots, desktop computers, etc. Figure 8 The terminal device included in the illustrated scenario is merely an example and should not impose any limitations on the functionality and scope of use of the embodiments of the present application.
[0193] For the terminal devices listed above, it can also include at least one input device such as a touch sensing unit for sensing touch events on a touch display panel, a keyboard, a mouse, a camera, a microphone, etc.; at least one output device such as a display, a speaker, a vibration mechanism, a lamp, etc.; various sensor components; a power management module and an antenna, etc., which can be determined based on the product type of the terminal device and its functional requirements, and this application does not list them one by one here.
[0194] In some embodiments, if the above-mentioned computer device is a service device, that is, after the terminal device captures each frame of the image, it can be sent to the service device to implement video object segmentation processing and obtain the required target mask image of each video frame. After that, the user can send a corresponding processing request to the service device based on the video display content, such as the display requirements of the personal window of the individual in the video conferencing interface, so that the service device responds to the processing request, obtains the video stream data about the user sent to other terminal devices participating in the video conference, and sends it to the other terminal for output.
[0195] Optionally, after the service device obtains the target mask image of each video frame, it can also feed it back to the terminal device, so that the user can use the target mask image on the terminal device to process the image content of each video frame to meet the user's display requirements for the output video content, such as realizing the requirement of outputting different video conferencing interfaces between this terminal device and other terminal devices, etc., and then send the processed video stream to other terminal devices for output.
[0196] In summary, the present application does not limit the product type of the above-mentioned computer equipment, which can be determined according to the needs of specific scenarios. The video object segmentation method and device proposed in the present application are not only applicable to video conferencing scenarios, but can also be applied to other video scenarios to meet the needs of other scenarios. This application will not elaborate on this.
[0197] Furthermore, it should be understood that Figure 8 The structure of the computer device shown does not constitute a limitation on the computer device in the embodiment of the present application. In practical applications, the electronic device may include Figure 8 More or fewer components as shown, or combinations of certain components, are not listed here one by one in this application.
[0198] Finally, it should be noted that the various embodiments in this specification are described in a progressive or parallel manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referred to each other. For the devices and computer equipment disclosed in the embodiments, and the system structure in the application scenario, since they correspond to the methods disclosed in the embodiments, the description is relatively simple, and the relevant parts can be referred to the method part description.
[0199] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present application. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to the embodiments shown herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A video object segmentation method, the method comprising: Acquire a first video frame and historical mask images of historical video frames adjacent to the first video frame; According to a first segmentation method, the historical mask image and the first video frame are used to perform object segmentation processing to obtain a first mask image of the first video frame; According to a second segmentation method, the first video frame is used to perform object segmentation processing to obtain a calibrated mask image of the first video frame; When a comparison result between the calibration mask image and the first mask image satisfies a video segmentation calibration condition, the calibration mask image is output as a target mask image of the first video frame.
2. The method according to claim 1, wherein the comparison process of the first mask image and the calibration mask image comprises: Acquire first attribute information of the first mask image and second attribute information of the calibration mask image; comparing the first attribute information and the second attribute information to obtain attribute differences between respective object segmentation regions of the first mask image and the calibration mask image; The comparison result between the calibration mask image and the first mask image satisfies a video segmentation calibration condition, including: The attribute difference reaches a video segmentation calibration threshold.
3. The method according to claim 2, wherein the acquiring the first attribute information of the first mask image and the second attribute information of the calibration mask image comprises: Performing pixel statistics on the object segmentation regions respectively included in the first mask image and the calibration mask image to obtain a first region area of the object segmentation region in the first mask image and a second region area of the object segmentation region in the calibration mask image; The comparing the first attribute information and the second attribute information to obtain the attribute difference between the object segmentation regions of the first mask image and the calibration mask image, includes: A difference operation is performed on the first region area and the second region area to obtain a region area difference between the object segmentation regions of the first mask image and the calibration mask image.
4. The method according to any one of claims 1 to 3, further comprising: Acquire segmentation status information of the first video frame; When the segmentation state information satisfies the video calibration condition, the step of performing object segmentation processing using the first video frame in accordance with the second segmentation manner to obtain a calibration mask image of the first video frame is performed.
5. The method according to claim 4, wherein the segmentation state information satisfies the video calibration condition comprising: Obtaining a calibration time interval corresponding to the first video frame, and determining whether the calibration time interval reaches a video calibration time interval threshold; wherein the calibration time interval refers to a time interval between a time point of obtaining the first video frame and a time point of a previous video calibration; or, A frame number interval between the first video frame and a video frame of a previous video calibration is obtained, and it is determined that the frame number interval reaches a video calibration frame number interval threshold.
6. The method according to claim 4, further comprising: When the segmentation state information does not satisfy the video calibration condition, or when the comparison result between the calibration mask image and the first mask image does not satisfy the video segmentation calibration condition, the first mask image is output as a target mask image of the first video frame.
7. The method according to any one of claims 1 to 3, wherein the step of performing object segmentation processing using the historical mask image and the first video frame in a first segmentation manner to obtain a first mask image of the first video frame comprises: Inputting the historical mask image and the first video frame into a first segmentation model, and outputting a first mask image of the first video frame; The method of performing object segmentation processing using the first video frame according to the second segmentation method to obtain a calibrated mask image of the first video frame includes: Inputting the first video frame into a second segmentation model and outputting a calibrated mask image of the first video frame; or, Setting the historical mask image to zero to obtain a target historical mask image; The target historical mask image and the first video frame are input into a third segmentation model, and a calibrated mask image of the first video frame is output.
8. The method according to claim 7, when the comparison result between the calibration mask image and the first mask image satisfies the video segmentation calibration condition, the method further comprises: According to the comparison result between the calibration mask image and the first mask image, and the first video frame, the model parameters of the first segmentation model are adjusted to continue to perform object segmentation processing on the next video frame using the adjusted first segmentation model.
9. A video object segmentation device, the device comprising: An acquisition module, used to acquire a first video frame and a historical mask image of a historical video frame adjacent to the first video frame; A first segmentation processing module, configured to perform object segmentation processing using the historical mask image and the first video frame in a first segmentation manner to obtain a first mask image of the first video frame; A second segmentation processing module, configured to perform object segmentation processing using the first video frame according to a second segmentation method to obtain a calibrated mask image of the first video frame; The target mask image output module is used to output the calibration mask image as the target mask image of the first video frame when the comparison result between the calibration mask image and the first mask image meets the video segmentation calibration condition.
10. A computer device, comprising: A memory, used for storing a program for implementing the video object segmentation method according to any one of claims 1 to 8; The processor is used to load and execute the program stored in the memory to implement each step of the video object segmentation method according to any one of claims 1 to 8.
