Move detections array to cpu

This commit is contained in:
mbsantiago 2025-08-31 22:59:06 +01:00
parent 5b9a5a968f
commit d3d2a28130
2 changed files with 6 additions and 7 deletions

View File

@ -24,7 +24,6 @@ from batdetect2.preprocess import MAX_FREQ, MIN_FREQ
from batdetect2.typing import ModelOutput from batdetect2.typing import ModelOutput
from batdetect2.typing.postprocess import ( from batdetect2.typing.postprocess import (
BatDetect2Prediction, BatDetect2Prediction,
DetectionsArray,
DetectionsTensor, DetectionsTensor,
PostprocessorProtocol, PostprocessorProtocol,
RawPrediction, RawPrediction,

View File

@ -96,12 +96,12 @@ class DetectionsTensor(NamedTuple):
def numpy(self) -> DetectionsArray: def numpy(self) -> DetectionsArray:
return DetectionsArray( return DetectionsArray(
scores=self.scores.detach().numpy(), scores=self.scores.detach().cpu().numpy(),
sizes=self.sizes.detach().numpy(), sizes=self.sizes.detach().cpu().numpy(),
class_scores=self.class_scores.detach().numpy(), class_scores=self.class_scores.detach().cpu().numpy(),
times=self.times.detach().numpy(), times=self.times.detach().cpu().numpy(),
frequencies=self.frequencies.detach().numpy(), frequencies=self.frequencies.detach().cpu().numpy(),
features=self.features.detach().numpy(), features=self.features.detach().cpu().numpy(),
) )