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

generate_blink_seq_randomly does not work for 21 frames #939

Open
SanderGi opened this issue Jul 14, 2024 · 0 comments
Open

generate_blink_seq_randomly does not work for 21 frames #939

SanderGi opened this issue Jul 14, 2024 · 0 comments

Comments

@SanderGi
Copy link

I ran into an issue with generate_blink_seq_randomly while testing short audio inputs.

For reference, src.generate_batch.py has the following implementation of generate_blink_seq_randomly:

def generate_blink_seq_randomly(num_frames):
    ratio = np.zeros((num_frames,1))
    if num_frames<=20:
        return ratio
    frame_id = 0
    while frame_id in range(num_frames):
        start = random.choice(range(min(10,num_frames), min(int(num_frames/2), 70))) 
        if frame_id+start+5<=num_frames - 1:
            ratio[frame_id+start:frame_id+start+5, 0] = [0.5, 0.9, 1.0, 0.9, 0.5]
            frame_id = frame_id+start+5
        else:
            break
    return ratio

When the number of frames is 21, int(num_frames/2) evaluates to 10 and min(10,num_frames) also evaluates to 10 meaning we get random.choice(10, 10) which is invalid and throws an error. A correct if condition would look like if int(num_frames / 2) < 11 instead of if num_frames<=20. Would submitting a PR that fixes this be appropriate?

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