|
11 | 11 | from matplotlib.collections import PatchCollection |
12 | 12 | from matplotlib.patches import Polygon |
13 | 13 |
|
| 14 | +from aperturedb import Status |
| 15 | + |
14 | 16 | class Constraints(object): |
15 | 17 |
|
16 | 18 | def __init__(self): |
@@ -88,7 +90,7 @@ def __init__(self, db, batch_size=100): |
88 | 90 | self.display_limit = 20 |
89 | 91 |
|
90 | 92 | self.img_id_prop = "_uniqueid" |
91 | | - self.bbox_label_prop = "label" |
| 93 | + self.bbox_label_prop = "_label" |
92 | 94 |
|
93 | 95 | def __retrieve_batch(self, index): |
94 | 96 |
|
@@ -152,15 +154,19 @@ def __get_bounding_boxes_polygons(self, index): |
152 | 154 | "blobs": False, |
153 | 155 | } |
154 | 156 | }, { |
155 | | - "FindEntity": { |
| 157 | + "FindBlob": { |
156 | 158 | "is_connected_to": { |
157 | 159 | "ref": 1 |
158 | 160 | }, |
| 161 | + "constraints": { |
| 162 | + "type": ["==", "segmentation"] |
| 163 | + }, |
159 | 164 | "blobs": True, |
160 | 165 | } |
161 | 166 | }] |
162 | 167 |
|
163 | 168 | res, polygons = self.db_connector.query(query) |
| 169 | + |
164 | 170 | ret_poly.append(polygons) |
165 | 171 |
|
166 | 172 | uniqueid_str = str(uniqueid) |
@@ -225,9 +231,7 @@ def __retrieve_bounding_boxes(self, index): |
225 | 231 | "_ref": 2, |
226 | 232 | "blobs": False, |
227 | 233 | "coordinates": True, |
228 | | - "results": { |
229 | | - "list": [self.bbox_label_prop], |
230 | | - } |
| 234 | + "labels": True, |
231 | 235 | } |
232 | 236 | }] |
233 | 237 |
|
@@ -458,18 +462,12 @@ def display(self, show_bboxes=False, show_segmentation=False, limit=None): |
458 | 462 |
|
459 | 463 | def get_props_names(self): |
460 | 464 |
|
461 | | - query = [ { |
462 | | - "GetSchema": { |
463 | | - "type" : "entities" |
464 | | - } |
465 | | - }] |
466 | | - |
467 | | - res, images = self.db_connector.query(query) |
| 465 | + status = Status.Status(self.db_connector) |
| 466 | + schema = status.get_schema() |
468 | 467 |
|
469 | 468 | try: |
470 | | - dictio = res[0]["FindImageInfo"]["entities"]["classes"][0]["_Image"] |
471 | | - search_key = "VD:" # TODO WHAT IS THIS? |
472 | | - props_array = [key for key, val in dictio.items() if not search_key in key] |
| 469 | + dictio = schema["entities"]["classes"]["_Image"]["properties"] |
| 470 | + props_array = [key for key, val in dictio.items()] |
473 | 471 | except: |
474 | 472 | props_array = [] |
475 | 473 | print("Cannot retrieve properties") |
|
0 commit comments