Video processing method, device, electronic device and storage medium

By combining the semantic segmentation results of the previous frame of the image and the proportional size of the filtered segmentation target, combined with the smoothing processing of the regional overlap rate and confidence threshold, the problem of jitter in the image segmentation results of adjacent frames in the real-time video stream is solved, and the video quality is improved. Semantic segmentation of streams for coherence and accuracy, optimizing visual effects.

CN112800850BActive Publication Date: 2024-09-17SHANGHAI SENSETIME INTELLIGENT TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202011632460.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-12-31
Publication Date
2024-09-17
Estimated Expiration
2040-12-31

AI Technical Summary

Technical Problem

In the process of semantic segmentation of real-time video streams in the existing technology, the segmentation results of adjacent frame images are jittered, resulting in poor visual effects and poor coherence of the segmentation results.

Method used

By combining the semantic segmentation results of the previous frame of image, the target location area of ​​the current frame is determined, the spatiotemporal domain stability of adjacent frame images in the video stream is optimized, and the inter-frame jitter caused by the target category prediction error is reduced, and the semantic segmentation model is used for screening Segment the area where the proportion of the target meets the requirements to improve the accuracy of the initial semantic segmentation results, and smooth it through the area overlap rate and confidence threshold to ensure the coherence of the semantic segmentation results.

Benefits of technology

It improves the coherence and accuracy of semantic segmentation results of adjacent frame images, reduces visual jitter, optimizes user experience, and enhances the stability and consistency of target recognition in video streams.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112800850B
    Figure CN112800850B
Patent Text Reader

Abstract

The present disclosure provides a video processing method, device, electronic device and storage medium, wherein the video processing method includes: obtaining a real-time video stream; the real-time video stream includes a first image of a current frame and a second image of a previous frame; determining a first semantic segmentation result of a target position area of ​​the first image, and obtaining a second semantic segmentation result of the second image; and determining a second semantic segmentation result of the first image based on the first semantic segmentation result and the second semantic segmentation result of the second image.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of video processing technology, and in particular to a video processing method, device, electronic device and storage medium. Background Art

[0002] In some application scenarios, such as live broadcasting, online conferencing, and autonomous driving, it is often necessary to perform semantic segmentation on the real-time video stream to distinguish the target objects contained in the video stream.

[0003] When performing semantic segmentation processing on a video stream, the images in the video stream can be used as image inputs into a pre-trained image semantic segmentation model for semantic segmentation to obtain the semantic segmentation results for each frame of the image. This method can identify the target object contained in a single frame of the image.

[0004] Since the image semantic segmentation model may have certain errors, the accuracy of the segmentation results obtained when performing semantic segmentation processing on the details in different frame images may be different. As a result, the semantic segmentation results of two adjacent frame images in the video stream will be different. For example, the outline of the same target object in two adjacent frame images may be a straight line in one frame image and a curve in the next frame image, which will cause visual jitter. Therefore, there is an urgent need to provide a semantic segmentation method for real-time video streams. Summary of the invention

[0005] The embodiments of the present disclosure at least provide a video processing solution.

[0006] In a first aspect, an embodiment of the present disclosure provides a video processing method, including:

[0007] Acquire a real-time video stream; the real-time video stream includes a first image of a current frame and a second image of a previous frame;

[0008] Determine a first semantic segmentation result of a target location area of ​​the first image, and obtain a second semantic segmentation result of the second image;

[0009] Based on the first semantic segmentation result and the second semantic segmentation result of the second image, a second semantic segmentation result of the first image is determined.

[0010] In the disclosed embodiment, taking into account that the acquisition time interval between two adjacent frames of images in a video stream is short, the same segmentation target exists between the two adjacent frames of images. In this way, when determining the second semantic segmentation result of the current frame, it can be determined in combination with the second semantic segmentation result of the previous frame of image, thereby improving the spatiotemporal stability of the two adjacent frames of images and reducing the problem of inter-frame jitter caused by the prediction error of the target category, so as to achieve the effect of optimizing the visual effect.

[0011] In a possible implementation, determining a first semantic segmentation result of a target location area of ​​the first image includes:

[0012] Acquire a position range of a target position area of ​​the second image, and intercept an initial position area matching the position range of the target position area of ​​the second image from the first image;

[0013] Determine an initial semantic segmentation result of the initial position area in the first image;

[0014] A first semantic segmentation result of the target position area of ​​the first image is determined based on the position range of the target position area of ​​the second image, the position range of the initial position area in the first image, and the initial semantic segmentation result.

[0015] In the disclosed embodiment, considering that the acquisition time interval between adjacent frames is short, the target position area whose proportion size of the segmentation target meets the requirements can be selected in the first image of the current frame through the target position area of ​​the second image of the previous frame. In this way, after selecting the initial position area whose proportion size of the segmentation target meets the requirements, on the one hand, when the semantic segmentation model is used to determine the initial semantic segmentation result, the accuracy of the determined initial semantic segmentation result can be improved. On the other hand, because the initial position area is determined based on the target position area of ​​the second image of the previous frame, there is a correlation between the two, which makes it easy to improve the coherence of the semantic segmentation results between adjacent frame images in the obtained video stream.

[0016] In a possible implementation, determining a first semantic segmentation result of the target position area of ​​the first image based on the position range of the target position area of ​​the second image, the position range of the initial position area in the first image, and the initial semantic segmentation result includes:

[0017] Obtaining an initial semantic segmentation result of the first image based on the initial semantic segmentation result of the initial position area and second semantic segmentation results corresponding to other position areas of the first image except the initial position area in the second image;

[0018] Determining an updated position area of ​​the first image based on an initial semantic segmentation result of the first image;

[0019] determining a target position area of ​​the first image based on a position range of the target position area of ​​the second image and a position range of the update position area of ​​the first image;

[0020] An initial semantic segmentation result corresponding to the target position region of the first image is selected from the initial semantic segmentation results of the first image as a first semantic segmentation result of the target position region of the first image.

[0021] In the disclosed embodiment, taking into account that the target position area in the first image may have certain changes compared to the second image, such as the foreground area may be positionally shifted, after obtaining the initial position area, the initial semantic segmentation result of the initial position area and the second semantic segmentation result of the position area outside the initial position area in the second image are combined to obtain the updated position area of ​​the first image. Further, it is possible to determine whether the target position area of ​​the first image has undergone a large shift based on the updated position area and the target position area of ​​the second image, thereby obtaining an accurate target position area of ​​the first image and a first semantic segmentation result of the target position area.

[0022] In a possible implementation, determining the update position area of ​​the first image based on the initial semantic segmentation result of the first image includes:

[0023] Determining label information corresponding to each pixel point in the first image according to the initial semantic segmentation results corresponding to each pixel point in the first image; the label information is used to indicate the target category to which the pixel point belongs;

[0024] The update position area is determined from the first image based on the label information and pre-selected label information respectively corresponding to each pixel in the first image.

[0025] In the disclosed embodiment, it is proposed that an updated position area with a high matching degree with the first image of the current frame can be obtained based on the initial semantic segmentation result of the first image.

[0026] In a possible implementation manner, determining the target position area of ​​the first image based on the position range of the target position area of ​​the second image and the position range of the update position area of ​​the first image includes:

[0027] Determine an area overlap ratio between a position range of a target position area of ​​the second image and a position range of the update position area in the first image;

[0028] When the area overlap rate is less than a set overlap rate threshold, taking the update position area as the target position area of ​​the first image;

[0029] When the area overlap rate is greater than or equal to the set overlap rate threshold, the initial position area of ​​the first image is used as the target position area of ​​the first image.

[0030] In the disclosed embodiment, it is proposed to determine the target position area of ​​the first image based on the area overlap rate of the target position area of ​​the second image and the update position area in the first image. On the one hand, when the position of the segmentation target in the video stream changes greatly, a target position area with a relatively appropriate size in the first image can be obtained. On the other hand, when the position of the segmentation target in the video stream changes little, by maintaining the position range corresponding to the target position area of ​​the previous frame image, the consistency of the segmentation result in the video stream can be improved while maintaining a relatively appropriate size.

[0031] In a possible implementation manner, determining the area overlap rate of the position range of the target position area of ​​the second image and the position range of the update position area in the first image includes:

[0032] Obtaining an intersection area and a union area of ​​a target position area of ​​the second image and the update position area in the first image;

