1
内两层我目前使用重新实现的CNTK我Jonathan Longs FCN8-s实施TensorFlow。虽然TensorFlow是非常同时所熟悉我,我在使用微软的CNTK但非常缺乏经验。我读了几CNTK Github上教程,但现在我在这里我想与upscore层添加pool4_score点。在TensorFlow我会简单地使用tf.add(pool4_score, upscore1)
但CNTK我必须使用Sequentials(正确吗?)所以我的代码如下所示:如何添加CNTK顺序
with default_options(activation=None, pad=True, bias=True):
z = Sequential([
For(range(2), lambda i: [
Convolution2D((3,3), 64, pad=True, name='conv1_{}'.format(i)),
Activation(activation=relu, name='relu1_{}'.format(i)),
]),
MaxPooling((2,2), (2,2), name='pool1'),
For(range(2), lambda i: [
Convolution2D((3,3), 128, pad=True, name='conv2_{}'.format(i)),
Activation(activation=relu, name='relu2_{}'.format(i)),
]),
MaxPooling((2,2), (2,2), name='pool2'),
For(range(3), lambda i: [
Convolution2D((3,3), 256, pad=True, name='conv3_{}'.format(i)),
Activation(activation=relu, name='relu3_{}'.format(i)),
]),
MaxPooling((2,2), (2,2), name='pool3'),
For(range(3), lambda i: [
Convolution2D((3,3), 512, pad=True, name='conv4_{}'.format(i)),
Activation(activation=relu, name='relu4_{}'.format(i)),
]),
MaxPooling((2,2), (2,2), name='pool4'),
For(range(3), lambda i: [
Convolution2D((3,3), 512, pad=True, name='conv5_{}'.format(i)),
Activation(activation=relu, name='relu5_{}'.format(i)),
]),
MaxPooling((2,2), (2,2), name='pool5'),
Convolution2D((7,7), 4096, pad=True, name='fc6'),
Activation(activation=relu, name='relu6'),
Dropout(0.5, name='drop6'),
Convolution2D((1,1), 4096, pad=True, name='fc7'),
Activation(activation=relu, name='relu7'),
Dropout(0.5, name='drop7'),
Convolution2D((1,1), num_classes, pad=True, name='fc8')
ConvolutionTranspose2D((4,4), num_classes, strides=(1,2), name='upscore1')
# TODO:
# conv for pool4_score with (1x512) and 21 classes
# combine upscore 1 and pool4_score
])(input)
我看是有combine
方法。但是我发现没有例子怎么用它在顺序内。因此,如何将使用CNTK我实现tf.add
方法?
非常感谢!