在 Keras 中使用每个先前过滤图像的特征图创建 CNN 模型
Creating a CNN Model in Keras with feature maps from each of the previous filtered images
我正在尝试实现人工卷积神经网络,以便执行两个 class 像素级 class化,如附图所示(来自 Chen 等人,Nature 2017 ).
你能告诉我第三层和第四层应该是什么样子吗?
这是我已经达到的程度:
from keras.models import Sequential
from keras.layers import Conv2D, MaxPooling2D
model = Sequential()
model.add(Conv2D(40, (15, 15), activation='relu',
padding='same', input_shape = (64, 64, 1))) # first layer
model.add(MaxPooling2D((2, 2), padding='same')) # second layer
# model.add(...) # third layer <-- how to implement this?
# model.add(...) # fourth layer <-- how to implement this?
print(model.summary())
他们为剩余层使用了多少个内核,我应该如何解释图像中的求和符号?
提前致谢!
实际问题比较含糊。
我猜对了,您希望有人为网络实现缺少的两行代码?
model = Sequential()
model.add(Conv2D(40, (15, 15), activation='relu',
padding='same', input_shape=(64, 64, 1)))
model.add(MaxPooling2D((2, 2), padding='same'))
model.add(Conv2D(40, (15, 15), activation='relu', padding='same')) # layer 3
model.add(Conv2D(1, (15, 15), activation='linear', padding='same')) # layer 4
print(model.summary())
要在第 3 层之后获得 40 个特征图,我们只需与 40 个不同的内核进行卷积。
在第4层之后,应该只有一个feature map/channel,所以这里1个kernel就够了。
顺便说一下,这张图好像是来自Convolutional neural networks for automated annotation of cellular cryo-electron tomograms (PDF) by Chen et al., nature 2017年的一篇文章
更新:
Comment: [...] why the authors say 1600 kernels in total and there is a summation?
实际上,作者在这里似乎遵循了一个相当奇怪的符号。他们有一个(恕我直言)不正确的方法来计算内核。他们的意思是权重(如果给定 1x1 内核...)。
也许他们不明白内核的形状实际上是 3 维的,因为最后一个维度等于特征图的数量。
当我们分解它时,有
- 第一层有 40 个大小为 15x15x1 的内核(这使得 40 * 15 ** 2 个可训练权重)
- 第二层没有内核
- 第 3 层有 40 个大小为 15x15x40 的内核(这使得 1600 * 15 ** 2 个可训练权重)
- 第 4 层的 1 个大小为 15x15x40 的内核(这使得 40 * 15 ** 2 个可训练权重)
我正在尝试实现人工卷积神经网络,以便执行两个 class 像素级 class化,如附图所示(来自 Chen 等人,Nature 2017 ).
你能告诉我第三层和第四层应该是什么样子吗?
这是我已经达到的程度:
from keras.models import Sequential
from keras.layers import Conv2D, MaxPooling2D
model = Sequential()
model.add(Conv2D(40, (15, 15), activation='relu',
padding='same', input_shape = (64, 64, 1))) # first layer
model.add(MaxPooling2D((2, 2), padding='same')) # second layer
# model.add(...) # third layer <-- how to implement this?
# model.add(...) # fourth layer <-- how to implement this?
print(model.summary())
他们为剩余层使用了多少个内核,我应该如何解释图像中的求和符号?
提前致谢!
实际问题比较含糊。
我猜对了,您希望有人为网络实现缺少的两行代码?
model = Sequential()
model.add(Conv2D(40, (15, 15), activation='relu',
padding='same', input_shape=(64, 64, 1)))
model.add(MaxPooling2D((2, 2), padding='same'))
model.add(Conv2D(40, (15, 15), activation='relu', padding='same')) # layer 3
model.add(Conv2D(1, (15, 15), activation='linear', padding='same')) # layer 4
print(model.summary())
要在第 3 层之后获得 40 个特征图,我们只需与 40 个不同的内核进行卷积。 在第4层之后,应该只有一个feature map/channel,所以这里1个kernel就够了。
顺便说一下,这张图好像是来自Convolutional neural networks for automated annotation of cellular cryo-electron tomograms (PDF) by Chen et al., nature 2017年的一篇文章
更新:
Comment: [...] why the authors say 1600 kernels in total and there is a summation?
实际上,作者在这里似乎遵循了一个相当奇怪的符号。他们有一个(恕我直言)不正确的方法来计算内核。他们的意思是权重(如果给定 1x1 内核...)。
也许他们不明白内核的形状实际上是 3 维的,因为最后一个维度等于特征图的数量。
当我们分解它时,有
- 第一层有 40 个大小为 15x15x1 的内核(这使得 40 * 15 ** 2 个可训练权重)
- 第二层没有内核
- 第 3 层有 40 个大小为 15x15x40 的内核(这使得 1600 * 15 ** 2 个可训练权重)
- 第 4 层的 1 个大小为 15x15x40 的内核(这使得 40 * 15 ** 2 个可训练权重)