Changing the shape of the input layer in tensorflow

I have a convolutional network which consists of multiple CNN layers (which could work with any size) and a fully connected layer at the end which can only work with fixed input size.

I have trained the network for certain image size and the fully connected layer can only work for those input sizes.

I don't want to retrain the entire network when operating on different input sizes. Is there any way to achieve training of only the newly added fully connected layer.

My code for inference looks like this

def inference(images, reuse=False, trainable=True):
coarse1_conv = conv2d('coarse1', images, [11, 11, 3, 96], [96], [1, 4, 4, 1], padding='VALID', reuse=reuse, trainable=trainable)
coarse1 = tf.nn.max_pool(coarse1_conv, ksize=[1, 3, 3, 1], strides=[1, 2, 2, 1], padding='VALID', name='pool1')
coarse2_conv = conv2d('coarse2', coarse1, [5, 5, 96, 256], [256], [1, 1, 1, 1], padding='VALID', reuse=reuse, trainable=trainable)
coarse2 = tf.nn.max_pool(coarse2_conv, ksize=[1, 3, 3, 1], strides=[1, 2, 2, 1], padding='SAME', name='pool1')
coarse3 = conv2d('coarse3', coarse2, [3, 3, 256, 384], [384], [1, 1, 1, 1], padding='VALID', reuse=reuse, trainable=trainable)
coarse4 = conv2d('coarse4', coarse3, [3, 3, 384, 384], [384], [1, 1, 1, 1], padding='VALID', reuse=reuse, trainable=trainable)
coarse5 = conv2d('coarse5', coarse4, [3, 3, 384, 256], [256], [1, 1, 1, 1], padding='VALID', reuse=reuse, trainable=trainable)
coarse6 = fc('coarse6', coarse5, [6*10*256, 4096], [4096], reuse=reuse, trainable=trainable)
coarse7 = fc('coarse7', coarse6, [4096, 4070], [4070], reuse=reuse, trainable=trainable)
coarse7_output = tf.reshape(coarse7, [-1, 55, 74, 1])
return coarse7_output

• Checkout the architecture of resnets etc.. Apr 17 '18 at 18:03
• Will do . ANything other than resnets which is directly adapted to the above code? Apr 18 '18 at 4:45