Skip to content

Commit de2371e

Browse files
author
Kévin Cortacero
authored
Update metrics.py
1 parent 537c65d commit de2371e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

cellpose/metrics.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,8 @@ def average_precision(masks_true, masks_pred, threshold=[0.5, 0.75, 0.9]):
118118
tp = np.zeros((len(masks_true), len(threshold)), np.float32)
119119
fp = np.zeros((len(masks_true), len(threshold)), np.float32)
120120
fn = np.zeros((len(masks_true), len(threshold)), np.float32)
121-
n_true = np.array(list(map(np.max, masks_true)))
122-
n_pred = np.array(list(map(np.max, masks_pred)))
121+
n_true = np.array([len(np.unique(mt)) - 1 for mt in masks_true])
122+
n_pred = np.array([len(np.unique(mp)) - 1 for mp in masks_pred])
123123

124124
for n in range(len(masks_true)):
125125
#_,mt = np.reshape(np.unique(masks_true[n], return_index=True), masks_pred[n].shape)

0 commit comments

Comments
 (0)