CNN Training Question

Hi,
I have another question. I have this workflow and that consists in 20.000 images of (28,28,3) and I have this error in Train CNN-> :

InvalidArgumentError (see above for traceback): Incompatible shapes: [9,3] vs. [25,3]
[[node gradients/mean_squared_error/SquaredDifference_grad/BroadcastGradientArgs (defined at :39) ]]

I have this 2 Python scripts in Network Creator an Network Learner but I have the error of the shapes: InvalidArgumentError (see above for traceback): Incompatible shapes: [9,3] vs. [25,3]

Do you know why??

NetworkCreator.txt (1.5 KB) NetworkLearner.txt (2.1 KB)

Hey Pableras,

the error states, that your shape size don’t match. one is 9,3 and the other one is 25,3 - but they should be 28,28,3 vs 28,28,3 or 9,3 vs 9,3 or 25,3 vs 25,3

br,
Sven

2 Likes

thank you, but my question is why is the shape 9,3 vs 25,3 wheter my images are 28,28,3.

If you see de 2 files .txt, I declare shape of (28,28,3), neither 9 or 25. Number 25 is de batch size.

Do you know why?? Thanks

I modified this workflow with 3 kinds of images of shape(21,28,3). The execution is OK but when I test images not work well because the result is always tha same. This is my code to Dl Python network creator. Something wrong???:

variable name of the output network: output_network

import tensorflow as tf
from TFModel import TFModel

input_shape = (None, 21, 28, 3)
num_classes = 3

Create a graph

graph = tf.Graph()

Set the graph as default -> Create every tensor in this graph

with graph.as_default():

# Create an input tensor
x = tf.placeholder(tf.float32, shape=input_shape, name='input')

# Define the graph
# Convolutional Layer #1
conv1 = tf.layers.conv2d(inputs=x, filters=32, kernel_size=[5, 5],
						 padding="same", activation=tf.nn.relu)

# Pooling Layer #1
pool1 = tf.layers.max_pooling2d(inputs=conv1, pool_size=[2, 2], strides=2)

	
# Convolutional Layer #2 and Pooling Layer #2
conv2 = tf.layers.conv2d(inputs=pool1, filters=64, kernel_size=[5, 5],
						 padding="same", activation=tf.nn.relu)
pool2 = tf.layers.max_pooling2d(inputs=conv2, pool_size=[2, 2], strides=2)

	
# Convolutional Layer #2 and Pooling Layer #2
conv3 = tf.layers.conv2d(inputs=pool2, filters=128, kernel_size=[5, 5],
						 padding="same", activation=tf.nn.relu)
pool3 = tf.layers.max_pooling2d(inputs=conv3, pool_size=[2, 2], strides=2)

# Dense Layer
pool2_flat = tf.reshape(pool3, [-1, 768])
dense = tf.layers.dense(inputs=pool2_flat, units=512, activation=tf.nn.relu)

# Create an output tensor
y = tf.layers.dense(dense, num_classes, activation=tf.nn.softmax, name='output')

Create the output network

output_network = TFModel(inputs={‘input’: x}, outputs={‘output’: y}, graph=graph)

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.