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

Method add_mask

eval.py:320–330  ·  view source on GitHub ↗

The segmentation should be the full mask, the size of the image and with size [h, w].

(self, image_id:int, category_id:int, segmentation:np.ndarray, score:float)

Source from the content-addressed store, hash-verified

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]. """
322 rle = pycocotools.mask.encode(np.asfortranarray(segmentation.astype(np.uint8)))
323 rle['counts'] = rle['counts'].decode('ascii') # json.dump doesn't like bytes strings
324
325 self.mask_data.append({
326 'image_id': int(image_id),
327 'category_id': get_coco_cat(int(category_id)),
328 'segmentation': rle,
329 'score': float(score)
330 })
331
332 def dump(self):
333 dump_arguments = [

Callers 1

prep_metricsFunction · 0.80

Calls 2

get_coco_catFunction · 0.85
appendMethod · 0.80

Tested by

no test coverage detected