Skip to content

Commit

Permalink
vqdang#133 UPD: fix tile format for metric
Browse files Browse the repository at this point in the history
  • Loading branch information
vqdang committed Jun 20, 2021
1 parent 9515afa commit a0f80c7
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
1 change: 1 addition & 0 deletions compute_stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
get_fast_dice_2,
get_fast_pq,
remap_label,
pair_coordinates
)


Expand Down
14 changes: 10 additions & 4 deletions infer/tile.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,11 +175,17 @@ def proc_callback(results):
"""
img_name, pred_map, pred_inst, inst_info_dict, overlaid_img = results

inst_type = [[k, v["type"]] for k, v in inst_info_dict.items()]
inst_type = np.array(inst_type)
nuc_val_list = list(inst_info_dict.values())
# need singleton to make matlab happy
nuc_uid_list = np.array(list(inst_info_dict.keys()))[:,None]
nuc_type_list = np.array([v["type"] for v in nuc_val_list])[:,None]
nuc_coms_list = np.array([v["centroid"] for v in nuc_val_list])

mat_dict = {
"inst_map": pred_inst,
"inst_type": inst_type,
"inst_map" : pred_inst,
"inst_uid" : nuc_uid_list,
"inst_type": nuc_type_list,
"inst_centroid": nuc_coms_list
}
if self.nr_types is None: # matlab does not have None type array
mat_dict.pop("inst_type", None)
Expand Down
1 change: 0 additions & 1 deletion metrics/stats_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,6 @@ def pair_coordinates(setA, setB, radius):
"""
# * Euclidean distance as the cost matrix
pair_distance = scipy.spatial.distance.cdist(setA, setB, metric='euclidean')
print(setA.shape, setB.shape)

# * Munkres pairing with scipy library
# the algorithm return (row indices, matched column indices)
Expand Down

0 comments on commit a0f80c7

Please sign in to comment.