tegg89 / SRCNN-Tensorflow

Image Super-Resolution Using Deep Convolutional Networks in Tensorflow https://arxiv.org/abs/1501.00092v3
MIT License
595 stars 279 forks source link

How to predict ? #2

Closed kitterive closed 7 years ago

kitterive commented 7 years ago

I have two questions: (1)I run this model ,and found after every epoch, the loss is 10125, and can't decrease, even I change the learning rate.

(2)After train, then can load the model, and how to predict or inference a low resolution picture , such as 1080p to a super resolution picture? thanks

tegg89 commented 7 years ago

@kitterive Thanks for left comments. The loss issue has not solved yet. I am still working on this matter, but super-resolution works. To test model, you have to make stride option like --stride 21, which is same size as label size. I forgot to put it in readme file. Sorry.

kitterive commented 7 years ago

Hi tegg89, Thanks your reply! I tested use the command "python main.py --is_train False --stride 21", I found nothing output, just display " [*] Reading checkpoints...", and sample directory is also empty. What I mean is: if I have a size 1920X1080 test.bmp, I will want to use it to verify the model is correct, I will downsampe the bmp, then upsample it to size 1920x1080, generate the low resolution bmp as the input of this model, the outut is the super resolution result. how to do it? I also run "liliumao/Tensorflow-srcnn" "predict.py" file use his model, I found the output.bmp is wrong.

kitterive commented 7 years ago

I reference "liliumao/Tensorflow-srcnn" srcnn.py code, and test your code as such, it can decrease loss, but I'm a tensorflow beginner, I don't know why it is. train_op = tf.train.GradientDescentOptimizer(config.learning_rate).minimize(self.loss,global_step=self.global_step)

_,step = self.sess.run([train_op, self.global_step], feed_dict={self.images:batch_images, self.labels:batch_labels})

    err = self.sess.run(self.loss, feed_dict={self.images:batch_images, self.labels:batch_labels})

    print("Epoch: [%2d] [%4d/%4d], step: [%2d], time: [%4.4f], loss: [%.8f]" \
          % (ep, idx, batch_idxs, counter, time.time()-start_time, err))
tegg89 commented 7 years ago

@kitterive Thanks for replies. I am currently working on loading model, but the loss value and preprocessing still keep wrong. As soon as figuring these out, I will upload new files. Thanks :)

tegg89 commented 7 years ago

@kitterive I changed sources. You can train and test files following the readme file. I will close this issue, and if you have any problem, feel free to raise. Thanks :)

niuniu111 commented 6 years ago

The result of operation is grayscale, can't it be color chart?