reiinakano / arbitrary-image-stylization-tfjs

Arbitrary style transfer using TensorFlow.js
https://reiinakano.github.io/arbitrary-image-stylization-tfjs/
Apache License 2.0
1.19k stars 214 forks source link

Update transformer weights for float16 #15

Closed reiinakano closed 5 years ago

reiinakano commented 5 years ago

@vdumoulin Here are the updated weights but I'm unsure if they work since I don't have other mobile devices to test it on.

Quick sanity check for me: This TensorFlow code looks right, no?

    with tf.variable_scope('', reuse=True):
      var_names = [
          'transformer/residual/residual1/conv1/weights',
          'transformer/residual/residual1/conv2/weights',
          'transformer/residual/residual2/conv1/weights',
          'transformer/residual/residual2/conv2/weights',
          'transformer/residual/residual3/conv1/weights',
          'transformer/residual/residual3/conv2/weights',
          'transformer/residual/residual4/conv1/weights',
          'transformer/residual/residual4/conv2/weights',
          'transformer/residual/residual5/conv1/weights',
          'transformer/residual/residual5/conv2/weights',
          'transformer/expand/conv1/conv/weights',
          'transformer/expand/conv2/conv/weights',
          'transformer/expand/conv3/conv/weights',
      ]
      assign_ops = [tf.get_variable(var_name).assign(tf.get_variable(var_name)*10.0) for var_name in var_names]
      update_op = tf.group(*assign_ops)
      sess.run([update_op])
      # Save the session

I compared the variable values before and after the update_op and they seem correctly multiplied by 10.