def generate_index(data_infos, window_size):
    """ Generate the indices of consecutive frames

    Args:
        data_infos (str): the data informations
        window_size(int): the window size of consecutive frames

    Returns:
        list(list(int)): the indices which each one represent the window size consecutive frames,like:
        [[1, 2, 3, 4, 5], ..., [64, 65, 66, 67, 68]]. each number in [1, 2, 3, 4, 5] represents the index of data_infos,
        which are consecutive frames
    """
    indices = []

    # The number of left adjacent frames
    left_cnt = (window_size - 1) // 2

    # The number of right adjacent frames
    right_cnt = window_size - 1 - left_cnt

    for i, img_info in enumerate(data_infos):
        video = img_info['video']

        # Anchor frame index
        index = [i]

        # Append left adjacent frames' index
        for left_index in range(1, left_cnt + 1):
            j = i - left_index
            if j < 0 or data_infos[j]['video'] != video:
                index.insert(0, i)
            else:
                index.insert(0, j)

        # Append right adjacent frames' index
        for right_index in range(1, right_cnt + 1):
            j = i + right_index
            if j >= len(data_infos) or data_infos[j]['video'] != video:
                index.append(i)
            else:
                index.append(j)

        assert len(index) == window_size
        indices.append(index)

    return indices