MCPcopy
hub / github.com/dbolya/yolact / add_bbox

Method add_bbox

eval.py:306–318  ·  view source on GitHub ↗

Note that bbox should be a list or tuple of (x1, y1, x2, y2)

(self, image_id:int, category_id:int, bbox:list, score:float)

Source from the content-addressed store, hash-verified

304 self.mask_data = []
305
306 def add_bbox(self, image_id:int, category_id:int, bbox:list, score:float):
307 """ Note that bbox should be a list or tuple of (x1, y1, x2, y2) """
308 bbox = [bbox[0], bbox[1], bbox[2]-bbox[0], bbox[3]-bbox[1]]
309
310 # Round to the nearest 10th to avoid huge file sizes, as COCO suggests
311 bbox = [round(float(x)*10)/10 for x in bbox]
312
313 self.bbox_data.append({
314 'image_id': int(image_id),
315 'category_id': get_coco_cat(int(category_id)),
316 'bbox': bbox,
317 'score': float(score)
318 })
319
320 def add_mask(self, image_id:int, category_id:int, segmentation:np.ndarray, score:float):
321 """ The segmentation should be the full mask, the size of the image and with size [h, w]. """

Callers 1

prep_metricsFunction · 0.80

Calls 2

get_coco_catFunction · 0.85
appendMethod · 0.80

Tested by

no test coverage detected