Closed delray closed 7 years ago
Sorry, I'll add some sample code to the repo explaining how to do that soon.
As for now, here's a quick example:
from model import EDSR
import scipy.misc
#Create your EDSR network (I left parameters blank, but be sure to use the same ones you used for training)
network = EDSR()
#Then, you're going to want to restore the weights that were saved. To do this, call resume(), you may have to pass in the save directory where you saved if you used a custom one
network.resume()
imgs = #TODO (get your image(s) here)
#Just a note, your imgs should be a 4D tensor of shape [number_of_images,width,height,3]
#Then, we pass this into the EDSR using network.predict()
scaled_images = network.predict(imgs)
#Scaled images will be a 4D tensor of shape [num_of_images,width*scale,height*scale,3]
#From here, you can do what you'd like with your images ex: saving them
for i in range(len(scaled_images)):
scipy.misc.imsave("output_img_"+str(i)+".png",scaled_images[i])
Hopefully this was helpful! Please contact me if you run into more trouble
Just as an update, I've added a file that assists in sampling output on a trained network. Simply use python test.py
. If you'd like to test on just a single image, just pass the command line argument --image
followed by the image you'd like to apply super resolution to. (ex. python test.py --image picture.png
)
Ive trained a dataset with your implementation, but Im curious how to pass an input image through the network and get a scaled image?