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

Hello, there is a problem when I run your code, could you please help me to solve it? #9

Open
FBLeee opened this issue May 12, 2020 · 5 comments

Comments

@FBLeee
Copy link

FBLeee commented May 12, 2020

==================== PRETRAINED MODEL Loading Succeeded ====================
==================== Reading Checkpoints ====================
=================== Fail to find a Checkpoint ====================
==================== No model to load ======================================

[*] Training Starts
Traceback (most recent call last):
File "D:\learningtool\python\1\lib\site-packages\tensorflow\python\client\session.py", line 1356, in _do_call
return fn(*args)
File "D:\learningtool\python\1\lib\site-packages\tensorflow\python\client\session.py", line 1341, in _run_fn
options, feed_dict, fetch_list, target_list, run_metadata)
File "D:\learningtool\python\1\lib\site-packages\tensorflow\python\client\session.py", line 1429, in _call_tf_sessionrun
run_metadata)
tensorflow.python.framework.errors_impl.OutOfRangeError: End of sequence
[[{{node IteratorGetNext}}]]

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "G:/class/papper/MZSR-master/main.py", line 67, in
main()
File "G:/class/papper/MZSR-master/main.py", line 26, in main
Trainer()
File "G:\class\papper\MZSR-master\train.py", line 170, in call
inputa, labela, inputb, labelb = self.data_generator.make_data_tensor(sess, self.scale_list, noise_std=0.0)
File "G:\class\papper\MZSR-master\dataGenerator.py", line 21, in make_data_tensor
label_train_=sess.run(self.label_train)
File "D:\learningtool\python\1\lib\site-packages\tensorflow\python\client\session.py", line 950, in run
run_metadata_ptr)
File "D:\learningtool\python\1\lib\site-packages\tensorflow\python\client\session.py", line 1173, in _run
feed_dict_tensor, options, run_metadata)
File "D:\learningtool\python\1\lib\site-packages\tensorflow\python\client\session.py", line 1350, in _do_run
run_metadata)
File "D:\learningtool\python\1\lib\site-packages\tensorflow\python\client\session.py", line 1370, in _do_call
raise type(e)(node_def, op, message)
tensorflow.python.framework.errors_impl.OutOfRangeError: End of sequence
[[node IteratorGetNext (defined at G:\class\papper\MZSR-master\dataGenerator.py:82) ]]

Errors may have originated from an input operation.
Input Source operations connected to node IteratorGetNext:
OneShotIterator (defined at G:\class\papper\MZSR-master\dataGenerator.py:80)

Original stack trace for 'IteratorGetNext':
File "G:/class/papper/MZSR-master/main.py", line 67, in
main()
File "G:/class/papper/MZSR-master/main.py", line 20, in main
task_batch_size=TASK_BATCH_SIZE,tfrecord_path=TFRECORD_PATH)
File "G:\class\papper\MZSR-master\dataGenerator.py", line 16, in init
self.label_train = self.load_tfrecord()
File "G:\class\papper\MZSR-master\dataGenerator.py", line 82, in load_tfrecord
label_train = iterator.get_next()
File "D:\learningtool\python\1\lib\site-packages\tensorflow\python\data\ops\iterator_ops.py", line 426, in get_next
output_shapes=self._structure._flat_shapes, name=name)
File "D:\learningtool\python\1\lib\site-packages\tensorflow\python\ops\gen_dataset_ops.py", line 1973, in iterator_get_next
output_shapes=output_shapes, name=name)
File "D:\learningtool\python\1\lib\site-packages\tensorflow\python\framework\op_def_library.py", line 788, in _apply_op_helper
op_def=op_def)
File "D:\learningtool\python\1\lib\site-packages\tensorflow\python\util\deprecation.py", line 507, in new_func
return func(*args, **kwargs)
File "D:\learningtool\python\1\lib\site-packages\tensorflow\python\framework\ops.py", line 3616, in create_op
op_def=op_def)
File "D:\learningtool\python\1\lib\site-packages\tensorflow\python\framework\ops.py", line 2005, in init
self._traceback = tf_stack.extract_stack()

@FBLeee
Copy link
Author

FBLeee commented May 12, 2020

I found that the code error might appear on line 17 of datagenerater.py: 【label_train_= sess. run(self. Label_train)】, 【 self. label_train】 can be output, but if you add 'sess.run', you will get an error. If you don't add this code, The following code will report an error.

@JWSoh
Copy link
Owner

JWSoh commented May 13, 2020

I have just uploaded a code to generate TFRecord file for MZSR and fixed errors of some codes. Please try again with new codes.

@BassantTolba1234
Copy link

Please @JWSoh I'm facing a problem when i load the pretrained model , specially when it reads the checkpoint
this is the error .. how did you kindly solve it please ??

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

@BassantTolba1234
Copy link

Please @943301098 I'm facing a problem when i load the pretrained model , specially when it reads the checkpoint
this is the error .. how did you kindly solve it please ??

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

@BassantTolba1234
Copy link

Please can you kindly explain me how to calculate this weight loss ?

def get_loss_weights(self):
loss_weights = tf.ones(shape=[self.TASK_ITER]) * (1.0/self.TASK_ITER)
decay_rate = 1.0 / self.TASK_ITER / (10000 / 3)
min_value= 0.03 / self.TASK_ITER

    loss_weights_pre = tf.maximum(loss_weights[:-1] - (tf.multiply(tf.to_float(self.global_step), decay_rate)), min_value)

    loss_weight_cur= tf.minimum(loss_weights[-1] + (tf.multiply(tf.to_float(self.global_step),(self.TASK_ITER- 1) * decay_rate)), 1.0 - ((self.TASK_ITER - 1) * min_value))
    loss_weights = tf.concat([[loss_weights_pre], [[loss_weight_cur]]], axis=1)
    return loss_weights

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