austinmw / densepose_setup

2 stars 2 forks source link

yaml.constructor.ConstructorError: could not determine a constructor for the tag 'tag:yaml.org,2002:python/object/new:detectron.utils.collections.AttrDict' #1

Open sfoxdev opened 6 years ago

sfoxdev commented 6 years ago

Hello, I'm running Densepose in Docker container with mounted data, first test runs OK

root@a182491c8d77:/densepose# python2 detectron/tests/test_batch_permutation_op.py

No handlers could be found for logger "caffe2.python.net_drawer"
net_drawer will not run correctly. Please install the correct dependencies.
E0626 20:12:38.665913     1 init_intrinsics_check.cc:54] 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.
E0626 20:12:38.665948     1 init_intrinsics_check.cc:54] 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.
E0626 20:12:38.665953     1 init_intrinsics_check.cc:54] 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.
Found Detectron ops lib: /usr/local/caffe2_build/lib/libcaffe2_detectron_ops_gpu.so

then I've tried next test and get error

root@a182491c8d77:/densepose# python2 tools/test_net.py --cfg configs/DensePose_ResNet101_FPN_s1x-e2e.yaml TEST.WEIGHTS https://s3.amazonaws.com/densepose/DensePose_ResNet101_FPN_s1x-e2e.pkl NUM_GPUS 1
Found Detectron ops lib: /usr/local/caffe2_build/lib/libcaffe2_detectron_ops_gpu.so
E0627 14:32:29.476986   232 init_intrinsics_check.cc:54] 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.
E0627 14:32:29.477037   232 init_intrinsics_check.cc:54] 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.
E0627 14:32:29.477042   232 init_intrinsics_check.cc:54] 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 test_net.py:  93: Called with args:
INFO test_net.py:  94: Namespace(cfg_file='configs/DensePose_ResNet101_FPN_s1x-e2e.yaml', multi_gpu_testing=False, opts=['TEST.WEIGHTS', 'https://s3.amazonaws.com/densepose/DensePose_ResNet101_FPN_s1x-e2e.pkl', 'NUM_GPUS', '1'], range=None, vis=False, wait=True)
INFO test_net.py: 100: Testing with config:
INFO test_net.py: 101: {'BBOX_XFORM_CLIP': 4.135166556742356,
 'BODY_UV_RCNN': {'BODY_UV_IMS': True,
                  'CONV_HEAD_DIM': 512,
                  'CONV_HEAD_KERNEL': 3,
                  'CONV_INIT': 'MSRAFill',
                  'DECONV_DIM': 256,
                  'DECONV_KERNEL': 4,
                  'DILATION': 1,
                  'HEATMAP_SIZE': 56,
                  'INDEX_WEIGHTS': 2.0,
                  'NUM_PATCHES': 24,
                  'NUM_STACKED_CONVS': 8,
                  'PART_WEIGHTS': 0.3,
                  'POINT_REGRESSION_WEIGHTS': 0.1,
                  'ROI_HEAD': 'body_uv_rcnn_heads.add_roi_body_uv_head_v1convX',
                  'ROI_XFORM_METHOD': 'RoIAlign',
                  'ROI_XFORM_RESOLUTION': 14,
                  'ROI_XFORM_SAMPLING_RATIO': 2,
                  'UP_SCALE': 2,
                  'USE_DECONV_OUTPUT': True},
 'CLUSTER': {'ON_CLUSTER': False},
 'DATA_LOADER': {'BLOBS_QUEUE_CAPACITY': 8,
                 'MINIBATCH_QUEUE_SIZE': 64,
                 'NUM_THREADS': 4},
 'DEDUP_BOXES': 0.0625,
 'DOWNLOAD_CACHE': '/tmp/detectron-download-cache',
 'EPS': 1e-14,
 'EXPECTED_RESULTS': [],
 'EXPECTED_RESULTS_ATOL': 0.005,
 'EXPECTED_RESULTS_EMAIL': '',
 'EXPECTED_RESULTS_RTOL': 0.1,
 'FAST_RCNN': {'CONV_HEAD_DIM': 256,
               'MLP_HEAD_DIM': 1024,
               'NUM_STACKED_CONVS': 4,
               'ROI_BOX_HEAD': 'fast_rcnn_heads.add_roi_2mlp_head',
               'ROI_XFORM_METHOD': 'RoIAlign',
               'ROI_XFORM_RESOLUTION': 7,
               'ROI_XFORM_SAMPLING_RATIO': 2},
 'FPN': {'COARSEST_STRIDE': 32,
         'DIM': 256,
         'EXTRA_CONV_LEVELS': False,
         'FPN_ON': True,
         'MULTILEVEL_ROIS': True,
         'MULTILEVEL_RPN': True,
         'ROI_CANONICAL_LEVEL': 4,
         'ROI_CANONICAL_SCALE': 224,
         'ROI_MAX_LEVEL': 5,
         'ROI_MIN_LEVEL': 2,
         'RPN_ANCHOR_START_SIZE': 32,
         'RPN_ASPECT_RATIOS': (0.5, 1, 2),
         'RPN_MAX_LEVEL': 6,
         'RPN_MIN_LEVEL': 2,
         'USE_GN': False,
         'ZERO_INIT_LATERAL': False},
 'GROUP_NORM': {'DIM_PER_GP': -1, 'EPSILON': 1e-05, 'NUM_GROUPS': 32},
 'KRCNN': {'CONV_HEAD_DIM': 256,
           'CONV_HEAD_KERNEL': 3,
           'CONV_INIT': 'GaussianFill',
           'DECONV_DIM': 256,
           'DECONV_KERNEL': 4,
           'DILATION': 1,
           'HEATMAP_SIZE': -1,
           'INFERENCE_MIN_SIZE': 0,
           'KEYPOINT_CONFIDENCE': 'bbox',
           'LOSS_WEIGHT': 1.0,
           'MIN_KEYPOINT_COUNT_FOR_VALID_MINIBATCH': 20,
           'NMS_OKS': False,
           'NORMALIZE_BY_VISIBLE_KEYPOINTS': True,
           'NUM_KEYPOINTS': -1,
           'NUM_STACKED_CONVS': 8,
           'ROI_KEYPOINTS_HEAD': '',
           'ROI_XFORM_METHOD': 'RoIAlign',
           'ROI_XFORM_RESOLUTION': 7,
           'ROI_XFORM_SAMPLING_RATIO': 0,
           'UP_SCALE': -1,
           'USE_DECONV': False,
           'USE_DECONV_OUTPUT': False},
 'MATLAB': 'matlab',
 'MEMONGER': True,
 'MEMONGER_SHARE_ACTIVATIONS': False,
 'MODEL': {'BBOX_REG_WEIGHTS': (10.0, 10.0, 5.0, 5.0),
           'BODY_UV_ON': True,
           'CLS_AGNOSTIC_BBOX_REG': False,
           'CONV_BODY': 'FPN.add_fpn_ResNet101_conv5_body',
           'EXECUTION_TYPE': 'dag',
           'FASTER_RCNN': True,
           'KEYPOINTS_ON': False,
           'MASK_ON': False,
           'NUM_CLASSES': 2,
           'RPN_ONLY': False,
           'TYPE': 'generalized_rcnn'},
 'MRCNN': {'CLS_SPECIFIC_MASK': True,
           'CONV_INIT': 'GaussianFill',
           'DILATION': 2,
           'DIM_REDUCED': 256,
           'RESOLUTION': 14,
           'ROI_MASK_HEAD': '',
           'ROI_XFORM_METHOD': 'RoIAlign',
           'ROI_XFORM_RESOLUTION': 7,
           'ROI_XFORM_SAMPLING_RATIO': 0,
           'THRESH_BINARIZE': 0.5,
           'UPSAMPLE_RATIO': 1,
           'USE_FC_OUTPUT': False,
           'WEIGHT_LOSS_MASK': 1.0},
 'NUM_GPUS': 1,
 'OUTPUT_DIR': '',
 'PIXEL_MEANS': array([[[102.9801, 115.9465, 122.7717]]]),
 'RESNETS': {'NUM_GROUPS': 1,
             'RES5_DILATION': 1,
             'SHORTCUT_FUNC': 'basic_bn_shortcut',
             'STEM_FUNC': 'basic_bn_stem',
             'STRIDE_1X1': True,
             'TRANS_FUNC': 'bottleneck_transformation',
             'WIDTH_PER_GROUP': 64},
 'RETINANET': {'ANCHOR_SCALE': 4,
               'ASPECT_RATIOS': (0.5, 1.0, 2.0),
               'BBOX_REG_BETA': 0.11,
               'BBOX_REG_WEIGHT': 1.0,
               'CLASS_SPECIFIC_BBOX': False,
               'INFERENCE_TH': 0.05,
               'LOSS_ALPHA': 0.25,
               'LOSS_GAMMA': 2.0,
               'NEGATIVE_OVERLAP': 0.4,
               'NUM_CONVS': 4,
               'POSITIVE_OVERLAP': 0.5,
               'PRE_NMS_TOP_N': 1000,
               'PRIOR_PROB': 0.01,
               'RETINANET_ON': False,
               'SCALES_PER_OCTAVE': 3,
               'SHARE_CLS_BBOX_TOWER': False,
               'SOFTMAX': False},
 'RFCN': {'PS_GRID_SIZE': 3},
 'RNG_SEED': 3,
 'ROOT_DIR': '/densepose',
 'RPN': {'ASPECT_RATIOS': (0.5, 1, 2),
         'RPN_ON': True,
         'SIZES': (64, 128, 256, 512),
         'STRIDE': 16},
 'SOLVER': {'BASE_LR': 0.002,
            'GAMMA': 0.1,
            'LOG_LR_CHANGE_THRESHOLD': 1.1,
            'LRS': [],
            'LR_POLICY': 'steps_with_decay',
            'MAX_ITER': 130000,
            'MOMENTUM': 0.9,
            'SCALE_MOMENTUM': True,
            'SCALE_MOMENTUM_THRESHOLD': 1.1,
            'STEPS': [0, 100000, 120000],
            'STEP_SIZE': 30000,
            'WARM_UP_FACTOR': 0.1,
            'WARM_UP_ITERS': 1000,
            'WARM_UP_METHOD': u'linear',
            'WEIGHT_DECAY': 0.0001,
            'WEIGHT_DECAY_GN': 0.0},
 'TEST': {'BBOX_AUG': {'AREA_TH_HI': 32400,
                       'AREA_TH_LO': 2500,
                       'ASPECT_RATIOS': (),
                       'ASPECT_RATIO_H_FLIP': False,
                       'COORD_HEUR': 'UNION',
                       'ENABLED': False,
                       'H_FLIP': False,
                       'MAX_SIZE': 4000,
                       'SCALES': (),
                       'SCALE_H_FLIP': False,
                       'SCALE_SIZE_DEP': False,
                       'SCORE_HEUR': 'UNION'},
          'BBOX_REG': True,
          'BBOX_VOTE': {'ENABLED': False,
                        'SCORING_METHOD': 'ID',
                        'SCORING_METHOD_BETA': 1.0,
                        'VOTE_TH': 0.8},
          'COMPETITION_MODE': True,
          'DATASETS': ('dense_coco_2014_minival',),
          'DETECTIONS_PER_IM': 20,
          'FORCE_JSON_DATASET_EVAL': True,
          'KPS_AUG': {'AREA_TH': 32400,
                      'ASPECT_RATIOS': (),
                      'ASPECT_RATIO_H_FLIP': False,
                      'ENABLED': False,
                      'HEUR': 'HM_AVG',
                      'H_FLIP': False,
                      'MAX_SIZE': 4000,
                      'SCALES': (),
                      'SCALE_H_FLIP': False,
                      'SCALE_SIZE_DEP': False},
          'MASK_AUG': {'AREA_TH': 32400,
                       'ASPECT_RATIOS': (),
                       'ASPECT_RATIO_H_FLIP': False,
                       'ENABLED': False,
                       'HEUR': 'SOFT_AVG',
                       'H_FLIP': False,
                       'MAX_SIZE': 4000,
                       'SCALES': (),
                       'SCALE_H_FLIP': False,
                       'SCALE_SIZE_DEP': False},
          'MAX_SIZE': 1333,
          'NMS': 0.5,
          'PRECOMPUTED_PROPOSALS': False,
          'PROPOSAL_FILES': (),
          'PROPOSAL_LIMIT': 1000,
          'RPN_MIN_SIZE': 0,
          'RPN_NMS_THRESH': 0.7,
          'RPN_POST_NMS_TOP_N': 1000,
          'RPN_PRE_NMS_TOP_N': 1000,
          'SCALE': 800,
          'SCORE_THRESH': 0.05,
          'SOFT_NMS': {'ENABLED': False, 'METHOD': 'linear', 'SIGMA': 0.5},
          'WEIGHTS': '/tmp/detectron-download-cache/DensePose_ResNet101_FPN_s1x-e2e.pkl'},
 'TRAIN': {'ASPECT_GROUPING': True,
           'AUTO_RESUME': True,
           'BATCH_SIZE_PER_IM': 512,
           'BBOX_THRESH': 0.5,
           'BG_THRESH_HI': 0.5,
           'BG_THRESH_LO': 0.0,
           'CROWD_FILTER_THRESH': 0.7,
           'DATASETS': ('dense_coco_2014_train',
                        'dense_coco_2014_valminusminival'),
           'FG_FRACTION': 0.25,
           'FG_THRESH': 0.5,
           'FREEZE_CONV_BODY': False,
           'GT_MIN_AREA': -1,
           'IMS_PER_BATCH': 3,
           'MAX_SIZE': 1333,
           'PROPOSAL_FILES': (),
           'RPN_BATCH_SIZE_PER_IM': 256,
           'RPN_FG_FRACTION': 0.5,
           'RPN_MIN_SIZE': 0,
           'RPN_NEGATIVE_OVERLAP': 0.3,
           'RPN_NMS_THRESH': 0.7,
           'RPN_POSITIVE_OVERLAP': 0.7,
           'RPN_POST_NMS_TOP_N': 2000,
           'RPN_PRE_NMS_TOP_N': 2000,
           'RPN_STRADDLE_THRESH': 0,
           'SCALES': (640, 672, 704, 736, 768, 800),
           'SNAPSHOT_ITERS': 20000,
           'USE_FLIPPED': True,
           'WEIGHTS': '/tmp/detectron-download-cache/R-101.pkl'},
 'USE_NCCL': False,
 'VIS': False,
 'VIS_TH': 0.9}