[0033] The ratio of the intersection area to the union area is used as the region overlap rate.

[0034] In the disclosed embodiment, the area overlap rate of the target position area and the update position area of ​​the second image can be quickly determined through the intersection area and the union area between the target position area and the update position area of ​​the second image.

[0035] In a possible implementation, the initial semantic segmentation result includes initial probability values ​​of the pixel points belonging to each target category;

[0036] The determining, according to the initial semantic segmentation results respectively corresponding to the pixels in the first image, label information respectively corresponding to the pixels in the first image comprises:

[0037] For each pixel in the first image, selecting a maximum initial probability value from the initial probability values ​​of the pixel belonging to each category;

[0038] The target category corresponding to the maximum initial probability value is used as the label information corresponding to the pixel point.

[0039] In the disclosed embodiment, by screening the label information of the target category indicated by the maximum initial probability value as the label information corresponding to the pixel point, label information with higher accuracy corresponding to the pixel point can be obtained, thereby facilitating preparation for the subsequent generation of an updated position area with higher accuracy based on the label information with higher accuracy.

[0040] In a possible implementation, determining a second semantic segmentation result of the first image based on the first semantic segmentation result and a second semantic segmentation result of the second image includes:

[0041] Determine a second semantic segmentation result of a target position area of ​​the first image based on the first semantic segmentation result and a second semantic segmentation result of the second image;

[0042] Obtaining a second semantic segmentation result of the first image based on a second semantic segmentation result of the target position area in the first image and a second semantic segmentation result of the reference position area in the second image;

[0043] The reference position area is a position area that matches a position area other than the target position area of ​​the first image.

[0044] In the embodiment of the present disclosure, after obtaining the second semantic segmentation result of the target position area in the first image, the second semantic segmentation result of the position area in the previous frame of the second image that matches the position area outside the target position area of ​​the first image can be combined to accurately and quickly obtain the second semantic segmentation result of the first image, providing support for subsequent video processing.

[0045] In a possible implementation, determining a second semantic segmentation result of the target location area of ​​the first image based on the first semantic segmentation result and the second semantic segmentation result of the second image includes:

[0046] For any first pixel point in the target position area of ​​the first image, determine an updated semantic segmentation result of the first pixel point according to the first semantic segmentation result of the first pixel point and the first semantic segmentation results of other pixels points within a preset position range from the first pixel point;

[0047] Based on the updated semantic segmentation result of the first pixel and the second semantic segmentation result of a second pixel matching the first pixel in the second image, a second semantic segmentation result of the first pixel is determined.

[0048] In the disclosed embodiment, it is proposed that, for any first pixel point in the target position area in the first image, the first semantic segmentation result of the first pixel point can be updated according to the first semantic segmentation result corresponding to the first pixel point and the first semantic segmentation results of other pixels within a preset range of intervals from the first pixel point, so that an updated semantic segmentation result with higher accuracy can be obtained.

[0049] In a possible implementation, determining the second semantic segmentation result of the first pixel based on the updated semantic segmentation result of the first pixel and the second semantic segmentation result of a second pixel matching the first pixel in the second image includes:

[0050] Determining a first confidence level of an updated semantic segmentation result of the first pixel, and determining a second confidence level of a second semantic segmentation result of the second pixel;

[0051] Determine a first smoothing coefficient between an updated semantic segmentation result of the first pixel and a second semantic segmentation result of the second pixel based on the first confidence level, the second confidence level, and a preset confidence threshold;

[0052] Based on the first smoothing coefficient, a smoothing process is performed between the updated semantic segmentation result of the first pixel and the second semantic segmentation result of the second pixel to obtain the second semantic segmentation result of the first pixel.

[0053] In an embodiment of the present disclosure, it is proposed that the updated semantic segmentation result of the first pixel point and the second semantic segmentation result of the second pixel point corresponding to the first pixel point can be smoothed according to the determined first smoothing coefficient, so that the semantic segmentation results of the pixel points at corresponding positions in two adjacent frames of images can be smoothly transitioned, thereby reducing visual jitter and improving user experience.

[0054] In a possible implementation, determining a first smoothing coefficient between an updated semantic segmentation result of the first pixel and a second semantic segmentation result of the second pixel based on the first confidence level, the second confidence level, and a preset confidence threshold includes:

[0055] When the first confidence level is greater than the preset confidence threshold, obtaining the first smoothing coefficient based on a preset second smoothing coefficient and the first confidence level;

[0056] When the first confidence level is less than the preset confidence threshold and the second confidence level is greater than the preset confidence threshold, obtaining the first smoothing coefficient based on the second smoothing coefficient and the second confidence level;

[0057] When the first confidence level and the second confidence level are both less than or equal to the preset confidence threshold, the first smoothing coefficient is determined to be a preset smoothing coefficient value.

[0058] In the embodiment of the present disclosure, by respectively comparing the relationship between the first confidence and the second confidence and the preset confidence threshold, a suitable first smoothing coefficient is selected, so that the updated semantic segmentation result of the first pixel point and the second semantic segmentation result of the second pixel point corresponding to the first pixel point can be adaptively smoothed.

[0059] In a possible implementation, the second semantic segmentation result of the first image includes a second probability value of each pixel in the first image belonging to each target category;

[0060] After determining a second semantic segmentation result of the first image, the method further includes:

[0061] According to the second probability value that each pixel point in the first image belongs to each target category, a target category area where pixels belonging to a specified target category are located is segmented from the first image.

[0062] In the disclosed embodiment, after obtaining the second semantic segmentation result with relatively high accuracy for the first image, the designated target category area of ​​interest to the user can be accurately segmented from the first image.

[0063] In a second aspect, an embodiment of the present disclosure provides a video processing device, including:

[0064] An acquisition module, used to acquire a real-time video stream; the real-time video stream includes a first image of a current frame and a second image of a previous frame;

[0065] A first determination module is used to determine a first semantic segmentation result of a target location area of ​​the first image, and to obtain a second semantic segmentation result of the second image;

[0066] The second determination module is used to determine a second semantic segmentation result of the first image based on the first semantic segmentation result and the second semantic segmentation result of the second image.

[0067] In a third aspect, an embodiment of the present disclosure provides an electronic device, comprising: a processor, a memory and a bus, wherein the memory stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor and the memory communicate via the bus, and when the machine-readable instructions are executed by the processor, the steps of the video processing method described in the first aspect are performed.

[0068] In a fourth aspect, an embodiment of the present disclosure provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the steps of the video processing method described in the first aspect are executed.

[0069] In order to make the above-mentioned objectives, features and advantages of the present disclosure more obvious and easy to understand, preferred embodiments are specifically cited below and described in detail with reference to the attached drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0070] In order to more clearly illustrate the technical solutions of the embodiments of the present disclosure, the following is a brief introduction to the drawings required for use in the embodiments. The drawings herein are incorporated into the specification and constitute a part of the specification. These drawings illustrate embodiments consistent with the present disclosure and are used together with the specification to illustrate the technical solutions of the present disclosure. It should be understood that the following drawings only illustrate certain embodiments of the present disclosure and should not be regarded as limiting the scope. For ordinary technicians in this field, other relevant drawings can also be obtained based on these drawings without creative work.

[0071] Figure 1 A flow chart of a video processing method provided by an embodiment of the present disclosure is shown;

[0072] Figure 2 A flow chart of a method for determining a first semantic segmentation result of a target position area of ​​a first image provided by an embodiment of the present disclosure is shown;

[0073] Figure 3 A flowchart of a method for specifically determining a first semantic segmentation result of a target position area of ​​a first image provided by an embodiment of the present disclosure is shown;

[0074] Figure 4 A schematic diagram of determining a region overlap rate provided by an embodiment of the present disclosure is shown;

[0075] Figure 5 A flow chart of a method for determining a second semantic segmentation result of a first image provided by an embodiment of the present disclosure is shown;

[0076] Figure 6 A flow chart of a method for determining a first semantic segmentation result of each first pixel point in a target position area of ​​a first image provided by an embodiment of the present disclosure is shown;

[0077] Figure 7 A schematic diagram of the structure of a video processing device provided by an embodiment of the present disclosure is shown;

[0078] Figure 8 A schematic diagram of an electronic device provided by an embodiment of the present disclosure is shown. DETAILED DESCRIPTION

