From 9dd27213e4c22f7acbfc94318947db7042cb0a1b Mon Sep 17 00:00:00 2001 From: Christopher Rhodes <christopher.rhodes@embl.de> Date: Mon, 30 Oct 2023 11:03:32 +0100 Subject: [PATCH] Wrong key name, needed to delete tree from ObjectClassification group --- .../examples/test_modify_object_classifier.py | 2 +- ...nsfer_labels_to_ilastik_object_classifier.py | 17 +++++++++-------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/extensions/chaeo/examples/test_modify_object_classifier.py b/extensions/chaeo/examples/test_modify_object_classifier.py index 11ac90e7..1c5343e5 100644 --- a/extensions/chaeo/examples/test_modify_object_classifier.py +++ b/extensions/chaeo/examples/test_modify_object_classifier.py @@ -19,7 +19,7 @@ def modify_ilastik_object_classifier(template_ilp: Path, lane: int = 0): # delete ObjectClassification/ClassifierForests keys_to_delete = [ f'ObjectExtraction/RegionFeatures/{lane:04d}', - 'ObjectExtraction/ClassifierForests' + 'ObjectClassification/ClassifierForests' ] for key in keys_to_delete: if key in h5.keys(): diff --git a/extensions/chaeo/examples/transfer_labels_to_ilastik_object_classifier.py b/extensions/chaeo/examples/transfer_labels_to_ilastik_object_classifier.py index d723ee7a..78418b8b 100644 --- a/extensions/chaeo/examples/transfer_labels_to_ilastik_object_classifier.py +++ b/extensions/chaeo/examples/transfer_labels_to_ilastik_object_classifier.py @@ -114,6 +114,7 @@ def generate_ilastik_object_classifier( return new_ilp + def compare_object_maps(truth: GenericImageDataAccessor, inferred: GenericImageDataAccessor) -> pd.DataFrame: """ Compare two object maps to assess classification results @@ -150,16 +151,16 @@ def compare_object_maps(truth: GenericImageDataAccessor, inferred: GenericImageD if __name__ == '__main__': root = Path('c:/Users/rhodes/projects/proj0011-plankton-seg/') template_ilp = root / 'exp0014/template_obj.ilp' - where_patch_stack = root / 'exp0009/output/labeled_patches-20231030-0001' + where_patch_stack = root / 'exp0009/output/labeled_patches-20231030-0002' # auto-populate an object classifier - # auto_ilp = generate_ilastik_object_classifier( - # template_ilp, - # where_patch_stack, - # stack_name='train', - # proj_name='auto_obj_before' - # ) - auto_ilp = 'auto_obj_before.ilp' + auto_ilp = generate_ilastik_object_classifier( + template_ilp, + where_patch_stack, + stack_name='train', + proj_name='auto_obj_before' + ) + # auto_ilp = 'auto_obj_before.ilp' def infer_and_compare_training_set(ilp, suffix): # infer object labels from the same data used to train the classifier -- GitLab