A computer-implemented method for generating pseudo-ground-truth data for training a machine learning model to segment or localize patterns in a sequence of frames over a succession dimension, the method comprising: - providing a sequence of frames and a plurality of timestamps, each timestamp including identification of a respective one of the frames and a pattern annotation of said frame; - defining at least one subset comprising the frames located between a first timestamp ( p i) and a consecutive second timestamp ( p i +1) of the plurality of timestamps, in the succession dimension; - initially assigning the frames of the at least one subset to one of three non-empty regions, the three regions comprising a first region, a second region and a neutral region joining the first region to the second region, wherein the first region starts from the first timestamp ( p i) and extends towards the second timestamp ( p i +1), and comprises the frames to be associated with the pattern of the first timestamp ( p i), the second region starts from the second timestamp ( p i +1) and extends towards the first timestamp ( p i), and comprises the frames to be associated with the pattern of the second timestamp ( p i +1); - obtaining pattern estimations for each frame of the at least one subset; - optimizing respective boundaries between the first region, the second region and the neutral region based on a compromise between the size of the neutral region and a match between the pattern estimations of the frames and the regions to which the frames are assigned; - outputting pseudo-ground-truth data comprising, for each frame of the first region and/or the second region after the optimizing, identification of said frame and, as a corresponding pattern annotation, the pattern annotation of the first timestamp ( p i) and/or the second timestamp ( p i +1), respectively; wherein the optimizing comprises solving the constrained minimization problem r i * g i * l i * = argmin r i, g i, l i ∑ i = 1 N ∑ t = p i − l i p i + r i − log y ̃ t y p i + β ∑ i = 0 N g i s. t. p i + 1 − p i = r i + g i + l i + 1 r i ≥ 0 g i ≥ 0 l i ≥ 0. where r i is the number of frames of the first region, g i is the number of frames of the neutral region, l i +1 is the number of frames of the second region, N is the number of timestamps, p i is the position of the i -th timestamp in the sequence, y p i is the pattern annotation of the i -th timestamp, ỹ t is the pattern estimation for frame t, and β is a hyperparameter. - providing a sequence of frames and a plurality of timestamps, each timestamp including identification of a respective one of the frames and a pattern annotation of said frame; - defining at least one subset comprising the frames located between a first timestamp ( p i) and a consecutive second timestamp ( p i +1) of the plurality of timestamps, in the succession dimension; - initially assigning the frames of the at least one subset to one of three non-empty regions, the three regions comprising a first region, a second region and a neutral region joining the first region to the second region, wherein the first region starts from the first timestamp ( p i) and extends towards the second timestamp ( p i +1), and comprises the frames to be associated with the pattern of the first timestamp ( p i), the second region starts from the second timestamp ( p i +1) and extends towards the first timestamp ( p i), and comprises the frames to be associated with the pattern of the second timestamp ( p i +1); - obtaining pattern estimations for each frame of the at least one subset; - optimizing respective boundaries between the first region, the second region and the neutral region based on a compromise between the size of the neutral region and a match between the pattern estimations of the frames and the regions to which the frames are assigned; - outputting pseudo-ground-truth data comprising, for each frame of the first region and/or the second region after the optimizing, identification of said frame and, as a corresponding pattern annotation, the pattern annotation of the first timestamp ( p i) and/or the second timestamp ( p i +1), respectively; wherein the optimizing comprises solving the constrained minimization problem r i * g i * l i * = argmin r i, g i, l i ∑ i = 1 N ∑ t = p i − l i p i + r i − log y ̃ t y p i + β ∑ i = 0 N g i s. t. p i + 1 − p i = r i + g i + l i + 1 r i ≥ 0 g i ≥ 0 l i ≥ 0. where r i is the number of frames of the first region, g i is the number of frames of the neutral region, l i +1 is the number of frames of the second region, N is the number of timestamps, p i is the position of the i -th timestamp in the sequence, y p i is the pattern annotation of the i -th timestamp, ỹ t is the pattern estimation for frame t, and β is a hyperparameter.