[0079] In order to make the purpose, technical scheme and advantages of the embodiments of the present disclosure clearer, the technical scheme in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the drawings in the embodiments of the present disclosure. Obviously, the described embodiments are only part of the embodiments of the present disclosure, rather than all of the embodiments. The components of the embodiments of the present disclosure generally described and shown in the drawings here can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present disclosure provided in the drawings is not intended to limit the scope of the present disclosure for protection, but merely represents the selected embodiments of the present disclosure. Based on the embodiments of the present disclosure, all other embodiments obtained by those skilled in the art without making creative work belong to the scope of protection of the present disclosure.

[0080] It should be noted that similar reference numerals and letters denote similar items in the following drawings, and therefore, once an item is defined in one drawing, further definition and explanation thereof is not required in subsequent drawings.

[0081] The term "and / or" herein only describes an association relationship, indicating that three relationships may exist. For example, A and / or B may represent the following three situations: A exists alone, A and B exist at the same time, and B exists alone. In addition, the term "at least one" herein represents any combination of at least two of any one or more of a plurality of. For example, including at least one of A, B, and C may represent including any one or more elements selected from the set consisting of A, B, and C.

[0082] For semantic segmentation scenarios, a pre-trained image semantic segmentation model can generally be used to predict the categories corresponding to the pixels in a single frame image, determine the probability value of the pixel belonging to each preset category, and then determine the category of the pixel based on the probability value, that is, the semantic segmentation result corresponding to the pixel can be obtained.

[0083] In some scenarios, it is necessary to perform semantic recognition on images in real-time video streams to meet specific application requirements, such as changing the background area or blurring the background. This requires semantic segmentation of each frame in the real-time video stream to determine the background area. When semantic segmentation is performed on a single frame through an image semantic segmentation model, there will be certain errors. The accuracy of the segmentation results obtained when semantic segmentation is performed on details in different frames may be different. In this way, the semantic segmentation results of two adjacent frames in the video stream will be different. For example, the outline of the same target object in two adjacent frames is a straight line in one frame and a curve in the next frame, which causes visual jitter. Therefore, there is an urgent need to provide a semantic segmentation method for real-time video streams.

[0084] Based on the above research, the present disclosure provides a video processing method. Taking into account that the acquisition time interval between two adjacent frames of images in a video stream is short, the same segmentation target exists between the two adjacent frames of images. In this way, when determining the second semantic segmentation result of the current frame, it can be determined in combination with the second semantic segmentation result of the previous frame of image, thereby improving the temporal and spatial stability of the two adjacent frames of images, reducing the problem of inter-frame jitter caused by the prediction error of the target category, and achieving the effect of optimizing the visual effect.

[0085] To facilitate understanding of the present embodiment, a video processing method disclosed in the embodiment of the present disclosure is first introduced in detail. The execution subject of the video processing method provided in the embodiment of the present disclosure is generally a computer device with certain computing capabilities, and the computer device includes, for example: a terminal device or a server or other processing device, and the terminal device can be a user equipment (UE), a mobile device, a user terminal, a handheld device, a computing device, a vehicle-mounted device, etc. In some possible implementations, the video processing method can be implemented by a processor calling a computer-readable instruction stored in a memory.

[0086] See also Figure 1 FIG. 1 is a flowchart of a video processing method provided by an embodiment of the present disclosure. The video processing method includes the following S101 to S103:

[0087] S101, obtaining a real-time video stream; the real-time video stream includes a first image of a current frame and a second image of a previous frame.

[0088] Exemplarily, the real-time video stream may include video streams in various application scenarios, such as a real-time video stream in a live broadcast scenario or a real-time video stream in an online conference, which is not specifically limited here.

[0089] Exemplarily, the real-time video stream includes images captured at set time intervals, and the first image of the current frame and the second image of the previous frame are two frames of images captured at adjacent time points.

[0090] S102, determining a first semantic segmentation result of a target position area of ​​a first image, and obtaining a second semantic segmentation result of a second image.

[0091] Exemplarily, the target position region of the first image may refer to a partial position region in the first image, or may refer to a complete position region in the first image.

[0092] Exemplarily, when the target position region of the first image belongs to the complete position region of the first image, the first image can be input into a pre-trained target neural network for semantic segmentation to obtain a first semantic segmentation result of the target position region of the first image; when the target position region of the first image is a partial position region in the first image, the target position region of the first image can be input into a pre-trained target neural network for semantic segmentation to obtain a first semantic segmentation result of the target position region of the first image.

[0093] Exemplarily, the first semantic segmentation result is obtained by predicting a single frame image based on a pre-trained target neural network for semantic segmentation. Considering that the target neural network is trained based on a single frame image, when the target neural network predicts images in real-time video streams, it is easy for the prediction accuracy problem to cause pixels that originally belonged to the same target category between adjacent frame images to be predicted as different target categories, which causes jitter between adjacent images and causes incoherent semantic segmentation results. Therefore, the first semantic segmentation result needs to be adjusted subsequently to obtain a second semantic segmentation result with higher accuracy.

[0094] Exemplarily, the second semantic segmentation result of the second image can be predetermined. When the second image is not the first frame image in the video stream, the determination method is the same as the method of determining the second semantic segmentation result of the first image. This article focuses on the process of determining the second semantic segmentation result of the first image. When the second image is the first frame image in the video stream, it can be determined by a pre-trained target neural network for semantic segmentation, which is not described in detail here.

[0095] Exemplarily, the first semantic segmentation result of the target position area of ​​the first image can be represented by a first probability value that the first pixel point in the target position area of ​​the first image belongs to the target category. The target category can be at least one pre-set category. For example, a frame of image can include a foreground category that the user is concerned about and a background category that the user is not concerned about. The target category here can include a foreground category and a background category. The first probability value of the first pixel point belonging to the target category can include a first probability value belonging to the foreground category and a first probability value belonging to the background category.

[0096] S103: Determine a second semantic segmentation result of the first image based on the first semantic segmentation result and the second semantic segmentation result of the second image.

[0097] Exemplarily, when the target position area of ​​the first image is a partial area in the first image, the second semantic segmentation result of the second image here may also be the second semantic segmentation result of the partial area in the second image. The partial area in the second image and the target position area of ​​the first image have the same position area in the same coordinate system. Because the second image and the first image have the same size, a pixel coordinate system can be established for each frame of the image. In two adjacent frames of images, the probability of having the same semantic segmentation results for areas with the same position range in the pixel coordinate system is high. Therefore, the second semantic segmentation result of the partial area in the second image that is the same as the target position area of ​​the first image in the same coordinate system can be selected here to determine the second semantic segmentation result of the first image.

[0098] In the disclosed embodiment, taking into account that the acquisition time interval between two adjacent frames of images in a video stream is short, the same segmentation target exists between the two adjacent frames of images. In this way, when determining the second semantic segmentation result of the current frame, it can be determined in combination with the second semantic segmentation result of the previous frame of image, thereby improving the spatiotemporal stability of the two adjacent frames of images and reducing the problem of inter-frame jitter caused by the prediction error of the target category, so as to achieve the effect of optimizing the visual effect.

[0099] Taking into account that in real-time video streams, the areas of segmentation targets to be semantically segmented in different frame images are constantly changing, and the pre-trained target neural network for semantic segmentation may need to process segmentation targets of different size ratios at the same time, and the training data of the target neural network are mostly images whose segmentation target ratios meet preset requirements. For example, the preset requirement may be that the segmentation target ratio is greater than or equal to a preset ratio. Therefore, when the target neural network predicts an image with a small segmentation target ratio, there will be boundary jagged edges, missing foreground gaps, and the like. Therefore, the disclosed embodiment proposes that it is possible to screen the areas whose segmentation target size ratios meet the requirements in the images in the real-time video stream.

[0100] Exemplarily, the segmentation target refers to a target that needs to be semantically segmented, such as the foreground that the user is paying attention to. For example, if a vehicle is identified in a video stream related to a road scene, the segmentation target is a vehicle; if a pedestrian is identified in a video stream related to a road scene, the segmentation target is a pedestrian. The proportion of the segmentation target refers to the ratio of the size of the segmentation target to the size of the image where the segmentation target is located. The following will describe in detail how to screen areas where the size proportion of the segmentation target meets the requirements.

[0101] With respect to the above S102, when the target position region of the first image is a partial region of the first image, when determining the first semantic segmentation result of the target position region of the first image, such as Figure 2 As shown, the following S201 to S203 may be included:

