gpt4 book ai didi

neural-network - 在 Caffe 中使用组合层时形状不匹配

转载 作者:行者123 更新时间:2023-12-02 03:21:10 25 4
gpt4 key购买 nike

我正在使用 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)

据我所知,我正在以与 BVLC_GoogLeNet 完全相同的方式使用 concat 层。 . 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 层。

最佳答案

我认为您遇到的问题是您的train 网络已更新为具有连接层,而您的测试 网络还没有。

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

关于neural-network - 在 Caffe 中使用组合层时形状不匹配,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33304859/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com