xingyizhou / CenterNet2

Two-stage CenterNet
Apache License 2.0
1.2k stars 188 forks source link

problem with registering custom dataset #22

Closed gauravlochab closed 3 years ago

gauravlochab commented 3 years ago

command Line Args: Namespace(config_file='/content/CenterNet2/projects/CenterNet2/configs/CenterNet2_R2-101-DCN-BiFPN_4x+4x_1560_ST.yaml', dist_url='tcp://127.0.0.1:23538', eval_only=False, machine_rank=0, manual_device='', num_gpus=1, num_machines=1, opts=[], resume=False) Config '/content/CenterNet2/projects/CenterNet2/configs/CenterNet2_R2-101-DCN-BiFPN_4x+4x_1560_ST.yaml' has no VERSION. Assuming it to be compatible with latest v2. Traceback (most recent call last): File "/content/CenterNet2/projects/CenterNet2/train_net.py", line 227, in args=(args,), File "/usr/local/lib/python3.7/dist-packages/detectron2/engine/launch.py", line 62, in launch main_func(*args) File "/content/CenterNet2/projects/CenterNet2/train_net.py", line 187, in main cfg = setup(args) File "/content/CenterNet2/projects/CenterNet2/train_net.py", line 175, in setup cfg.merge_from_file(args.config_file) File "/usr/local/lib/python3.7/dist-packages/detectron2/config/config.py", line 54, in merge_from_file self.merge_from_other_cfg(loaded_cfg) File "/usr/local/lib/python3.7/dist-packages/fvcore/common/config.py", line 123, in merge_from_other_cfg return super().merge_from_other_cfg(cfg_other) File "/usr/local/lib/python3.7/dist-packages/yacs/config.py", line 217, in merge_from_other_cfg _merge_a_into_b(cfg_other, self, self, []) File "/usr/local/lib/python3.7/dist-packages/yacs/config.py", line 474, in _merge_a_into_b v = _check_and_coerce_cfg_value_type(v, b[k], k, full_key) File "/usr/local/lib/python3.7/dist-packages/yacs/config.py", line 537, in _check_and_coerce_cfg_value_type original_type, replacement_type, original, replacement, full_key ValueError: Type mismatch (<class 'detectron2.config.config.CfgNode'> vs. <class 'str'>) with values (PRECOMPUTED_PROPOSAL_TOPK_TEST: 1000 PRECOMPUTED_PROPOSAL_TOPK_TRAIN: 2000 PROPOSAL_FILES_TEST: () PROPOSAL_FILES_TRAIN: () TEST: () TRAIN: () vs. TRAIN = ('my_dataset_train',) TEST = ('my_dataset_test',)) for config key: DATASETS

thanks for this amazing work , I am running into this issue after I register my dataset i am using colab and before running !python /content/CenterNet2/projects/CenterNet2/train_net.py --config /content/CenterNet2/projects/CenterNet2/configs/CenterNet2_R2-101-DCN-BiFPN_4x+4x_1560_ST.yaml I am registering the dataset like this from detectron2.data.datasets import register_coco_instances register_coco_instances("my_dataset_train", {}, "/content/results/yolo2coco/train.json", "/content/results/yolo2coco/train")

register_coco_instances("my_dataset_val", {}, "/content/results/yolo2coco/test.json", "/content/results/yolo2coco/valid")

register_coco_instances("my_dataset_test", {}, "/content/results/yolo2coco/test.json", "/content/results/yolo2coco/test") and adding the name my_dataset_train and my_dataset_test in config Could you please help me out .

xingyizhou commented 3 years ago

Hi, From the error log, it seems the config file is not in the correct format. Did you use TRAIN = ('my_dataset_train',) instead of TRAIN: ('my_dataset_train',)?

gauravlochab commented 3 years ago

thanks for the quick reply yes that was the issue, I am training on my custom data on colab with one gpu. could you tell me the best way to fine-tune this on my data what all hyperparameters i should be looking for while training 21:08:40 iter: 186080 total_loss: 2.043 loss_cls_stage0: 0.2828 loss_box_reg_stage0: 0.02241 loss_cls_stage1: 0.2958 loss_box_reg_stage1: 0.02742 loss_cls_stage2: 0.2986 loss_box_reg_stage2: 0.02829 loss_centernet_loc: 0.6763 loss_centernet_agn_pos: 0.3532 loss_centernet_agn_neg: 0.02419 time: 0.8431 data_time: 0.0036 lr: 0.039999 last iteration looks like this. Thanks again

DatDoc commented 3 years ago

@gauravlochab Could you share the notebook you are working on? I'm stuck at the data register.

gauravlochab commented 3 years ago

i am no longer using colab i am doing it on local now but I can help you with it you just have to go to train_net.py and add these line from detectron2.data.datasets import register_coco_instances register_coco_instances("my_dataset_train", {}, "/content/results/yolo2coco/train.json", "/content/results/yolo2coco/train") register_coco_instances("my_dataset_val", {}, "/content/results/yolo2coco/test.json", "/content/results/yolo2coco/test") register_coco_instances("my_dataset_test", {}, "/content/results/yolo2coco/test.json", "/content/results/yolo2coco/test") make changes according to your data and add my_dataset_train and my_dataset_test in config file datasets key as mentioned above

DatDoc commented 3 years ago

@gauravlochab Thank you for the quick response

gauravlochab commented 3 years ago

let me know if you get good results :p

carlsummer commented 3 years ago

https://blog.csdn.net/Carlsummer/article/details/116711708