facebookresearch / Detectron

FAIR's research platform for object detection research, implementing popular algorithms like Mask R-CNN and RetinaNet.
Apache License 2.0
26.26k stars 5.45k forks source link

KeyError: u'Non-existent config key: MODEL.NUM_GPUS' #493

Closed travis0925 closed 6 years ago

travis0925 commented 6 years ago

I tried to train the model with the custom dataset, and I ran the following code (the dataset was properly transformed to a COCO style) python tools/train_net.py --cfg configs/12_2017_baselines/e2e_mask_rcnn_R-50-FPN_1x.yaml OUTPUT_DIR detectron/datasets/data/fundus_patch/output And all the tests were passed before I ran this code, I modified the config file

MODEL:
  TYPE: generalized_rcnn
  CONV_BODY: FPN.add_fpn_ResNet50_conv5_body
  NUM_CLASSES: 4
  FASTER_RCNN: True
  MASK_ON: True
  NUM_GPUS: 1
SOLVER:
  WEIGHT_DECAY: 0.0001
  LR_POLICY: steps_with_decay
  BASE_LR: 0.0025
  GAMMA: 0.1
  MAX_ITER: 11000
  STEPS: [0, 4000, 8000]
FPN:
  FPN_ON: True
  MULTILEVEL_ROIS: True
  MULTILEVEL_RPN: True
FAST_RCNN:
  ROI_BOX_HEAD: fast_rcnn_heads.add_roi_2mlp_head
  ROI_XFORM_METHOD: RoIAlign
  ROI_XFORM_RESOLUTION: 7
  ROI_XFORM_SAMPLING_RATIO: 2
MRCNN:
  ROI_MASK_HEAD: mask_rcnn_heads.mask_rcnn_fcn_head_v1up4convs
  RESOLUTION: 28  # (output mask resolution) default 14
  ROI_XFORM_METHOD: RoIAlign
  ROI_XFORM_RESOLUTION: 7  # default 7
  ROI_XFORM_SAMPLING_RATIO: 2  # default 0
  DILATION: 1  # default 2
  CONV_INIT: MSRAFill  # default GaussianFill
TRAIN:
  WEIGHTS: https://s3-us-west-2.amazonaws.com/detectron/ImageNetPretrained/MSRA/R-50.pkl
  DATASETS: ('lesion_detection_train',)
  SCALES: (500,)
  MAX_SIZE: 833
  BATCH_SIZE_PER_IM: 64
  RPN_PRE_NMS_TOP_N: 2000  # Per FPN level
TEST:
  DATASETS: ( 'lesion_detection_val',)
  SCALE: 500
  MAX_SIZE: 833
  NMS: 0.5
  RPN_PRE_NMS_TOP_N: 1000  # Per FPN level
  RPN_POST_NMS_TOP_N: 1000
OUTPUT_DIR: .

System information

And the following was what I got: Found Detectron ops lib: /usr/local/lib/libcaffe2_detectron_ops_gpu.so E0612 20:32:38.941774 3756 init_intrinsics_check.cc:43] CPU feature avx is present on your machine, but the Caffe2 binary is not compiled with it. It means you may not get the full speed of your CPU. E0612 20:32:38.941857 3756 init_intrinsics_check.cc:43] CPU feature avx2 is present on your machine, but the Caffe2 binary is not compiled with it. It means you may not get the full speed of your CPU. E0612 20:32:38.941905 3756 init_intrinsics_check.cc:43] CPU feature fma is present on your machine, but the Caffe2 binary is not compiled with it. It means you may not get the full speed of your CPU. INFO train_net.py: 95: Called with args: INFO train_net.py: 96: Namespace(cfg_file='configs/12_2017_baselines/fundus_mask_rcnn_R-50-FPN_1x.yaml', multi_gpu_testing=False, opts=['OUTPUT_DIR', 'detectron/datasets/data/fundus_patch/output'], skip_test=False) Traceback (most recent call last): File "tools/train_net.py", line 128, in main() File "tools/train_net.py", line 98, in main merge_cfg_from_file(args.cfg_file) File "/home/travis/software/detectron/detectron/core/config.py", line 1124, in merge_cfg_from_file _merge_a_into_b(yaml_cfg, __C) File "/home/travis/software/detectron/detectron/core/config.py", line 1184, in _merge_a_into_b _merge_a_into_b(v, b[k], stack=stack_push) File "/home/travis/software/detectron/detectron/core/config.py", line 1174, in _merge_a_into_b raise KeyError('Non-existent config key: {}'.format(full_key)) KeyError: u'Non-existent config key: MODEL.NUM_GPUS'

Anyone knows what was wrong with my training?

gadcam commented 6 years ago

NUM_GPUS is not a subkey of MODEL so it should not be indented.

travis0925 commented 6 years ago

Thx a lot. It solved. I'd better be more careful about this. @gadcam