Output COCO-style JSON Annotation for single images in eval.py
See original GitHub issueHi @dbolya,
thank you for this great piece of software. I already used it, to generate images with drawn masks using the inference script eval.py
on single images and folders. This worked fine. Now after getting the images, i wanted to programmatically use the inference results, which is why i would need a coco style json file instead of an png as an output.
I already saw there is the args.output_coco_json
parameter, but looking at the code, it seems to only work when evaluating whole datasets (with ground truth available?) and not for single images or folders of single images, without annotations.
What i would like to do, is calling eval.py similar to this:
--config=yolact_base_config
--trained_model=weights/yolact_base_54_800000.pth
--output_coco_json
--bbox_det_file=myimage.bbox.json
--mask_det_file=myimage.mask.json
--score_threshold=0.2 --top_k=15
--image=myimage.png:myimage_out.png
(with only myimage.png
, yolact_base_config
and weights/yolact_base_54_800000.pth
already existing.)
i also tried putting the following additional parameters into the arguments:
--mask_proto_debug
--dataset=coco2017_testdev_dataset
but they did not help, as the coco style dumping function in eval.py (https://github.com/dbolya/yolact/blob/02bde378e98cd7e2831639ff782c1f5a5046771a/eval.py#L960) does not get executed when --image
is set (see https://github.com/dbolya/yolact/blob/02bde378e98cd7e2831639ff782c1f5a5046771a/eval.py#L855).
Is there any other way i can use arguments to reveice a coco style json file with annotations for a single image or a folder of images? If not, please regard this as a feature request 😃 Kind Regards Alexander
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (1 by maintainers)
Top GitHub Comments
It’s too cumbersome, please add
json
output to--image
use 😉(I’ve created my own dataset, but
if target.shape[0] == 0:
is failing, as target =[]
. What am I doing wrong?)I followed the steps and I could use the dataset parameter as suggested , but now i have 2 questions: After running the script eval.py as follows :
python eval.py --trained_model=weights/yolact_plus_resnet50_generated_dwg_3599_360000.pth --config yolact_resnet50_generated_dwg_config --output_coco_json --score_threshold=0.1 --top_k=30 --dataset=generated_Test_datasetfiles
as an output i got two files under results/ :
Is this the correct output ? isn’t there a way that i could find all the resulted annotations of the tested dataset in one single file rather than being divided in Two files ? ( all the annotations results (bbox and segmentation) would be written in the empty annotation array of the annotations.json file of the custom test dataset ) ?
I am getting the segmentation in encoded format:
Why is that ? and is there a way to deal with it?
Thanks,