小编Ham*_*ard的帖子

如何更改 Pytorch 预训练模块中的激活层?

如何更改 Pytorch 预训练网络的激活层?这是我的代码:

print("All modules")
for child in net.children():
    if isinstance(child,nn.ReLU) or isinstance(child,nn.SELU):
        print(child)

print('Before changing activation')
for child in net.children():
    if isinstance(child,nn.ReLU) or isinstance(child,nn.SELU):
        print(child)
        child=nn.SELU()
        print(child)
print('after changing activation')
for child in net.children():
    if isinstance(child,nn.ReLU) or isinstance(child,nn.SELU):
        print(child)
Run Code Online (Sandbox Code Playgroud)

这是我的输出:

All modules
ReLU(inplace=True)
Before changing activation
ReLU(inplace=True)
SELU()
after changing activation
ReLU(inplace=True)
Run Code Online (Sandbox Code Playgroud)

python neural-network deep-learning activation-function pytorch

5
推荐指数
1
解决办法
6146
查看次数

更改预训练模型的输入形状及其权重

我试图将转移学习与受过训练的[3D]CNN结合使用,在那里我对模型及其权重进行了训练。

但是问题是它的输入大小为,(64,64,7,3)而我的输入大小为(256,256,256,1)。我该如何解决这个问题?

python deep-learning conv-neural-network keras tensorflow

2
推荐指数
1
解决办法
1533
查看次数

需要 scipy 信号的 Tensorflow/Keras 等效项.fftconvolve

我想scipy.signal.fftconvolve在 Tensorflow/Keras 中使用,有什么办法吗?

现在我正在使用以下代码:

window = np.tile(window, (1, 1, 1, 3))
tf.nn.conv2d(img1, window, strides=[1,1,1,1], padding='VALID')
Run Code Online (Sandbox Code Playgroud)

这些行是否等效于:

signal.fftconvolve(img1, window, mode='valid')
Run Code Online (Sandbox Code Playgroud)

python numpy scipy keras tensorflow

2
推荐指数
1
解决办法
1262
查看次数