I'm making a CNN and I don't know the full ins and outs of coding. When i try to add the layers, it constantly gives me a "NotImplmentedError" and a "ValueError" that says ValueError: Input 0 of layer "conv2d" is incompatible with the layer: expected min_ndim=4, found ndim=2. Full shape received: (None, 4)
single_feature_normalizer = tf.keras.layers.Normalization(axis=None) feature = tf.random.normal((314, 1)) single_feature_normalizer.adapt(feature) single_feature_model = tf.keras.models.Sequential([ tf.keras.layers.Input(shape=(1,)), single_feature_normalizer, tf.keras.layers.Conv2D(1) ]) model.add(Conv2D(16, (3,3), 1, activation='relu', input_shape=(None,256,256,3))) model.add(MaxPooling2D()) model.add(Conv2D(32, (3,3), 1, activation='relu', input_shape=(None,256,256,3))) model.add(MaxPooling2D()) model.add(Conv2D(16, (3,3), 1, activation='relu')) model.add(MaxPooling2D()) model.add(Flatten()) model.add(Dense(256, activation='relu')) model.add(Dense(1, activation='sigmoid')) My min_ndim is 4, I checked so I'm unsure what's wrong.
I tried adding these lines:
single_feature_normalizer = tf.keras.layers.Normalization(axis=None) feature = tf.random.normal((314, 1)) single_feature_normalizer.adapt(feature) single_feature_model = tf.keras.models.Sequential([ tf.keras.layers.Input(shape=(1,)), single_feature_normalizer, tf.keras.layers.Conv2D(1) ]) `` but it didn't work, I also tried explicitly stating that the min_ndim was 4