深度学习TensorFlow---本人踩过的坑(报错总结)第一篇

#深度学习TensorFlow Object Detection API训练自己的模型时—本人踩过的坑(报错总结)第一篇
##2019年5月31 收获总结
##报错一:object_detection/protos/*.proto: No such file or directoryobject_detection/protos/*.proto: No such file or directory

解决方案:自己的路径\models\research\object_detection\protos 路径下的所有 .proto 文件都需要编译成 .py 文件才可以运行。。把/.proto 这部分改成文件夹下具体的文件名,每运行一个,文件夹下应该出现对应的.py结尾的文件。不报错即可。 把号换成具体的文件名字,这样就会生成一个个.py文件,列出我自己的
Protoc object_detection/protos/anchor_generator.proto --python_out=.
protoc object_detection/protos/bipartite_matcher.proto --python_out=.
protoc object_detection/protos/box_coder.proto --python_out=.
protoc object_detection/protos/*.proto --python_out=.
protoc object_detection/protos/box_predictor.proto --python_out=.
protoc object_detection/protos/eval.proto --python_out=.
protoc object_detection/protos/faster_rcnn.proto --python_out=.
protoc object_detection/protos/faster_rcnn_box_coder.proto --python_out=.
protoc object_detection/protos/graph_rewriter.proto --python_out=.
protoc object_detection/protos/grid_anchor_generator.proto --python_out=.
protoc object_detection/protos/hyperparams.proto --python_out=.
protoc object_detection/protos/image_resizer.proto --python_out=.
protoc object_detection/protos/input_reader.proto --python_out=.
protoc object_detection/protos/keypoint_box_coder.proto --python_out=.
protoc object_detection/protos/losses.proto --python_out=.
protoc object_detection/protos/matcher.proto --python_out=.
protoc object_detection/protos/mean_stddev_box_coder.proto --python_out=.
protoc object_detection/protos/model.proto --python_out=.
protoc object_detection/protos/multiscale_anchor_generator.proto --python_out=.
protoc object_detection/protos/optimizer.proto --python_out=.
protoc object_detection/protos/pipeline.proto --python_out=.
protoc object_detection/protos/post_processing.proto --python_out=.
protoc object_detection/protos/preprocessor.proto --python_out=.
protoc object_detection/protos/region_similarity_calculator.proto --python_out=.
protoc object_detection/protos/square_box_coder.proto --python_out=.
protoc object_detection/protos/ssd.proto --python_out=.
protoc object_detection/protos/ssd_anchor_generator.proto --python_out=.
protoc object_detection/protos/string_int_label_map.proto --python_out=.
protoc object_detection/protos/train.proto --python_out=.
protoc object_detection/protos/preprocessor.proto --python_out=.
protoc object_detection/protos/preprocessor.proto --python_out=.
protoc object_detection/protos/argmax_matcher.proto --python_out=.

##报错二: 导入错误ImportError: cannot import name ‘xxxx.py
在这里插入图片描述在这里插入图片描述
解决方案:这属于一个类错误,原因是在编译protoc object_detection/protos/*.proto --python_out=.时对应报错文件没有正确生成.py文件,解决方案为:找到对应文件删除,重新编译该文件:
例如:…\models-master\research\object_detection\protos下找到argmax_matcher_pb2.py和grid_anchor_generator_pb2.py删除,编译
protoc object_detection/protos/argmax_matcher.proto --python_out=.
protoc object_detection/protos/grid_anchor_generator.proto --python_out=.,即可解决

##报错三:不能打开某个文件问题python:can’t open file ‘xxxxx.py’:[Error] Nosuch file or directory
在这里插入图片描述
答:一般是路径问题,比如我的已经
cd C:\Users\Administrator\Desktop\deeplearning\TensorflowAPI_modelmaster\models-master
research\object_detection,当运行python object_detection/builders/model_builder_test.py时就报错说找不到文件,此时解决方案为:python builders/model_builder_test.py

报错四:error: could not create ‘build’: 当文件已存在时,无法创建该文件。

答;原因是git clone下来的代码库中有个BUILD文件,而build和install指令需要新建build文件夹,名字冲突导致问题。
解决方案为首先找到…\models-master\research\slim下的BUILD文件
将该文件移动到其他目录或删除,再运行上述指令,即可成功安装。随后在…\models-master\research\slim目录下
运行
python setup.py build,
然后运行
python setup.py install
解决完毕!

##报错五:ModuleNotFoundError: No module named 'nets’或ImportError: No module named 'object_detection’

解决方案:前一个为在目录…\models-master\research下,输入conda install nets,后一个问题是因为没有安装tensorflow\models造成的,

终于测试成功啦!

在这里插入图片描述

若有帮到你,觉得有用就点个赞吧,用不到也关注一下吧,嘻嘻,非常感谢!

猜你喜欢

转载自blog.csdn.net/qq_41570307/article/details/91610310
今日推荐