infocusp / tf_cnnvis

CNN visualization tool in TensorFlow
MIT License
780 stars 208 forks source link

why I always meet this problem? #9

Closed daixiaogang closed 7 years ago

daixiaogang commented 7 years ago

Here's the error I'm getting

ValueError: Cannot feed value of shape (1, 224, 224, 3) for Tensor u'Placeholder:0', which has shape '(2, 224, 224, 3)'

Here's the code for reproducing the error:


images = tf.placeholder("float", [2, 224, 224, 3]) batch1 = img1.reshape((1, 224, 224, 3)) batch2 = img2.reshape((1, 224, 224, 3)) batch = np.concatenate((batch1, batch2), 0) feed_dict = {images: batch} is_success = activation_visualization(graph_or_path=tf.get_default_graph(),value_feed_dict={X:batch},layers='r')


Network is vgg16

BhagyeshVikani commented 7 years ago

You already define feed_dict but you again define it while calling activation_visualization. Try this solution: is_success = activation_visualization(graph_or_path=tf.get_default_graph(), value_feed_dict=feed_dict, layers='r')

daixiaogang commented 7 years ago

thanks,I have solved this problem!