jmiller656/EDSR-Tensorflow

issue when scale is larger than 2

Closed this issue · 4 comments

Hi,

I built and run this code, it works very good, Thanks! only one issue is: when I set scale > 2 (like 3 or 4), I got errors, like the following, could you help us update some code so we can set scale as 4? Thanks!

python test.py --image orig_01.jpg --savedir ./saved_models --scale 4

/home/bxu/anaconda3/envs/tensorflow/lib/python3.6/site-packages/h5py/init.py:36: FutureWarning: Conversion of the second argument of issubdtype from float to np.floating is deprecated. In future, it will be treated as np.float64 == np.dtype(float).type.
from ._conv import register_converters as _register_converters
Building EDSR...
2018-02-23 16:26:57.346452: I tensorflow/core/platform/cpu_feature_guard.cc:137] Your CPU supports instructions that this TensorFlow binary was not compiled to use: SSE4.1 SSE4.2 AVX AVX2 FMA
Done building!
Restoring...
2018-02-23 16:26:57.677459: W tensorflow/core/framework/op_kernel.cc:1198] Not found: Key Conv_68/weights not found in checkpoint
2018-02-23 16:26:57.683096: W tensorflow/core/framework/op_kernel.cc:1198] Not found: Key Conv_68/biases not found in checkpoint
Traceback (most recent call last):
File "/home/bxu/anaconda3/envs/tensorflow/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1350, in _do_call
return fn(*args)
File "/home/bxu/anaconda3/envs/tensorflow/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1329, in _run_fn
status, run_metadata)
File "/home/bxu/anaconda3/envs/tensorflow/lib/python3.6/site-packages/tensorflow/python/framework/errors_impl.py", line 473, in exit
c_api.TF_GetCode(self.status.status))
tensorflow.python.framework.errors_impl.NotFoundError: Key Conv_68/weights not found in checkpoint
[[Node: save/RestoreV2_131 = RestoreV2[dtypes=[DT_FLOAT], _device="/job:localhost/replica:0/task:0/device:CPU:0"](_arg_save/Const_0_0, save/RestoreV2_131/tensor_names, save/RestoreV2_131/shape_and_slices)]]

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "test.py", line 23, in
network.resume(args.savedir)
File "/home/bxu/bxu/ai/tensorflow_test/super-resolution/EDSR-Tensorflow-master/model.py", line 131, in resume
self.saver.restore(self.sess,tf.train.latest_checkpoint(savedir))
File "/home/bxu/anaconda3/envs/tensorflow/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 1686, in restore
{self.saver_def.filename_tensor_name: save_path})
File "/home/bxu/anaconda3/envs/tensorflow/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 895, in run
run_metadata_ptr)
File "/home/bxu/anaconda3/envs/tensorflow/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1128, in _run
feed_dict_tensor, options, run_metadata)
File "/home/bxu/anaconda3/envs/tensorflow/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1344, in _do_run
options, run_metadata)
File "/home/bxu/anaconda3/envs/tensorflow/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1363, in _do_call
raise type(e)(node_def, op, message)
tensorflow.python.framework.errors_impl.NotFoundError: Key Conv_68/weights not found in checkpoint
[[Node: save/RestoreV2_131 = RestoreV2[dtypes=[DT_FLOAT], _device="/job:localhost/replica:0/task:0/device:CPU:0"](_arg_save/Const_0_0, save/RestoreV2_131/tensor_names, save/RestoreV2_131/shape_and_slices)]]

Caused by op 'save/RestoreV2_131', defined at:
File "test.py", line 22, in
network = EDSR(down_size,args.layers,args.featuresize,scale=args.scale)
File "/home/bxu/bxu/ai/tensorflow_test/super-resolution/EDSR-Tensorflow-master/model.py", line 115, in init
self.saver = tf.train.Saver()
File "/home/bxu/anaconda3/envs/tensorflow/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 1239, in init
self.build()
File "/home/bxu/anaconda3/envs/tensorflow/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 1248, in build
self._build(self._filename, build_save=True, build_restore=True)
File "/home/bxu/anaconda3/envs/tensorflow/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 1284, in _build
build_save=build_save, build_restore=build_restore)
File "/home/bxu/anaconda3/envs/tensorflow/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 765, in _build_internal
restore_sequentially, reshape)
File "/home/bxu/anaconda3/envs/tensorflow/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 428, in _AddRestoreOps
tensors = self.restore_op(filename_tensor, saveable, preferred_shard)
File "/home/bxu/anaconda3/envs/tensorflow/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 268, in restore_op
[spec.tensor.dtype])[0])
File "/home/bxu/anaconda3/envs/tensorflow/lib/python3.6/site-packages/tensorflow/python/ops/gen_io_ops.py", line 1031, in restore_v2
shape_and_slices=shape_and_slices, dtypes=dtypes, name=name)
File "/home/bxu/anaconda3/envs/tensorflow/lib/python3.6/site-packages/tensorflow/python/framework/op_def_library.py", line 787, in _apply_op_helper
op_def=op_def)
File "/home/bxu/anaconda3/envs/tensorflow/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 3160, in create_op
op_def=op_def)
File "/home/bxu/anaconda3/envs/tensorflow/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 1625, in init
self._traceback = self._graph._extract_stack() # pylint: disable=protected-access

NotFoundError (see above for traceback): Key Conv_68/weights not found in checkpoint
[[Node: save/RestoreV2_131 = RestoreV2[dtypes=[DT_FLOAT], _device="/job:localhost/replica:0/task:0/device:CPU:0"](_arg_save/Const_0_0, save/RestoreV2_131/tensor_names, save/RestoreV2_131/shape_and_slices)]]

Oh yeah, it looks like you're using the pretrained model?

Probably something I should have mentioned in the readme. Since this is the EDSR model and not the MDSR model, it can be only trained for a specific scale. Because of this, the pretrained model has been trained with scale of 2, and therefore can only be used with that scale. I'll add more info on this in the future

@jmiller656 Hi what's the MDSR model? If I tried training it on the celeb a dataset model what parameters would I need to adjust?

hi ,Will your problem be solved?

@impactcolor MDSR is also proposed in https://arxiv.org/abs/1707.02921, strongly suggest you read through the paper before you reproduce EDSR results.