5.2 KiB
5.2 KiB
In [ ]:
import os
os.environ['CUDA_VISIBLE_DEVICES']='1' In [ ]:
from fasterai.visualize import *
plt.style.use('dark_background')
torch.backends.cudnn.benchmark=TrueIn [ ]:
colorizer = get_image_colorizer(artistic=True)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://i.imgur.com/NajrX6Z.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,2):
colorizer.plot_transformed_image(source_path, render_factor=i, display_render_factor=True, figsize=(8,8))In [ ]: