hard target matching removed from check_mask_stats
Browse files
inference_utils/output_processing.py
CHANGED
@@ -11,15 +11,15 @@ def check_mask_stats(img, mask, modality_type, target):
|
|
11 |
# modality_type: str, see target_dist.json for the list of modality types
|
12 |
# target: str, see target_dist.json for the list of targets
|
13 |
|
14 |
-
|
15 |
-
|
16 |
target_dist = json.load(open("inference_utils/target_dist.json"))
|
17 |
|
18 |
-
|
19 |
-
|
20 |
|
21 |
-
|
22 |
-
|
23 |
|
24 |
ms = mask_stats(mask, img)
|
25 |
|
|
|
11 |
# modality_type: str, see target_dist.json for the list of modality types
|
12 |
# target: str, see target_dist.json for the list of targets
|
13 |
|
14 |
+
huggingface_hub.hf_hub_download('microsoft/BiomedParse', filename='target_dist.json', local_dir='./inference_utils')
|
15 |
+
huggingface_hub.hf_hub_download('microsoft/BiomedParse', filename="config.yaml", local_dir="./configs")
|
16 |
target_dist = json.load(open("inference_utils/target_dist.json"))
|
17 |
|
18 |
+
if modality_type not in target_dist:
|
19 |
+
raise ValueError(f"Currently support modality types: {list(target_dist.keys())}")
|
20 |
|
21 |
+
if target not in target_dist[modality_type]:
|
22 |
+
raise ValueError(f"Currently support targets for {modality_type}: {list(target_dist[modality_type].keys())}")
|
23 |
|
24 |
ms = mask_stats(mask, img)
|
25 |
|