Skip to content

Commit 2fd78a1

Browse files
fix: content categoriser updates
1 parent 4ef6db4 commit 2fd78a1

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

preprocessors/depth-map-gen/depth-map-generator.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,8 @@ def depthgenerator():
103103
classifier_1 = "ca.mcgill.a11y.image.preprocessor.contentCategoriser"
104104
if classifier_1 in preprocess_output:
105105
classifier_1_output = preprocess_output[classifier_1]
106-
classifier_1_label = classifier_1_output.get("category", "")
107-
if classifier_1_label != "photograph":
106+
categoriser_tags = classifier_1_output["categories"]
107+
if not categoriser_tags["photo"]:
108108
logging.info("Not photograph content. Skipping...")
109109
return "", 204
110110
else:

preprocessors/graphic-tagger/azure_api.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,9 +139,8 @@ def categorise():
139139
if content_classifier in preprocess_output:
140140
content_classifier_output = \
141141
preprocess_output[content_classifier]
142-
content_label = \
143-
content_classifier_output["category"]
144-
if content_label == "photograph":
142+
categoriser_tags = content_classifier_output["categories"]
143+
if categoriser_tags["photo"]:
145144
source = content["graphic"]
146145
image_b64 = source.split(",")[1]
147146
binary = base64.b64decode(image_b64)

preprocessors/mmsemseg/segment.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,8 +161,9 @@ def segment():
161161
# if the architecture is modified appropriately
162162
if classifier_1 in preprocess_output:
163163
classifier_1_output = preprocess_output[classifier_1]
164-
classifier_1_label = classifier_1_output["category"]
165-
if classifier_1_label != "photograph":
164+
categoriser_tags = classifier_1_output["categories"]
165+
166+
if not categoriser_tags["photo"]:
166167
logging.info("Not photograph content. Skipping...")
167168
return "", 204
168169
if classifier_2 in preprocess_output:

preprocessors/object-detection-azure/objdetect.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,9 +137,9 @@ def categorise():
137137
if content_classifier in preprocess_output:
138138
content_classifier_output = \
139139
preprocess_output[content_classifier]
140-
content_label = \
141-
content_classifier_output["category"]
142-
if content_label == "photograph":
140+
content_tags = \
141+
content_classifier_output["categories"]
142+
if content_tags["photo"]:
143143
source = content["graphic"]
144144
image_b64 = source.split(",")[1]
145145
binary = base64.b64decode(image_b64)

0 commit comments

Comments
 (0)