Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug when dividing clips of small lengths #9

Open
tevkhieu opened this issue Nov 6, 2023 · 0 comments
Open

Bug when dividing clips of small lengths #9

tevkhieu opened this issue Nov 6, 2023 · 0 comments

Comments

@tevkhieu
Copy link

tevkhieu commented Nov 6, 2023

Hello,

I found a bug when handling small clips. In the data preprocessing:

def divide_clip(input, window, window_step, divide):
    if not divide:  # return the whole clip
        t = ((input.shape[0]) // 4) * 4 + 4
        t = max(t, 12)
        if len(input) < t:
            input = pad_to_window(input, t)

        return [input]

    """ Slide over windows """
    windows = []
    for j in range(0, len(input)-window//4, window_step):
        """ If slice too small pad out by repeating start and end poses """
        slice = input[j:j+window]
        if len(slice) < window:
            left = slice[:1].repeat(
                (window-len(slice))//2 + (window-len(slice)) % 2, axis=0)
            left[..., -3:] = 0.0
            right = slice[-1:].repeat((window-len(slice))//2, axis=0)
            right[..., -3:] = 0.0
            slice = np.concatenate([left, slice, right], axis=0)

        if len(slice) != window:
            raise Exception()

        windows.append(slice)

The issue is that if the input has a length under window // 4 (e.g. a 30 frame clip like 106_01.bvh in the CMU dataset) it won't enter the loop thus not padding the data and return an empty list.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant