当前位置:网站首页>Picture coloring project - deoldify
Picture coloring project - deoldify
2022-07-06 11:06:00 【zkkkkkkkkkkkkk】
Catalog
One 、 Pull Deoldify Project code
Two 、 Download pre training model
3、 ... and 、 Color the picture
One 、 Pull Deoldify Project code
git Address :https://github.com/jantic/DeOldify
Two 、 Download pre training model
2.1、 step
1) Create in project root models Folder
2) Download the pre training model file , Upload three files to models Catalog
3、 ... and 、 Color the picture
from deoldify import device
from deoldify.device_id import DeviceId
from deoldify.visualize import *
from pathlib import Path
import os
os.environ['KMP_DUPLICATE_LIB_OK'] = "TRUE"
import warnings
warnings.filterwarnings("ignore", category=UserWarning, message=".*?Your .*? set is empty.*?")
#choices: CPU, GPU0...GPU7
device.set(device=DeviceId.GPU0)
plt.style.use('dark_background')
torch.backends.cudnn.benchmark=True
render_factor=35
result_path = None
p = Path('D:\\Gitlab\\DeOldify\\test_images')
all_file_path = []
count = 0
for file_name in p.rglob('*.jpg'):
all_file_path.append(file_name)
count+=1
for file_name in p.rglob('*.png'):
all_file_path.append(file_name)
count+=1
for file_name in p.rglob('*.jppeg'):
all_file_path.append(file_name)
count+=1
print(f" End of traversing the folder to be colored , share {count} A picture file \n")
# Traverse images , Color
for img_file_path in all_file_path:
# arctan
colorizer = get_image_colorizer(artistic=True)
img_file_name = str(img_file_path).split('\\')[-1]
print(f" Start to deal with {img_file_name}")
colorizer.plot_transformed_image(path=img_file_path, render_factor=render_factor, compare=True)
print(f"{img_file_name} End of processing ")
print("\n")
# end
print(" The picture coloring process is over ")
Four 、 Video coloring
from deoldify import device
from deoldify.device_id import DeviceId
from deoldify.visualize import *
plt.style.use('dark_background')
import warnings
warnings.filterwarnings("ignore", category=UserWarning, message=".*?Your .*? set is empty.*?")
#choices: CPU, GPU0...GPU7
device.set(device=DeviceId.GPU0)
colorizer = get_video_colorizer()
#NOTE: Max is 44 with 11GB video cards. 21 is a good default
render_factor=21
result_path = None
file_name_ext = 'D:\\Gitlab\\DeOldify\\test_video\\test1.mp4'
colorizer.colorize_from_file_name(file_name_ext, render_factor=render_factor)
边栏推荐
- Mysql 其他主机无法连接本地数据库
- 【博主推荐】C# Winform定时发送邮箱(附源码)
- [recommended by bloggers] C MVC list realizes the function of adding, deleting, modifying, checking, importing and exporting curves (with source code)
- API learning of OpenGL (2005) gl_ MAX_ TEXTURE_ UNITS GL_ MAX_ TEXTURE_ IMAGE_ UNITS_ ARB
- 软件测试-面试题分享
- JDBC原理
- npm一个错误 npm ERR code ENOENT npm ERR syscall open
- C language advanced pointer Full Version (array pointer, pointer array discrimination, function pointer)
- TCP/IP协议(UDP)
- 解决扫描不到xml、yml、properties文件配置
猜你喜欢
[recommended by bloggers] asp Net WebService background data API JSON (with source code)
Win10: how to modify the priority of dual network cards?
Breadth first search rotten orange
A trip to Macao - > see the world from a non line city to Macao
Mysql22 logical architecture
CSDN-NLP:基于技能树和弱监督学习的博文难度等级分类 (一)
机器学习--人口普查数据分析
Valentine's Day is coming, are you still worried about eating dog food? Teach you to make a confession wall hand in hand. Express your love to the person you want
Esp8266 at+cipstart= "", "", 8080 error closed ultimate solution
A brief introduction to the microservice technology stack, the introduction and use of Eureka and ribbon
随机推荐
记一次某公司面试题:合并有序数组
打开浏览器的同时会在主页外同时打开芒果TV,抖音等网站
csdn-Markdown编辑器
CSDN问答模块标题推荐任务(一) —— 基本框架的搭建
MySQL的一些随笔记录
Copy constructor template and copy assignment operator template
Ansible实战系列三 _ task常用命令
++Implementation of I and i++
Kubesphere - deploy the actual combat with the deployment file (3)
A trip to Macao - > see the world from a non line city to Macao
[Li Kou 387] the first unique character in the string
MySQL flush operation
SSM integrated notes easy to understand version
CSDN问答模块标题推荐任务(二) —— 效果优化
Deoldify项目问题——OMP:Error#15:Initializing libiomp5md.dll,but found libiomp5md.dll already initialized.
JDBC原理
安全测试涉及的测试对象
[recommended by bloggers] asp Net WebService background data API JSON (with source code)
PyCharm中无法调用numpy,报错ModuleNotFoundError: No module named ‘numpy‘
Installation and use of MySQL under MySQL 19 Linux