Add argument max workers for multiprocessing in create_labeled_video#3143
Merged
AlexEMG merged 1 commit intoDeepLabCut:mainfrom Nov 12, 2025
Merged
Conversation
…video This parameter can be used to limit the RAM usage when the user is processing many videos on multiple cores.
c50c0a5 to
66d55c7
Compare
AlexEMG
approved these changes
Nov 12, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add argument
max_workersto limit the number of processes spawned increate_labeled_video.The default behavior remains the same: when using multiprocessing, the number of spawned processes is
min(cpu_cores, n_videos).For some users that are processing many videos on a machine with many cores, the large number of simultaneous processes can drastically increase RAM-usage, especially for high resolution videos. Adding the
max_workersparameter helps to the user to mitigate this.Some profiling results:

The effects of limiting the max number of workers to 4 on a machine with 20 cores.