1

I've been given a trained mask r-cnn model with .pth checkpoint file and .py config files, and I'm able to perform the object segmentation on a video using the general tutorial. https://mmdetection.readthedocs.io/en/latest/1_exist_data_model.html I'm trying to convert the result of the segmentation to coco format in json so I can insert it into my pipeline. To specify: I need the result of the inference detector to be transformed to a json file in coco format. Code from demo/video_demo from mmdetection github repo:demo_video.py script from tutorial

Result would be : enter image description here

I have found a possible solution here: https://mmdetection.readthedocs.io/en/latest/api.html#module-mmdet.datasets . where the results2json function would dump the result of the segmentation (+ bbox etc.) to a coco json file but I should be making an instance of a CocoDataset to use this function. I don't have a json file with annotations, let alone a pipline? (check the arguments to create one).

How could I still generate the coco format json file using the results of the segmentation? Thanks in advance.

Svekke
  • 53
  • 5

1 Answers1

0

You can easily build the dataset by

dataset = build_dataset(cfg.data.test) 

While building the cfg you can insert how the test pipeline and config will work.

Check here for the content witthin cfg.data.test

Then you can use the dataset.result2json(result) to get the annotations in json format.

JACK
  • 414
  • 1
  • 5
  • 15