2

約 70,000 のトレーニング イメージのリストがあり、それぞれが (カラー チャネルの数、高さ、幅) = (3, 30, 30) の形をしており、約 20,000 のテスト イメージがあります。私の畳み込みオートエンコーダーは次のように定義されています。

 # Same as the code above, but with some params changed
# Now let's define the model. 

# Set input dimensions:
input_img = Input(shape=(3, 30, 30))

# Encoder: define a chain of Conv2D and MaxPooling2D layers
x = Convolution2D(128, 3, 3, 
                  activation='relu', 
                  border_mode='same')(input_img)
x = MaxPooling2D((2, 2), border_mode='same')(x)
x = Convolution2D(64, 3, 3, 
                  activation='relu', 
                  border_mode='same')(x)
x = MaxPooling2D((2, 2), border_mode='same')(x)
x = Convolution2D(64, 3, 3, 
                  activation='relu', 
                  border_mode='same')(x)
encoded = MaxPooling2D((2, 2), border_mode='same')(x)

# at this point, the representation is (8, 4, 4) i.e. 128-dimensional

# Decoder: a stack of Conv2D and UpSampling2D layers
x = Convolution2D(64, 3, 3, 
                  activation='relu', 
                  border_mode='same')(encoded)
x = UpSampling2D((2, 2))(x)
x = Convolution2D(64, 3, 3, 
                  activation='relu', 
                  border_mode='same')(x)
x = UpSampling2D((2, 2))(x)
x = Convolution2D(128, 3, 3, 
                  activation='relu')(x)
x = UpSampling2D((2, 2))(x)
decoded = Convolution2D(1, 3, 3, 
                        activation='sigmoid', 
                        border_mode='same')(x)

autoencoder2 = Model(input_img, decoded)
autoencoder2.compile(optimizer='adadelta', loss='mse')

hereのオートエンコーダーはどれですか。

エラーがスローされます:

Error when checking model target: expected convolution2d_14 to have shape (None, 1, 28, 28) but got array with shape (76960, 3, 30, 30)

指定された入力形状を (3, 30, 30) として明確に変更したため、これは奇妙です。私が見逃している実装技術はありますか?

4

3 に答える 3

2

デコーダーの最後の convnet レイヤーに border_mode='same' を追加するのを忘れました。

于 2016-09-17T19:42:49.443 に答える