File tree Expand file tree Collapse file tree 2 files changed +10
-13
lines changed Expand file tree Collapse file tree 2 files changed +10
-13
lines changed Original file line number Diff line number Diff line change @@ -268,25 +268,22 @@ def __retrieve_bounding_boxes(self, index):
268268 "labels" : True
269269 }
270270 }]
271-
271+ uniqueid_str = str (uniqueid )
272+ self .images_bboxes [uniqueid_str ] = {}
272273 try :
273274 res , images = self .db_connector .query (query )
274-
275275 bboxes = []
276276 tags = []
277- for bbox in res [1 ]["FindBoundingBox" ]["entities" ]:
278- bboxes .append (bbox ["_coordinates" ])
279- tags .append (bbox [self .bbox_label_prop ])
280-
281- uniqueid_str = str (uniqueid )
282- self .images_bboxes [uniqueid_str ] = {}
277+ if "entities" in res [1 ]["FindBoundingBox" ]:
278+ for bbox in res [1 ]["FindBoundingBox" ]["entities" ]:
279+ bboxes .append (bbox ["_coordinates" ])
280+ tags .append (bbox [self .bbox_label_prop ])
281+ except :
282+ logger .warn (f"Cannot retrieve bounding boxes for image { uniqueid } " )
283+ finally :
283284 self .images_bboxes [uniqueid_str ]["bboxes" ] = bboxes
284285 self .images_bboxes [uniqueid_str ]["tags" ] = tags
285286
286- except :
287- print (self .db_connector .get_last_response_str ())
288- raise
289-
290287 def total_results (self ) -> int :
291288 """
292289 **Returns the total number of images that matched the query**
Original file line number Diff line number Diff line change 77
88logger = logging .getLogger (__name__ )
99
10- __version__ = "0.4.14 "
10+ __version__ = "0.4.15 "
1111
1212# set log level
1313logger .setLevel (logging .DEBUG )
You can’t perform that action at this time.
0 commit comments