Ich bin im Moment meine TensorFlow Implementierung von Jonathan Longs FCN8-s mit CNTK reimplementieren. Während TensorFlow mir inzwischen sehr bekannt ist, bin ich noch sehr unerfahren in der Verwendung von Microsofts CNTK. Ich lese ein paar CNTK Github Tutorials, aber jetzt bin ich an dem Punkt, wo ich pool4_score mit der Upscore-Ebene hinzufügen möchte. In TensorFlow verwenden würde ich einfach tf.add(pool4_score, upscore1)
aber in CNTK habe ich Sequentials zu verwenden (richtig?) Also mein Code wie folgt aussieht:Wie füge ich zwei Schichten innerhalb einer CNTK Sequential hinzu
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)
ich gelesen, dass es ein combine
Methode ist .. Aber ich fand keine Beispiele, wie man verwendet es innerhalb der sequentiellen. Also, wie würde ich die tf.add
Methode mit CNTK implementieren?
Vielen Dank!