5.4 KiB
5.4 KiB
In [ ]:
import os
os.environ['CUDA_VISIBLE_DEVICES']='0' In [ ]:
#import numpy as np
#import cv2
#import osIn [ ]:
from deoldify.visualize import *
plt.style.use('dark_background')
torch.backends.cudnn.benchmark=TrueIn [ ]:
colorizer = get_image_colorizer(artistic=False)In [ ]:
#NOTE: Max is 45 with 11GB video cards. 35 is a good default
render_factor=35
#NOTE: Make source_url None to just read from file at ./video/source/[file_name] directly without modification
source_url='https://upload.wikimedia.org/wikipedia/commons/e/e4/Raceland_Louisiana_Beer_Drinkers_Russell_Lee.jpg'
source_path = 'test_images/image.png'
result_path = None
if source_url is not None:
result_path = colorizer.plot_transformed_image_from_url(url=source_url, path=source_path, render_factor=render_factor, compare=True)
else:
result_path = colorizer.plot_transformed_image(path=source_path, render_factor=render_factor, compare=True)
show_image_in_notebook(result_path)In [ ]:
#for i in range(10,46):
#colorizer.plot_transformed_image(source_path, render_factor=i, display_render_factor=True, figsize=(10,10))In [ ]: