Closed scholltan closed 7 years ago
For one instance of an annotation:
from pycocotools import mask as maskUtils
import json
segmentation = maskUtils.encode(msk)
mskDic = {"image_id": int(image_id),
"category_id": category_id,
"segmentation": segmentation,
"score": float(score)}
with open('ouputFile.json', 'w') as json_file:
json.dump(mskDic, json_file)
for more loop through the annotations and create a list of annotations then do the dump
is that what you were asking?
The value corresponding to the key 'segmentation' in the minival json file is a list of floats, but the maskUtils.encode(msk)
returns a dictionary with keys 'counts' and 'size'. How to convert the dictionary into the segmentation list as in minival.json
@meetshah1995 Have you convert the segmentaion list as minival.json successfully?
how would you encode masks to uncompressed RLE for use when iscrowd=1?
I meet the same problem. I can't dump the compressed RLE in the JSON file
Hi, @vchiley,
Recently I use cocoapi to evaluate my results, but I do not how to get the "score" that comes from
mskDic = {"image_id": int(image_id), "category_id": category_id, "segmentation": segmentation, "score": float(score)}
. And my net does not output confidence or probability.
I am looking forward to your reply.
hi all, I want to know how to convert annotations of my own data into the RLE format (.json). thx