相关文章推荐
长情的人字拖  ·  [ERROR]all ...·  1 年前    · 
睿智的椰子  ·  visual studio 2010 - ...·  1 年前    · 

Detectron 框架使用出现错误yaml.constructor.ConstructorError: could not determine a constructor for the tag

最新推荐文章于 2023-03-17 09:24:17 发布
最新推荐文章于 2023-03-17 09:24:17 发布

错误yaml.constructor.ConstructorError: could not determine a constructor for the tag

错误提示:

Traceback (most recent call last):
  File "tools/train_net.py", line 133, in <module>
    main()
  File "tools/train_net.py", line 98, in main
    if args.cfg_file is not None:
  File "/data/yang/detectron/detectron/utils/train.py", line 58, in train_model
    setup_model_for_training(model, weights_file, output_dir)
  File "/data/yang/detectron/detectron/utils/train.py", line 174, in setup_model_for_training
    nu.initialize_gpu_from_weights_file(model, weights_file, gpu_id=0)
  File "/data/yang/detectron/detectron/utils/net.py", line 65, in initialize_gpu_from_weights_file
    saved_cfg = load_cfg(src_blobs['cfg'])
  File "/data/yang/detectron/detectron/core/config.py", line 1147, in load_cfg
    return envu.yaml_load(cfg_to_load)
  File "/home/ec2-user/anaconda3/envs/pytorch_p36/lib/python3.6/site-packages/yaml/__init__.py", line 114, in load
    return loader.get_single_data()
  File "/home/ec2-user/anaconda3/envs/pytorch_p36/lib/python3.6/site-packages/yaml/constructor.py", line 51, in get_single_data
    return self.construct_document(node)
  File "/home/ec2-user/anaconda3/envs/pytorch_p36/lib/python3.6/site-packages/yaml/constructor.py", line 55, in construct_document
    data = self.construct_object(node)
  File "/home/ec2-user/anaconda3/envs/pytorch_p36/lib/python3.6/site-packages/yaml/constructor.py", line 102, in construct_object
    data = constructor(self, tag_suffix, node)
  File "/home/ec2-user/anaconda3/envs/pytorch_p36/lib/python3.6/site-packages/yaml/constructor.py", line 659, in construct_python_object_new
    return self.construct_python_object_apply(suffix, node, newobj=True)
  File "/home/ec2-user/anaconda3/envs/pytorch_p36/lib/python3.6/site-packages/yaml/constructor.py", line 642, in construct_python_object_apply
    value = self.construct_mapping(node, deep=True)
  File "/home/ec2-user/anaconda3/envs/pytorch_p36/lib/python3.6/site-packages/yaml/constructor.py", line 218, in construct_mapping
    return super().construct_mapping(node, deep=deep)
  File "/home/ec2-user/anaconda3/envs/pytorch_p36/lib/python3.6/site-packages/yaml/constructor.py", line 143, in construct_mapping
    value = self.construct_object(value_node, deep=deep)
  File "/home/ec2-user/anaconda3/envs/pytorch_p36/lib/python3.6/site-packages/yaml/constructor.py", line 107, in construct_object
    for dummy in generator:
  File "/home/ec2-user/anaconda3/envs/pytorch_p36/lib/python3.6/site-packages/yaml/constructor.py", line 413, in construct_yaml_map
    value = self.construct_mapping(node)
  File "/home/ec2-user/anaconda3/envs/pytorch_p36/lib/python3.6/site-packages/yaml/constructor.py", line 218, in construct_mapping
    return super().construct_mapping(node, deep=deep)
  File "/home/ec2-user/anaconda3/envs/pytorch_p36/lib/python3.6/site-packages/yaml/constructor.py", line 143, in construct_mapping
    value = self.construct_object(value_node, deep=deep)
  File "/home/ec2-user/anaconda3/envs/pytorch_p36/lib/python3.6/site-packages/yaml/constructor.py", line 100, in construct_object
    data = constructor(self, node)
  File "/home/ec2-user/anaconda3/envs/pytorch_p36/lib/python3.6/site-packages/yaml/constructor.py", line 429, in construct_undefined
    node.start_mark)
