mirror of
https://github.com/macaodha/batdetect2.git
synced 2026-01-10 17:19:34 +01:00
Limit number of parallel processes to match predictions and annotations
This commit is contained in:
parent
7d92ec772b
commit
c7b110feeb
@ -1,3 +1,4 @@
|
||||
import os
|
||||
from functools import partial
|
||||
from multiprocessing import Pool
|
||||
from typing import List, Optional, Tuple
|
||||
@ -171,7 +172,8 @@ def _match_all_collected_examples(
|
||||
) -> List[MatchEvaluation]:
|
||||
logger.info("Matching all annotations and predictions")
|
||||
|
||||
with Pool() as p:
|
||||
cpu_count = os.cpu_count() or 1
|
||||
with Pool(processes=min(cpu_count, 4)) as p:
|
||||
matches = p.starmap(
|
||||
partial(
|
||||
match_sound_events_and_raw_predictions,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user