Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

scipy imread has been deprecated since v1.0.0. #29

Open
jlnrdeep opened this issue Jul 2, 2019 · 2 comments
Open

scipy imread has been deprecated since v1.0.0. #29

jlnrdeep opened this issue Jul 2, 2019 · 2 comments

Comments

@jlnrdeep
Copy link

jlnrdeep commented Jul 2, 2019

It might be worth considering to mantain/update the code for removed dependecies

I've got this error trying to use stylize.py on windows.

Restoring vars for relu5_1 from checkpoint models/relu5_1\model.ckpt-15004
W0702 06:19:34.308990 4512 deprecation.py:323] From C:\Program Files\Python37\lib\site-packages\tensorflow\python\training\saver.py:1276: checkpoint_exists (from tensorflow.python.training.checkpoint_management) is deprecated and will be removed in a future version.
Instructions for updating:
Use standard file APIs to check for files with this prefix.
Traceback (most recent call last):
File "stylize.py", line 126, in
main()
File "stylize.py", line 74, in main
content_img = get_img(content_fullpath)
File "C:\Users\JLNR\Documents\WCT-TF-master\utils.py", line 24, in get_img
img = scipy.misc.imread(src, mode='RGB')
AttributeError: module 'scipy.misc' has no attribute 'imread'

I'm going to try using an earlier version of scipy

@eridgd
Copy link
Owner

eridgd commented Jul 5, 2019

Thanks for pointing that out. I unfortunately don't have the time to update the repo right now, but at some point in the next few months I'd like to migrate it to TF 2.0 and will hopefully also clean up other bits like this along the way.

@AbsurdePhoton
Copy link

The only TF2 implementation I found didn't work so well, so I tried to make this one work, using Anaconda and python v3.8, a custom environment to install all these old package versions. The right combination is tensorflow 1.2.1 with keras 2.0.0... and the changes below.

You can easily replace scipy.misc.imread and scipy.misc.imresize in the code (mainly sytlize.py and utils.py, I didn't try the camera thing).

Here are the BEFORE and AFTER functions

for deprecated scipy.misc.imread:

import imageio
(...)
#BEFORE img = scipy.misc.imread(src, mode='RGB')
img = imageio.imread(src, as_gray=False, pilmode='RGB')

You'll also have problems with the deprecated image resize function from scipy.misc !

from skimage import transform
(...)
#BEFORE style_img_resized = scipy.misc.imresize(style_img, (stylized_rgb.shape[0], stylized_rgb.shape[0]))
style_img_resized = transform.resize(style_img, (stylized_rgb.shape[0], stylized_rgb.shape[0]), anti_aliasing=True)

Made me search a little as I don't program in python, you'll have a lot of deprecation warnings when using the scripts, but it works :)

The only thing that didn't work with the image resize function is when you're trying to use the --ss-stride command-line option. Must be something like a conversion between integers and floats that I don't understand...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants