Tensorflow freeze model but backpropagate error and update input layer

I try to explain my goal. With a trained model I want to select the output class and update the feeded image.

  • Assign an image to the 'input_layer'.
  • Forward and compute error of 'output_layer' against desired output/class.
  • Backpropagate the error to the 'input_layer' without updating the weights and biases of the net.
  • Update the input layer, the original image, with the backpropagated error.
  • Some hint?


    You can use tf.gradients to back propagate to the input layer:

    ...
    logits = run_net(image)
    g = tf.gradients(logits[target_class], image)
    image += g[0] * step
    ...
    

    Good examples of doing this can be found in the Deep Dream demo code (see for example "Naive feature visualization" or "Multiscale image generation."

    链接地址: http://www.djcxy.com/p/32062.html

    上一篇: 调用全局时出错

    下一篇: Tensorflow冻结模型,但反向传播错误和更新输入层