-
Notifications
You must be signed in to change notification settings - Fork 104
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
Visual Voice Activity Detection (VVAD) integration including live camera and prerecorded demo #330
Conversation
Fixed small bug in framerate reduction
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this PR is almost there!
paz/processors/standard.py
Outdated
if value is None: | ||
mean = None | ||
else: | ||
size = len(self.predictions) | ||
|
||
self.predictions.append(value) | ||
if size > self.window_size: | ||
self.predictions.pop(0) | ||
|
||
mean = 0 | ||
if len(self.predictions) <= 1: | ||
mean = value | ||
else: | ||
total_weights = 0 | ||
for prediction_index in range(0, size): | ||
weight = (prediction_index + 1) / size | ||
mean = mean + self.predictions[prediction_index] * weight | ||
total_weights = total_weights + weight | ||
mean = mean / total_weights | ||
return mean | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this can be split into smaller functions to improve readability. The 3 conditions + for loop in a call seems to complex to read and understand easily.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have combined the AveragePredictions class with the WeightedAveragePredictions class. Additionally, I moved the computation of the weighted average (the for loop) to the backend.
For me it looks more readable now and I could save duplicated lines :)
…tion_to_paz # Conflicts: # paz/backend/standard.py # paz/processors/__init__.py # paz/processors/standard.py
This pull request includes:
Note: