mirror of
https://github.com/fchollet/deep-learning-with-python-notebooks.git
synced 2021-07-27 01:28:40 +03:00
Update notebooks for TF 2.6
This commit is contained in:
@@ -69,7 +69,7 @@
|
||||
"style_reference_image_path = keras.utils.get_file(\n",
|
||||
" \"starry_night.jpg\", origin=\"https://img-datasets.s3.amazonaws.com/starry_night.jpg\")\n",
|
||||
"\n",
|
||||
"original_width, original_height = keras.preprocessing.image.load_img(base_image_path).size\n",
|
||||
"original_width, original_height = keras.utils.load_img(base_image_path).size\n",
|
||||
"img_height = 400\n",
|
||||
"img_width = round(original_width * img_height / original_height)"
|
||||
]
|
||||
@@ -94,9 +94,9 @@
|
||||
"import numpy as np\n",
|
||||
"\n",
|
||||
"def preprocess_image(image_path):\n",
|
||||
" img = keras.preprocessing.image.load_img(\n",
|
||||
" img = keras.utils.load_img(\n",
|
||||
" image_path, target_size=(img_height, img_width))\n",
|
||||
" img = keras.preprocessing.image.img_to_array(img)\n",
|
||||
" img = keras.utils.img_to_array(img)\n",
|
||||
" img = np.expand_dims(img, axis=0)\n",
|
||||
" img = keras.applications.vgg19.preprocess_input(img)\n",
|
||||
" return img\n",
|
||||
@@ -312,7 +312,7 @@
|
||||
" print(f\"Iteration {i}: loss={loss:.2f}\")\n",
|
||||
" img = deprocess_image(combination_image.numpy())\n",
|
||||
" fname = f\"combination_image_at_iteration_{i}.png\"\n",
|
||||
" keras.preprocessing.image.save_img(fname, img)"
|
||||
" keras.utils.save_img(fname, img)"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user