[0102] S201, obtaining a position range of a target position area of ​​a second image, and intercepting an initial position area matching the position range of the target position area of ​​the second image from a first image.

[0103] Exemplarily, the target position area can be an area where the proportion of the segmented target meets preset requirements. When the second image is a non-first frame image of the real-time video stream, the method for determining the target position area of ​​the second image is the same as the method for determining the target position area of ​​the first image below, and will not be repeated here.

[0104] In the case where the second image is the first frame image of the real-time video stream, the target position area of ​​the second image may be determined according to the following method, which specifically includes the following S2011 to S2013:

[0105] S2011, performing category prediction on each pixel point in the second image through a target neural network to determine a second probability value that each pixel point in the second image belongs to the target category.

[0106] Exemplarily, taking the binary classification prediction of an image in a video stream as an example, to determine which pixels in the image in the video stream belong to the foreground and which pixels belong to the background, the second image can be input into the target neural network for category prediction to obtain a second probability value for each pixel in the second image belonging to the foreground and a second probability value for each pixel belonging to the background.

[0107] S2012: Determine label information for indicating a target category corresponding to each pixel in the second image according to the second probability value corresponding to each pixel in the second image.

[0108] Exemplarily, the label information can be represented in the form of a one-hot vector, where the dimension of the one-hot vector is the same as the number of target categories in the image. For example, there are two target categories in total, namely, foreground category and background category. The one-hot vector here is a two-dimensional vector, and each dimension corresponds to a target category. Specifically, the correspondence between the dimensions and the target categories in the one-hot vector can be preset. For example, in the one-hot vector, the first dimension corresponds to the foreground category, and the second dimension corresponds to the background category. The foreground label information and the background label information can be preset. For example, the foreground label information is represented by [1 0] for the foreground category, and by [0 1] for the background category.

[0109] Exemplarily, in the process of determining the label information corresponding to one of the pixels for indicating the target category, if the second probability value of the pixel belonging to the foreground is greater than the second probability value of the pixel belonging to the background, the label information corresponding to the pixel is used to indicate the foreground, which can be expressed by [1 0]; otherwise, the label information corresponding to the pixel is used to indicate the background, which can be expressed by [0 1].

[0110] S2013: Obtain a target position region of the second image based on the label information corresponding to each pixel point in the second image and the pre-selected label information.

[0111] Exemplarily, the pre-selected label information specifically refers to label information used to select the segmentation target. For example, if the segmentation target is the foreground, the pre-selected label information here is [1 0]. In this way, the external detection frame of the largest connected area composed of label information that is the same as the pre-selected label information can be selected from the label information corresponding to the pixel points in the previous frame image through a connected domain search, as the target position area of ​​the second image. In this way, an area where the segmentation target ratio meets the requirements can be selected, such as an area where the segmentation target ratio is greater than the set ratio.

[0112] Exemplarily, the target position area is a rectangular detection frame. After obtaining the target position area of ​​the second image, the initial position area matching the position range can be intercepted in the pixel coordinate system corresponding to the first image based on the position range of the rectangular detection frame in the pixel coordinate system of the second image.

[0113] S202, determining an initial semantic segmentation result of an initial position area in the first image.

[0114] Exemplarily, the initial position area captured from the first image can be input into the target neural network for category prediction to obtain the initial probability value of each pixel in the initial position area in the first image belonging to the target category, such as the initial probability value belonging to the foreground and the initial probability value belonging to the background mentioned above.

[0115] S203, determining a first semantic segmentation result of the target position area of ​​the first image based on the position range of the target position area of ​​the second image, the position range of the initial position area in the first image, and the initial semantic segmentation result.

[0116] For example, considering that the relative position of the segmentation target in the first image may be offset compared to the segmentation target in the second image, for example, the foreground area in the first image is located in the center-left area of ​​the first image, while the foreground area in the second image is located in the center-right area of ​​the second image, in the event of an offset, if the offset is severe, if the initial position area of ​​the first image is directly used as the target position area, an accurate second semantic segmentation result of the first image may not be obtained. Therefore, it is necessary to determine whether it is necessary to re-acquire the updated position area of ​​the first image based on the initial semantic segmentation result of the initial position area in the first image, and finally obtain the target position area of ​​the first image and the first semantic segmentation result of the target position area.

[0117] Specifically, for S203, when determining the first semantic segmentation result of the target position area of ​​the first image based on the position range of the target position area of ​​the second image, the position range of the initial position area in the first image, and the initial semantic segmentation result, as follows: Figure 3 As shown, the following S301 to S304 may be included:

[0118] S301, obtaining an initial semantic segmentation result of the first image based on an initial semantic segmentation result of the initial position region and second semantic segmentation results corresponding to other position regions of the first image except the initial position region in the second image.

[0119] Exemplarily, after obtaining the initial semantic segmentation result of the initial position area, the initial position area can be pasted back to the first image, and then the initial semantic segmentation result of the initial position area and the second semantic segmentation results corresponding to other position areas outside the initial position area in the second image are used as the initial semantic segmentation results of the first image.

[0120] S302: Determine an update position area of ​​the first image based on an initial semantic segmentation result of the first image.

[0121] Exemplarily, the process of generating the update region according to the initial semantic segmentation result of the first image is similar to the above-mentioned method of obtaining the target position region corresponding to the first frame image, and will not be repeated here.

[0122] Specifically, with respect to S302, when determining the update position area of ​​the first image based on the initial semantic segmentation result of the first image, the following S3021 to S3022 are included:

[0123] S3021, determining label information corresponding to each pixel in the first image according to the initial semantic segmentation results corresponding to each pixel in the first image; the label information is used to indicate the target category to which the pixel belongs;

[0124] Exemplarily, the initial semantic segmentation result includes initial probability values ​​of each pixel belonging to each target category, such as the initial probability values ​​of each pixel belonging to the foreground and the initial probability values ​​of each pixel belonging to the background mentioned above.

[0125] Specifically, when determining the label information corresponding to each pixel point in the first image according to the initial semantic segmentation results corresponding to each pixel point in the first image, the following steps S30211 to S30212 are included:

[0126] S30211, for each pixel in the first image, selecting a maximum initial probability value from initial probability values ​​of the pixel belonging to each category;

[0127] S30212, taking the target category corresponding to the maximum initial probability value as the label information corresponding to the pixel point.

[0128] The specific process is detailed in the above-mentioned process of determining the label information corresponding to each pixel point in the second image when the second image is the first frame image, and will not be repeated here.

[0129] By filtering the label information of the target category indicated by the maximum initial probability value as the label information corresponding to the pixel point, label information with higher accuracy corresponding to the pixel point can be obtained, thereby facilitating the preparation for the subsequent generation of an updated position area with higher accuracy based on the label information with higher accuracy.

[0130] S3022: Determine an update position area from the first image based on the label information and pre-selected label information respectively corresponding to each pixel point in the first image.

[0131] Among them, after the initial position area is pasted back to the first image, each pixel point in the first image includes each pixel point in the initial position area and each pixel point in other position areas outside the initial position area. Therefore, the label information of each pixel point in the first image includes the label information of each pixel point in the initial position area and the label information of each pixel point in other position areas outside the initial position area.

[0132] Further, the update position area corresponding to the first image can be determined according to the process of determining the target position area of ​​the second image when the second image is the first frame image mentioned above, which will not be repeated here.

[0133] In the disclosed embodiment, it is proposed that an updated position area with a high matching degree with the first image of the current frame can be obtained based on the initial semantic segmentation result of the first image.

[0134] S303 : Determine the target position area of ​​the first image based on the position range of the target position area of ​​the second image and the position range of the update position area of ​​the first image.

[0135] For example, considering that in the images captured by the real-time video stream, the capture time interval between two adjacent frames is short, and therefore the position change of the segmented target may be small, in order to maintain the consistency of the semantic segmentation results between two adjacent frames of the real-time video stream, in general, when the area overlap rate between the target position area and the update position area of ​​the second image meets certain requirements, the initial position area determined based on the target position area of ​​the second image can be used as the target position area of ​​the first image; otherwise, the initial position area needs to be updated based on the update position area to obtain the target position area of ​​the first image.

[0136] S304 , selecting an initial semantic segmentation result corresponding to the target position region of the first image from the initial semantic segmentation results of the first image as a first semantic segmentation result of the target position region of the first image.

