python - 将 Lasagne 模型转换为 Keras

标签 python machine-learning deep-learning keras lasagne

我想将 Lasagne 模型规范转换为 Keras。 Keras 中与 Lasagne 中的等效层是什么:

  nn = Conv3DDNNLayer(nn, 8, 3)  # Lasagne layers

Keras 的 Convolution3D 层规范为:

keras.layers.convolutional.Convolution3D(nb_filter, kernel_dim1, kernel_dim2, kernel_dim3, init='glorot_uniform', activation=None, weights=None, border_mode='valid', subsample=(1, 1, 1), dim_ordering='default', W_regularizer=None, b_regularizer=None, activity_regularizer=None, W_constraint=None, b_constraint=None, bias=True)

...还有烤宽面条:

class lasagne.layers.dnn.Conv3DDNNLayer(incoming, num_filters, filter_size, stride=(1, 1, 1), pad=0, untie_biases=False, W=lasagne.init.GlorotUniform(), b=lasagne.init.Constant(0.), nonlinearity=lasagne.nonlinearities.rectify, flip_filters=False, **kwargs)

因此,在上面的示例中,Lasagne 层有“nn”个传入、8 个过滤器和过滤器大小 3。

但是,Keras 要求指定每个 kernel_dim。他们都只有3岁吗?

谢谢。

最佳答案

正如您可能读到的 here :

filter_size : int or iterable of int

An integer or a 3-element tuple specifying the size of the filters.

nn = Conv3DDNNLayer(nn, 8, 3)

相当于:

model.add(Convolution3D(8, 3, 3, 3, ...)

conv_3d_output = Convolution3D(8, 3, 3, 3, ...)(conv_3d_input)

取决于您使用的 Keras.API

关于python - 将 Lasagne 模型转换为 Keras,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42641330/

相关文章:

python - Keras:为什么 model.fit() 返回与 model.evaluate() 相同的值?

deep-learning - 为什么 torch 修剪实际上没有去除过滤器或重物?

python - 如何使用python保存内存、pid和进程

python - 更改 PyLint 中列入黑名单的函数

python - 如何删除django中的用户?

python - pip : command in environment . yaml 文件的含义是什么?

machine-learning - 查找用户标签之间的距离/相似度的算法?

python - 如何在 python 中使用 Opentelemtry 跨服务使用嵌套跨度进行跟踪传播?

annotations - 当用户为任何主题注释多个类别时,注释者之间达成一致

c# - C# 中的强化学习