[Caffe] 关于错误Error parsing text-format caffe.NetParameter: 14:17: Invalid escape sequence in string l

深度学习交流QQ群:116270156

我是在Windows环境下配置的Caffe,在训练mnist的时候发生这个错误,完整的错误列表如下:

I0614 11:22:51.603456 8644 solver.cpp:87] Creating training net from net file: ./lenet_train_test.prototxt
[libprotobuf ERROR C:\Users\guillaume\work\caffe-builder\build_v140_x64\packages\protobuf\protobuf_download-prefix\src\p
rotobuf_download\src\google\protobuf\text_format.cc:298] Error parsing text-format caffe.NetParameter: 14:17: Invalid es
cape sequence in string literal.
[libprotobuf ERROR C:\Users\guillaume\work\caffe-builder\build_v140_x64\packages\protobuf\protobuf_download-prefix\src\p
rotobuf_download\src\google\protobuf\text_format.cc:298] Error parsing text-format caffe.NetParameter: 14:25: Invalid es
cape sequence in string literal.
[libprotobuf ERROR C:\Users\guillaume\work\caffe-builder\build_v140_x64\packages\protobuf\protobuf_download-prefix\src\p
rotobuf_download\src\google\protobuf\text_format.cc:298] Error parsing text-format caffe.NetParameter: 14:31: Invalid es
cape sequence in string literal.
[libprotobuf ERROR C:\Users\guillaume\work\caffe-builder\build_v140_x64\packages\protobuf\protobuf_download-prefix\src\p
rotobuf_download\src\google\protobuf\text_format.cc:298] Error parsing text-format caffe.NetParameter: 31:17: Invalid es
cape sequence in string literal.
[libprotobuf ERROR C:\Users\guillaume\work\caffe-builder\build_v140_x64\packages\protobuf\protobuf_download-prefix\src\p
rotobuf_download\src\google\protobuf\text_format.cc:298] Error parsing text-format caffe.NetParameter: 31:25: Invalid es
cape sequence in string literal.
[libprotobuf ERROR C:\Users\guillaume\work\caffe-builder\build_v140_x64\packages\protobuf\protobuf_download-prefix\src\p
rotobuf_download\src\google\protobuf\text_format.cc:298] Error parsing text-format caffe.NetParameter: 31:31: Invalid es
cape sequence in string literal.
F0614 11:22:51.608458 8644 upgrade_proto.cpp:88] Check failed: ReadProtoFromTextFile(param_file, param) Failed to parse
NetParameter file: ./lenet_train_test.prototxt
*** Check failure stack trace: ***

可以看出是解析lenet_train_test.prototxt出错,NetParameter后面跟的是错误的位置,比如第一个是14行17列,找到lenet_train_test.prototxt这个位置发现是’\’。

问题原因:

在windows中路径分隔符是’\’,比如我一开始直接复制lmdb的路径到prototxt中的:

[Caffe] 关于错误Error parsing text-format caffe.NetParameter: 14:17: Invalid escape sequence in string l_第1张图片

source这个字符串在c里面解析为转义,所以出错。

解决方法:

‘\’改为‘/’或者‘\\’

[Caffe] 关于错误Error parsing text-format caffe.NetParameter: 14:17: Invalid escape sequence in string l_第2张图片

你可能感兴趣的:(问题以及解决方法)