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

SRCNN.NET does not load #13

Closed
78Alpha opened this issue Dec 21, 2020 · 7 comments
Closed

SRCNN.NET does not load #13

78Alpha opened this issue Dec 21, 2020 · 7 comments

Comments

@78Alpha
Copy link

78Alpha commented Dec 21, 2020

Expected Output: Model would load and proceed to show lighting of examples/custom image

Obtained Output: Failure to load model with the correct dependencies installed. Error reason is unknown but can be guessed at where the root issue is.

Code snippet

Traceback (most recent call last): File "example001.py", line 18, in <module> from ProjectPaintingLight import run File "C:\Users\prome\PycharmProjects\PaintingLight\PaintingLight-master\code\ProjectPaintingLight.py", line 26, in <module> srcnn = tf.keras.models.load_model('srcnn.net') File "C:\Users\prome\PycharmProjects\PaintingLight\core\lib\site-packages\tensorflow\python\keras\_impl\keras\models.py", line 244, in load_model model_config = json.loads(model_config.decode('utf-8')) AttributeError: 'str' object has no attribute 'decode'

I have gotten this program to work in the past, varies on day I installed python, some builds it will work, some builds it won't, even if they use the same dependencies and so on... A standalone version (packaged) or even a docker image might be useful, as this "app" is touchy enough to break from a number of other factors.

@lllyasviel
Copy link
Owner

It seem that the error comes from keras installation. What is the version of keras inside of the fensorflow you have installed?

@78Alpha
Copy link
Author

78Alpha commented Dec 26, 2020

I had thought it was keras but no version was mentioned in the install instructions, or one that was used specifically...

The one in my VENV is... well... unmarked. It doesn't have any keras version listed, however, the script is trying to use tensorflow.keras built into the 1.4.0

@78Alpha
Copy link
Author

78Alpha commented Dec 26, 2020

Looked into it further, and it appears to be version 2.0.8-tf

@ghost
Copy link

ghost commented Jan 2, 2021

out-of-date:

pip install opencv-python
pip install opencv-contrib-python
pip install h5py

error:

Traceback (most recent call last):
  File "example002.py", line 18, in <module>
    from ProjectPaintingLight import run
  File "D:\PaintingLight\code\ProjectPaintingLight.py", line 27, in <module>
    srcnn = tf.keras.models.load_model('srcnn.net')
  File "E:\VirtualEnvs\paint_lighting_3\lib\site-packages\tensorflow\python\keras\_impl\keras\models.py", line 244, in load_model
    model_config = json.loads(model_config.decode('utf-8'))
AttributeError: 'str' object has no attribute 'decode'

Solution

Create a new virtual environment.

pip install opencv-python==4.2.0.34
pip install opencv-contrib-python==4.2.0.34
pip install h5py==2.10.0

pip install tensorflow==1.4.0
pip install scipy==1.1.0
pip install trimesh==2.37.1

For windows, use Python 3.6 x86-64 (can't use other python version), and install:
pip install Rtree-0.9.3-cp36-cp36m-win_amd64.whl

Ref: #2

@78Alpha
Copy link
Author

78Alpha commented Jan 2, 2021

Following the solution, I was presented with

On entry to DGEBAL parameter number 3 had an illegal value
On entry to DGEHRD parameter number 2 had an illegal value
On entry to DORGHR DORGQR parameter number 2 had an illegal value
On entry to DHSEQR parameter number 4 had an illegal value
ImportError: numpy.core.multiarray failed to import
Traceback (most recent call last):
File "example001.py", line 1, in <module>
import cv2
File "C:\Users\prome\PycharmProjects\PaintingLight\venv\lib\site-packages\cv2\__init__.py", line 5, in <module>
from .cv2 import *
ImportError: numpy.core.multiarray failed to import

@ghost
Copy link

ghost commented Jan 2, 2021

pip install numpy==1.18.2

@78Alpha
Copy link
Author

78Alpha commented Jan 2, 2021 via email

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

2 participants