Skip to content

Add argument max workers for multiprocessing in create_labeled_video#3143

Merged
AlexEMG merged 1 commit intoDeepLabCut:mainfrom
deruyter92:jaap/fix_multiprocessing
Nov 12, 2025
Merged

Add argument max workers for multiprocessing in create_labeled_video#3143
AlexEMG merged 1 commit intoDeepLabCut:mainfrom
deruyter92:jaap/fix_multiprocessing

Conversation

@deruyter92
Copy link
Copy Markdown
Collaborator

@deruyter92 deruyter92 commented Nov 11, 2025

Add argument max_workers to limit the number of processes spawned in create_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_workers parameter 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.
total-memory-and-time

per-worker-memory

…video

This parameter can be used to limit the RAM usage when the user is processing many videos on multiple cores.
@deruyter92 deruyter92 force-pushed the jaap/fix_multiprocessing branch from c50c0a5 to 66d55c7 Compare November 11, 2025 09:59
@AlexEMG AlexEMG merged commit ee866cc into DeepLabCut:main Nov 12, 2025
10 checks passed
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

Successfully merging this pull request may close these issues.

2 participants