Removed extra scaling call in image notebooks (#154)

This commit is contained in:
Karl Weinmeister
2021-11-15 17:45:02 -08:00
committed by GitHub
parent a2ae130378
commit 644612fde9
10 changed files with 20 additions and 40 deletions
@@ -1496,9 +1496,8 @@
"\n",
"When you send a prediction or explanation request, the content of the request is base 64 decoded into a Tensorflow string (`tf.string`), which is passed to the serving function (`serving_fn`). The serving function preprocesses the `tf.string` into raw (uncompressed) numpy bytes (`preprocess_fn`) to match the input requirements of the model:\n",
"- `io.decode_jpeg`- Decompresses the JPG image which is returned as a Tensorflow tensor with three channels (RGB).\n",
"- `image.convert_image_dtype` - Changes integer pixel values to float 32.\n",
"- `image.convert_image_dtype` - Changes integer pixel values to float 32, and rescales pixel data between 0 and 1.\n",
"- `image.resize` - Resizes the image to match the input shape for the model.\n",
"- `resized / 255.0` - Rescales (normalization) the pixel data between 0 and 1.\n",
"\n",
"At this point, the data can be passed to the model (`m_call`)."
]
@@ -1518,8 +1517,7 @@
" decoded = tf.io.decode_jpeg(bytes_input, channels=3)\n",
" decoded = tf.image.convert_image_dtype(decoded, tf.float32)\n",
" resized = tf.image.resize(decoded, size=(32, 32))\n",
" rescale = tf.cast(resized / 255.0, tf.float32)\n",
" return rescale\n",
" return resized\n",
"\n",
"\n",
"@tf.function(input_signature=[tf.TensorSpec([None], tf.string)])\n",
@@ -1521,9 +1521,8 @@
"\n",
"When you send a prediction or explanation request, the content of the request is base 64 decoded into a Tensorflow string (`tf.string`), which is passed to the serving function (`serving_fn`). The serving function preprocesses the `tf.string` into raw (uncompressed) numpy bytes (`preprocess_fn`) to match the input requirements of the model:\n",
"- `io.decode_jpeg`- Decompresses the JPG image which is returned as a Tensorflow tensor with three channels (RGB).\n",
"- `image.convert_image_dtype` - Changes integer pixel values to float 32.\n",
"- `image.convert_image_dtype` - Changes integer pixel values to float 32, and rescales pixel data between 0 and 1.\n",
"- `image.resize` - Resizes the image to match the input shape for the model.\n",
"- `resized / 255.0` - Rescales (normalization) the pixel data between 0 and 1.\n",
"\n",
"At this point, the data can be passed to the model (`m_call`).\n",
"\n",
@@ -1552,8 +1551,7 @@
" decoded = tf.io.decode_jpeg(bytes_input, channels=3)\n",
" decoded = tf.image.convert_image_dtype(decoded, tf.float32)\n",
" resized = tf.image.resize(decoded, size=(32, 32))\n",
" rescale = tf.cast(resized / 255.0, tf.float32)\n",
" return rescale\n",
" return resized\n",
"\n",
"\n",
"@tf.function(input_signature=[tf.TensorSpec([None], tf.string)])\n",
@@ -1498,9 +1498,8 @@
"\n",
"When you send a prediction or explanation request, the content of the request is base 64 decoded into a Tensorflow string (`tf.string`), which is passed to the serving function (`serving_fn`). The serving function preprocesses the `tf.string` into raw (uncompressed) numpy bytes (`preprocess_fn`) to match the input requirements of the model:\n",
"- `io.decode_jpeg`- Decompresses the JPG image which is returned as a Tensorflow tensor with three channels (RGB).\n",
"- `image.convert_image_dtype` - Changes integer pixel values to float 32.\n",
"- `image.convert_image_dtype` - Changes integer pixel values to float 32, and rescales pixel data between 0 and 1.\n",
"- `image.resize` - Resizes the image to match the input shape for the model.\n",
"- `resized / 255.0` - Rescales (normalization) the pixel data between 0 and 1.\n",
"\n",
"At this point, the data can be passed to the model (`m_call`)."
]
@@ -1520,8 +1519,7 @@
" decoded = tf.io.decode_jpeg(bytes_input, channels=3)\n",
" decoded = tf.image.convert_image_dtype(decoded, tf.float32)\n",
" resized = tf.image.resize(decoded, size=(32, 32))\n",
" rescale = tf.cast(resized / 255.0, tf.float32)\n",
" return rescale\n",
" return resized\n",
"\n",
"\n",
"@tf.function(input_signature=[tf.TensorSpec([None], tf.string)])\n",
@@ -1761,9 +1761,8 @@
"\n",
"When you send a prediction or explanation request, the content of the request is base 64 decoded into a Tensorflow string (`tf.string`), which is passed to the serving function (`serving_fn`). The serving function preprocesses the `tf.string` into raw (uncompressed) numpy bytes (`preprocess_fn`) to match the input requirements of the model:\n",
"- `io.decode_jpeg`- Decompresses the JPG image which is returned as a Tensorflow tensor with three channels (RGB).\n",
"- `image.convert_image_dtype` - Changes integer pixel values to float 32.\n",
"- `image.convert_image_dtype` - Changes integer pixel values to float 32, and rescales pixel data between 0 and 1.\n",
"- `image.resize` - Resizes the image to match the input shape for the model.\n",
"- `resized / 255.0` - Rescales (normalization) the pixel data between 0 and 1.\n",
"\n",
"At this point, the data can be passed to the model (`m_call`)."
]
@@ -1783,8 +1782,7 @@
" decoded = tf.io.decode_jpeg(bytes_input, channels=3)\n",
" decoded = tf.image.convert_image_dtype(decoded, tf.float32)\n",
" resized = tf.image.resize(decoded, size=(32, 32))\n",
" rescale = tf.cast(resized / 255.0, tf.float32)\n",
" return rescale\n",
" return resized\n",
"\n",
"\n",
"@tf.function(input_signature=[tf.TensorSpec([None], tf.string)])\n",
@@ -1600,9 +1600,8 @@
"\n",
"When you send a prediction or explanation request, the content of the request is base 64 decoded into a Tensorflow string (`tf.string`), which is passed to the serving function (`serving_fn`). The serving function preprocesses the `tf.string` into raw (uncompressed) numpy bytes (`preprocess_fn`) to match the input requirements of the model:\n",
"- `io.decode_jpeg`- Decompresses the JPG image which is returned as a Tensorflow tensor with three channels (RGB).\n",
"- `image.convert_image_dtype` - Changes integer pixel values to float 32.\n",
"- `image.convert_image_dtype` - Changes integer pixel values to float 32, and rescales pixel data between 0 and 1.\n",
"- `image.resize` - Resizes the image to match the input shape for the model.\n",
"- `resized / 255.0` - Rescales (normalization) the pixel data between 0 and 1.\n",
"\n",
"At this point, the data can be passed to the model (`m_call`)."
]
@@ -1622,8 +1621,7 @@
" decoded = tf.io.decode_jpeg(bytes_input, channels=3)\n",
" decoded = tf.image.convert_image_dtype(decoded, tf.float32)\n",
" resized = tf.image.resize(decoded, size=(32, 32))\n",
" rescale = tf.cast(resized / 255.0, tf.float32)\n",
" return rescale\n",
" return resized\n",
"\n",
"\n",
"@tf.function(input_signature=[tf.TensorSpec([None], tf.string)])\n",
@@ -1523,9 +1523,8 @@
"\n",
"When you send a prediction or explanation request, the content of the request is base 64 decoded into a Tensorflow string (`tf.string`), which is passed to the serving function (`serving_fn`). The serving function preprocesses the `tf.string` into raw (uncompressed) numpy bytes (`preprocess_fn`) to match the input requirements of the model:\n",
"- `io.decode_jpeg`- Decompresses the JPG image which is returned as a Tensorflow tensor with three channels (RGB).\n",
"- `image.convert_image_dtype` - Changes integer pixel values to float 32.\n",
"- `image.convert_image_dtype` - Changes integer pixel values to float 32, and rescales pixel data between 0 and 1.\n",
"- `image.resize` - Resizes the image to match the input shape for the model.\n",
"- `resized / 255.0` - Rescales (normalization) the pixel data between 0 and 1.\n",
"\n",
"At this point, the data can be passed to the model (`m_call`).\n",
"\n",
@@ -1554,8 +1553,7 @@
" decoded = tf.io.decode_jpeg(bytes_input, channels=3)\n",
" decoded = tf.image.convert_image_dtype(decoded, tf.float32)\n",
" resized = tf.image.resize(decoded, size=(32, 32))\n",
" rescale = tf.cast(resized / 255.0, tf.float32)\n",
" return rescale\n",
" return resized\n",
"\n",
"\n",
"@tf.function(input_signature=[tf.TensorSpec([None], tf.string)])\n",
@@ -2103,9 +2103,8 @@
"\n",
"When you send a prediction or explanation request, the content of the request is base 64 decoded into a Tensorflow string (`tf.string`), which is passed to the serving function (`serving_fn`). The serving function preprocesses the `tf.string` into raw (uncompressed) numpy bytes (`preprocess_fn`) to match the input requirements of the model:\n",
"- `io.decode_jpeg`- Decompresses the JPG image which is returned as a Tensorflow tensor with three channels (RGB).\n",
"- `image.convert_image_dtype` - Changes integer pixel values to float 32.\n",
"- `image.convert_image_dtype` - Changes integer pixel values to float 32, and rescales pixel data between 0 and 1.\n",
"- `image.resize` - Resizes the image to match the input shape for the model.\n",
"- `resized / 255.0` - Rescales (normalization) the pixel data between 0 and 1.\n",
"\n",
"At this point, the data can be passed to the model (`m_call`)."
]
@@ -2125,8 +2124,7 @@
" decoded = tf.io.decode_jpeg(bytes_input, channels=3)\n",
" decoded = tf.image.convert_image_dtype(decoded, tf.float32)\n",
" resized = tf.image.resize(decoded, size=(128, 128))\n",
" rescale = tf.cast(resized / 255.0, tf.float32)\n",
" return rescale\n",
" return resized\n",
"\n",
"\n",
"@tf.function(input_signature=[tf.TensorSpec([None], tf.string)])\n",
@@ -1567,9 +1567,8 @@
"\n",
"When you send a prediction or explanation request, the content of the request is base 64 decoded into a Tensorflow string (`tf.string`), which is passed to the serving function (`serving_fn`). The serving function preprocesses the `tf.string` into raw (uncompressed) numpy bytes (`preprocess_fn`) to match the input requirements of the model:\n",
"- `io.decode_jpeg`- Decompresses the JPG image which is returned as a Tensorflow tensor with three channels (RGB).\n",
"- `image.convert_image_dtype` - Changes integer pixel values to float 32.\n",
"- `image.convert_image_dtype` - Changes integer pixel values to float 32, and rescales pixel data between 0 and 1.\n",
"- `image.resize` - Resizes the image to match the input shape for the model.\n",
"- `resized / 255.0` - Rescales (normalization) the pixel data between 0 and 1.\n",
"\n",
"At this point, the data can be passed to the model (`m_call`)."
]
@@ -1589,8 +1588,7 @@
" decoded = tf.io.decode_jpeg(bytes_input, channels=3)\n",
" decoded = tf.image.convert_image_dtype(decoded, tf.float32)\n",
" resized = tf.image.resize(decoded, size=(32, 32))\n",
" rescale = tf.cast(resized / 255.0, tf.float32)\n",
" return rescale\n",
" return resized\n",
"\n",
"\n",
"@tf.function(input_signature=[tf.TensorSpec([None], tf.string)])\n",
@@ -1559,9 +1559,8 @@
"\n",
"When you send a prediction or explanation request, the content of the request is base 64 decoded into a Tensorflow string (`tf.string`), which is passed to the serving function (`serving_fn`). The serving function preprocesses the `tf.string` into raw (uncompressed) numpy bytes (`preprocess_fn`) to match the input requirements of the model:\n",
"- `io.decode_jpeg`- Decompresses the JPG image which is returned as a Tensorflow tensor with three channels (RGB).\n",
"- `image.convert_image_dtype` - Changes integer pixel values to float 32.\n",
"- `image.convert_image_dtype` - Changes integer pixel values to float 32, and rescales pixel data between 0 and 1.\n",
"- `image.resize` - Resizes the image to match the input shape for the model.\n",
"- `resized / 255.0` - Rescales (normalization) the pixel data between 0 and 1.\n",
"\n",
"At this point, the data can be passed to the model (`m_call`)."
]
@@ -1581,8 +1580,7 @@
" decoded = tf.io.decode_jpeg(bytes_input, channels=3)\n",
" decoded = tf.image.convert_image_dtype(decoded, tf.float32)\n",
" resized = tf.image.resize(decoded, size=(32, 32))\n",
" rescale = tf.cast(resized / 255.0, tf.float32)\n",
" return rescale\n",
" return resized\n",
"\n",
"\n",
"@tf.function(input_signature=[tf.TensorSpec([None], tf.string)])\n",
@@ -1501,9 +1501,8 @@
"\n",
"When you send a prediction or explanation request, the content of the request is base 64 decoded into a Tensorflow string (`tf.string`), which is passed to the serving function (`serving_fn`). The serving function preprocesses the `tf.string` into raw (uncompressed) numpy bytes (`preprocess_fn`) to match the input requirements of the model:\n",
"- `io.decode_jpeg`- Decompresses the JPG image which is returned as a Tensorflow tensor with three channels (RGB).\n",
"- `image.convert_image_dtype` - Changes integer pixel values to float 32.\n",
"- `image.convert_image_dtype` - Changes integer pixel values to float 32, and rescales pixel data between 0 and 1.\n",
"- `image.resize` - Resizes the image to match the input shape for the model.\n",
"- `resized / 255.0` - Rescales (normalization) the pixel data between 0 and 1.\n",
"\n",
"At this point, the data can be passed to the model (`m_call`).\n",
"\n",
@@ -1529,8 +1528,7 @@
" decoded = tf.io.decode_jpeg(bytes_input, channels=3)\n",
" decoded = tf.image.convert_image_dtype(decoded, tf.float32)\n",
" resized = tf.image.resize(decoded, size=(16, 16))\n",
" rescale = tf.cast(resized / 255.0, tf.float32)\n",
" return rescale\n",
" return resized\n",
"\n",
"\n",
"@tf.function(input_signature=[tf.TensorSpec([None], tf.string)])\n",