chongruo / detectron2-ResNeSt

A fork of Detectron2 with ResNeSt backbone
https://arxiv.org/abs/2004.08955
Apache License 2.0
385 stars 73 forks source link

KeyError: 'Non-existent config key: MODEL.RESNETS.RADIX'Please read & provide the following #33

Open shida666 opened 4 years ago

shida666 commented 4 years ago

i wanna use the "train_ResNeSt.py"with "ResNeSt" to train my own datasets,but it show this KeyError.

it print: (pytorch1.4.0) root@111:~/detectron2-ResNeSt/maize_img/800600# python train_ResNeSt.py Traceback (most recent call last): File "train_ResNeSt.py", line 17, in cfg.merge_from_file("/root/detectron2-ResNeSt/configs/COCO-InstanceSegmentation/mask_rcnn_ResNeSt_50_FPN_syncBN_1x_weights_dir_change.yaml") #original File "/root/anaconda3/envs/pytorch1.4.0/lib/python3.6/site-packages/detectron2/config/config.py", line 47, in merge_from_file self.merge_from_other_cfg(loaded_cfg) File "/root/anaconda3/envs/pytorch1.4.0/lib/python3.6/site-packages/fvcore/common/config.py", line 118, in merge_from_other_cfg return super().merge_from_other_cfg(cfg_other) File "/root/anaconda3/envs/pytorch1.4.0/lib/python3.6/site-packages/yacs/config.py", line 217, in merge_from_other_cfg _merge_a_into_b(cfg_other, self, self, []) File "/root/anaconda3/envs/pytorch1.4.0/lib/python3.6/site-packages/yacs/config.py", line 464, in _merge_a_into_b _merge_a_into_b(v, b[k], root, key_list + [k]) File "/root/anaconda3/envs/pytorch1.4.0/lib/python3.6/site-packages/yacs/config.py", line 464, in _merge_a_into_b _merge_a_into_b(v, b[k], root, key_list + [k]) File "/root/anaconda3/envs/pytorch1.4.0/lib/python3.6/site-packages/yacs/config.py", line 477, in _merge_a_into_b raise KeyError("Non-existent config key: {}".format(full_key)) KeyError: 'Non-existent config key: MODEL.RESNETS.RADIX'

my train_ResNeSt.py : import random from detectron2.utils.visualizer import Visualizer from detectron2.data.catalog import MetadataCatalog, DatasetCatalog import maize_img import cv2 from detectron2.engine import DefaultTrainer from detectron2.config import get_cfg from detectron2.utils.logger import setup_logger import os setup_logger()

if name == "main": cfg = get_cfg()

**cfg.merge_from_file("/root/detectron2-ResNeSt/configs/COCO-InstanceSegmentation/mask_rcnn_ResNeSt_50_FPN_syncBN_1x.yaml")** 

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

cfg.DATASETS.TEST = ()  # no metrics implemented for this dataset
cfg.DATALOADER.NUM_WORKERS = 2

**cfg.MODEL.WEIGHTS = '/root/detectron2/pretrain_model/COCO_InstanceSegmentation_Baselines_with_MaskR-CNN/R50-FPN-3x/model_final_f10217.pkl'**

cfg.SOLVER.IMS_PER_BATCH = 2
cfg.SOLVER.BASE_LR = 0.0025
cfg.SOLVER.MAX_ITER = (2000)  

cfg.MODEL.ROI_HEADS.BATCH_SIZE_PER_IMAGE = (128)  # faster, and good enough for this toy dataset
cfg.MODEL.ROI_HEADS.NUM_CLASSES = 3  # 3 classes (data, fig, hazelnut)
os.makedirs(cfg.OUTPUT_DIR, exist_ok=True)
trainer = DefaultTrainer(cfg)
trainer.resume_or_load(resume=False)
trainer.train()

how can i solve this problem ?please help me

shida666 commented 4 years ago

when i choose cfg.merge_from_file("/root/detectron2-ResNeSt/configs/COCO-InstanceSegmentation/mask_rcnn_R_50_FPN_3x.yaml")

cfg.MODEL.WEIGHTS = '/root/detectron2/pretrain_model/COCO_InstanceSegmentation_Baselines_with_MaskR-CNN/R50-FPN-3x/model_final_f10217.pkl'

it's all right ,it can train normally and i can get my own "model_final.pth",but when i use any "ResNeSt", it has some wrong

shida666 commented 4 years ago

@zhanghang1989 @chongruo

chongruo commented 4 years ago

please refer to #25

raynor08 commented 4 years ago

when i choose cfg.merge_from_file("/root/detectron2-ResNeSt/configs/COCO-InstanceSegmentation/mask_rcnn_R_50_FPN_3x.yaml")

cfg.MODEL.WEIGHTS = '/root/detectron2/pretrain_model/COCO_InstanceSegmentation_Baselines_with_MaskR-CNN/R50-FPN-3x/model_final_f10217.pkl'

it's all right ,it can train normally and i can get my own "model_final.pth",but when i use any "ResNeSt", it has some wrong

I think this is due to the Python path issue, just make sure you are running ./tools/train_net.py under the project root folder detectron2-ResNeSt/

Labaien96 commented 4 years ago

Same error here, any update on this?

zhanghang1989 commented 4 years ago

Please install our detectron fork https://github.com/zhanghang1989/detectron2-ResNeSt/blob/resnest/INSTALL.md

Labaien96 commented 4 years ago

Hi @zhanghang1989 , I have followed the installation guide but I get the same error.

shida666 commented 4 years ago

Hi @zhanghang1989 , I have followed the installation guide but I get the same error.

HI,i am so sorry to reply you so late,in 【detectron2-ResNeSt/INSTALL.md】,it's 【# Or, to install it from a local clone: git clone https://github.com/zhanghang1989/detectron2-ResNeSt.git cd detectron2 && python -m pip install -e .】, it should be 【# Or, to install it from a local clone: git clone https://github.com/zhanghang1989/detectron2-ResNeSt.git cd detectron2-ResNeSt && python -m pip install -e .】

shida666 commented 4 years ago

Hi @zhanghang1989 , I have followed the installation guide but I get the same error.

HI,i am so sorry to reply you so late,in 【detectron2-ResNeSt/INSTALL.md】,it's 【# Or, to install it from a local clone: git clone https://github.com/zhanghang1989/detectron2-ResNeSt.git cd detectron2 && python -m pip install -e .】, it should be 【# Or, to install it from a local clone: git clone https://github.com/zhanghang1989/detectron2-ResNeSt.git cd detectron2-ResNeSt && python -m pip install -e .】

@zhanghang1989 @chongruo Hi sir , this may be a mistake, please verify it. in 【detectron2-ResNeSt/INSTALL.md】

it should be 【# Or, to install it from a local clone: git clone https://github.com/zhanghang1989/detectron2-ResNeSt.git cd detectron2-ResNeSt && python -m pip install -e .】

PurveshChhajed commented 4 years ago

@shida666 have you overcome with that issue?? i got the same issue

shida666 commented 4 years ago

@shida666 have you overcome with that issue?? i got the same issue

you can try "git clone https://github.com/zhanghang1989/detectron2-ResNeSt.git cd detectron2-ResNeSt && python -m pip install -e ." not "git clone https://github.com/zhanghang1989/detectron2-ResNeSt.git cd detectron2 && python -m pip install -e ."