loading annotations into memory...
Done (t=0.87s)
creating index...
index created!
loading annotations into memory...
Done (t=1.00s)
creating index...
index created!
WARNING cnn.py:  40: [====DEPRECATE WARNING====]: you are creating an object from CNNModelHelper class which will be deprecated soon. Please use ModelHelper object with brew module. For more information, please refer to caffe2.ai and python/brew.py, python/brew_test.py for more information.
INFO net.py:  51: Loading weights from: /tmp/detectron-download-cache/DensePose_ResNet101_FPN_s1x-e2e.pkl
Traceback (most recent call last):
  File "tools/test_net.py", line 111, in <module>
    check_expected_results=True,
  File "/densepose/detectron/core/test_engine.py", line 120, in run_inference
    all_results = result_getter()
  File "/densepose/detectron/core/test_engine.py", line 100, in result_getter
    multi_gpu=multi_gpu_testing
  File "/densepose/detectron/core/test_engine.py", line 153, in test_net_on_dataset
    weights_file, dataset_name, proposal_file, output_dir, gpu_id=gpu_id
  File "/densepose/detectron/core/test_engine.py", line 233, in test_net
    model = initialize_model_from_cfg(weights_file, gpu_id=gpu_id)
  File "/densepose/detectron/core/test_engine.py", line 333, in initialize_model_from_cfg
    model, weights_file, gpu_id=gpu_id,
  File "/densepose/detectron/utils/net.py", line 56, in initialize_gpu_from_weights_file
    saved_cfg = load_cfg(src_blobs['cfg'])
  File "/densepose/detectron/core/config.py", line 1163, in load_cfg
    return yaml.load(cfg_to_load)
  File "/usr/local/lib/python2.7/dist-packages/yaml/__init__.py", line 74, in load
    return loader.get_single_data()
  File "/usr/local/lib/python2.7/dist-packages/yaml/constructor.py", line 39, in get_single_data
    return self.construct_document(node)
  File "/usr/local/lib/python2.7/dist-packages/yaml/constructor.py", line 43, in construct_document
    data = self.construct_object(node)
  File "/usr/local/lib/python2.7/dist-packages/yaml/constructor.py", line 88, in construct_object
    data = constructor(self, node)
  File "/usr/local/lib/python2.7/dist-packages/yaml/constructor.py", line 414, in construct_undefined
    node.start_mark)
