I have a Keras model and I want to do some cool visiualizations with it. It's an object recognition network.
So I thought, It would be cool to input a blank image into the network and treat the image as the variable and not the weights, and then train the network to always output an icecream for example.
So I wrote the following code:
#loading the model model = load_model('model.h5') #create the input image as a variable w = tf.Variable(tf.zeros([1,224,224,3])) #create the flowgraph with the variable input pred = model.call(inputs=w) #create the desired output distribution desired = np.zeros((1000)) desired = 1.0 err = tf.reduce_mean(tf.subtract(pred,desired)) lr = tf.placeholder(dtype=tf.float32, shape=None) #create an optimizer that can only affect the inital input variable I created optimizer = tf.train.AdamOptimizer(learning_rate=0.0001).minimize(err, var_list=[w]) #train the network for i in range(0,100): _,cost = sess.run([optimizer,err]) print(cost)
So I thought the code would work well, but the cost literally doesn't change. It stays in place as if it's entirely unaffected.
cool? Is that "looks nice" or "helps explain the data" or .. ? $\endgroup$