前提・実現したいこと
CNNの保存済みモデルをロードして、predictをしたいです。
発生している問題・エラーメッセージ
ValueError: Input 0 is incompatible with layer model: expected shape=(None, 120, 90, 1), found shape=(None, 90, 1)
該当のソースコード
python
1#X_testはnumpy形式で形状は,(120, 90, 1)です。(確認済み) 2loaded_model = load_model('model.h5', custom_objects=ak.CUSTOM_OBJECTS) 3predicted_y = loaded_model.predict(X_test)
モデルの構造
Layer (type) Output Shape Param # ================================================================= input_1 (InputLayer) [(None, 120, 90, 1)] 0 _________________________________________________________________ cast_to_float32 (CastToFloat (None, 120, 90, 1) 0 _________________________________________________________________ normalization (Normalization (None, 120, 90, 1) 3 _________________________________________________________________ conv2d (Conv2D) (None, 118, 88, 32) 320 _________________________________________________________________ conv2d_1 (Conv2D) (None, 116, 86, 64) 18496 _________________________________________________________________ max_pooling2d (MaxPooling2D) (None, 58, 43, 64) 0 _________________________________________________________________ dropout (Dropout) (None, 58, 43, 64) 0 _________________________________________________________________ flatten (Flatten) (None, 159616) 0 _________________________________________________________________ dropout_1 (Dropout) (None, 159616) 0 _________________________________________________________________ dense (Dense) (None, 3) 478851 _________________________________________________________________ classification_head_1 (Softm (None, 3) 0
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。