0

I'm training Detectron with the following command

python2 tools/train_net.py \ --cfg configs/getting_started/tutorial_1gpu_e2e_faster_rcnn_R-50-FPN.yaml \ OUTPUT_DIR /tmp/detectron-output

and I'm getting the error below. Everything goes well except at the end when the training model file is about to be saved.

Thanks in advance for your help.

...........

 File "/home/username/Documents/Detectron/lib/utils/net.py", line 165, in save_model_to_weights_file
    cfg_yaml = yaml.dump(cfg)
  File "build/bdist.linux-x86_64/egg/yaml/__init__.py", line 202, in dump
  File "build/bdist.linux-x86_64/egg/yaml/__init__.py", line 190, in dump_all
  File "build/bdist.linux-x86_64/egg/yaml/representer.py", line 28, in represent
  File "build/bdist.linux-x86_64/egg/yaml/representer.py", line 61, in represent_data
  File "build/bdist.linux-x86_64/egg/yaml/representer.py", line 447, in represent_object
  File "build/bdist.linux-x86_64/egg/yaml/representer.py", line 123, in represent_mapping
  File "build/bdist.linux-x86_64/egg/yaml/representer.py", line 57, in represent_data
  File "build/bdist.linux-x86_64/egg/yaml/representer.py", line 223, in represent_dict
  File "build/bdist.linux-x86_64/egg/yaml/representer.py", line 123, in represent_mapping
  File "build/bdist.linux-x86_64/egg/yaml/representer.py", line 41, in represent_data
  File "build/bdist.linux-x86_64/egg/yaml/representer.py", line 142, in ignore_aliases
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
4

2 回答 2

0

这是我的 .yaml 文件:

MODEL:
  TYPE: generalized_rcnn
  CONV_BODY: FPN.add_fpn_ResNet50_conv5_body
  NUM_CLASSES: 81
  FASTER_RCNN: True
NUM_GPUS: 1
SOLVER:
  WEIGHT_DECAY: 0.0001
  LR_POLICY: steps_with_decay
  BASE_LR: 0.0025
  GAMMA: 0.1
  MAX_ITER: 100
  STEPS: [0, 30, 40]
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
TRAIN:
  WEIGHTS: R-50.pkl
  DATASETS: ('mydata_2018_train',)
  SCALES: (500,)
  MAX_SIZE: 833
  BATCH_SIZE_PER_IM: 256
  RPN_PRE_NMS_TOP_N: 2000  # Per FPN level
TEST:
  DATASETS: ('mydata_2018_test',)
  SCALES: (500,)
  MAX_SIZE: 833
  NMS: 0.5
  RPN_PRE_NMS_TOP_N: 1000  # Per FPN level
  RPN_POST_NMS_TOP_N: 1000
OUTPUT_DIR: .
于 2018-02-07T14:02:53.893 回答
0

我有同样的问题。安装更新的 PyYAML,就像这里建议的那样,为我解决了这个问题:

pip install 'pyyaml>=3.12'
于 2018-02-16T13:15:44.943 回答