0

目前,我正在尝试修剪一个网络(简单的卷积自动编码器)——不用说没有成功。

首先,我指的来源是博客文章:

http://machinethink.net/blog/compressing-deep-neural-nets/

第一步,我只想将卷积滤波器设置为零,这样它就不再起作用了。到目前为止我尝试过的是:

weights = model.get_weights() # weights is a numpy array
weights[2][0] = 0 # e.g. set the first filter of the second Conv2D-layer 0
weights[3][0] = 0 # and the filter's bias, of course

之后,我用这些权重初始化一个新模型:

newmodel.set_weights(weights)

并致电:

newmodel.fit()

但是,在检索权重后:

newweights = newmodel.get_weights()

newweights[2][0] 

不再是 0。

这意味着我的过滤器已更新,尽管根据文章,它不应该发生。

谁能告诉我我做错了什么(或如何正确做)?

最好的,

阿雷波

4

0 回答 0