3

我正在使用 Caffe 库来训练卷积神经网络 (CNN)。但是,在将两个卷积层的输出应用到 inner_product 层之前,使用 concat 层组合输出时出现以下错误。

F1023 15:14:03.867435  2660 net.cpp:788] Check failed: target_blobs[j]->shape() == source_blob->shape() Cannot share param 0 weights from layer 'fc1'; shape mismatch.  Source param shape is 400 800 (320000); target param shape is 400 400 (160000)

据我所知,我使用 concat 层的方式与BVLC_GoogLeNet 完全相同。concat 层可以在我的 train.prototxt 中的pastebin名称下找到combined。我的输入 blob 的尺寸是256x8x7x24,Caffe 中的数据格式是batch_size x channels x height x width。我尝试过使用 pycaffe 界面和控制台进行培训。我犯了同样的错误。下面是使用控制台进行训练的代码。

solver_path = CAFFE_ROOT+'build/tools/caffe train -solver '
model_path = self.run_dir+'models/solver.prototxt'
log_path = self.run_dir+'models/training.log'

p = subprocess.Popen("GLOG_logtostderr=1 {} {} 2> {}".format(solver_path, model_path, log_path), shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)

这个错误是什么意思?以及如何解决?

更新

正如评论中提到的,日志只包含错误。错误的堆栈跟踪如下:

@     0x7f231886e267  caffe::Net<>::ShareTrainedLayersWith()
@     0x7f231885c338  caffe::Solver<>::Test()
@     0x7f231885cc3e  caffe::Solver<>::TestAll()
@     0x7f231885cd79  caffe::Solver<>::Step()
@     0x7f231885d6c5  caffe::Solver<>::Solve()
@           0x408d2b  train()
@           0x4066f1  main

还应该注意的是,我的求解器和代码可以很好地训练完全相同的 CNN,在网络中只有 1 个“路径”,即没有 CONCAT 层。

4

1 回答 1

1

我相信您遇到的问题是您的火车网络已更新为具有连接层,而您的测试网络没有。

它将解释您在考虑 concat 合并两个 400x400 层时遇到的 400x400 与 400x800 问题。如果不能看到您的测试网,我无法确定。

于 2015-10-27T03:20:51.223 回答