自定义caffe模型的净手术 [英] net surgery on a custom caffe model
问题描述
我正在尝试修改caffe模型的权重,该模型是名为Deep Lab的caffe分支的一部分。尽管有关于如何进行网络手术的教程,当我尝试使用自定义caffemodel进行相同操作时,python内核始终死于以下行:
I'm trying to modify the weights of a caffemodel which is part of a caffe-branch called Deep Lab. Although there is a tutorial on how to do net surgery, when I try to do the same with my custom caffemodel the python kernel dies always on the following line:
# Load the original network and extract the fully connected layers' parameters.
net = caffe.Net('../models/deeplab/train.prototxt',
'../models/deeplab/train.caffemodel',
caffe.TRAIN)
我认为是因为pycaffe不知道其自定义图层,例如 ImageSegData
, Silence
和 SegAccuracy
,因此我从prototxt文件中删除了这些图层,但仍然删除了python内核当我尝试加载网络模型时,它一直在消亡。有人知道如何将这些权重加载到python中吗?
I think its because pycaffe doesn't know their custom layers such as ImageSegData
, Silence
and SegAccuracy
so I removed these layers from the prototxt file, but still the python kernel keeps on dying when I try to load the network model. Does anyone know how to load these weights into python?
推荐答案
我已经找到了。我不得不从字面上删除每个自定义层,尤其是修改数据层,以便它可以读取所有输入图像,从而计算输入尺寸。
I found it already. I had literally to remove every custom layer and especially adapt the data layer such that it could read all the input images and thereby calculate the input dimensions.
这篇关于自定义caffe模型的净手术的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!