Saafke/EDSR_Tensorflow

tensorflow.tools.graph_transforms missing?

ManuLinares opened this issue · 5 comments

python main.py --upscale --scale 4 --image FILEPATH

Traceback (most recent call last):
  File "/home/mb/scripts/EDSR_Tensorflow/main.py", line 3, in <module>
    import run
  File "/home/mb/scripts/EDSR_Tensorflow/run.py", line 13, in <module>
    from tensorflow.tools.graph_transforms import TransformGraph
ModuleNotFoundError: No module named 'tensorflow.tools.graph_transforms'

I'm Manjaro, and Tensorflow 2.5

Getting the same error, they are using some old version of tensorflow , so you have to downgrade the version . (They didn't specify the tf version )

tensorflow 19.10 will work

What do you mean version 19.10? maybe it was a typo.

for reference, here are the available version numbers: https://www.tensorflow.org/install/source#linux

It would be awesome if they Included a Requirements file, as to not go hunting for packages.

Sorry . I meant the Nvidia tf docker container version

You can try tf 1.9 . It's working for me

Hi guys,

Thanks for the question/discussion. I am using TensorFlow 1.14.0 and it's working. I added a requirements.txt. Let me know if it works.

Sorry . I meant the Nvidia tf docker container version

You can try tf 1.9 . It's working for me

Could you tell me what image you're using? and Maybe steps after.
I'm trying this without success.

docker run --gpus all -it --rm -v $PWD:/tmp -w /tmp tensorflow/tensorflow:1.14.0-gpu-py3 bash
pip install -U pip
pip install -r requirements.txt
python main.py --upscale --scale 4 --image 1.png

Traceback (most recent call last):
  File "main.py", line 2, in <module>
    import data_utils
  File "/tmp/data_utils.py", line 5, in <module>
    import cv2
  File "/usr/local/lib/python3.6/dist-packages/cv2/__init__.py", line 5, in <module>
    from .cv2 import *
ImportError: libGL.so.1: cannot open shared object file: No such file or directory

EDIT:

I had a success but I had to do some stuff like installing
pip install opencv-python-headless
and replacing code to not use the function "cv2.imshow" like this:


--- a/run.py
+++ b/run.py
@@ -302,12 +302,14 @@ class run:
 
             bicubic_image = cv2.resize(fullimg, None, fx=self.scale, fy=self.scale, interpolation=cv2.INTER_CUBIC)
 
-            cv2.imshow('Original image', fullimg)
-            cv2.imshow('EDSR upscaled image', HR_image)
-            cv2.imshow('Bicubic upscaled image', bicubic_image)
+            #cv2.imshow('Original image', fullimg)
+            #cv2.imshow('EDSR upscaled image', HR_image)
+            #cv2.imshow('Bicubic upscaled image', bicubic_image)
 
-            cv2.waitKey(0)
-            cv2.destroyAllWindows()
+            #cv2.waitKey(0)
+            #cv2.destroyAllWindows()
+            cv2.imwrite("./output.png", HR_image)
+            #print("path is:",path)

EDIT2: for multiple file processing, made a bash script (just sharing)

mkdir -p input; mkdir -p output; mkdir -p output/input
#put png's in "input" dir
find input -name '*.png'| sort | awk '{print "python main.py --upscale --scale 4 --image "$1" ; mv output.png output/"$s}'|bash