Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to change dataset #20

Open
libingDY opened this issue Nov 15, 2021 · 7 comments
Open

how to change dataset #20

libingDY opened this issue Nov 15, 2021 · 7 comments

Comments

@libingDY
Copy link

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

@XiaoyuWant
Copy link

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.

@libingDY
Copy link
Author

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.

@XiaoyuWant
Copy link

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",)

@libingDY
Copy link
Author

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'

@XiaoyuWant
Copy link

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

@sourabh-patil
Copy link

@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!

@special-yang
Copy link

special-yang commented Feb 17, 2022

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants