mmdetection icon indicating copy to clipboard operation
mmdetection copied to clipboard

Running inference on subset of Coco

Open eregen opened this issue 3 years ago • 3 comments

I'm trying to run inference on 100 images selected from the COCO validation set, instead of the whole thing. I want to do example 6 in https://mmdetection.readthedocs.io/en/latest/1_exist_data_model.html

but only for 100 images in the 'person' category. I have the 100 images in its own directory and an annotation .json for those 100. How do I point the inference to that directory to produce instance segmentation results and output into an .json?

eregen avatar Jul 27 '22 17:07 eregen

Sorry for didn't get your questions. If you have a new coco style dataset, you can directly use CocoDataset and set the ann_file to your local dir. For outputting results, you can use CocoDataset.format_results

jbwang1997 avatar Jul 29 '22 15:07 jbwang1997

It's not a new dataset, it's a subset of COCO val dataset. I want to make coarse segmentation results for post-processing. How do I use CocoDataset.format_results in the shell? Do I modify the config file or call CocoDataset in the command line?

eregen avatar Aug 01 '22 17:08 eregen

If your dataset is a subclass of CocoDataset, you can add --format-only after the command line to call the function.

jbwang1997 avatar Aug 04 '22 00:08 jbwang1997

You need to create a JSON that only contain 100 images for now. In MMDet 3.x, you can set indices=100 with CLASSES=('person', ) to only load data of person and use the first 100 images.

ZwwWayne avatar Nov 30 '22 06:11 ZwwWayne