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

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

Open
shida666 opened this issue May 31, 2020 · 11 comments

Comments

@shida666
Copy link

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
Copy link
Author

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
Copy link
Author

@zhanghang1989 @chongruo

@chongruo
Copy link
Owner

please refer to #25

@raynor08
Copy link

raynor08 commented Jun 1, 2020

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
Copy link

Same error here, any update on this?

@zhanghang1989
Copy link
Collaborator

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

@Labaien96
Copy link

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

@shida666
Copy link
Author

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
Copy link
Author

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
Copy link

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

@shida666
Copy link
Author

@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 ."

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

6 participants