[0137] In the disclosed embodiment, taking into account that the target position area in the first image may be shifted compared to the second image, such as the foreground area, after obtaining the initial position area, the initial semantic segmentation result of the initial position area and the second semantic segmentation result of the position area outside the initial position area in the second image are combined to obtain the updated position area of ​​the first image. Further, it is possible to determine whether the target position area of ​​the first image has a large shift based on the updated position area and the target position area of ​​the second image, thereby obtaining an accurate target position area of ​​the first image and a first semantic segmentation result of the target position area.

[0138] Specifically, with respect to the above S303, when determining the target position area of ​​the first image based on the position range of the target position area of ​​the second image and the position range of the update position area of ​​the first image, the following S3031 to S3032 are included:

[0139] S3031, determining an area overlap ratio between a position range of a target position area of ​​the second image and a position range of an update position area in the first image.

[0140] Exemplarily, the target position region and the update position region of the second image are both rectangular detection frames, and the region overlap rate can be determined by the overlap area of ​​the two rectangular detection frames in the same frame image.

[0141] Specifically, when determining the area overlap rate of the position range of the target position area of ​​the second image and the position range of the update position area in the first image, the following steps S30311 to S30312 are included:

[0142] S30311, obtaining an intersection area and a union area of ​​a target position area and an update position area of ​​the second image in the first image;

[0143] S30312: The ratio of the intersection area to the union area is used as the region overlap ratio.

[0144] For example, Figure 4 As shown, the target position area of ​​the second image can be represented by a rectangular detection box ABCD, and the update position area can be represented by a rectangular detection box EFGH, where the intersection area of ​​the rectangular detection box ABCD and the rectangular detection box EFGH is shown as Figure 4 The area of ​​the rectangular box MBNH, the union area of ​​the rectangular detection box ABCD and the rectangular detection box EFGH are as follows Figure 4 The area of ​​polygon AMEFGNCD.

[0145] Furthermore, after the intersection area and the union area are obtained, the ratio of the intersection area to the union area is used as the region overlap rate.

[0146] In the disclosed embodiment, the area overlap rate of the first target location area and the update location area can be quickly determined through the intersection area and the union area between the first target location area and the update location area.

[0147] S3032: When the area overlap rate is less than the set overlap rate threshold, the updated position area is used as the target position area of ​​the first image.

[0148] S3033: When the region overlap rate is greater than or equal to the set overlap rate threshold, the initial position region of the first image is used as the target position region of the first image.

[0149] Exemplarily, an overlap rate threshold can be set in advance based on big data statistics. When the regional overlap rate is less than the set overlap rate threshold, it means that the position range of the segmentation target in the first image has changed significantly compared to the position range in the second image. Therefore, it is necessary to use the updated position area as the target position area of ​​the first image for subsequent processing. Conversely, when the regional overlap rate is greater than or equal to the set overlap rate threshold, the initial position area determined based on the target position area of ​​the second image can be directly used as the target position area of ​​the first image to maintain the consistency of the segmentation results in the video stream.

[0150] In the disclosed embodiment, it is proposed to determine the target position area of ​​the first image based on the area overlap rate of the target position area of ​​the second image and the update position area in the first image. On the one hand, when the position of the segmentation target in the video stream changes greatly, a target position area with a relatively appropriate size in the first image can be obtained. On the other hand, when the position of the segmentation target in the video stream changes little, by maintaining the position range corresponding to the target position area of ​​the previous frame image, the consistency of the segmentation result in the video stream can be improved while maintaining a relatively appropriate size.

[0151] In one embodiment, with respect to the above S103, when determining the second semantic segmentation result of the first image based on the first semantic segmentation result and the second semantic segmentation result of the second image, as follows: Figure 5 As shown, it includes the following S401~S402:

[0152] S401, determining a second semantic segmentation result of a target position area of ​​the first image based on the first semantic segmentation result and the second semantic segmentation result of the second image.

[0153] S402 , obtaining a second semantic segmentation result of the first image based on the second semantic segmentation result of the target position region in the first image and the second semantic segmentation result of the reference position region in the second image.

[0154] The reference position area is a position area that matches a position area other than the target position area of ​​the first image.

[0155] Exemplarily, the first semantic segmentation result of the target position area of ​​the first image includes the first semantic segmentation results corresponding to each first pixel point in the target position area of ​​the first image, and the second semantic segmentation result of the second image includes the second semantic segmentation results corresponding to each pixel point in the second image. When determining the second semantic segmentation result of the first image, second pixel points having the same position coordinates as the first pixel points in the target position area of ​​the first image in the same pixel coordinate system can be extracted from the second image, and then the second semantic segmentation result of the target position area of ​​the first image can be obtained based on the first semantic segmentation result of each first pixel point and the second semantic segmentation result of the second pixel point having the same position coordinates as the first pixel points.

[0156] Exemplarily, after obtaining the second semantic segmentation result of the target position area of ​​the first image, the target position area of ​​the first image can be pasted back into the first image, and then the second semantic segmentation result of the target position area of ​​the first image and the corresponding second semantic segmentation results of other position areas outside the target position area in the second image are used as the second semantic segmentation result of the first image.

[0157] In the embodiment of the present disclosure, after obtaining the second semantic segmentation result of the target position area in the first image, the second semantic segmentation result of the position area in the second image of the previous frame that matches the position area outside the target position area of ​​the first image can be combined to accurately and quickly obtain the second semantic segmentation result of the first image, providing support for video processing of subsequent frames.

[0158] In one embodiment, with respect to the above S401, when determining the second semantic segmentation result of the target position area of ​​the first image based on the first semantic segmentation result and the second semantic segmentation result of the second image, such as Figure 6 As shown, it includes the following S501~S502:

[0159] S501, for any first pixel point in the target position area of ​​the first image, determine an updated semantic segmentation result of the first pixel point according to the first semantic segmentation result of the first pixel point and the first semantic segmentation results corresponding to other pixels within a preset range of the first pixel point interval.

[0160] Exemplarily, considering that there are some pixels whose color features, brightness features and texture features change dramatically compared with other surrounding pixels, especially the pixels at the boundary positions, the accuracy of the semantic segmentation results of these pixels obtained using the target neural network is not high. Therefore, it is proposed here that for any first pixel, the first semantic segmentation result corresponding to the first pixel point and the first semantic segmentation results corresponding to other pixels within a preset range of the first pixel point can be used to update the first semantic segmentation result of the first pixel point to obtain an updated semantic segmentation result of the first pixel point.

[0161] S502: Determine a second semantic segmentation result of the first pixel based on the updated semantic segmentation result of the first pixel and a second semantic segmentation result of a second pixel matching the first pixel in the second image.

[0162] Exemplarily, the second pixel point that matches the first pixel point refers to the second pixel point with the same position coordinates as the first pixel point in the same pixel coordinate system. The same pixel coordinate system can be established for the first image and the second image, so that it is possible to determine whether two pixel points are matching pixel points based on the pixel coordinate values ​​of the pixel points. For example, taking the first pixel point with position coordinates (m, n) in the first image as an example, the second pixel point corresponding to the first pixel point is the pixel point with position coordinates (m, n) in the second image.

[0163] Exemplarily, considering that the interval time between two adjacent frames of images is short, the probability that two pixels located at the same position coordinates in adjacent images belong to the same target category is high. Therefore, for each first pixel, the second semantic segmentation result of the first pixel can be determined by the updated semantic segmentation result corresponding to the first pixel and the second semantic segmentation result of the second pixel matching the first pixel in the second image.

[0164] In the disclosed embodiment, it is proposed that, for any first pixel point in the target position area in the first image, the first semantic segmentation result of the first pixel point can be updated according to the first semantic segmentation result corresponding to the first pixel point and the first semantic segmentation results of other pixels within a preset range of intervals from the first pixel point, so that an updated semantic segmentation result with higher accuracy can be obtained.

[0165] Specifically, with respect to the above S502, when determining the second semantic segmentation result of the first pixel based on the updated semantic segmentation result of the first pixel and the second semantic segmentation result of the second pixel matching the first pixel in the second image, the following S5021 to S5023 are included:

[0166] S5021, determining a first confidence level of an updated semantic segmentation result of a first pixel, and determining a second confidence level of a second semantic segmentation result of a second pixel.

