Skip to content

Commit ed0acba

Browse files
committed
Added LNK, BIO and OP scores. Made code fresh such that pylint stops barking
1 parent 65f41f1 commit ed0acba

File tree

3 files changed

+11
-13
lines changed

3 files changed

+11
-13
lines changed

ctc_metrics/metrics/biological/bio.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -35,5 +35,5 @@ def bio(
3535
total_metrics += 1
3636
else:
3737
cca = 0
38-
bio = (ct + tf + bc + cca) / total_metrics
39-
return bio
38+
metric = (ct + tf + bc + cca) / total_metrics
39+
return metric

ctc_metrics/scripts/evaluate.py

+7-9
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import argparse
2-
import numpy as np
3-
from os.path import join, basename, exists
2+
from os.path import join, basename
43
from multiprocessing import Pool, cpu_count
4+
import numpy as np
55

66
from ctc_metrics.metrics import (
77
valid, det, seg, tra, ct, tf, bc, cca, op_ctb, op_csb, bio, op_clb, lnk
@@ -73,7 +73,7 @@ def load_data(
7373

7474
# Match golden truth tracking masks to result masks
7575
traj = {}
76-
is_valid = True
76+
is_valid = 0
7777
if trajectory_data:
7878
traj = match_computed_to_reference_masks(
7979
ref_tra_masks, comp_masks, threads=threads)
@@ -99,7 +99,6 @@ def calculate_metrics(
9999
ref_tracks: np.ndarray,
100100
traj: dict,
101101
segm: dict,
102-
comp_masks: list,
103102
metrics: list = None,
104103
is_valid: bool = None,
105104
): # pylint: disable=too-complex
@@ -111,7 +110,6 @@ def calculate_metrics(
111110
ref_tracks: The reference tracks result file.
112111
traj: The frame-wise trajectory match data.
113112
segm: The frame-wise segmentation match data.
114-
comp_masks: The computed masks.
115113
metrics: The metrics to evaluate.
116114
is_valid: A Flag if the results are valid
117115
@@ -186,7 +184,7 @@ def calculate_metrics(
186184
if "BIO(0)" in results and "LNK" in results:
187185
for i in range(4):
188186
results[f"OP_CLB({i})"] = op_clb(
189-
results[f"LNK"], results[f"BIO({i})"])
187+
results[f"LNK({i})"], results[f"BIO({i})"])
190188

191189
return results
192190

@@ -219,17 +217,17 @@ def evaluate_sequence(
219217
trajectory_data = True
220218
segmentation_data = True
221219

222-
if metrics == ["SEG"] or metrics == ["CCA"]:
220+
if metrics in (["SEG"], ["CCA"]):
223221
trajectory_data = False
224222

225223
if "SEG" not in metrics:
226224
segmentation_data = False
227225

228-
comp_tracks, ref_tracks, traj, segm, comp_masks, is_valid = load_data(
226+
comp_tracks, ref_tracks, traj, segm, _, is_valid = load_data(
229227
res, gt, trajectory_data, segmentation_data, threads)
230228

231229
results = calculate_metrics(
232-
comp_tracks, ref_tracks, traj, segm, comp_masks, metrics, is_valid)
230+
comp_tracks, ref_tracks, traj, segm, metrics, is_valid)
233231

234232
print("with results: ", results, " done!")
235233

ctc_metrics/scripts/validate.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ def validate_all(
6464
"""
6565
results = []
6666
ret = parse_directories(res_root, None)
67-
for res, gt, name in zip(*ret):
68-
results.append([name, validate_sequence(res, gt)])
67+
for res, _, name in zip(*ret):
68+
results.append([name, validate_sequence(res, threads)])
6969
return results
7070

7171

0 commit comments

Comments
 (0)