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

Help with training #1

Open
wanshun123 opened this issue Mar 20, 2019 · 3 comments
Open

Help with training #1

wanshun123 opened this issue Mar 20, 2019 · 3 comments

Comments

@wanshun123
Copy link

I am trying to train a model using around 12,000 128x128 ref/input images (extracted from 8 border 128x128 regions of 512x512 images):

ref example:
11
corresponding input example:
11

My aim is to deblur images like this:

00001_0

So they are closer to this:

00032_0

I have ran offline_patchMatch_textureSwap.py on my data which generated 329 GB of feature maps, then used this command to try to run training:

python main.py --is_train True --save_dir SRNTT --input_dir data/train/CUFED/input --ref_dir data/train/CUFED/ref --map_dir data/train/CUFED/map_321 --batch_size 9 --num_epochs 100 --input_size 32

This results in the following:

X:\python\DF\srntt\SRNTT-master>python main.py --is_train True --save_dir SRNTT --input_dir data/train/CUFED/input --ref_dir data/train/CUFED/ref --map_dir data/train/CUFED/map_321 --batch_size 9 --num_epochs 100 --input_size 32
12443 12443 12443
2019-03-20 16:01:54,106 root  INFO     Building graph ...
Traceback (most recent call last):
  File "C:\Users\User\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\framework\ops.py", line 1628, in _create_c_op
    c_op = c_api.TF_FinishOperation(op_desc)
tensorflow.python.framework.errors_impl.InvalidArgumentError: Dimension 1 in both shapes must be equal, but are 32 and 40. Shapes are [9,32,32] and [9,40,40]. for 'texture_transfer/concatenation1' (op: 'ConcatV2') with input shapes: [9,32,32,64], [9,40,40,256], [] and with computed input tensors: input[2] = <-1>.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "X:\python\DF\srntt\SRNTT-master\SRNTT\tensorlayer\layers.py", line 5172, in __init__
    self.outputs = tf.concat(self.inputs, concat_dim, name=name)
  File "C:\Users\User\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\ops\array_ops.py", line 1124, in concat
    return gen_array_ops.concat_v2(values=values, axis=axis, name=name)
  File "C:\Users\User\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\ops\gen_array_ops.py", line 1202, in concat_v2
    "ConcatV2", values=values, axis=axis, name=name)
  File "C:\Users\User\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\framework\op_def_library.py", line 787, in _apply_op_helper
    op_def=op_def)
  File "C:\Users\User\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\util\deprecation.py", line 488, in new_func
    return func(*args, **kwargs)
  File "C:\Users\User\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\framework\ops.py", line 3274, in create_op
    op_def=op_def)
  File "C:\Users\User\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\framework\ops.py", line 1792, in __init__
    control_input_ops)
  File "C:\Users\User\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\framework\ops.py", line 1631, in _create_c_op
    raise ValueError(str(e))
ValueError: Dimension 1 in both shapes must be equal, but are 32 and 40. Shapes are [9,32,32] and [9,40,40]. for 'texture_transfer/concatenation1' (op: 'ConcatV2') with input shapes: [9,32,32,64], [9,40,40,256], [] and with computed input tensors: input[2] = <-1>.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\User\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\framework\ops.py", line 1628, in _create_c_op
    c_op = c_api.TF_FinishOperation(op_desc)
tensorflow.python.framework.errors_impl.InvalidArgumentError: Dimension 1 in both shapes must be equal, but are 32 and 40. Shapes are [9,32,32,64] and [9,40,40,256].
        From merging shape 0 with other shapes. for 'texture_transfer/concatenation1_1/concat_dim' (op: 'Pack') with input shapes: [9,32,32,64], [9,40,40,256].

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "main.py", line 95, in <module>
    use_lower_layers_in_per_loss=args.use_lower_layers_in_per_loss
  File "X:\python\DF\srntt\SRNTT-master\SRNTT\model.py", line 359, in train
    self.net_upscale, self.net_srntt = self.model(self.input, self.maps)
  File "X:\python\DF\srntt\SRNTT-master\SRNTT\model.py", line 131, in model
    net = ConcatLayer(layer=[map_in, map_ref], concat_dim=-1, name='concatenation1')
  File "X:\python\DF\srntt\SRNTT-master\SRNTT\tensorlayer\layers.py", line 5174, in __init__
    self.outputs = tf.concat(concat_dim, self.inputs, name=name)
  File "C:\Users\User\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\ops\array_ops.py", line 1121, in concat
    dtype=dtypes.int32).get_shape().assert_is_compatible_with(
  File "C:\Users\User\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\framework\ops.py", line 1050, in convert_to_tensor
    as_ref=False)
  File "C:\Users\User\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\framework\ops.py", line 1146, in internal_convert_to_tensor
    ret = conversion_func(value, dtype=dtype, name=name, as_ref=as_ref)
  File "C:\Users\User\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\ops\array_ops.py", line 971, in _autopacking_conversion_function
    return _autopacking_helper(v, dtype, name or "packed")
  File "C:\Users\User\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\ops\array_ops.py", line 923, in _autopacking_helper
    return gen_array_ops.pack(elems_as_tensors, name=scope)
  File "C:\Users\User\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\ops\gen_array_ops.py", line 5857, in pack
    "Pack", values=values, axis=axis, name=name)
  File "C:\Users\User\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\framework\op_def_library.py", line 787, in _apply_op_helper
    op_def=op_def)
  File "C:\Users\User\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\util\deprecation.py", line 488, in new_func
    return func(*args, **kwargs)
  File "C:\Users\User\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\framework\ops.py", line 3274, in create_op
    op_def=op_def)
  File "C:\Users\User\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\framework\ops.py", line 1792, in __init__
    control_input_ops)
  File "C:\Users\User\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\framework\ops.py", line 1631, in _create_c_op
    raise ValueError(str(e))
ValueError: Dimension 1 in both shapes must be equal, but are 32 and 40. Shapes are [9,32,32,64] and [9,40,40,256].
        From merging shape 0 with other shapes. for 'texture_transfer/concatenation1_1/concat_dim' (op: 'Pack') with input shapes: [9,32,32,64], [9,40,40,256].

How should I be running training in this case where I'm using 128x128 images? Or should I regenerate the training data as 160x160 images same as the CUFED dataset?

@ZZUTK
Copy link
Owner

ZZUTK commented Apr 1, 2019

It seems that you are still using CUFED dataset for training, but the feature maps are generated from your own dataset, where the input size is different from that of CUFED. Please use your own dataset for training as well.

@Yu-Wang-0801
Copy link

Have you completed all the relevant experiments? I want to ask you some experimental details in private. Is it convenient to leave your contact information?

@dannilv-lab
Copy link

May I ask how your problem was finally solved? I tried to use the image of 400*400 for training, and the same error message as you appeared

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

4 participants