[0167] For example, the first confidence level of the updated semantic segmentation result of the first pixel can represent the reliability of the updated semantic segmentation result of the first pixel, and the second confidence level of the second semantic segmentation result of the second pixel can represent the reliability of the second semantic segmentation result of the second pixel. Specifically, the confidence level of the probability value of the pixel belonging to the target category can be determined according to the following formula (1):

[0168] C = |p-0.5|+0.5 (1);

[0169] Among them, C represents confidence, p represents the semantic segmentation result of the pixel point, which can be expressed by the probability value belonging to the target category. When p is the updated semantic segmentation result of the first pixel point, C represents the first confidence of the updated semantic segmentation result of the first pixel point; when p is the second semantic segmentation result of the second pixel point, C represents the second confidence of the second semantic segmentation result of the second pixel point.

[0170] For example, when the probability value of a pixel belonging to the foreground is 0.4, according to the above formula (1), the confidence level corresponding to the probability value is determined to be 0.6, and it can be considered that the accuracy of the probability value of the pixel belonging to the foreground is average; when the probability value of a pixel belonging to the foreground is 0.05, according to the above formula (1), the confidence level corresponding to the probability value is determined to be 0.95, and it can be considered that the accuracy of the probability value of the pixel belonging to the foreground is high, that is, the conclusion that the pixel does not belong to the foreground reflected by the probability value is highly credible.

[0171] S5022: Determine a first smoothing coefficient between an updated semantic segmentation result of a first pixel and a second semantic segmentation result of a second pixel based on the first confidence level, the second confidence level, and a preset confidence threshold.

[0172] Exemplarily, the preset confidence threshold can be set based on experience, and is used to judge the accuracy of the updated semantic segmentation result of the first pixel point in combination with the first confidence; and is used to judge the accuracy of the second semantic segmentation result of the second pixel point in combination with the second confidence, thereby further providing a basis for determining the first smoothing coefficient.

[0173] For example, if the first confidence is greater than the preset confidence threshold, it may indicate that the reliability of the updated semantic segmentation result of the first pixel is higher, otherwise it may indicate that the reliability of the updated semantic segmentation result of the first pixel is lower; if the second confidence is greater than the preset confidence threshold, it may indicate that the reliability of the second semantic segmentation result of the second pixel is higher, otherwise it may indicate that the reliability of the second semantic segmentation result of the second pixel is lower.

[0174] S5023: Based on the first smoothing coefficient, smooth the updated semantic segmentation result of the first pixel and the second semantic segmentation result of the second pixel to obtain the second semantic segmentation result of the first pixel.

[0175] For example, when the semantic segmentation result is represented by the probability value of the pixel belonging to the target category, the second probability value of the first pixel with the position coordinate (i, j) in the first image belonging to the target category can be determined according to the following formula (2):

[0176] P 2(i,j) =P 1(i,j) ×(1-s)+p 2(i,j) ×s (2);

[0177] Among them, p 2(i,j) represents the updated probability value of the first pixel with the position coordinate (i, j) in the first image belonging to the target category; p 1(i,j) represents the second probability value that the second pixel belongs to the target category; P 2(i,j) The second probability value indicating that the first pixel point with the position coordinates (i, j) belongs to the target category; s indicates the first smoothing coefficient.

[0178] In an embodiment of the present disclosure, it is proposed that the updated semantic segmentation result of the first pixel point and the second semantic segmentation result of the second pixel point corresponding to the first pixel point can be smoothed according to the determined first smoothing coefficient, so that the semantic segmentation results of the pixel points at corresponding positions in two adjacent frames of images can be smoothly transitioned, thereby reducing visual jitter and improving user experience.

[0179] Specifically, when determining a first smoothing coefficient between an updated semantic segmentation result of a first pixel and a second semantic segmentation result of a second pixel based on a first confidence level, a second confidence level, and a preset confidence threshold, the following steps S50221 to S50223 are included:

[0180] S50221: When the first confidence level is greater than a preset confidence threshold, obtain a first smoothing coefficient based on a preset second smoothing coefficient and the first confidence level.

[0181] Exemplarily, in the process of smoothing the updated probability value corresponding to the first pixel point and the second probability value that the second pixel point corresponding to the first pixel point belongs to the target category by using the first smoothing coefficient in the above manner, the first smoothing coefficient can be used as the weight of the updated probability value corresponding to the first pixel point.

[0182] If the first confidence level is greater than a preset confidence threshold and is relatively large, if the first confidence level is directly used as the first smoothing coefficient, then the second probability value of the first pixel point belonging to the target category obtained after smoothing by the above formula (2) will be overly dependent on the first probability value corresponding to the first pixel point, resulting in poor smoothing effect. Therefore, the second smoothing coefficient is introduced here to adjust the first smoothing coefficient.

[0183] Specifically, the first smoothing coefficient can be determined according to the following formula (3):

[0184] s=C 1 ×d (3);

[0185] Among them, C 1 represents the first confidence level; d represents the second smoothing coefficient.

[0186] S50222: When the first confidence level is less than a preset confidence threshold and the second confidence level is greater than the preset confidence threshold, obtain a first smoothing coefficient based on the second smoothing coefficient and the second confidence level.

[0187] Similarly, when the first confidence is less than the preset confidence threshold and the second confidence is greater than the preset confidence threshold, if the second confidence is large, in order to suppress the result after smoothing from being overly dependent on the second probability value that the second pixel belongs to the target category, resulting in poor smoothing effect, a second smoothing coefficient is also introduced here to adjust the first smoothing coefficient. The first smoothing coefficient can be determined according to the following formula (4):

[0188] s=1-d×C 2 (4);

[0189] Among them, C 2 represents the second confidence level; d represents the second smoothing coefficient.

[0190] S50222: When the first confidence level and the second confidence level are both less than or equal to a preset confidence threshold, determine that the first smoothing coefficient is a preset value.

[0191] Exemplarily, in the case that does not belong to S50221 and S50222, that is, when the first confidence and the second confidence are both less than or equal to the preset confidence threshold, there is no need to introduce the second smoothing coefficient for suppression, and the first smoothing coefficient can be directly set to 0.5.

[0192] Illustratively, the above S50221 to S50223 are not limited in order during execution.

[0193] In the embodiment of the present disclosure, by respectively comparing the relationship between the first confidence and the second confidence and the preset confidence threshold, a suitable first smoothing coefficient is selected, so that the updated semantic segmentation result of the first pixel point and the second semantic segmentation result of the second pixel point corresponding to the first pixel point can be adaptively smoothed.

[0194] In a possible implementation, the second semantic segmentation result of the first image includes second probability values ​​of each first pixel in the first image belonging to each target category;

[0195] After determining the second semantic segmentation result of the first image, the video processing method further includes:

[0196] According to the second probability value that each pixel point in the first image belongs to each target category, a target category region where the pixel points belonging to the specified target category are located is segmented from the first image.

[0197] Exemplarily, the category information corresponding to each pixel in the first image can be determined based on the second probability value that each pixel in the first image belongs to each target category, and then the target category area where the pixel points of the specified target category are located can be segmented in the first image, such as the foreground area.

[0198] In the disclosed embodiment, after obtaining the second semantic segmentation result with relatively high accuracy for the first image, the designated target category area of ​​interest to the user can be accurately segmented from the first image.

[0199] Those skilled in the art will appreciate that, in the above method of specific implementation, the order in which the steps are written does not imply a strict execution order and does not constitute any limitation on the implementation process. The specific execution order of the steps should be determined by their functions and possible internal logic.

[0200] Based on the same technical concept, a video processing device corresponding to the video processing method is also provided in the embodiment of the present disclosure. Since the principle of solving the problem by the device in the embodiment of the present disclosure is similar to the above-mentioned video processing method in the embodiment of the present disclosure, the implementation of the device can refer to the implementation of the method, and the repeated parts will not be repeated.

[0201] Reference Figure 7 FIG. 6 is a schematic diagram of a video processing device 600 provided in an embodiment of the present disclosure, and the video processing device includes:

[0202] The acquisition module 601 acquires a real-time video stream; the real-time video stream includes a first image of a current frame and a second image of a previous frame;

[0203] A first determination module 602 determines a first semantic segmentation result of a target location area of ​​a first image, and obtains a second semantic segmentation result of a second image;

[0204] The second determination module 603 determines a second semantic segmentation result of the first image based on the first semantic segmentation result and the second semantic segmentation result of the second image.

[0205] In a possible implementation, when the first determination module 602 is used to determine a first semantic segmentation result of a target position area of ​​a first image, the first determination module 602 includes:

