2017-06-28 4 views
1

私はDeep Learningの初心者です。Kerasを使用してRでモデルを構築しようとしています。私は実行training.When私はモデルの配列に格納され2万32x32x3イメージを持っている:Kerasモデルはinput_layerを受け付けません

model = keras_model_sequential() 
model %>% layer_input(shape = c(32,32,3)) 

私は次のエラーを取得:

Error in py_call_impl(callable, dots$args, dots$keywords) : 
TypeError: int() argument must be a string or a number, not 'Sequential' 

Detailed traceback: 
File "/home/abhijit331/.virtualenvs/r-tensorflow/lib/python2.7/site-packages/tensorflow/contrib/keras/python/keras/engine/topology.py", line 1380, in Input 
input_tensor=tensor) 
File "/home/abhijit331/.virtualenvs/r-tensorflow/lib/python2.7/site-packages/tensorflow/contrib/keras/python/keras/engine/topology.py", line 1287, in __init__ 
name=self.name) 
File "/home/abhijit331/.virtualenvs/r-tensorflow/lib/python2.7/site-packages/tensorflow/contrib/keras/python/keras/backend.py", line 545, in placeholder 
x = array_ops.placeholder(dtype, shape=shape, name=name) 
File "/home/abhijit331/.virtualenvs/r-tensorflow/lib/python2.7/site-packages/tensorflow/python/ops/array_ops.py", line 1499, in placeholder 
shape = tensor_shape.as_shape(shape) 
File "/home/abhijit331/.virtualenvs/r-tensorflow/lib/python2.7/site-packages/tensorflow/python/framework/tensor_shape.py", line 80 

を誰も私がどのようにセットアップするための入力層を把握することができます私のモデル?

答えて

3

Sequential APIを使用する場合は、layer_input関数を使用しないでください。 最初のレイヤーにinput_shape引数が必要です。これはlayer_inputとして機能します。たとえば、

model %>% 
    layer_dense(units = 32, input_shape = c(784)) %>% 
    layer_activation('relu') %>% 
    layer_dense(units = 10) %>% 
    layer_activation('softmax') 

Functional APIを使用する場合は、layer_input関数を使用できます。詳細hereを参照してください。

関連する問題