title: use `tf.to_float()` or `tf.image.convert_image_dtype()` in image pipeline for CNN?
body: <p>I am modifying the <code>tf.slim</code> example using this file as a template <a href="https://github.com/tensorflow/models/blob/master/research/slim/preprocessing/vgg_preprocessing.py" rel="nofollow noreferrer">vgg_preprocessing.py</a> . </p>
  
  <p>When I read the data from the TFRecord file using a clip from the <code>tf.slim</code> notebook (<a href="https://github.com/tensorflow/models/blob/master/research/slim/slim_walkthrough.ipynb" rel="nofollow noreferrer">slim_walkthrough.ipynb</a>) I get an image with distorted colors. It happens when the pre-processing script uses <code>tf.to_float()</code> changes the image tensor from <code>tf.uint8</code> to <code>tf.float32</code>. </p>
  
  <p><code>image = tf.to_float(image)</code>
  <a href="https://i.stack.imgur.com/wB7Jj.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/wB7Jj.png" alt="enter image description here"></a></p>
  
  <p><code>image = tf.image.convert_image_dtype(image, dtype=tf.float32)</code>
  <a href="https://i.stack.imgur.com/gFdkb.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/gFdkb.png" alt="enter image description here"></a></p>
  
  <p>Do the differences matter after you run it through a CNN? If so, which one is more appropriate for the <code>Vgg16</code> image processing pipeline? Does it matter if I switch to a different pre-trained model like <code>Inception</code>?</p>
  
  <p>Here is the full method:</p>
  
  <pre><code># tf.to_float() and tf.image.convert_image_dtype() give different results
  def preprocess_for_train(image,
                       output_height,
                       output_width):
    # randomly crop to 224x244
    image = _random_crop([image], output_height, output_width)[0]
    image.set_shape([output_height, output_width, 3])
  
    image = tf.to_float(image)
    # image = tf.image.convert_image_dtype(image, dtype=tf.float32)
  
    image = tf.image.random_flip_left_right(image)
    return image
  </code></pre>