Skip to content

Commit

Permalink
tf2_image_retraining: use bilinear interpolation in preprocessing.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 250435519
  • Loading branch information
TensorFlow Hub Authors authored and vbardiovskyg committed May 31, 2019
1 parent 3e82e1a commit cf635b7
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions examples/colab/tf2_image_retraining.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -206,16 +206,18 @@
"metadata": {
"colab": {},
"colab_type": "code",
"id": "BzysZO58YA8H"
"id": "umB5tswsfTEQ"
},
"outputs": [],
"source": [
"datagen_kwargs = dict(rescale=1./255, validation_split=.20)\n",
"dataflow_kwargs = dict(target_size=IMAGE_SIZE, batch_size=BATCH_SIZE,\n",
" interpolation=\"bilinear\")\n",
"\n",
"valid_datagen = tf.keras.preprocessing.image.ImageDataGenerator(\n",
" **datagen_kwargs)\n",
"valid_generator = valid_datagen.flow_from_directory(\n",
" data_dir, subset=\"validation\", shuffle=False,\n",
" target_size=IMAGE_SIZE, batch_size=BATCH_SIZE)\n",
" data_dir, subset=\"validation\", shuffle=False, **dataflow_kwargs)\n",
"\n",
"do_data_augmentation = False #@param {type:\"boolean\"}\n",
"if do_data_augmentation:\n",
Expand All @@ -228,8 +230,7 @@
"else:\n",
" train_datagen = valid_datagen\n",
"train_generator = train_datagen.flow_from_directory(\n",
" data_dir, subset=\"training\", shuffle=True,\n",
" target_size=IMAGE_SIZE, batch_size=BATCH_SIZE)\n"
" data_dir, subset=\"training\", shuffle=True, **dataflow_kwargs)"
]
},
{
Expand Down

0 comments on commit cf635b7

Please sign in to comment.