kweisamx / TensorFlow-VDSR

TensorFlow implementation of very deep convolution network for image super-resolution, color
https://arxiv.org/abs/1511.04587
MIT License
23 stars 16 forks source link

I have mistake but I con't finish it #8

Open Zhangang1999 opened 5 years ago

Zhangang1999 commented 5 years ago

from ._conv import register_converters as _register_converters 2019-06-11 16:04:46.808436: I T:\src\github\tensorflow\tensorflow\core\platform\cpu_feature_guard.cc:140] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 Traceback (most recent call last): File "C:/Users/Administrator/Desktop/TensorFlow-VDSR-master/main.py", line 28, in vdsr.train(FLAGS) File "C:\Users\Administrator\Desktop\TensorFlow-VDSR-master\model.py", line 67, in train nx, ny = input_setup(config) File "C:\Users\Administrator\Desktop\TensorFlow-VDSR-master\utils.py", line 193, in input_setup sub_input_sequence, sub_label_sequence, nx, ny = make_sub_data(data, config) File "C:\Users\Administrator\Desktop\TensorFlow-VDSR-master\utils.py", line 115, in make_sub_data sub_label = sub_label.reshape([config.label_size, config.label_size, config.c_dim]) ValueError: cannot reshape array of size 4920 into shape (41,41,3)

Zhangang1999 commented 5 years ago
for i in range(len(data)):
    if config.is_train:
        input_, label_, = preprocess(data[i], config.scale) # do bicbuic
    else: # Test just one picture
        input_, label_, = preprocess(data[i], config.scale) # do bicbuic

    if len(input_.shape) == 3: # is color
        h, w, c = input_.shape
    else:
        h, w = input_.shape # is grayscale
    #checkimage(input_)
    nx, ny = 0, 0
    for x in range(0, h - config.image_size + 1, config.stride):
        nx += 1; ny = 0
        for y in range(0, w - config.image_size + 1, config.stride):
            ny += 1

            sub_input = input_[x: x + config.image_size, y: y + config.image_size] # 41 * 41
            sub_label = label_[x: x + config.label_size, y: y + config.label_size] # 41 * 41

            # Reshape the subinput and sublabel
            sub_input = sub_input.reshape([config.image_size, config.image_size, config.c_dim])
            sub_label = sub_label.reshape([config.label_size, config.label_size, config.c_dim])

            # Normialize
            sub_input =  sub_input / 255.0
            sub_label =  sub_label / 255.0

            #cv2.imshow("im1",sub_input)
            #cv2.imshow("im2",sub_label)
            #cv2.imshow("residual",sub_input - sub_label)
            #cv2.waitKey(0)

            # Add to sequence
            sub_input_sequence.append(sub_input)
            sub_label_sequence.append(sub_label)