mirror of
https://github.com/macaodha/batdetect2.git
synced 2026-08-22 03:00:10 +02:00
Avoid np stack error for empty arrays
This commit is contained in:
parent
ffa37ebb43
commit
b8f23d8b4b
@ -140,7 +140,7 @@ class RawFormatter(OutputFormatterProtocol[ClipDetections]):
|
|||||||
"clip_id": str(clip.uuid),
|
"clip_id": str(clip.uuid),
|
||||||
}
|
}
|
||||||
|
|
||||||
if self.include_class_scores:
|
if self.include_class_scores and values["class_scores"]:
|
||||||
class_scores = np.stack(values["class_scores"], axis=0)
|
class_scores = np.stack(values["class_scores"], axis=0)
|
||||||
data_vars["class_scores"] = (
|
data_vars["class_scores"] = (
|
||||||
["detection", "classes"],
|
["detection", "classes"],
|
||||||
@ -148,7 +148,7 @@ class RawFormatter(OutputFormatterProtocol[ClipDetections]):
|
|||||||
)
|
)
|
||||||
coords["classes"] = ("classes", self.targets.class_names)
|
coords["classes"] = ("classes", self.targets.class_names)
|
||||||
|
|
||||||
if self.include_features:
|
if self.include_features and values["features"]:
|
||||||
features = np.stack(values["features"], axis=0)
|
features = np.stack(values["features"], axis=0)
|
||||||
data_vars["features"] = (["detection", "feature"], features)
|
data_vars["features"] = (["detection", "feature"], features)
|
||||||
coords["feature"] = ("feature", np.arange(num_features))
|
coords["feature"] = ("feature", np.arange(num_features))
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user