33__generated_with = "0.23.8"
44app = marimo .App ()
55
6- with app .setup :
6+ async with app .setup :
77 import io
88 import sys
99 import os
@@ -22,7 +22,7 @@ def _object_count(mask: np.ndarray) -> int:
2222 n_objects = len (uniques )
2323 if 0 in uniques : # 0 = background by convention; not counted
2424 n_objects -= 1
25-
25+
2626 return n_objects
2727
2828
@@ -33,7 +33,7 @@ def object_count_score(gtruth_mask: np.ndarray, submission_mask: np.ndarray) ->
3333 n_gt = _object_count (gtruth_mask )
3434 n_sub = _object_count (submission_mask )
3535 count_score = np .abs (n_gt - n_sub ) / n_gt
36-
36+
3737 return 1 - count_score
3838
3939
@@ -45,7 +45,7 @@ def binary_iou_score(gtruth_mask: np.ndarray, submission_mask: np.ndarray) -> fl
4545 binary_sub = submission_mask > 0
4646 intersection = np .logical_and (binary_gt , binary_sub ).sum ()
4747 union = np .logical_or (binary_gt , binary_sub ).sum ()
48-
48+
4949 return intersection / union
5050
5151
@@ -54,10 +54,13 @@ def binary_iou_score(gtruth_mask: np.ndarray, submission_mask: np.ndarray) -> fl
5454 ground_truths_path = public_folder_path / "Ground_Truths"
5555
5656 if "pyodide" in sys .modules :
57+ import micropip
58+ await micropip .install ("tifffile" )
59+
5760 if not public_folder_path .exists ():
5861 # Download and unzip the public folder from the repository
5962 zip_path = Path ("public.zip" )
60- url = mo . notebook_location () / " public.zip"
63+ url = "https://raw.githubusercontent.com/EPFL-Center-for-Imaging/segmentation-challenge/main/ public.zip"
6164 r = requests .get (str (url ))
6265 r .raise_for_status ()
6366 zip_path .write_bytes (r .content )
0 commit comments