microsoft / DynamicHead

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

how to change dataset

libingDY opened this issue · comments

I want to know how to change my dataset. Can you tell me where to modify it? I've changed the dataset to coco format

When loading cfg, you can register your dataset like this. In function : train_net.py -> def setup(args)

img_path_train = "your/dataset/path"
json_path_train = "annotation/file/path"
register_coco_instances("dataset_name", {}, json_path_train, img_path_train)

And put it into cfg parameters:

cfg.DATASETS.TRAIN = ("dataset_name",)

So is val set.

I also want to ask, what should I write about the "dataset_name"? Can you explain it in detail? It would be better if you could give me an example. Do you need to add the data set path of the test.thank you very much.

dataset_name is a name defined by yourself, it can be any string you like. You just register you dataset for this name, and then in cfg.DATASET.TRAIN , program can identify dataset by that name, just like above codes.
eg. register_coco_instances("food_data_train", {}, json_path_train, img_path_train)
And for Test data, you follow the same register rules, and set cfg.DATASET.TEST=("food_data_val",)

Thank you very much for helping me answer my questions. Then I met the following questions. How can I solve them? Thank you.
'NameError: name 'register_coco_instances' is not defined'

from detectron2.data.datasets import register_coco_instances
and you should change cfg.MODEL.ROI_HEADS.NUM_CLASSEES or cfg.MODEL.ATSS.NUM_CLASSES to your dataset's foreground classes number

@XiaoyuWant Hi! I wanted to use Dynamic Head for classification problem. After passing images through a backbone and then Dynamic Head, we will have output as B,L,S,C where S = median H * median W. So should one apply adaptive avg pool and then some linear layers or one should first come back to generic dimensions like B, C, H, W? I mean should one reshape the output from Dynamic Heads (B, L, S, C) as B, L * C, H, W ? Thank you!

from detectron2.data.datasets import register_coco_instances and you should change cfg.MODEL.ROI_HEADS.NUM_CLASSEES or cfg.MODEL.ATSS.NUM_CLASSES to your dataset's foreground classes number
some one say ,if your class id strart from 1 in json, NUM_CLASSEES+1 , and 0 is the background. But coco if from 1,but NUM_CLASSEES=80? if I should set the class id from 1? or from 0?