diff --git a/preprocessors/depth-map-gen/depth-map-generator.py b/preprocessors/depth-map-gen/depth-map-generator.py index bda8d634..972cffac 100644 --- a/preprocessors/depth-map-gen/depth-map-generator.py +++ b/preprocessors/depth-map-gen/depth-map-generator.py @@ -103,8 +103,8 @@ def depthgenerator(): classifier_1 = "ca.mcgill.a11y.image.preprocessor.contentCategoriser" if classifier_1 in preprocess_output: classifier_1_output = preprocess_output[classifier_1] - classifier_1_label = classifier_1_output.get("category", "") - if classifier_1_label != "photograph": + categoriser_tags = classifier_1_output["categories"] + if not categoriser_tags["photo"]: logging.info("Not photograph content. Skipping...") return "", 204 else: diff --git a/preprocessors/graphic-tagger/azure_api.py b/preprocessors/graphic-tagger/azure_api.py index 3632c243..48c433f7 100644 --- a/preprocessors/graphic-tagger/azure_api.py +++ b/preprocessors/graphic-tagger/azure_api.py @@ -139,9 +139,8 @@ def categorise(): if content_classifier in preprocess_output: content_classifier_output = \ preprocess_output[content_classifier] - content_label = \ - content_classifier_output["category"] - if content_label == "photograph": + categoriser_tags = content_classifier_output["categories"] + if categoriser_tags["photo"]: source = content["graphic"] image_b64 = source.split(",")[1] binary = base64.b64decode(image_b64) diff --git a/preprocessors/mmsemseg/segment.py b/preprocessors/mmsemseg/segment.py index 7e41d1be..a089293a 100644 --- a/preprocessors/mmsemseg/segment.py +++ b/preprocessors/mmsemseg/segment.py @@ -161,8 +161,9 @@ def segment(): # if the architecture is modified appropriately if classifier_1 in preprocess_output: classifier_1_output = preprocess_output[classifier_1] - classifier_1_label = classifier_1_output["category"] - if classifier_1_label != "photograph": + categoriser_tags = classifier_1_output["categories"] + + if not categoriser_tags["photo"]: logging.info("Not photograph content. Skipping...") return "", 204 if classifier_2 in preprocess_output: diff --git a/preprocessors/object-detection-azure/objdetect.py b/preprocessors/object-detection-azure/objdetect.py index 2ebc1035..6e541890 100644 --- a/preprocessors/object-detection-azure/objdetect.py +++ b/preprocessors/object-detection-azure/objdetect.py @@ -137,9 +137,9 @@ def categorise(): if content_classifier in preprocess_output: content_classifier_output = \ preprocess_output[content_classifier] - content_label = \ - content_classifier_output["category"] - if content_label == "photograph": + content_tags = \ + content_classifier_output["categories"] + if content_tags["photo"]: source = content["graphic"] image_b64 = source.split(",")[1] binary = base64.b64decode(image_b64)