Esempio n. 1
0
# Import required libraries.
print("Loading the required Python modules ...\n")

import os
import cv2 as cv
import glob

from utils import get_predict_api, plot_bw_color_comparison, IMG_PATH

# Load model

print("Loading the model ...")
predict, _ = get_predict_api()

cwd = os.getcwd()
print("Demonstrate colorization using images found in\n",
      os.path.join(cwd, IMG_PATH), "\n")

print("Please close each image (Ctrl-w) to proceed through the demonstration.\n")

if __name__ == '__main__':
    image_folder = 'images'

    images = glob.glob(os.path.join(IMG_PATH, "*_bw.png"))
    images.sort()

    for image in images:
        print("Colorize " + os.path.basename(image))
        gray = cv.imread(image, 0)
        out = predict(gray)
        plot_bw_color_comparison(gray, cv.cvtColor(out, cv.COLOR_BGR2RGB))
Esempio n. 2
0
print("Loading required Python modules ...")

from keras.utils import plot_model
import subprocess
from utils import get_predict_api

print("\nLoading model ...")

graph_file = "cache/model_graph.png"
_, model = get_predict_api()
plot_model(model, to_file=graph_file)

subprocess.Popen("xdg-open " + graph_file, shell=True, stderr=subprocess.PIPE)