【问题标题】:Reading dangerously large protocol message Caffe warning读取危险的大协议消息 Caffe 警告
【发布时间】:2016-07-26 19:34:17
【问题描述】:

我正在尝试针对我的问题微调全卷积网络。我收到以下警告。 为什么我会收到此警告?

     [libprotobuf WARNING google/protobuf/io/coded_stream.cc:505] Reading dangerously 
     large protocol message.  If the message turns out to be larger than 2147483647 bytes, 
     parsing will be halted for security reasons.  To increase the limit (or to disable 
     these warnings), see CodedInputStream::SetTotalBytesLimit() in google/protobuf/io/coded_stream.h.

【问题讨论】:

  • 我想你不必太担心。您收到该警告是因为您的模型原型可能接近 2147483647 字节。
  • 是的,我一直得到这个......从不影响我的网。如果它困扰您,请在编译之前更改源代码。虽然我确信警告是出于某种原因!

标签: caffe pycaffe matcaffe


【解决方案1】:

2147483647 是您可以在 C++ 中以整数数据类型存储的最大值。

Caffe 将 .prototxt 文件读入缓冲区,然后从缓冲区中读取参数。该缓冲区在内部定义为最大大小为 2147483647 字节。所以如果 .prototxt 文件太大,它可能不适合这个缓冲区。所以 Caffe 给出了这个警告以增加限制。

【讨论】:

  • 警告后会自动调整大小吗?
  • 没有。你必须这样做。请参阅 google/protobuf/io/coded_stream.h 中的 CodedInputStream::SetTotalBytesLimit()。