[0206] Acquire the position range of the target position area of ​​the second image, and intercept an initial position area matching the position range of the target position area of ​​the second image from the first image;

[0207] Determine an initial semantic segmentation result of the initial position area in the first image;

[0208] Based on the position range of the target position area of ​​the second image, the position range of the initial position area in the first image, and the initial semantic segmentation result, a first semantic segmentation result of the target position area of ​​the first image is determined.

[0209] In a possible implementation, the first determination module 602, when used to determine a first semantic segmentation result of the target position area of ​​the first image based on the position range of the target position area of ​​the second image, the position range of the initial position area in the first image, and the initial semantic segmentation result, includes:

[0210] Obtaining an initial semantic segmentation result of the first image based on an initial semantic segmentation result of the initial position region and second semantic segmentation results corresponding to other position regions of the first image except the initial position region in the second image;

[0211] Determining an updated position region of the first image based on an initial semantic segmentation result of the first image;

[0212] Determine the target position area of ​​the first image based on the position range of the target position area of ​​the second image and the position range of the update position area of ​​the first image;

[0213] An initial semantic segmentation result corresponding to the target position region of the first image is selected from the initial semantic segmentation results of the first image as a first semantic segmentation result of the target position region of the first image.

[0214] In a possible implementation, the first determining module 602 determines the update position area of ​​the first image based on the initial semantic segmentation result of the first image, including:

[0215] Determine, according to the initial semantic segmentation results corresponding to the pixels in the first image, label information corresponding to the pixels in the first image; the label information is used to indicate the target category to which the pixels belong;

[0216] Based on the label information and the pre-selected label information respectively corresponding to each pixel point in the first image, an update position area is determined from the first image.

[0217] In a possible implementation, the first determining module 602 is configured to determine the target position area of ​​the first image based on the position range of the target position area of ​​the second image and the position range of the update position area of ​​the first image, including:

[0218] Determine the area overlap ratio of the position range of the target position area of ​​the second image and the position range of the update position area in the first image;

[0219] When the area overlap rate is less than the set overlap rate threshold, the updated position area is used as the target position area of ​​the first image;

[0220] When the area overlap rate is greater than or equal to the set overlap rate threshold, the initial position area of ​​the first image is used as the target position area of ​​the first image.

[0221] In a possible implementation manner, when the first determination module 602 is used to determine the position range of the target position area of ​​the second image and the area overlap rate of the position range of the update position area in the first image, the first determination module 602 includes:

[0222] Obtaining the intersection area and union area of ​​the target position area and the update position area of ​​the second image in the first image;

[0223] The ratio of the intersection area to the union area is taken as the region overlap rate.

[0224] In a possible implementation, the initial semantic segmentation result includes initial probability values ​​of the pixels belonging to each target category;

[0225] The first determination module 602, when used to determine the label information corresponding to each pixel point in the first image according to the initial semantic segmentation results corresponding to each pixel point in the first image, includes:

[0226] For each pixel in the first image, a maximum initial probability value is selected from the initial probability values ​​of the pixel belonging to each category;

[0227] The target category corresponding to the maximum initial probability value is used as the label information corresponding to the pixel.

[0228] In a possible implementation, the second determination module 603, when used to determine the second semantic segmentation result of the first image based on the first semantic segmentation result and the second semantic segmentation result of the second image, includes:

[0229] Determine a second semantic segmentation result of the target position area of ​​the first image based on the first semantic segmentation result and the second semantic segmentation result of the second image;

[0230] Obtaining a second semantic segmentation result of the first image based on a second semantic segmentation result of the target position area in the first image and a second semantic segmentation result of the reference position area in the second image;

[0231] The reference position area is a position area that matches a position area other than the target position area of ​​the first image.

[0232] In a possible implementation, the second determination module 603 determines the second semantic segmentation result of the target position area of ​​the first image based on the first semantic segmentation result and the second semantic segmentation result of the second image, including:

[0233] For any first pixel point in the target position area of ​​the first image, determine an updated semantic segmentation result of the first pixel point according to the first semantic segmentation result of the first pixel point and the first semantic segmentation results of other pixels points within a preset position range from the first pixel point;

[0234] Based on the updated semantic segmentation result of the first pixel and the second semantic segmentation result of a second pixel matching the first pixel in the second image, a second semantic segmentation result of the first pixel is determined.

[0235] In a possible implementation, the second determination module 603, when used to determine the second semantic segmentation result of the first pixel based on the updated semantic segmentation result of the first pixel and the second semantic segmentation result of the second pixel matching the first pixel in the second image, includes:

[0236] Determining a first confidence level of an updated semantic segmentation result of a first pixel, and determining a second confidence level of a second semantic segmentation result of a second pixel;

[0237] Determine a first smoothing coefficient between an updated semantic segmentation result of the first pixel and a second semantic segmentation result of the second pixel based on the first confidence level, the second confidence level, and a preset confidence threshold;

[0238] Based on the first smoothing coefficient, a smoothing process is performed between the updated semantic segmentation result of the first pixel and the second semantic segmentation result of the second pixel to obtain the second semantic segmentation result of the first pixel.

[0239] In a possible implementation, the second determination module 603 is used to determine a first smoothing coefficient between an updated semantic segmentation result of a first pixel and a second semantic segmentation result of a second pixel based on the first confidence, the second confidence, and a preset confidence threshold, including:

[0240] When the first confidence level is greater than a preset confidence threshold, obtaining a first smoothing coefficient based on a preset second smoothing coefficient and the first confidence level;

[0241] When the first confidence level is less than a preset confidence threshold and the second confidence level is greater than the preset confidence threshold, obtaining a first smoothing coefficient based on the second smoothing coefficient and the second confidence level;

[0242] When the first confidence level and the second confidence level are both less than or equal to a preset confidence threshold, the first smoothing coefficient is determined to be a preset smoothing coefficient value.

[0243] In a possible implementation, the second semantic segmentation result of the first image includes a second probability value of each pixel in the first image belonging to each target category;

[0244] After determining the second semantic segmentation result of the first image, the second determination module 603 is further used to:

[0245] According to the second probability value that each pixel point in the first image belongs to each target category, a target category region where the pixel points belonging to the specified target category are located is segmented from the first image.

[0246] For descriptions of the processing flow of each module in the device and the interaction flow between each module, reference may be made to the relevant descriptions in the above method embodiment, which will not be described in detail here.

[0247] Corresponds to Figure 1 The video processing method in the present disclosure also provides an electronic device 700, such as Figure 8 FIG. 7 is a schematic diagram of the structure of an electronic device 700 provided in an embodiment of the present disclosure, including:

[0248] Processor 71, memory 72, and bus 73; memory 72 is used to store execution instructions, including internal memory 721 and external memory 722; the internal memory 721 here is also called internal memory, which is used to temporarily store the calculation data in the processor 71, as well as the data exchanged with the external memory 722 such as a hard disk. The processor 71 exchanges data with the external memory 722 through the internal memory 721. When the electronic device 700 is running, the processor 71 and the memory 72 communicate through the bus 73, so that the processor 71 executes the following instructions: obtain a real-time video stream; the real-time video stream includes a first image of the current frame and a second image of the previous frame; determine a first semantic segmentation result of the target position area of ​​the first image, and obtain a second semantic segmentation result of the second image; based on the first semantic segmentation result and the second semantic segmentation result of the second image, determine the second semantic segmentation result of the first image.

[0249] The present disclosure also provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the video processing method described in the above method embodiment are executed. The storage medium can be a volatile or non-volatile computer-readable storage medium.

[0250] The embodiments of the present disclosure also provide a computer program product, which carries a program code. The instructions included in the program code can be used to execute the steps of the video processing method described in the above method embodiment. For details, please refer to the above method embodiment, which will not be repeated here.

[0251] The computer program product may be implemented in hardware, software or a combination thereof. In one optional embodiment, the computer program product is implemented as a computer storage medium. In another optional embodiment, the computer program product is implemented as a software product, such as a software development kit (SDK).

[0252] Those skilled in the art can clearly understand that, for the convenience and simplicity of description, the specific working process of the system and device described above can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here. In the several embodiments provided in the present disclosure, it should be understood that the disclosed system, device and method can be implemented in other ways. The device embodiments described above are merely schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some communication interfaces, and the indirect coupling or communication connection of the device or unit can be electrical, mechanical or other forms.

