0
現在、Keras 2.0用にthis densenet implementationを更新しようとしています。すべては私がマージレイヤーをKeras 2.0と "連結"する方法は?
from keras.layers import Input, concatenate
[...]
feature_list = [x]
for i in range(nb_layers):
x = conv_block(x, growth_rate, bottleneck, dropout_rate, weight_decay)
feature_list.append(x)
x = concatenate(feature_list, axis=concat_axis)
nb_filter += growth_rate
return x, nb_filter
にそれを変更し
from keras.layers import Input, merge
[...]
concat_axis = 1 if K.image_dim_ordering() == "th" else -1
feature_list = [x]
for i in range(nb_layers):
x = conv_block(x, growth_rate, bottleneck, dropout_rate, weight_decay)
feature_list.append(x)
x = merge(feature_list, mode='concat', concat_axis=concat_axis)
nb_filter += growth_rate
return x, nb_filter
を除き、動作しますが、これは
Traceback (most recent call last):
File "./run_training.py", line 87, in <module>
config=experiment_meta)
File "/home/moose/GitHub/msthesis-experiments/train/train_keras.py", line 74, in main
model = model_module.create_model(nb_classes, input_shape)
File "/home/moose/GitHub/msthesis-experiments/models/densenet.py", line 173, in create_model
densenet = Model(inputs=model_input, outputs=x, name="create_dense_net")
File "/usr/local/lib/python2.7/dist-packages/keras/legacy/interfaces.py", line 87, in wrapper
return func(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/keras/engine/topology.py", line 1700, in __init__
str(layers_with_complete_input))
RuntimeError: Graph disconnected: cannot obtain value for tensor Tensor("conv2d_2/convolution:0", shape=(?, 32, 32, 12), dtype=float32) at layer "concatenate_1". The following previous layers were accessed without issue: ['input_1', 'initial_conv2D', 'batch_normalization_1', 'activation_1', 'conv2d_1']
がどのように私はこの問題を解決することができます提供しますか?