yaml.constructor.ConstructorError: could not determine a constructor for the tag 'tag:yaml.org,2002:python/object/new:detectron.utils.collections.AttrDict'
  in "<unicode string>", line 1, column 1:
    !!python/object/new:detectron.ut ...
    ^
root@a182491c8d77:/densepose#

I've tried other test and also get the same error

root@a182491c8d77:/densepose# python2 tools/infer_simple.py \
> --cfg configs/DensePose_ResNet101_FPN_s1x-e2e.yaml \
> --output-dir DensePoseData/infer_out/ \
> --image-ext jpg \
> --wts https://s3.amazonaws.com/densepose/DensePose_ResNet101_FPN_s1x-e2e.pkl \
> DensePoseData/demo_data/demo_im.jpg
Found Detectron ops lib: /usr/local/caffe2_build/lib/libcaffe2_detectron_ops_gpu.so
E0627 14:34:10.943832   248 init_intrinsics_check.cc:54] 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.
E0627 14:34:10.943878   248 init_intrinsics_check.cc:54] 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.
E0627 14:34:10.943883   248 init_intrinsics_check.cc:54] 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.
WARNING cnn.py:  40: [====DEPRECATE WARNING====]: you are creating an object from CNNModelHelper class which will be deprecated soon. Please use ModelHelper object with brew module. For more information, please refer to caffe2.ai and python/brew.py, python/brew_test.py for more information.
INFO net.py:  51: Loading weights from: /tmp/detectron-download-cache/DensePose_ResNet101_FPN_s1x-e2e.pkl
Traceback (most recent call last):
  File "tools/infer_simple.py", line 140, in <module>
    main(args)
  File "tools/infer_simple.py", line 91, in main
    model = infer_engine.initialize_model_from_cfg(args.weights)
  File "/densepose/detectron/core/test_engine.py", line 333, in initialize_model_from_cfg
    model, weights_file, gpu_id=gpu_id,
  File "/densepose/detectron/utils/net.py", line 56, in initialize_gpu_from_weights_file
    saved_cfg = load_cfg(src_blobs['cfg'])
  File "/densepose/detectron/core/config.py", line 1163, in load_cfg
    return yaml.load(cfg_to_load)
  File "/usr/local/lib/python2.7/dist-packages/yaml/__init__.py", line 74, in load
    return loader.get_single_data()
  File "/usr/local/lib/python2.7/dist-packages/yaml/constructor.py", line 39, in get_single_data
    return self.construct_document(node)
  File "/usr/local/lib/python2.7/dist-packages/yaml/constructor.py", line 43, in construct_document
    data = self.construct_object(node)
  File "/usr/local/lib/python2.7/dist-packages/yaml/constructor.py", line 88, in construct_object
    data = constructor(self, node)
  File "/usr/local/lib/python2.7/dist-packages/yaml/constructor.py", line 414, in construct_undefined
    node.start_mark)
yaml.constructor.ConstructorError: could not determine a constructor for the tag 'tag:yaml.org,2002:python/object/new:detectron.utils.collections.AttrDict'
  in "<unicode string>", line 1, column 1:
    !!python/object/new:detectron.ut ...
    ^
root@a182491c8d77:/densepose#

I can't find what this error means and how to solve it

sfoxdev commented 6 years ago

we need to use PyYAML version 3.12 instead of 4.1

pip install PyYAML==3.12