@dbolya Thanks for the source code , i just wanted to write all the predicted boxes and mask area into a json file similar to the input json file which we are giving while training . I see in your code u have made this accomodation for the validation set , how can i use this for the test set
Simply specify the dataset parameter: --dataset=x. For the COCO test set, I already have that set up as coco2017_testdev_dataset, so the command you would want is
python (...) --dataset=coco2017_testdev_dataset --output_coco_json
Then if you have a test set for your own custom dataset, look at how I made coco2017_testdev_dataset in data/config.py. Just make sure you set 'has_gt' to false.
thanks for response but when i perform this , i get encode values in json for the segmented mask
You mean you want a polygon segmentation out? Converting a 2d tensor to a polygon is a pretty hard task so you'll have to implement that yourself if you want that.
The output format of the segmentation is COCO's RLE format. I'll quote an explanation of the format I made in another thread:
All it is is an array with alternating numbers of 0's and 1's. So [10, 20, 30] would be 10 0's followed by 20 1's then followed again by 30 0's finally reshaped into the saved size, though coco does some extra compression on top of this.
Is it possible for you to just use this format? You can use pycocotools to convert RLE's back into a 2d tensor. I was also able to pretty easily implement this decoding function in Javascript you can find here if you want that.
@dbolya yes i wanted the polygon output of the segmentation . I shall try to use the pycocotools to convert the format , since i require the functionality output to be in polygon form
Ah, I meant use pycocotools to convert it back into a 2d tensor (it won't convert it into a polygon). What you're asking for is probably impossible to do losslessly (esp. for very concave / separated shapes) and it would slow down the network, which is why I haven't implemented that.
If you really need polygon masks, you can try something like this, though it might break in some difficult cases.
sure i shall try the link suggested , i need to perform this offline so i am wokay with slowing of the network
Since this has been open so long, I'm going to close it. Feel free to reopen if you have any updates.
@abhigoku10
Did you managed to get the json file? I also need the json output for evaluatio in image
Curremtly I am using python eval.py --trained_model=weights/yolact_base_54_800000.pth --score_threshold=0.15 --top_k=15 --image=my_image.png and want to get the output json file containing the polygons.
@shahabe i have got the file into the json then converted using pycoco tools , just see the authors comment same thing i followed
Most helpful comment
@shahabe i have got the file into the json then converted using pycoco tools , just see the authors comment same thing i followed