mirror of
https://github.com/macaodha/batdetect2.git
synced 2026-01-11 17:29: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 functools import partial
|
||||||
from multiprocessing import Pool
|
from multiprocessing import Pool
|
||||||
from typing import List, Optional, Tuple
|
from typing import List, Optional, Tuple
|
||||||
@ -171,7 +172,8 @@ def _match_all_collected_examples(
|
|||||||
) -> List[MatchEvaluation]:
|
) -> List[MatchEvaluation]:
|
||||||
logger.info("Matching all annotations and predictions")
|
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(
|
matches = p.starmap(
|
||||||
partial(
|
partial(
|
||||||
match_sound_events_and_raw_predictions,
|
match_sound_events_and_raw_predictions,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user