[0253] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0254] In addition, each functional unit in each embodiment of the present disclosure may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.

[0255] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a non-volatile computer-readable storage medium that is executable by a processor. Based on this understanding, the technical solution of the present disclosure, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present disclosure. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.

[0256] Finally, it should be noted that the above-described embodiments are only specific implementation methods of the present disclosure, which are used to illustrate the technical solutions of the present disclosure, rather than to limit them. The protection scope of the present disclosure is not limited thereto. Although the present disclosure is described in detail with reference to the above-described embodiments, ordinary technicians in the field should understand that any technician familiar with the technical field can still modify the technical solutions recorded in the above-described embodiments within the technical scope disclosed in the present disclosure, or can easily think of changes, or make equivalent replacements for some of the technical features therein; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present disclosure, and should be included in the protection scope of the present disclosure. Therefore, the protection scope of the present disclosure should be based on the protection scope of the claims.

Claims

1. A video processing method, characterized in that: include: Acquire a real-time video stream; the real-time video stream includes a first image of a current frame and a second image of a previous frame; Determine a first semantic segmentation result of a target location area of ​​the first image, and obtain a second semantic segmentation result of the second image; Determine a second semantic segmentation result of a target position area of ​​the first image based on the first semantic segmentation result and a second semantic segmentation result of the second image; Obtaining a second semantic segmentation result of the first image based on the second semantic segmentation result of the target position area of ​​the first image and the second semantic segmentation result of the reference position area in the second image; wherein the reference position area is a position area that matches a position area other than the target position area of ​​the first image; The determining, based on the first semantic segmentation result and the second semantic segmentation result of the second image, a second semantic segmentation result of the target position area of ​​the first image comprises: For any first pixel point in the target position area of ​​the first image, determine an updated semantic segmentation result of the first pixel point according to the first semantic segmentation result of the first pixel point and the first semantic segmentation results of other pixels points within a preset position range from the first pixel point; Determining a first confidence level of an updated semantic segmentation result of the first pixel, and determining a second confidence level of a second semantic segmentation result of a second pixel matching the first pixel in the second image; Determine a first smoothing coefficient between an updated semantic segmentation result of the first pixel and a second semantic segmentation result of the second pixel based on the first confidence level, the second confidence level, and a preset confidence threshold; Based on the first smoothing coefficient, a smoothing process is performed between the updated semantic segmentation result of the first pixel and the second semantic segmentation result of the second pixel to obtain the second semantic segmentation result of the first pixel.

2. The method according to claim 1, characterized in that The determining of a first semantic segmentation result of a target location area of ​​the first image includes: Acquire a position range of a target position area of ​​the second image, and intercept an initial position area matching the position range of the target position area of ​​the second image from the first image; Determine an initial semantic segmentation result of the initial position area in the first image; A first semantic segmentation result of the target position area of ​​the first image is determined based on the position range of the target position area of ​​the second image, the position range of the initial position area in the first image, and the initial semantic segmentation result.

3. The method according to claim 2, characterized in that The determining, based on the position range of the target position area of ​​the second image, the position range of the initial position area in the first image, and the initial semantic segmentation result, a first semantic segmentation result of the target position area of ​​the first image comprises: Obtaining an initial semantic segmentation result of the first image based on the initial semantic segmentation result of the initial position area and second semantic segmentation results corresponding to other position areas of the first image except the initial position area in the second image; Determining an updated position area of ​​the first image based on an initial semantic segmentation result of the first image; determining a target position area of ​​the first image based on a position range of the target position area of ​​the second image and a position range of the update position area of ​​the first image; An initial semantic segmentation result corresponding to the target position region of the first image is selected from the initial semantic segmentation results of the first image as a first semantic segmentation result of the target position region of the first image.

4. The method according to claim 3, characterized in that The step of determining an updated position area of ​​the first image based on an initial semantic segmentation result of the first image includes: Determining label information corresponding to each pixel point in the first image according to the initial semantic segmentation results corresponding to each pixel point in the first image; the label information is used to indicate the target category to which the pixel point belongs; The update position area is determined from the first image based on the label information and pre-selected label information respectively corresponding to each pixel in the first image.

5. The method according to claim 3 or 4, characterized in that: The determining the target position area of ​​the first image based on the position range of the target position area of ​​the second image and the position range of the update position area of ​​the first image includes: Determine an area overlap ratio between a position range of a target position area of ​​the second image and a position range of the update position area in the first image; When the area overlap rate is less than a set overlap rate threshold, taking the update position area as the target position area of ​​the first image; When the area overlap rate is greater than or equal to the set overlap rate threshold, the initial position area of ​​the first image is used as the target position area of ​​the first image.

6. The method according to claim 5, characterized in that The determining of the area overlap rate between the position range of the target position area of ​​the second image and the position range of the update position area in the first image includes: Obtaining an intersection area and a union area of ​​a target position area of ​​the second image and the update position area in the first image; The ratio of the intersection area to the union area is used as the region overlap rate.

7. The method according to claim 4, characterized in that The initial semantic segmentation result includes initial probability values ​​of the pixels belonging to each target category; The determining, according to the initial semantic segmentation results respectively corresponding to the pixels in the first image, label information respectively corresponding to the pixels in the first image comprises: For each pixel in the first image, selecting a maximum initial probability value from the initial probability values ​​of the pixel belonging to each category; The target category corresponding to the maximum initial probability value is used as the label information corresponding to the pixel point.

8. The method according to claim 1, characterized in that The determining, based on the first confidence level, the second confidence level, and a preset confidence threshold, a first smoothing coefficient between an updated semantic segmentation result of the first pixel point and a second semantic segmentation result of the second pixel point comprises: When the first confidence level is greater than the preset confidence threshold, obtaining the first smoothing coefficient based on a preset second smoothing coefficient and the first confidence level; When the first confidence level is less than the preset confidence threshold and the second confidence level is greater than the preset confidence threshold, obtaining the first smoothing coefficient based on the second smoothing coefficient and the second confidence level; When the first confidence level and the second confidence level are both less than or equal to the preset confidence threshold, the first smoothing coefficient is determined to be a preset smoothing coefficient value.

9. The method according to any one of claims 1 to 4, characterized in that: The second semantic segmentation result of the first image includes a second probability value of each pixel in the first image belonging to each target category; After determining a second semantic segmentation result of the first image, the method further includes: According to the second probability value that each pixel point in the first image belongs to each target category, a target category area where pixels belonging to a specified target category are located is segmented from the first image.

10. A video processing device, characterized in that: include: An acquisition module, used to acquire a real-time video stream; the real-time video stream includes a first image of a current frame and a second image of a previous frame; A first determination module is used to determine a first semantic segmentation result of a target location area of ​​the first image, and to obtain a second semantic segmentation result of the second image; A second determination module is used to determine a second semantic segmentation result of a target position area of ​​the first image based on the first semantic segmentation result and the second semantic segmentation result of the second image; based on the second semantic segmentation result of the target position area of ​​the first image and the second semantic segmentation result of a reference position area in the second image, obtain a second semantic segmentation result of the first image; wherein the reference position area is a position area that matches a position area other than the target position area of ​​the first image; When determining the second semantic segmentation result of the target position area of ​​the first image based on the first semantic segmentation result and the second semantic segmentation result of the second image, the second determination module is used to: For any first pixel point in the target position area of ​​the first image, determine an updated semantic segmentation result of the first pixel point according to the first semantic segmentation result of the first pixel point and the first semantic segmentation results of other pixels points within a preset position range from the first pixel point; Determining a first confidence level of an updated semantic segmentation result of the first pixel, and determining a second confidence level of a second semantic segmentation result of a second pixel matching the first pixel in the second image; Determine a first smoothing coefficient between an updated semantic segmentation result of the first pixel and a second semantic segmentation result of the second pixel based on the first confidence level, the second confidence level, and a preset confidence threshold; Based on the first smoothing coefficient, a smoothing process is performed between the updated semantic segmentation result of the first pixel and the second semantic segmentation result of the second pixel to obtain the second semantic segmentation result of the first pixel.

11. An electronic device, characterized in that: include: A processor, a memory and a bus, wherein the memory stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor and the memory communicate via the bus, and when the machine-readable instructions are executed by the processor, the steps of the video processing method as described in any one of claims 1 to 9 are performed.

12. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the video processing method according to any one of claims 1 to 9 are executed.