You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Need to download pilatus800.jpg at the resource as follows.
pilatus800.jpg: //github.com/Spidy20/Data-scince-ML-project/tree/master/Deep%20dream
And then save pilatus800.jpg in the directory of /dl-cookbook/data/.
At last change data/pilatus800.jpg to /home/user/Documents/dl-cookbook/data/pilatus800.jpg in the page of 12.1 Activation Optimization by jupyter notebook.
The text was updated successfully, but these errors were encountered:
mikechen66
changed the title
12.1 Activation Optimization --imresize and pilatus800.jpgs issues and solutions
12.1 Activation Optimization --imresize and pilatus800.jpg issues and solutions
May 8, 2020
With regard to the RuntimeError, the small modification will make the example script run correctly.
RuntimeError: Variable += value not supported. Use variable.assign_add(value) to modify the variable value and variable = variable + value to get a new Tensor object.
~/miniconda3/lib/python3.7/site-packages/tensorflow_core/python/ops/resource_variable_ops.py in iadd(self, unused_other)
1220
1221 def iadd(self, unused_other):
-> 1222 raise RuntimeError("Variable += value not supported. Use "
1223 "variable.assign_add(value) to modify the variable "
1224 "value and variable = variable + value to get a new "
RuntimeError: Variable += value not supported. Use variable.assign_add(value) to modify the variable value and variable = variable + value to get a new Tensor object.
2. Solution
Change the original scripts
if K.image_data_format() == 'channels_first':
loss += coeff * K.sum(K.square(x[:, :, 2: -2, 2: -2])) / scaling
else:
loss += coeff * K.sum(K.square(x[:, 2: -2, 2: -2, :])) / scaling
to the following scripts.
if K.image_data_format() == 'channels_first':
loss = loss + coeff * K.sum(K.square(x[:, :, 2: -2, 2: -2])) / scaling
else:
loss = loss + coeff * K.sum(K.square(x[:, 2: -2, 2: -2, :])) / scaling
I found out the two issues that stopped the example application running. I have corrected them as follows.
1. imresize issue:
Issue:
ImportError: cannot import name 'imresize' from 'scipy.misc'
Solution:
First install scikit-image
$ pip install scikit-image
or
$ conda install -c conda-forge scikit-image
And then change
from scipy.misc import imresize
to
from skimage.transform import resize
Please have a look at the skimage example at the official website ad follows.
skimage: https://scikit-image.org/docs/stable/auto_examples/transform/plot_rescale.html
2. pilatus800.jpg issue
Issue:
No directory of data/pilatus800.jpg
Solution:
Need to download pilatus800.jpg at the resource as follows.
pilatus800.jpg: //github.com/Spidy20/Data-scince-ML-project/tree/master/Deep%20dream
And then save pilatus800.jpg in the directory of /dl-cookbook/data/.
At last change data/pilatus800.jpg to /home/user/Documents/dl-cookbook/data/pilatus800.jpg in the page of 12.1 Activation Optimization by jupyter notebook.
The text was updated successfully, but these errors were encountered: