Alvin-Zeng / PGCN

Graph Convolutional Networks for Temporal Action Localization (ICCV2019)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

code understanding problem

hzphzp opened this issue · comments

Hi, I'm recently reading your excellent code.
When I read the sample_indeices(start, end nm_seg) function in I3D_Poolin.py, I found that the valid_length > num_seg condition would never exist. Is it a bug?

def sample_indices(start, end, num_seg):
    """
    :param record: VideoRecord
    :return: list
    """
    valid_length = end - start
    average_duration = (valid_length + 1) // num_seg
    if average_duration > 0:
        # normal cases
        offsets = np.multiply(list(range(num_seg)), average_duration)

    # TODO: here is a bug?
    elif valid_length > num_seg:
        offsets = np.sort(randint(valid_length, size=num_seg))
    else:
        offsets = np.zeros((num_seg,))

    return offsets, average_duration