Я пытаюсь выполнить этот пример записной книжки с модуляцией https://github.com/radioML/examples/blob/master/modulation_recognition/RML2016.10a_VTCNN2_example.ipynb
После выполнения этого
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Dense, Dropout, Activation, Flatten, Conv2D, MaxPooling2D , Reshape , ZeroPadding2D,BatchNormalization
from tensorflow.keras.callbacks import EarlyStopping
model = Sequential()
model.add(Reshape([1]+in_shp, input_shape=in_shp))
model.add(ZeroPadding2D((0, 2), data_format="channels_first"))
model.add(Conv2D(256, (1,3), data_format="channels_first"))
model.add(Dropout(0.5))
model.add(ZeroPadding2D((0, 1), data_format="channels_first"))
model.add(Conv2D(80, (2 ,3), data_format="channels_first" , activation="relu"))
model.add(Dropout(0.5))
model.add(Flatten())
model.add(Dense(256, activation='relu'))
model.add(Dropout(0.5))
model.add(Dense(len(classes) , activation='softmax'))
model.add(Activation('softmax'))
model.add(Reshape([len(classes)]))
model.compile(loss='binary_crossentropy', optimizer='adam', metrics=['accuracy'])
model.summary()
я получаю это
Model: "sequential_4"
_________________________________________________________________
Layer (type) Output Shape Param #
=================================================================
reshape_7 (Reshape) (None, 1, 2, 128) 0
_________________________________________________________________
zero_padding2d_8 (ZeroPaddin (None, 1, 2, 132) 0
_________________________________________________________________
conv2d_8 (Conv2D) (None, 256, 2, 130) 1024
_________________________________________________________________
dropout_10 (Dropout) (None, 256, 2, 130) 0
_________________________________________________________________
zero_padding2d_9 (ZeroPaddin (None, 256, 2, 132) 0
_________________________________________________________________
conv2d_9 (Conv2D) (None, 80, 1, 130) 122960
_________________________________________________________________
dropout_11 (Dropout) (None, 80, 1, 130) 0
_________________________________________________________________
flatten_3 (Flatten) (None, 10400) 0
_________________________________________________________________
dense_6 (Dense) (None, 256) 2662656
_________________________________________________________________
dropout_12 (Dropout) (None, 256) 0
_________________________________________________________________
dense_7 (Dense) (None, 11) 2827
_________________________________________________________________
activation_3 (Activation) (None, 11) 0
_________________________________________________________________
reshape_8 (Reshape) (None, 11) 0
=================================================================
Total params: 2,789,467
Trainable params: 2,789,467
Non-trainable params: 0
_________________________________________________________________
и затем при запуске этого
model_fit(model, X_train, Y_train, test_idx)
я получаю эту ошибку
**InvalidArgumentError: Conv2DCustomBackpropInputOp only supports NHWC.**
[[node Conv2DBackpropInput (defined at <ipython-input-17-9cd1191bc59a>:3) ]] [Op:__inference_distributed_function_3032]
Function call stack:
distributed_function
Когда я запускаю тот же код на других машинах, он работает. Поэтому я удалил Anaconda, Keras, TensorFlow и переустановил все.
inp_shp = [2, 128]
X_train.shape = (110000, 2, 128)