Visitar URL original
make parenting video name changes backwards compatible; add code to r… · DeepLabCut/DeepLabCut@597cf6b · GitHub
Skip to content

Commit 597cf6b

Browse files
authored
make parenting video name changes backwards compatible; add code to results (#2740)
1 parent 55de11b commit 597cf6b

3 files changed

Lines changed: 19 additions & 2 deletions

File tree

‎deeplabcut/benchmark/__init__.py‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,11 @@ def evaluate(
8585
continue
8686
benchmark = benchmark_cls()
8787
for name in benchmark.names():
88-
if Result(method_name=name, benchmark_name=benchmark_cls.name) in results:
88+
if Result(
89+
code=benchmark.code,
90+
method_name=name,
91+
benchmark_name=benchmark_cls.name,
92+
) in results:
8993
continue
9094
else:
9195
result = benchmark.evaluate(name, on_error=on_error)

‎deeplabcut/benchmark/base.py‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def get_predictions(self):
5959
raise NotImplementedError()
6060

6161
def __init__(self):
62-
keys = ["name", "keypoints", "ground_truth", "metadata"]
62+
keys = ["code", "name", "keypoints", "ground_truth", "metadata"]
6363
for key in keys:
6464
if not hasattr(self, key):
6565
raise NotImplementedError(
@@ -110,6 +110,7 @@ def evaluate(self, name: str, on_error="raise"):
110110
else:
111111
raise NotImplementedError() from exception
112112
return Result(
113+
code=self.code,
113114
method_name=name,
114115
benchmark_name=self.name,
115116
mean_avg_precision=mean_avg_precision,
@@ -139,13 +140,15 @@ def _validate_predictions(self, name: str, predictions: dict) -> dict:
139140
class Result:
140141
"""Benchmark result."""
141142

143+
code: str
142144
method_name: str
143145
benchmark_name: str
144146
root_mean_squared_error: float = float("nan")
145147
mean_avg_precision: float = float("nan")
146148
benchmark_version: str = __version__
147149

148150
_export_mapping = dict(
151+
code="code",
149152
benchmark_name="benchmark",
150153
method_name="method",
151154
benchmark_version="version",

‎deeplabcut/benchmark/benchmarks.py‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,16 @@ def compute_pose_map(self, results_objects):
9696
symmetric_kpts=[(0, 4), (1, 3)],
9797
)
9898

99+
def _validate_predictions(self, name: str, predictions: dict) -> dict:
100+
"""Fixes filenames for predictions made on old versions of the dataset"""
101+
return super()._validate_predictions(
102+
name,
103+
{
104+
k.replace("Dummy", "D").replace("Dead pup", "DP"): v
105+
for k, v in predictions.items()
106+
},
107+
)
108+
99109

100110
class MarmosetBenchmark(deeplabcut.benchmark.base.Benchmark):
101111
"""Dataset with two marmosets.

0 commit comments

Comments
 (0)