mirror of
https://github.com/macaodha/batdetect2.git
synced 2026-01-10 17:19:34 +01:00
Fix matching error after optimising
This commit is contained in:
parent
c7b110feeb
commit
75e555ff00
@ -9,7 +9,6 @@ from batdetect2.configs import BaseConfig
|
|||||||
from batdetect2.evaluate.types import MatchEvaluation
|
from batdetect2.evaluate.types import MatchEvaluation
|
||||||
from batdetect2.postprocess.types import BatDetect2Prediction
|
from batdetect2.postprocess.types import BatDetect2Prediction
|
||||||
from batdetect2.targets.types import TargetProtocol
|
from batdetect2.targets.types import TargetProtocol
|
||||||
from batdetect2.utils.arrays import iterate_over_array
|
|
||||||
|
|
||||||
|
|
||||||
class BBoxMatchConfig(BaseConfig):
|
class BBoxMatchConfig(BaseConfig):
|
||||||
@ -126,8 +125,9 @@ def match_sound_events_and_raw_predictions(
|
|||||||
class_scores = (
|
class_scores = (
|
||||||
{
|
{
|
||||||
str(class_name): float(score)
|
str(class_name): float(score)
|
||||||
for class_name, score in iterate_over_array(
|
for class_name, score in zip(
|
||||||
prediction.raw.class_scores
|
targets.class_names,
|
||||||
|
prediction.raw.class_scores,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
if prediction is not None
|
if prediction is not None
|
||||||
|
|||||||
@ -172,8 +172,7 @@ def _match_all_collected_examples(
|
|||||||
) -> List[MatchEvaluation]:
|
) -> List[MatchEvaluation]:
|
||||||
logger.info("Matching all annotations and predictions")
|
logger.info("Matching all annotations and predictions")
|
||||||
|
|
||||||
cpu_count = os.cpu_count() or 1
|
with Pool() as p:
|
||||||
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,
|
||||||
@ -182,6 +181,7 @@ def _match_all_collected_examples(
|
|||||||
),
|
),
|
||||||
pre_matches,
|
pre_matches,
|
||||||
)
|
)
|
||||||
|
|
||||||
return [match for clip_matches in matches for match in clip_matches]
|
return [match for clip_matches in matches for match in clip_matches]
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user