yolact icon indicating copy to clipboard operation
yolact copied to clipboard

The way `--output_coco_json` works right now is it operates on a dataset (which doesn't need to have ground truth). So you need to give a `--dataset` parameter instead of an `--image` parameter. The dataset you use doesn't need annotations, simply create a COCO dataset with just images and an empty annotation array and follow the dataset definition of `coco2017_testdev_dataset`.

Open linyingyingkarina opened this issue 3 years ago • 23 comments

Hi, thanks for your code. it works well with my dataset. But I have a problem of outputting the json file of eval.py. I have create a json file with empty annotation based on the test image (more than one), so I used this json file on the coco2017_testdev_dataset, but it did not give a path for imaging, just path for json file. I think I did not really understand how I can use --dataset, can u explain more?? thanks a lot.

The way --output_coco_json works right now is it operates on a dataset (which doesn't need to have ground truth). So you need to give a --dataset parameter instead of an --image parameter. The dataset you use doesn't need annotations, simply create a COCO dataset with just images and an empty annotation array and follow the dataset definition of coco2017_testdev_dataset.

For single images, this is kind of cumbersome, but for large batches it probably works fine? This feature was intended for submission to the COCO eval servers so that's why it's so roundabout. Let me know if this is indeed too cumbersome, and I can add --output_coco_json support to --image.

Originally posted by @dbolya in https://github.com/dbolya/yolact/issues/230#issuecomment-560542964

linyingyingkarina avatar Mar 29 '21 14:03 linyingyingkarina

Hi @dbolya ,

Same here, is there a way to get a single json file (COCO format) per image as output of the inference?

Thank you :)

piseabhijeet avatar Apr 10 '21 04:04 piseabhijeet

Hi @PL-96, @linyingyingkarina

I could use the dataset parameter as suggested and it gave me two files: mask_detections.json bbox_detections.json

How can i get single file per image from these two files? Do i use coco2labelme.py for this?

piseabhijeet avatar Apr 20 '21 13:04 piseabhijeet

Here is my eval command:

python eval.py --trained_model=weights/yolact_base_540_20000.pth --score_threshold=0.6 --top_k=50 --dataset=my_custom_dataset --output_coco_json

piseabhijeet avatar Apr 20 '21 13:04 piseabhijeet

Hi @PL-96,

I am getting the segmentation in encoded format: image

Is there a way to deal with it?

piseabhijeet avatar Apr 20 '21 13:04 piseabhijeet

You want to get image file from json file? you may get some help from #536

PL-96 avatar Apr 21 '21 02:04 PL-96

Hi @PL-96

No, here is what i want to do:

Manual annotation - drawing polygons is a painful task. I have trained the YOLACT model on few images and it is predicting good polygons on the remaining. However the categories are false, so i need to open the annotations in labelme and correct the labels. Once the labels are corrected, i will retrain the model on the additional images (now i will have many images to train).

For this purpose, i need the 'eval.py' to output single json file for each image (i know we can add --dataset parameter to get a single json - but that is one file for the entire dataset, i need per image)

Thanks

piseabhijeet avatar Apr 21 '21 04:04 piseabhijeet

Hi @PL-96

No, here is what i want to do:

Manual annotation - drawing polygons is a painful task. I have trained the YOLACT model on few images and it is predicting good polygons on the remaining. However the categories are false, so i need to open the annotations in labelme and correct the labels. Once the labels are corrected, i will retrain the model on the additional images (now i will have many images to train).

For this purpose, i need the 'eval.py' to output single json file for each image (i know we can add --dataset parameter to get a single json - but that is one file for the entire dataset, i need per image)

Thanks

hi, can I know how u generate my_custom_dataset to meet the demand of the dataset parameter?

linyingyingkarina avatar Apr 24 '21 05:04 linyingyingkarina

Hi @linyingyingkarina

I am generating mask images , drawing polygons on it and converting to MSCOCO format.

piseabhijeet avatar Apr 24 '21 06:04 piseabhijeet

Hi @linyingyingkarina

I am generating mask images , drawing polygons on it and converting to MSCOCO format.

but I think the testing dataset do not need mask images, do it ?? thx.

linyingyingkarina avatar Apr 24 '21 06:04 linyingyingkarina

Using masks, i am generating the polygons and then dumping into the json format which yolact requires.

piseabhijeet avatar Apr 24 '21 07:04 piseabhijeet

Hi @piseabhijeet

Sorry I don't know how to generate single json. But maybe you can write python script to extract per image information from the entire folder json file. In my thought, output json ->mask->coco may work. If you have solved the problem, please let me konw how. thanks

PL-96 avatar Apr 24 '21 08:04 PL-96

Hi @PL-96 No, here is what i want to do: Manual annotation - drawing polygons is a painful task. I have trained the YOLACT model on few images and it is predicting good polygons on the remaining. However the categories are false, so i need to open the annotations in labelme and correct the labels. Once the labels are corrected, i will retrain the model on the additional images (now i will have many images to train). For this purpose, i need the 'eval.py' to output single json file for each image (i know we can add --dataset parameter to get a single json - but that is one file for the entire dataset, i need per image) Thanks

hi, can I know how u generate my_custom_dataset to meet the demand of the dataset parameter?

the same as coco2017_testdev_dataset, and set 'has_gt' to False.

PL-96 avatar Apr 24 '21 08:04 PL-96

Hi @PL-96

Thank you for the prompt response. Sure will do.

piseabhijeet avatar Apr 24 '21 08:04 piseabhijeet

Hi @PL-96 No, here is what i want to do: Manual annotation - drawing polygons is a painful task. I have trained the YOLACT model on few images and it is predicting good polygons on the remaining. However the categories are false, so i need to open the annotations in labelme and correct the labels. Once the labels are corrected, i will retrain the model on the additional images (now i will have many images to train). For this purpose, i need the 'eval.py' to output single json file for each image (i know we can add --dataset parameter to get a single json - but that is one file for the entire dataset, i need per image) Thanks

hi, can I know how u generate my_custom_dataset to meet the demand of the dataset parameter?

the same as coco2017_testdev_dataset, and set 'has_gt' to False. 截屏2021-04-24 下午5 12 44

linyingyingkarina avatar Apr 24 '21 09:04 linyingyingkarina

Hi @PL-96 No, here is what i want to do: Manual annotation - drawing polygons is a painful task. I have trained the YOLACT model on few images and it is predicting good polygons on the remaining. However the categories are false, so i need to open the annotations in labelme and correct the labels. Once the labels are corrected, i will retrain the model on the additional images (now i will have many images to train). For this purpose, i need the 'eval.py' to output single json file for each image (i know we can add --dataset parameter to get a single json - but that is one file for the entire dataset, i need per image) Thanks

hi, can I know how u generate my_custom_dataset to meet the demand of the dataset parameter?

the same as coco2017_testdev_dataset, and set 'has_gt' to False.

截屏2021-04-24 下午5 12 44

I added the image path

PL-96 avatar Apr 24 '21 11:04 PL-96

Hi @PL-96 No, here is what i want to do: Manual annotation - drawing polygons is a painful task. I have trained the YOLACT model on few images and it is predicting good polygons on the remaining. However the categories are false, so i need to open the annotations in labelme and correct the labels. Once the labels are corrected, i will retrain the model on the additional images (now i will have many images to train). For this purpose, i need the 'eval.py' to output single json file for each image (i know we can add --dataset parameter to get a single json - but that is one file for the entire dataset, i need per image) Thanks

hi, can I know how u generate my_custom_dataset to meet the demand of the dataset parameter?

the same as coco2017_testdev_dataset, and set 'has_gt' to False.

截屏2021-04-24 下午5 12 44

I added the image path

thanks, I did so. but the output json file had way more bbox information than the image show. the image prediction only show 5 bbox. but in the json file there is 100. do u know why?? the mask json file had same problem

linyingyingkarina avatar May 06 '21 08:05 linyingyingkarina

@piseabhijeet Hi. Thanks sharing your tip. Do you know that generating .json file from my_image.png ? I typed python eval.py --trained_model=weights/yolact_base_540_20000.pth --score_threshold=0.6 --top_k=50 --dataset=my_custom_dataset --output_coco_json but show me NameError: name 'my_image' is not defined.. Can you help me? I hope to make json files from my images dataset.. and I will convert output_json to labelme json style then read and modify it on labelme

7eta avatar May 10 '21 07:05 7eta

Hi @PL-96, @linyingyingkarina

I could use the dataset parameter as suggested and it gave me two files: mask_detections.json bbox_detections.json

How can i get single file per image from these two files? Do i use coco2labelme.py for this?

What does it mean by empty annotation array? Could you please explain.

Resham-Sundar avatar Aug 16 '21 16:08 Resham-Sundar

Hi @PL-96, @linyingyingkarina I could use the dataset parameter as suggested and it gave me two files: mask_detections.json bbox_detections.json How can i get single file per image from these two files? Do i use coco2labelme.py for this?

What does it mean by empty annotation array? Could you please explain. Did you find the answer?

qiumei1101 avatar Aug 17 '21 05:08 qiumei1101

Hi @PL-96, @linyingyingkarina I could use the dataset parameter as suggested and it gave me two files: mask_detections.json bbox_detections.json How can i get single file per image from these two files? Do i use coco2labelme.py for this?

What does it mean by empty annotation array? Could you please explain. Did you find the answer?

Did not receive any answer

Resham-Sundar avatar Aug 17 '21 05:08 Resham-Sundar

Hi @PL-96, @linyingyingkarina I could use the dataset parameter as suggested and it gave me two files: mask_detections.json bbox_detections.json How can i get single file per image from these two files? Do i use coco2labelme.py for this?

What does it mean by empty annotation array? Could you please explain. Did you find the answer?

Did not receive any answer

thanks for replying, I create an empty json file; image but I get the error: image if you know how to solve this issue, please share;

I'm facing the same error, Could somebody help.

Resham-Sundar avatar Aug 17 '21 06:08 Resham-Sundar

Hi @PL-96, @linyingyingkarina I could use the dataset parameter as suggested and it gave me two files: mask_detections.json bbox_detections.json How can i get single file per image from these two files? Do i use coco2labelme.py for this?

What does it mean by empty annotation array? Could you please explain. Did you find the answer?

Did not receive any answer

thanks for replying, I create an empty json file; image but I get the error: image if you know how to solve this issue, please share;

I'm facing the same error, Could somebody help.

I modified the code and get the json file now.

qiumei1101 avatar Aug 20 '21 14:08 qiumei1101

Hi @PL-96,

I am getting the segmentation in encoded format: image

Is there a way to deal with it?

I'm currently facing a similar issue, Did you find a solution for the encoded format ?

takwaaa avatar Jun 13 '22 13:06 takwaaa