tf-perceptual-eusr
tf-perceptual-eusr copied to clipboard
You must feed a value for placeholder tensor 'model/sr_input_scale' with dtype float
I am unable to run test.py successfully. I keep running into this error which I have not been able to figure out. Any help in this regard is highly appreciated. The error is as follows.
Error
Found 356 images
- ./LR\20210331_135726.jpg -> ./SR\20210331_135726.jpg 2021-06-28 15:53:46.774187: W tensorflow/core/framework/cpu_allocator_impl.cc:81] Allocation of 3072000000 exceeds 10% of system memory. Traceback (most recent call last): File "C:\Users\user\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow_core\python\client\session.py", line 1365, in _do_call return fn(*args) File "C:\Users\user\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow_core\python\client\session.py", line 1350, in _run_fn target_list, run_metadata) File "C:\Users\user\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow_core\python\client\session.py", line 1443, in _call_tf_sessionrun run_metadata) tensorflow.python.framework.errors_impl.InvalidArgumentError: You must feed a value for placeholder tensor 'model/sr_input_scale' with dtype float [[{{node model/sr_input_scale}}]]
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "test.py", line 83, in
This might also help
Original stack trace for 'model/sr_input_scale':
File "test.py", line 80, in
Oops, sorry for the error. Can you check whether the testing works well when you change this line of the test.py
?:
https://github.com/idearibosome/tf-perceptual-eusr/blob/master/test/test.py#L34
from
model_output = tf.import_graph_def(model_graph_def, name='model', input_map={'sr_input:0': image}, return_elements=['sr_output:0'])[0]
to
model_output = tf.import_graph_def(model_graph_def, name='model', input_map={'sr_input:0': image, 'sr_input_scale:0': 4}, return_elements=['sr_output:0'])[0]
I am currently not available to test it on my side, but I will try to figure it out in a few days.
Thanks for the response. The code does run without an error now but it terminates without writing any images to the target folder. The final print statement also doesn't get executed.
Sorry for the late response. The main problem of the test code is the lack of providing upscaling factor, which is defined as sr_input_scale:0
in the trained model.
I've updated test.py
(via this commit) to support both our pretrained models and models trained via our code. With the new testing code, the frozen graph should be loaded successfully.