@@ -117,7 +117,7 @@ def models():
117117 "vit_l_histopathology" : "xxh128:b591833c89754271023e901281dee3f2" ,
118118 "vit_h_histopathology" : "xxh128:bd1856dafc156a43fb3aa705f1a6e92e" ,
119119 # Medical Imaging models:
120- "vit_b_medical_imaging" : "xxh128:5be672f1458263a9edc9fd40d7f56ac1 " ,
120+ "vit_b_medical_imaging" : "xxh128:40169f1e3c03a4b67bff58249c176d92 " ,
121121 }
122122 # Additional decoders for instance segmentation.
123123 decoder_registry = {
@@ -133,6 +133,8 @@ def models():
133133 "vit_b_histopathology_decoder" : "xxh128:6a66194dcb6e36199cbee2214ecf7213" ,
134134 "vit_l_histopathology_decoder" : "xxh128:46aab7765d4400e039772d5a50b55c04" ,
135135 "vit_h_histopathology_decoder" : "xxh128:3ed9f87e46ad5e16935bd8d722c8dc47" ,
136+ # Medical Imaging models:
137+ "vit_b_medical_imaging_decoder" : "xxh128:9e498b12f526f119b96c88be76e3b2ed" ,
136138 }
137139 registry = {** encoder_registry , ** decoder_registry }
138140
@@ -150,7 +152,7 @@ def models():
150152 "vit_b_histopathology" : "https://owncloud.gwdg.de/index.php/s/sBB4H8CTmIoBZsQ/download" ,
151153 "vit_l_histopathology" : "https://owncloud.gwdg.de/index.php/s/IZgnn1cpBq2PHod/download" ,
152154 "vit_h_histopathology" : "https://owncloud.gwdg.de/index.php/s/L7AcvVz7DoWJ2RZ/download" ,
153- "vit_b_medical_imaging" : "https://owncloud.gwdg.de/index.php/s/AB69HGhj8wuozXQ /download" ,
155+ "vit_b_medical_imaging" : "https://owncloud.gwdg.de/index.php/s/f5Ol4FrjPQWfjUF /download" ,
154156 }
155157
156158 decoder_urls = {
@@ -163,6 +165,7 @@ def models():
163165 "vit_b_histopathology_decoder" : "https://owncloud.gwdg.de/index.php/s/KO9AWqynI7SFOBj/download" ,
164166 "vit_l_histopathology_decoder" : "https://owncloud.gwdg.de/index.php/s/oIs6VSmkOp7XrKF/download" ,
165167 "vit_h_histopathology_decoder" : "https://owncloud.gwdg.de/index.php/s/1qAKxy5H0jgwZvM/download" ,
168+ "vit_b_medical_imaging_decoder" : "https://owncloud.gwdg.de/index.php/s/ahd3ZhZl2e0RIwz/download" ,
166169 }
167170 urls = {** encoder_urls , ** decoder_urls }
168171
@@ -1312,16 +1315,44 @@ def micro_sam_info():
13121315 )
13131316 )
13141317
1318+ # Creating a cache directory when users' run `micro_sam.info`.
1319+ cache_dir = get_cache_directory ()
1320+ os .makedirs (cache_dir , exist_ok = True )
1321+
13151322 # The cache directory panel.
13161323 console .print (
1317- Panel (f"[bold #009E73]Cache Directory:[/bold #009E73]\n { get_cache_directory () } " , title = "Cache Directory" )
1324+ Panel (f"[bold #009E73]Cache Directory:[/bold #009E73]\n { cache_dir } " , title = "Cache Directory" )
13181325 )
13191326
1320- # The available models panel.
1321- available_models = list (get_model_names ())
1322- # We filter out the decoder models.
1323- available_models = [m for m in available_models if not m .endswith ("_decoder" )]
1327+ # We have a simple versioning logic here (which is what I'll follow here for mapping model versions).
1328+ available_models = []
1329+ for model_name , model_path in models ().urls .items (): # We filter out the decoder models.
1330+ if model_name .endswith ("decoder" ):
1331+ continue
1332+
1333+ if "https://dl.fbaipublicfiles.com/segment_anything/" in model_path : # Valid v1 SAM models.
1334+ available_models .append (model_name )
1335+
1336+ if "https://owncloud.gwdg.de/" in model_path : # Our own hosted models (in their v1 mode quite often)
1337+ if model_name == "vit_t" : # MobileSAM model.
1338+ available_models .append (model_name )
1339+ else :
1340+ available_models .append (f"{ model_name } (v1)" )
1341+
1342+ # Now for our models, the BioImageIO ModelZoo upload structure is such that:
1343+ # '/1/files' corresponds to v2 models.
1344+ # '/1.1/files' corresponds to v3 models.
1345+ # '/1.2/files' corresponds to v4 models.
1346+ if "/1/files" in model_path :
1347+ available_models .append (f"{ model_name } (v2)" )
1348+ if "/1.1/files" in model_path :
1349+ available_models .append (f"{ model_name } (v3)" )
1350+ if "/1.2/files" in model_path :
1351+ available_models .append (f"{ model_name } (v4)" )
1352+
13241353 model_list = "\n " .join (available_models )
1354+
1355+ # The available models panel.
13251356 console .print (
13261357 Panel (f"[bold #D55E00]Available Models:[/bold #D55E00]\n { model_list } " , title = "List of Supported Models" )
13271358 )
0 commit comments