class CustomModel(tf.keras.Model):def __init__(self):super(CustomModel, self).__init__()self.conv1 = Conv2D(32, (3, 3), padding='same')self.conv2 = Conv2D(64, (3, 3), padding='same')self.pool = MaxPooling2D(pool_size=(2, 2))self.bn = BatchNormalization()self.relu = Activation("relu")self.softmax = Activation("softmax")self.drop1 = Dropout(0.25)self.drop2 = Dropout(0.5)self.dense1 = Dense(512)self.dense2 = Dense(10)self.flat = Flatten()def call(self, inputs, train):z = self.conv1(inputs)z = self.bn(z, training=train)z = self.relu(z)z = self.conv1(z)z = self.bn(z, training=train)z = self.relu(z)z = self.pool(z)z = self.drop1(z, training=train)z = self.conv2(z)z = self.bn(z, training=train)z = self.relu(z)z = self.conv2(z)z = self.bn(z, training=train)z = self.relu(z)z = self.pool(z)z = self.drop1(z, training=train)z = self.flat(z)z = self.dense1(z)z = self.relu(z)z = self.drop2(z, training=train)z = self.dense2(z)z = self.softmax(z)return z
random_input = np.random.rand(32,32, 3).astype(np.float32)
random_input = np.expand_dims(random_input, axis=0)
preds = model(random_input, train=False)
print(preds)
InvalidArgumentError: input depth must be evenly divisible by filter depth: 32 vs 3 [Op:Conv2D]
The error is very clear , you shoul have input depth that divisible by filter 32 , this error i get when i use yolo darknet to train my dataset , you should have ( filters mod 32 ==0)
--
You received this message because you are subscribed to the Google Groups "TensorFlow Community Testing" group.
To unsubscribe from this group and stop receiving emails from it, send an email to testing+u...@tensorflow.org.
----Cordialement
________________________________________________________Neji Abdechafi
Développeur informatique
Adresse: Route Ellaba Km 4 Medenine - 4100 - TUNISIE.
Tél: 00 216 54 60 46 97
Mail: neji.abdec...@gmail.com
I don't agree. Number of filters in a conv layer has no relation with the input depth. Also, the same model when defined using `Sequential` or `Functional` api works fine. I suspect this is something related to the call to `build` method.
To unsubscribe from this group and stop receiving emails from it, send an email to tes...@tensorflow.org.
----Cordialement
________________________________________________________
Neji Abdechafi
Développeur informatique
Adresse: Route Ellaba Km 4 Medenine - 4100 - TUNISIE.
Tél: 00 216 54 60 46 97
Mail: neji.abde...@gmail.com