-
Notifications
You must be signed in to change notification settings - Fork 0
/
SR_VPS.py
24 lines (20 loc) · 823 Bytes
/
SR_VPS.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import os
import sys
import tensorflow as tf
import numpy as np
import cv2
import tensorflow.keras as keras
from tensorflow.keras import regularizers
from tensorflow.keras import optimizers
from util import ffzk,img2np,tf2img
sys.path.append(os.path.dirname(os.path.abspath(__file__)))
os.chdir(os.path.dirname(os.path.join("./", __file__)))
if __name__ == "__main__":
model = keras.models.load_model("SR_VPS.h5")
inputImage=img2np(["./input.png"])[0]
height, width, _ = inputImage.shape[:3]
inputImage=cv2.resize(inputImage, dsize=(width//4, height//4))
inputImage=cv2.resize(inputImage, dsize=((width//16)*16, (height//16)*16), interpolation=cv2.INTER_CUBIC)[np.newaxis,...]
tf2img(inputImage,"./",name="cubic.png")
predY=model.predict(inputImage)
tf2img(predY,"./",name="output.png")