2017-01-14 7 views
0

私はKerasでCNNを訓練していますが、画像から30x30のパッチを使用しています。私は完全なイメージを持つネットワークをテストしたいが、私は次のエラーを取得:これは私のmodel.predictあるケラスモデル予測列車/テスト形状

ValueError: GpuElemwise. Input dimension mis-match. Input 2 (indices start at 0) has shape[1] == 30, but the output's size on that axis is 100. Apply node that caused the error: GpuElemwise{Composite{((i0 + i1) - i2)}}[(0, 0)](GpuDimShuffle{0,2,3,1}.0, GpuReshape{4}.0, GpuFromHost.0) Toposort index: 79 Inputs types: [CudaNdarrayType(float32, 4D), CudaNdarrayType(float32, (True, True, True, False)), CudaNdarrayType(float32, 4D)] Inputs shapes: [(10, 100, 100, 3), (1, 1, 1, 3), (10, 30, 30, 3)] Inputs strides: [(30000, 100, 1, 10000), (0, 0, 0, 1), (2700, 90, 3, 1)] Inputs values: ['not shown', CudaNdarray([[[[ 0.01060364 0.00988821 0.00741314]]]]), 'not shown'] Outputs clients: [[GpuCAReduce{pre=sqr,red=add}{0,1,1,1}(GpuElemwise{Composite{((i0 + i1) - i2)}}[(0, 0)].0)]]

predict_image = model.predict(np.array([test_images[1]]), batch_size=1)[0] 

にですが問題のように思える入力サイズをすることができないということですが30×30以外が、私のネットワークの第1の層のための最初の入力形状なし、なし、3

model.add(Convolution2D(n1, f1, f1, border_mode='same', input_shape=(None, None, 3), activation='relu')) 

が、私がワットを訓練されたものと異なる寸法で画像をテストするだけではできませんされていませんith?あなたがフラット化操作を使用して層を持っている場合

input_shape=(1, None, None) 

しかし、これは失敗します。

答えて

0

としては、自身があなたがそうのように入力を定義することができるはず、hereを説明fchollet。

これは、完全な畳み込みNNで目標を達成できるはずであることを示しています。

関連する問題