yaml.constructor.ConstructorError: could not determine a constructor for the tag 'tag:yaml.org,2002:python/object/apply:numpy.core.multiarray.scalar'
  in "<unicode string>", line 3, column 20:
      BBOX_XFORM_CLIP: !!python/object/apply:numpy.core ... 

错误原因分析:

pyyaml的版本不匹配造成的。

解决方法:

(1)卸载之前的版本

conda list
conda remove pyyaml
conda remove yaml

(2)安装此版本的yaml

pip install pyyaml==4.2b2

至此问题完美解决!!!

参考链接:

Detectron 框架安装与使用!

Detectron 框架使用出现错误yaml.constructor.ConstructorError: could not determine a constructor for the tag 错误yaml.constructor.ConstructorError: could not determine a constructor for the tag错误提示:Traceback (most recent call last): File "tools/train_net.py", line 133, in &lt;module&gt; main() File "tools/train_net.py", line 98, in main if args.cfg_fi 它很新,还有很多缺失的章节,但我已经很高兴收到有关如何改进的建议以及您希望看到的信息类型。 有很多页面解释 YAML。 他们中的大多数都遗漏了一些东西或使用错误的术语。 此外,其中大部分是为 YAML 1.1 编写的,在 YAML 1.2 中存在一些显着差异。 我认为使用 YAML 规范中也使用的官方词汇很重要。 库部分对用户很有用。 它还为开发人员实施 YAML 库或使用 YAML 实施应用程序提供信息。 在过去的几年里,我一直在研究 YAML 的不同方面,并看到需要一个包含此类信息的网站。
Yufrontin 使用yaml.js的轻量级yaml前端提取器 yaml.js的核心包含在lib目录中。 当我只使用核心时,我觉得不需要将整个存储库用作依赖项。 这样可以使项目的规模变小。 包含yaml.js的许可证文件。 $ npm install yufrontin yufrontin ( '---\ntitle: \'me\'\n---\nHello World' ) // results in --> { data : { title : 'me' } , content : 'Hello World' } yufrontin ( 'Hello World' ) { data : { } , content : 'Hello World' } 或者您可以这样做: var fs = require ( 'fs' ) var parsefm = require (
描述问题:通过调用snakeyaml的api生产了yaml的配置文件,然后将生成的yaml配置文件放到spring boot 的bootstrap.yml 配置文件中,启动项目,程序报错。 问题结论:Spring Boot 集成snakeyaml 但却没用snakeyaml 对set集合中复杂对象的解析,自己封装了一套解析方案,导致Spring Boot 加载yaml时对set集合中复杂对象解析失败。 疑问:是Spring Boot 压根没有想对这种类型支持,还是Spring Boot的Bug?有大佬给
Caused by: org.yaml.snakeyaml.constructor.ConstructorException: Can't construct a java object for !QAZ2wsx; exception=Invalid tag: !QAZ2wsx 用单引号将特殊字符的值包起来,如下: password : '!QAZ2wsx' 重新启动即可正常运行。
1、由于用的jersey,而jersey使用的jack-json版本和redison使用的不一样,导致maven依赖冲突。 解决思路,优先考虑使用exclusions排除重复的jar包。如果解决不了,那就添加不同版本的jar,使用exclipse自带在配置里 使用mvn dependency:tree 显示依赖树。看使用那些依赖把没有的加上。 2、官方配置redisson的单机配置
wget : 操作已超时。 所在位置 行:1 字符: 1 + wget http://host.robots.ox.ac.uk/pascal/VOC/voc2007/VOCtest_06-Nov-20 ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-WebRequest],WebExce ption + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand 有没有大佬知道这是什么意思 Faster-RCNN.pytorch的搭建、使用过程详解(适配PyTorch 1.0以上版本) m0_73306197: wget : 操作已超时。 所在位置 行:1 字符: 1 + wget http://host.robots.ox.ac.uk/pascal/VOC/voc2007/VOCtest_06-Nov-20 ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-WebRequest],WebExce ption + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand 有没有大佬知道这是什么意思