Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,9 @@ dependencies = [
"deepmerge>=2.0",
"hydra-core>=1.3.2",
"librosa>=0.10.1",
"lightning[extra]==2.5.0",
"lightning==2.5.0",
"loguru>=0.7.3",
"matplotlib>=3.7.1",
"netcdf4>=1.6.5",
"numpy>=1.23.5",
"pandas>=1.5.3",
"pydantic>=2.0.0",
Expand All @@ -24,9 +23,10 @@ dependencies = [
"seaborn>=0.13.2",
"soundevent[audio,geometry,plot]>=2.10.0",
"soundfile>=0.12.1",
"tensorboard>=2.16.2",
"tabulate>=0.10.0",
"torch>=2.0.0",
"torchaudio>=2.0.0",
"tqdm>=4.70.0",
Comment on lines 24 to +29
"xarray>=2024.0.0",
]
requires-python = ">=3.10,<3.14"
Expand Down Expand Up @@ -88,6 +88,7 @@ dev = [
"deepdiff>=8.6.1",
"pytest-xdist[psutil]>=3.8.0",
]
tensorboard = ["tensorboard>=2.16.2"]
dvclive = ["dvclive>=3.48.2"]
Comment on lines 89 to 92
mlflow = ["mlflow>=3.1.1"]
gradio = [
Expand Down
9 changes: 7 additions & 2 deletions src/batdetect2/outputs/formats/parquet.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from pathlib import Path
from typing import List, Literal, Sequence
from typing import List, Literal, Sequence, TypedDict
from uuid import UUID

import numpy as np
Expand All @@ -26,6 +26,11 @@ class ParquetOutputConfig(BaseConfig):
include_geometry: bool = True


class ClipInfo(TypedDict):
clip: data.Clip
preds: list[Detection]


class ParquetFormatter(OutputFormatterProtocol[ClipDetections]):
def __init__(
self,
Expand Down Expand Up @@ -120,7 +125,7 @@ def load(self, path: data.PathLike) -> List[ClipDetections]:
else:
df = pd.read_parquet(path)

predictions_by_clip = {}
predictions_by_clip: dict[UUID, ClipInfo] = {}

for _, row in df.iterrows():
clip_uuid = row["clip_uuid"]
Expand Down
8 changes: 4 additions & 4 deletions src/batdetect2/plotting/detections.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,25 +185,25 @@ def plot_clip_evaluation(
label="found GT",
edgecolor=gt_color,
facecolor="none" if not fill else gt_color,
linestyle=gt_linestyle,
linestyle=gt_linestyle, # type: ignore
),
patches.Patch(
label="missed GT",
edgecolor=missed_gt_color,
facecolor="none" if not fill else missed_gt_color,
linestyle=missed_gt_linestyle,
linestyle=missed_gt_linestyle, # type: ignore
),
patches.Patch(
label="true Det",
edgecolor=true_pred_color,
facecolor="none" if not fill else true_pred_color,
linestyle=true_pred_linestyle,
linestyle=true_pred_linestyle, # type: ignore
),
patches.Patch(
label="false Det",
edgecolor=false_pred_color,
facecolor="none" if not fill else false_pred_color,
linestyle=false_pred_linestyle,
linestyle=false_pred_linestyle, # type: ignore
),
]
)
Expand Down
4 changes: 2 additions & 2 deletions src/batdetect2/plotting/heatmaps.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
"""Plot heatmaps."""

import matplotlib.pyplot as plt
import numpy as np
import torch
from matplotlib import axes, patches
from matplotlib.cm import get_cmap
from matplotlib.colors import Colormap, LinearSegmentedColormap, to_rgba

from batdetect2.plotting.common import create_ax
Expand Down Expand Up @@ -80,7 +80,7 @@ def plot_classification_heatmap(
raise ValueError("Inconsistent number of class names")

if not isinstance(cmap, Colormap):
cmap = get_cmap(cmap)
cmap = plt.get_cmap(cmap)

handles = []

Expand Down
Loading
Loading