AttributeError:“FasterRcnn”对象没有属性“inplace”“batchnorm”“update”

2024-04-26 01:37:17 发布

您现在位置:Python中文网/ 问答频道 /正文

我试图为tensorflow对象检测API训练一个预训练的"faster_rcnn_resnet101_kitti"模型。在

但每次我想跑的时候

 python3 train.py --logtostderr --train_dir='/training/' --pipeline_config_path='/training/faster_rcnn_resnet101_kitti.config' 

我收到以下错误

^{pr2}$

Tags: 对象py模型apiconfigtensorflowdirtraining
2条回答

我也有这个错误,对我来说,这是因为在我从TF模型库中取出最后一个更新之后,我没有re-compiled my .proto-files。在

要重新编译(在Linux上):

# From tensorflow/models/research/ folder
protoc object_detection/protos/*.proto  python_out=.

我假设失败的代码试图从更快的rcnn config中读取属性/字段inplace_batchnorm_update,这在旧版本中不存在。我希望这对你也有帮助。在

我的版本是:tensorflow gpu 1.7.0,并让TF模型提交哈希77d3bbefeb33e89bfa1eee707151e5d794d122b,其中包含消息“Merge pull requestค3888 from hsm207/patch-3 Fix typo”。在

在Windows上重新编译

我从自己的经验中知道,与Windows相比,在Linux中编译上述许多文件是很容易的。对于Windows,有一些方法可以使该过程不那么麻烦:

this issuedavemers0160已共享 在Windows上编译的脚本。在

只需将this file另存为.bat-文件:

^{pr2}$

从上面提到的同一个文件夹运行该文件。因为问题是在Linux中,我只是在底部添加了这个,以防Windows用户也来阅读这个。在

在更新了模型存储库之后,我也出现了同样的错误。 我重新编译了.proto文件,但仍然有错误。在

根据日志:

File "/home/duane/anaconda3/lib/python3.6/site-packages/object_detection-0.1-py3.6.egg/object_detection/builders/model_builder.py", line 164, in _build_ssd_model
inplace_batchnorm_update=ssd_config.inplace_batchnorm_update)

我想可能是因为object_detection-0.1-py3.6.egg版本太旧,所以我重新安装了models/research/setup.py

^{pr2}$

那么它就没有错误了。在

注意:在重新安装之前,我确实重新编译了.proto文件设置.py. 您可以看到更多详细信息#3968

希望这能对你有所帮助。在

相关问题 更多 >