I am new in the computer vision and ML. After several exiting weeks with Python and TensorFlow I have some questions.
How to convert trained convolutional network (CNN) to use it as a detector? (get a heatmap)
For ex.:
We have
trained MNIST model
MODEL = [None, 28**2] > [CONV3+POOL] > [CONV3+POOL] > [DENSELAYER] > [None, 10]
I want:
[None, WH] > [MODEL] > [None, w, h, 10]
I read that to do so it is necessary to convert the [DENSELAYER] into convolution. Am i right?
Thank you in advance for your help and sorry for my english :) the old code looks like this:
with tf.name_scope('dense_layer'):
dense1 = tf.reshape(conv2, [-1, _weights['wd1'].get_shape().as_list()[0]])
dense1 = tf.nn.relu(tf.matmul(dense1, _weights['wd1']) + _biases['bd1'])
dense1 = tf.nn.dropout(dense1, dropout)
out = tf.nn.softmax(tf.matmul(dense1, _weights['out']) + _biases['out'])
return out
I think the first fully connected layer should be a 7x7 conv, but I'm not sure how to handle the second fc layer (the output layer):
with tf.name_scope('conv_layer_3'):
# ?????
wc3 = tf.reshape(_weights['wd1'], [7, 7, w2, d1])
conv3 = conv2d_valid(conv2, wc3, _biases['bd1'])
with tf.name_scope('conv_layer_4'):
# ???
return out