Skip to content

Speed up prediction - batch_size & num_workers #731

Answered by sammlapp
charleygros asked this question in Q&A
Discussion options

You must be logged in to vote

Hey @charleygros so prediction on long files with OpenSoundscape >=0.8.0 is actually very simple (even simpler than my message above). All you need to do is pass a list of files (or dataframe with file paths in the index), and the CNN.predict() method will take care of splitting up your files into the appropriate length clips. The CNN object's .preprocessor attribute will use the same clip duration that was used to train the model. You can use the predict method's num_workers argument to parallelize preprocessing of samples over parallel CPU processes, and batch_size to increase training speed by preparing and running many samples at once.

For example, with OpenSoundscape 0.9.0:

from open…

Replies: 2 comments 5 replies

Comment options

You must be logged in to vote
1 reply
@sammlapp
Comment options

Comment options

You must be logged in to vote
4 replies
@charleygros
Comment options

@sammlapp
Comment options

@charleygros
Comment options

@sammlapp
Comment options

Answer selected by charleygros
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants