This application claims priority to the Chinese Patent Application No. 201510368762.1, filed on Jun. 29, 2015, which is incorporated herein by reference in its entirety.
The present invention relates to the field of computer technology and, more particularly, to a method for object segmentation in videos tagged with semantic labels.
Video object segmentation is a technique for detecting and segmenting an object region of a given semantic category from the video, which is a fundamental technique in the field of computer vision and multimedia analysis, and plays an important role in application aspects such as object retrieval, video editing and video-based three-dimensional modeling. A weakly-labeled method for segmenting video objects refers to a method in which only a semantic category of the video object is labeled by a user, and an object belonging to a category specified by the user is detected and segmented with an algorithm Considering that most of the Internet videos usually have a user flag, and a semantic tag relevant to the content, therefore, the weakly-labeled method for segmenting video objects is of great importance in the application of analyzing and processing ever-increasing internet video data.
Since a weakly-labeled video object has a feature that, it is only known about that there is an object belonging to a specified semantic category in the input video, but the specific location information is still unknown. Currently, the most widely adopted solution is based on weakly supervised learning, which particularly is: firstly, positive videos and negative videos are collected, wherein, the positive videos contain the objects from a pre-specified semantic category while the negative videos do not contain any objects from this category; secondly, each video is segmented into spatio-temporal segments, and a semantic category of each spatio-temporal segment is determined according to the association between the positive videos and the negative videos; finally, the positive videos and the negative videos are all co-segmented with a multi-graph optimization model to obtain a segmentation result, that is, the objects belonging to the specified semantic category in the input video.
The above method for segmenting video objects based on weakly-supervised learning can effectively solve the problem of segmenting a video object under a weakly-labeled condition in some cases, however, since that a weakly-labeled video lacks location information of an object of a specific semantic category, which makes the classification of the positive sample video and the negative sample video inaccurate, and thus a wrong result of video segmentation during segmentation is most likely to occur, in addition, multiple videos are simultaneously needed as the input for segmentation, which renders these methods not applicable for segmenting a semantic category object of a single input video.
The present invention provides a method for object segmentation in videos tagged with semantic labels, to assist segmentation of an object of a given semantic category in a video by means of an object bounding box detector and an object contour detector, so that the problem that the existing method for segmenting video objects is inaccurate and not applicable to segmenting a semantic category object of a single input video can be solved.
According to the present invention, there is provided a method for object segmentation in videos tagged with semantic labels, including:
detecting each frame of the video sequence with an object bounding box detector of the given semantic category, and an object contour detector and obtaining a candidate object bounding box set and a candidate object contour set for each frame of the input video;
building a joint assignment model for the candidate object bounding box set and the candidate object contour set, and solve this model to obtain the initial object segment sequence, wherein at least one of the initial segment sequences contains the object;
processing the initial object segment sequence, to estimate a probability distribution of the object shapes in the input video; and
optimizing the initial object segment sequence with a variant of graph cut algorithm that integrates the shape probability distribution of the object, to obtain the optimal object segment sequence corresponding to the object in the input video.
The present invention provides a method for object segmentation in videos tagged with semantic labels, to assist segmentation of an object of a given semantic category in an input video by applying an object bounding box detector and an object contour detector, so that the problem of ambiguous video segment classification under a weakly-supervised learning condition can be avoided, further, the method for object segmentation in videos tagged with semantic labels in the present invention is applicable to segmenting an object of a given semantic category of a single input video, not having to process multiple videos at the same time, and thus has a better applicability.
In order to illustrate embodiments of the present invention or the technical solutions in the prior art more clearly, accompanying drawings needed for describing the embodiments or the prior art will be introduced in brief hereinafter. Apparently, the accompanying drawings show certain embodiments of the invention, and persons skilled in the art can derive other drawings from them without creative efforts.
In order to make the objects, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention are hereinafter described clearly and completely with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the embodiments described here are part of the embodiments of the present invention but not all of the embodiments. Based on the embodiments of the present invention, other embodiments obtained by those skilled in the art without creative efforts all fall in the scope of the present invention.
Video object segmentation is a technique for detecting and segmenting an object region of a given semantic category from the video, which is a fundamental technique in the field of computer vision and multimedia analysis, and plays an important role in application aspects such as object retrieval, video editing and video-based three-dimensional modeling.
Currently, depending on different user input conditions, the existing method for segmenting semantic video objects is mainly divided into three general categories: a label-free method for segmenting video objects, a strongly-labeled method for segmenting video objects, and a weakly-labeled method for segmenting video objects. In the label-free method for segmenting video objects, an algorithm can automatically segment semantic objects from a video, which does not need user interaction; in the strongly-labeled method for segmenting video objects, the user needs to manually segment objects in several key frames of the input video, an algorithm can propagate the segmentation result on the remaining frames, so that the semantic object can be segmented from the whole input video; in the weakly-labeled method for segmenting video objects, the user only needs to label a semantic category to which object in the input video belongs to, an algorithm is used to detect and segment objects of the specified semantic category from the input video. Considering that most of the Internet videos usually have semantic tags annotated by users relevant to the content, therefore, the weakly-labeled method for segmenting video objects is of great importance in the application of analyzing and processing ever-increasing internet video data.
Under a weakly-labeled condition, it is only known that there is an object belonging to a specified semantic category in the input video, while location information of the object is still unknown. In order to solve this problem, a vision model based on weakly-supervised learning is mainly adopted for solution in the relevant research field, which particularly is: in the framework of weakly-supervised learning, positive videos and negative videos are firstly collected, wherein, the positive videos contain objects from a specific semantic category while the negative videos do not contain any objects from that category; secondly, each video is segmented into spatio-temporal segments (Spatio-temporal Segment), and a semantic category of each spatio-temporal segment is solved according to the visual similarity between the segments in the positive and negative videos; for example, Hartmann learns a segment-based classifier with a linear support vector machine (Linear SVM) and multi-instance boosting (MI-Boosting), and detects an object region of a given semantic category in the input video; Tang et al uses a negative mining method, that is to compare each segment of the positive videos with all the segments of the negative videos, score each segment of all the positive videos according to a neighbor relationship between the positive videos and the negative videos, and judge that the segment with a higher score belongs to a specified semantic category; Xiao et al propose to learn a distance measure between the positive videos and the negative videos with a weakly-supervised Hash algorithm, and give a probability that a video segment belongs to the given semantic category with a K-neighbor classifying method; finally, the positive videos and the negative videos are all co-segmented with a multi-graph optimization model to obtain a segmentation result, that is, the objects belonging to the specified semantic category in the input video.
The above method for segmenting video objects based on learning can effectively solve the problem of segmenting a video object under a weakly-labeled condition in some case, however, it still has two disadvantages as follows. Firstly, since a weakly-labeled video lacks location information of an object of a specific semantic category, therefore, a category to which a sample segment belongs can be speculated by comparing the appearance of the segment, which makes the classification of the sample segment always inaccurate (for example, two segments with similar appearances may either belong to the same semantic category or belong to different categories), thus makes the classification of the positive sample video and the negative sample video inaccurate. A wrong result of video segmentation is most likely to occur due to such fuzzy sample classification. Secondly, multiple videos are needed as the input for segmentation in the method for segmenting video objects based on weakly-supervised learning, which is not applicable for segmenting object of a single input video.
Considering that the object detector has many successful application cases in the aspect of image semantic segmentation, for example, Xia et al achieves a highly-efficient image semantic segmentation method with an object detector, without the need of a complicated training process and a pixel-by-pixel accurately-labeled image training set. Therefore, in terms of an input video with a semantic category label, in order to solve the problem existed in the method for segmenting video objects based on weakly-supervised learning, the present invention proposes a method for object segmentation in videos tagged with semantic labels, the method firstly estimates a rough location of the video object with an object detector corresponding to a given semantic category, and on the basis of that, completes segmentation of objects belonging to the semantic category.
Step 101, Detecting each frame of an input video sequence with an object bounding box detector for a semantic category, and an object contour detector according to a semantic category label to which an object belongs, and obtaining a candidate object bounding box set and a candidate object contour set for each frame of the input video;
Since there may be multiple objects belonging to different semantic categories in the input video, and under a weakly-labeled condition, it is only known that there is an object belonging to a specified semantic category in the input video, while location information of the object is still unknown, therefore, the present invention firstly estimates a rough location of the video object of a specified semantic category with an object detector, that is, detect each frame of the input video with an object bounding box detector first, obtain a candidate object bounding box set for each frame of the input video, and on the basis of the candidate object bounding box set, detect each frame of the input video with an object contour detector, obtain a candidate object contour set for each video frame.
Step 102, Building a joint assignment model containing the candidate object bounding box set and the candidate object contour set, and solve it to obtain initial object segmentation corresponding to the object in the input video;
wherein, at least one of the initial segment sequences contains the object.
Since all the existing object detectors (object bounding box detectors and object contour detectors) are obtained by training on static images therefore, if applied in a video frame directly, the factors such as encoding compression, object occlusion and camera movement will cause that the detected candidate object bounding box set and candidate object contour set are in disorder and inaccurate.
To this end, by using a joint assignment model the present invention selects the right candidate object bounding boxes and candidate object contours from the noisy candidate object bounding box set and candidate object contour set The selected object contours correspond to the initial object segment sequence of a given semantic category label in the input video.
Step 103, Processing the initial object segment sequence, to estimate a shape probability distribution of the object in the input video;
As for the above initial object segmentation, the present invention proposes a method for estimating a shape probability distribution of the object which encodes spatio-temporal consistency, the method estimates the shape probability distribution of the object of a given semantic category in the input video, by analyzing statistical information of many candidate segment sequences that spatially overlapped with the above initial object segment sequence.
Step 104, Optimizing each initial object sequence with a graph cut algorithm in combination with the shape probability distribution of the object, to obtain the optimal object segmentation results in the input video.
Optimizing each sequence containing the object in the initial segmenting sequence in sequence with a graph cut algorithm in combination with the shape probability distribution of the object of a given semantic category solved in Step 103, to obtain an optimal segmenting sequence corresponding to the object in the input video.
Embodiments of the present invention provide a method for object segmentation in videos tagged with semantic labels, to assist segmentation of an object of a given semantic category in an input video by applying an object bounding box detector and an object contour detector, so that the problem of a fuzzy sample video classification under a weakly-supervised learning condition can be avoided, further, the method for object segmentation in videos tagged with semantic labels according to the present invention is applicable for segmenting an object of a given semantic category of a single input video, without the need of processing multiple videos at the same time, and thus shows better applicability.
Step 201, Detecting each frame of the input video with the object bounding box detector on at least two thresholds according to the semantic category label to which the object belongs, to calculate a comprehensive performance value of the detection result corresponding to the at least two thresholds, and take a threshold corresponding to a maximum comprehensive performance value selected form the comprehensive performance values as an optimal threshold of the object bounding box detector;
Since the user manually labels a given semantic category of an object on a training set of each frame of the input video under a weakly-labeled condition, therefore, comprehensive performance values with different magnitudes can be obtained when each frame of the input video is detected on different thresholds with an object bounding box detector, and a threshold corresponding to a maximum comprehensive performance value is selected as an optimal threshold of the object bounding box detector.
It should be noted that, the detection performance is measured by F-Score value, the F-Score value is also called F-Measure, which is a common evaluation criterion in the IR (information retrieval) field, the bigger F-Score is, the better the detection performance is. Therefore, the threshold corresponding to a maximum F-Score can be taken as the optimal threshold of the object bounding box detector.
Step 202, Detecting each frame of the input video with the object bounding box detector on the optimal threshold according to the semantic category label to which the object belongs, to obtain an object bounding box set for each frame of the input video, wherein, the final object bounding box set is the union of the object bounding box set for each frame of the input video and a dummy bounding box;
For example, if detect the t-th frame of the input frame with an object bounding box detector, an object bounding box set for the t-th frame is obtained, which is denoted as Dt+, a candidate object bounding box set for the t-th frame contains Dt+ and a dummy bounding box Dφ, marked as Dt=Dt++∪{Dφ}. Particularly, the dummy bounding box Dφ is used to indicate an ideal area of the bounding box of the object.
It should be noted that, the existence of the dummy bounding box has a significance that, when the object bounding box detector fails to detect a certain frame, any detected bounding box in the obtained object bounding box set cannot locate on the object of the input video, if an dummy bounding box is not introduced, objects on the frame cannot be segmented accurately in the subsequent processing, that is, if all the object bounding box sets cannot locate on the object of the input video accurately, then, when the joint assignment model is built subsequently, the algorithm can only select a wrong detection for this frame as part of the solution, which will make the result inaccurate. With the dummy bounding box included, the algorithm can possibly choose the dummy bounding box instead of any of the others, which will not significantly influence the results.
However, the above problem can be solved to a certain extent with an assumption of the empty bounding box set, when all the object bounding box sets cannot locate on the object of the input video accurately, the algorithm of solving the initial segmenting sequence corresponding to the object can select an empty bounding box set first, and then select a better initial segmenting sequence.
It should be noted that, the joint allocation model built subsequently containing the candidate object bounding box set and the candidate object contour set joins the object bounding box set with the initial segmenting sequence, and allocation between the object bounding box set and the initial segmenting sequence is interdependent.
Step 203, Detecting each frame of the input video with an object contour detector based on (Constrained Parametric min-Cuts, CPMC) after obtaining the candidate object bounding box set for each frame of the input video, to obtain a candidate object contour set for each frame of the input video.
Particularly, after knowing the candidate object bounding box set for the t-th frame of the input video, on the basis of the candidate object bounding box set, a heat map is computed by counting the number of detections on each pixel location in the frame. In order to improve the detection accuracy of the object contour detector, in the seed placement stage of constrained parametric min-cuts algorithm, additional foreground seeds are placed on the pixel locations with high detection hits. The detected object contours are denoted as St, for the t-th frame of the input video.
Before detecting each frame of the input video with the object contour detector, it is necessary to select seed points of the object contour detector, and the seed point indicates an optimal pixel region to be detected by the object contour detector.
In order to improve the detection accuracy of the object contour detector, additional foreground seed points are added as follows: detect the t-th frame of the input video with different object bounding box detectors having a lower threshold, to obtain a series of candidate object bounding boxes, and calculate times of each object pixel being covered by the candidate object bounding box, to obtain a heat map of detection results, that is, to obtain a pixel region of each object pixel covered by the candidate object bounding box; select a local maxima of the heat map as the additional foreground seed point, that is, the local maxima of the heat map is the optimal pixel region to be detected.
In the method for object segmentation in videos tagged with semantic labels according to Embodiment 2 of the present invention, select the optimal threshold of the object bounding box detector, so that the object bounding box detector detects each frame of the input video on the optimal threshold, to obtain an object bounding box set for each frame of the input video, and then detect each frame of the input video with an object contour detector based on constrained parametric min-cuts, to obtain a candidate object contour set for each frame of the input video, thus roughly determining a location of the object of a given semantic category, and improving accuracy of the subsequent video object segmentation.
Step 301, Building the first optimization objective function which targets at obtaining the initial object segment sequence corresponding to the object as the optimization object, by setting an allocated 0-1 variable set indicating the candidate object bounding box set and the candidate object contour set respectively;
Formalizedly, setting a set A={aDk|∀k,t,DεDt} for the candidate object bounding box set, wherein Dt indicates the candidate object bounding box set of the t-th frame of the input video, aDkε{0,1}, when aDk takes a value of 1, it means the bounding box D is assigned to the k-th sequence, and when aDk takes a value of 0, it means the bounding box D is not assigned to the k-th sequence;
Likewise, setting a set B={bSk|∀k,t,SεSt} for the candidate object contour set, wherein, St indicates a candidate object contour set of the t-th frame of the input video, bSkε{0,1}, when bSk takes a value of 1, it means the contour S is assigned to the k-th sequence, and when bSk takes a value of 0, it means the contour S is not assigned to the k-th sequence.
Building a first optimization objective function i.e., Formula (1), for obtaining the initial segment sequence corresponding to the object, constraint conditions of the objective function are Formula (2);
wherein, L(A,B) is a loss function, indicating a confidence of the selected object bounding boxes object contours; Ω1(A,B) is a penalty term, indicating a time domain smoothness of the selected object bounding boxes and object contours on adjacent t-th frame and t+1-th frame of the input video; Ω2(B) is a penalty term, indicating the spatial overlap among the selected object contours in the different sequences; λ1 is a parameter of the penalty term of Ω1(A,B), and λ2 is a parameter of the penalty term of Ω2(B).
Theoretically, value ranges of the parameters λ1 and λ2 can be determined depending on an accuracy, optionally, in the embodiments of the present invention, the parameters λ1 and λ2 are respectively λ1=10, λ2=1000.
Further, the constraint conditions described above have restricting functions respectively as follows:
the constraint condition of aDk,bSkε{0,1}, ∀k,t,DεDt, SεSt is used to restrict value ranges of the variable aDk of the set A and the variable bSk of the set B;
the constraint condition of
is used to restrict that each sequence can select at most one bounding box or contour on each frame of the input video;
the constraint condition of
is used to restrict that each bounding box or contour is assigned to at most one sequence;
the constraint condition of
is used to restrict the consecutiveness of the sequence, provided that the sequence must select a bounding box or contour on continuous video frames;
the constraint condition of
is used to restrict that each sequence can select at least one bounding box and contour in the input video.
Particularly, L(A,B) is a loss function, indicating a confidence coefficient of the selected object bounding boxes and object contours wherein, the confidence for each bounding box or object contour takes a value from 0 to 1, the confidence values are obtained from the output of the used object detectors. Generally speaking, the loss function of L(A,B) is particularly indicated by Formula (3):
wherein, the expression of ξ(Df,S) is indicated by Formula (4):
Wherein,
in Formula (4) indicates an area overlapping ratio between region R1 and region R2 (i.e., a ratio of an intersected area to a unioned area between region R1 and region R2), o(S) indicates an objectness score of contour S as the outcome of the object contour detector, r(D) indicates a confidence score of bounding box D as the transferred outcome of the object bounding box detector; r(D) is calculated by Formula (5):
In Formula (5), {circumflex over (r)}(D) is a confidence score of object bounding box D given by the object bounding box detector, γ is an optimal threshold of the object bounding box detector, λd is an average value of all the object bounding box scores ({circumflex over (r)}(D)−γ).
Ω1(A,B) is a penalty term, indicating a time domain smoothness of the selected object bounding boxes and object contours on adjacent t-th frame and t+1-th frame of the input video, a formalized expression is Formula (6):
wherein, the specific expression of η(D,S,D0,S0) is Formula (7):
Particularly, f(S) is a feature vector indicating the appearance of contour S, and is expressed as a concatenation between Hue color histogram and 64-dimensional texton histogram, χ2 indicates the Chi-Square distance between Hue color histogram and 64-dimensional texton histogram.
The penalty term of Ω2(B) indicates the overlap degree of the candidate object contour sets selected between different sequences, which is particularly indicated by Formula (8):
When calculating the penalty term of Ω2(B), both contours S and S0 are from the candidate object contour set St of the t-th frame.
Step 302, Converting the problem of solving the initial segmenting sequence corresponding to the object into a problem of solving minimal cost-maximal flow.
Since the joint assignment model containing the candidate object bounding box set and the candidate object contour set constructed as above contains tens of thousands of binary variables and complicated inequality constraints, it is difficult to be solved with common optimization methods, therefore, embodiments of the present invention convert the problem of solving the initial segmenting sequence corresponding to the object into a problem of solving minimal cost-maximal flow of a network flow.
Particularly, the first optimization objective function expression
can be converted to the equivalent objective function
by substituting
with an auxiliary variable
wherein, ξ, η, δx, δy are all column vectors, used to record variables relevant to all the bounding boxes and contours respectively; the matrix Π is used to record an overlapping region between contours; the auxiliary variable δx(D,S) is used to indicate an activated status of a node represented by a combination (D,S), auxiliary variable δy(D,D0,S,S0) is used to indicate an activated status of an edge of a node for connecting the combination (D,S) and the combination (D0,S0), D0εDt+1 indicates that D0 belongs to the candidate object bounding box set Dt+1 of the t+1-th frame of the input video, S0εSt+1 indicates that S0 belongs to the candidate object bounding box set St+1 of the t+1-th frame of the input video, the
indicates a second optimization object function expression with an optimization object of minimal cost-maximal flow.
Step 303, Solving Kmax initial sequences satisfying the problem of minimal cost-maximal flow;
Since the second optimization object function expression indicating the minimal cost-maximal flow problem contains a quadratic term, the minimal cost-maximal flow algorithm cannot be used directly to solve the initial segmenting sequence, therefore, when solving the above problem based on the minimal cost-maximal flow algorithm, the quadratic term is ignored first, and then the second optimization object function expression is simplified to
Therefore, the process to solve Kmax initial sequences satisfying the problem of minimal cost-maximal flow includes:
Firstly, the network flow is solved with the minimal cost-maximal flow algorithm to obtain a sequence; secondly, the bounding box and contour (and relevant edges thereof) selected by the sequence are removed from the original network flow, to obtain an updated network flow. This process is repeated until the newly-added sequence triggers one of the following cases: one is that a constraint condition of the optimization problem is not satisfied; the other is that the objective function value increases.
In all the obtained sequences, sequences with a length less than 5 frames are discarded, to obtain Kmax sequences as an initial solution for the minimal cost-maximal flow problem of the network flow.
Step 304, Re-selecting an object contour of the first K initial sequences in the Kmax initial sequences respectively with a K shortest path algorithm, to obtain K candidate sequence sets;
Assuming that the number K of the candidate sequence is known (1≦K≦Kmax), in terms of each sequence among the first K initial sequences, maintain the selected candidate object bounding box unchanged, and re-select the object contour with the K Shortest Path algorithm, to obtain K candidate sequence sets consisting of M new sequences and the original K initial sequences. Wherein, M can be any positive integer, the bigger the value of M is, the better the segmentation result may be, and M is usually set to be M=100 in the experiment.
Step 305, Optimization on the selection status of each candidate sequence with 0-1 variable for each candidate sequence in K candidate sequence sets through 0-1 quadratic programming;
Select one candidate sequence respectively from each of the K candidate sequence sets, so that the newly-selected K candidate sequence sets make the optimization object of the original network flow minimal.
Let με{0,1}MK indicate selection statuses of all the candidate sequences in the K candidate sequence sets, wherein, 1 indicates to be selected while 0 indicates not to be selected, then the problem of solving minimal cost-maximal flow of the network flow is converted into a problem of solving 0-1 quadratic programming, which is indicated by Formula (9):
The constraint condition is Cμ=1.
Particularly, each component of column vector S records a loss function value and a time domain smoothness penalty function value of a corresponding sequence, matrix A records a sum of the overlapping areas between any of the two sequences, and constraint matrix Cε{0,1}K×MK defines that the sum of selecting status variable of sequences in each candidate set is 1.
Step 306, Solving the problem of 0-1 quadratic programming with an optimizer, to obtain the initial segmenting sequence corresponding to the object.
The above problem of quadratic programming can be solved with a common optimizer, such as Gurobi optimizer.
In terms of each K value satisfying 1≦K≦Kmax, candidate sequence of the object and object function values of a first optimization object function expression taking the initial segmenting sequence corresponding to the object as the optimization object can be solved by applying step 303. Select a K* making the object function value minimal and take this sequence as a final solution for the first optimization object function expression, and select the optimal contour sequence as the initial segmenting sequence corresponding to the object.
By means of Step 301 to Step 306, the initial segmenting sequence corresponding to the object of a given semantic category can be obtained, and the initial segmenting sequence can roughly locate the object of a given semantic category in the input video, and lay the foundation for subsequently solving the optimal segmenting sequence corresponding to the object.
In the method for segmenting video objects tagged with semantic labels according to Embodiment 3 of the present invention, the object tagged with a given semantic category can be selected from a disorder candidate object bounding box set and candidate object contour set, by building the joint allocation model containing the candidate object bounding box set and the candidate object contour set, and the problem of solving the initial segmentation sequence of the object is expressed with the first object function expression, the problem of solving the initial segmenting sequence corresponding to the object is converted into a problem of solving minimal cost-maximal flow, and the initial segmenting sequence corresponding to the object of a given semantic category in the input video is finally solved with a minimal cost-maximal flow algorithm and 0-1 quadratic programming local search. However, since that the object bounding box and contour detector are applied individually for each video frame, the initial segmentation may be inconsistent on different video frames. To address this problem, consistent spatiotemporal shape probability distribution is further estimated from the initial segmentation sequence.
Step 401, Selecting the candidate object contours having an overlapping ratio more than a preset threshold with the initial segmenting sequence from all the candidate object contour sets of the input video;
Particularly, in all the candidate object contours of the input video, keep candidate object contours having an overlapping ratio more than a preset threshold with the initial segmenting sequence, and remove candidate object contours having an overlapping ratio less than the preset threshold. The preset threshold is set at will as required by the user, and is generally 50%.
Step 402, adding a candidate contour having a highest matching degree on the next frame found from the candidate object contour with an optical flow matching method into a candidate segmenting sequence, by taking any candidate object contour on any frame of the input video as a starting point with a greedy algorithm, to obtain N candidate segmenting sequences;
In detail, this step is to construct N candidate segmentation sequences from the candidate object contours having an overlapping ratio more than the preset threshold with a greedy algorithm, the specific construction method is that: search and add a candidate contour having a highest matching degree on the next frame with an optical flow matching method into a candidate segmenting sequence, by taking a certain candidate object contour on a certain frame of the input video as a starting point of the segmenting sequence, and this process is repeated until one of the following two cases is satisfied: one is that the final frame of the input video is arrived; the other is that the overlapping degree of the projected region between any candidate contour on the next frame and the current candidate contour is less than a preset threshold. The preset threshold is optionally 50%.
According to the method described above, after constructing the candidate segmenting sequence, removing the candidate contour selected by the candidate segmenting sequence, and repeatedly constructing the candidate segmenting sequence for the remaining candidate contours until all the candidate contours are selected, and thereby construct N candidate segmentation sequences.
Step 403, Setting an initial scoring expression for each candidate segmenting sequence respectively, to compute an initial score of each candidate segmenting sequence based on an appearance consistency and a time domain consistency of the object;
Particularly, denote the r-th candidate segmenting sequence as {Sr,l}l=1L
Wherein, λf is an average value of all the values χ2 (f(Sr,l),f(Sr,l+1));
Step 404, Setting a scoring expression of N candidate segmenting sequences after optimization, to build a third optimization object function expression taking the N candidate segmenting sequences as an optimization object, by taking the scoring expression of the N candidate segmenting sequences after optimization as variables;
Optionally, denote the re-calculated scores of the N candidate segmentation sequences after optimization as α={αr}r=1N, then the objective function to re-calculate the scores of candidate segmentation sequences by taking the appearance and temporal consistency into account can be expressed as Formula (11):
Wherein,
is a loss function, configured to restrict the deviations between the re-calculated scores and the initial scores; C1(α) and C2(α) are penalty terms, C1(α) is used to represent the appearance consistency of scoring between candidate segmentation sequences; C2(α) is used to represent temporal consistency of scoring between candidate segmentation sequences; θ1 and θ2 are parameters of C1(α) and C2(α) respectively.
Optionally, parameters of θ1 and θ2 are set to be θ1=θ2=1.5.
Formula (11) is to avoid the re-calculated scores from deviating the initial scores too much, while enforcing appearance and temporal consistencies between the re-calculated scores.
Particularly, the appearance consistency penalty term C1(α) is expressed by Formula (12):
Wherein, weight wr,s=e−dist(r,s) is a similarity between the r-th candidate segmenting sequence and the s-th candidate segmenting sequence, dist(r,s) is the Hausdorff distance of contour features between the r-th candidate segmenting sequence and the s-th candidate segmenting sequence, Rr is the set of candidate segmentation sequences whose feature distances between the r-th candidate segmentation sequence are below a given threshold. The appearance consistency penalty term C1(α) can make the scores of the candidate sequences with similar appearance as close as possible.
The time domain consistency penalty term C2(α) is expressed by Formula (13):
Wherein, {Ap}p=1P is the set of superpixels, |Ap| indicates the area (number of pixels) of the superpixel Ap, βp indicates the score of the superpixel Ap, which is calculated by
wherein, Πp is the set of candidate segmentation sequences covering the superpixel Ap; Mp1 (Mp2) indicates the set of superpixels that are temporally matched to the p-th superpixel by forward (backward) optical flows, ωq,p1 (ωq,p2) indicates the proportion of the area of the p-th superpixel that are mapped to the superpixel AqεMp1(Mp2). The temporal consistency penalty term C2(α) is to make the shape probability distribution of adjacent pixels in time domain as close as possible.
Step 405, optimizing the objective function with L-BFGS algorithm, to obtain the shape probability distribution of the object in the input video.
After solving the objective function
with the L-BFGS algorithm, to obtain the optimal solution α*, the shape probability of each pixel is the averaged score of the candidate segmenting sequence covering the pixel, and thus the shape probability distribution of the object in the input video can be obtained.
In the method for object segmentation in videos tagged with semantic labels according to Embodiment 4 of the present invention, the initial segmentation sequence is processed under the joint constraints of the appearance consistency penalty term and the time domain consistency penalty term, the appearance consistency penalty term can effectively enhance the shape probability values of the segmentation sequences corresponding to the objects, the time domain consistency penalty term can reduce the effect of background noise based on video interframe relationship and obtain a visually more consistent shape probability distribution of the object.
Step 501, Constructing a 4-neighbor graph structure G={V,E} taking pixels as nodes and neighboring relationship between pixels as edges in terms of each frame of the input video;
wherein, V is a node set, E is an edge set;
Step 502, Building the fourth optimization objective function, indicated by Formula (14), by indicating a foreground status and a background status of each pixel on each frame of the input video with x=(x1, x2, . . . , xn)ε{0,1}n;
The optimization objective of the fourth optimization object function expression is to obtain the best foreground/background status x* so that the pixel can be segmented into a foreground and a background and a local smoothness of the candidate segmenting sequence can be maintained;
wherein, ui indicates a data item with a definition formula indicated by Formula (15):
u
i(xi)=−ρ log(A(xi))+(1−ρ)log(S(xi)) (15)
In the formula, A(xi) is the foreground probability given by a Gaussian mixture model, indicating the foreground object appearance of the i-th pixel, S(xi) is a shape probability of the i-th pixel solved in Step 103; particularly, Gaussian mixture models of the foreground and the background are learned from the foreground pixels and background pixels determined by the initial segmenting sequence respectively.
vi is the smoothing item, defined by a contrast sensitive Potts model (Contrast Sensitive Potts Model) commonly used in the graph cut algorithm.
Step 503, Solving the fourth optimization object function expression with the graph cut algorithm, to obtain the foreground/background status x*;
Particularly, the optimization objective can be solved quickly with the graph cut (Graph Cut) algorithm.
Step 504, Constituting each optimization segmenting sequence corresponding to the object by a set of the flag status x* of all the pixels on each frame in the input video;
Step 505, Constituting an optimal segmenting sequence corresponding to the object in the input video by the set containing each optimization segmenting sequence corresponding to the object.
After individual optimization of each initial segmentation sequence containing the object with steps according to Embodiment 5 of the present invention, the determined foreground regions may be overlapped. To solve this problem, the present invention further provides a simple processing method, that is, extract the appearance feature (color histogram and texton histogram) of the overlapping region first, and then compare it with foreground region of each segmenting sequence closest to the overlapping region under Chi-Square distance measure, and assign the semantic category of the segmentation sequence with the minimum feature distance to the overlapping region.
In the method for object segmentation in videos tagged with semantic labels according to Embodiment 5 of the present invention, the foreground status and the background status of each pixel on each frame of the input video are indicated with one optimization objective function expression by constructing the 4-neighbor graph structure, and an optimal segmenting sequence corresponding to the object in the input video is obtained by solving with the graph cut algorithm, so as to achieve segmentation of the object of a given semantic category.
In the method for object segmentation in videos tagged with semantic labels according to Embodiment 1 to Embodiment 5 of the present invention, firstly, an object bounding box detector and an object contour detector are applied to roughly estimate the locations of the object of a given semantic category, so that the problem of ambiguous sample selection and classification under weakly-supervised learning condition can be avoided, secondly, a joint assignment model containing the candidate object bounding box set and the candidate object contour set is built, so that the object bounding boxes and contours that best cover the objects to be segmented can be selected from the set of noisy, inaccurate object bounding box and contour candidates, and finally, the initial segmentation sequence of the object in the input video is optimized in combination with the shape probability distribution of the object, to make the obtained optimal segmentation sequence of the object more accurate and spatiotemporally consistent. Further, the method for object segmentation in videos tagged with semantic labels according to the present invention is applicable to segmenting an object of a semantic category of a single input video, not having to process multiple videos at the same time, and thus has a better applicability.
The method for object segmentation in videos tagged with semantic labels according to the present invention is widely applicable to semantic parsing of video contents in a computer vision system in the fields such as national defense and military, film-making and public safety.
Finally, it should be noted that the above embodiments are merely provided for describing the technical solutions of the present invention, but not intended to limit the present invention. It should be understood by persons skilled in the art that although the present invention has been described in detail with reference to the foregoing embodiments, modifications can be made to the technical solutions described in the foregoing embodiments, or equivalent replacements can be made to partial or all technical features in the technical solutions; however, such modifications or replacements do not cause the essence of corresponding technical solutions to depart from the scope of the embodiments of the present invention.
Number | Date | Country | Kind |
---|---|---|---|
201510368762.1 | Jun 2015 | CN | national |