Edwardlzy / SRCNN

Tensorflow implementation of single image super-resolution using a Convolutional Neural Network
http://mmlab.ie.cuhk.edu.hk/projects/SRCNN.html
MIT License
47 stars 17 forks source link

can't train with the tf.nn.conv2d(x, W, strides=[1, 1, 1, 1], padding='SAME') #2

Open Yannis1995 opened 6 years ago

Yannis1995 commented 6 years ago

When I try to try the network with the padding = "SAME" in the code: def conv2d(x, W): return tf.nn.conv2d(x, W, strides=[1, 1, 1, 1], padding='VALID') “”” return tf.nn.conv2d(x, W, strides=[1, 1, 1, 1], padding='SAME') “”” in flie net.py, and the it goes wrong: in the code: l2_loss = tf.reduce_mean(tf.square(labels - model)) ValueError: Dimensions must be equal, but are 21 and 33 for 'sub' (op: 'Sub') with input shapes: [?,21,21,1], [?,33,33,1]. Can you tell me how to solve this problem? Thanks!

AnwarUllahKhan commented 5 years ago

@Yannis1995 I have the same problem did you solve that? If yes then please tell me how you solved?

taburiss3525 commented 5 years ago

@Yannis1995 I have the same problem did you solve that? If yes then please tell me how you solved?

Setting padding = 'VALID' makes the code work.

15732031137 commented 4 years ago

@taburiss3525 Hello! First of all, thank you for sharing your ideas here. I recently encountered a problem when I reproduced this program. Can you help me?

Traceback (most recent call last): File "net.py", line 162, in train_SRCNN(images) File "net.py", line 92, in train_SRCNN train_data, train_label = load_data(train_path) File "net.py", line 24, in load_data with h5py.File(path, 'r') as hf: File "/root/anaconda3/lib/python3.7/site-packages/h5py/_hl/files.py", line 408, in init swmr=swmr) File "/root/anaconda3/lib/python3.7/site-packages/h5py/_hl/files.py", line 173, in make_fid fid = h5f.open(name, flags, fapl=fapl) File "h5py/_objects.pyx", line 54, in h5py._objects.with_phil.wrapper File "h5py/_objects.pyx", line 55, in h5py._objects.with_phil.wrapper File "h5py/h5f.pyx", line 88, in h5py.h5f.open OSError: Unable to open file (unable to open file: name = './checkpoint/train.h5', errno = 2, error message = 'No such file or directory', flags = 0, o_flags = 0)

Thank you very much! Looking forward to your reply!