当前位置:网站首页>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)
边栏推荐
- Deoldify项目问题——OMP:Error#15:Initializing libiomp5md.dll,but found libiomp5md.dll already initialized.
- Django运行报错:Error loading MySQLdb module解决方法
- [C language foundation] 04 judgment and circulation
- CSDN问答标签技能树(二) —— 效果优化
- @Controller, @service, @repository, @component differences
- Breadth first search rotten orange
- Ansible practical series I_ introduction
- Did you forget to register or load this tag 报错解决方法
- Development of C language standard
- C语言标准的发展
猜你喜欢
Detailed reading of stereo r-cnn paper -- Experiment: detailed explanation and result analysis
CSDN Q & a tag skill tree (V) -- cloud native skill tree
[recommended by bloggers] asp Net WebService background data API JSON (with source code)
Asp access Shaoxing tourism graduation design website
Install mongdb tutorial and redis tutorial under Windows
Idea import / export settings file
[recommended by bloggers] C WinForm regularly sends email (with source code)
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
Postman Interface Association
A trip to Macao - > see the world from a non line city to Macao
随机推荐
Windows cannot start the MySQL service (located on the local computer) error 1067 the process terminated unexpectedly
Timestamp with implicit default value is deprecated error in MySQL 5.6
MySQL 20 MySQL data directory
Asp access Shaoxing tourism graduation design website
[leectode 2022.2.13] maximum number of "balloons"
解决扫描不到xml、yml、properties文件配置
01项目需求分析 (点餐系统)
Dotnet replaces asp Net core's underlying communication is the IPC Library of named pipes
Leetcode 461 Hamming distance
一键提取pdf中的表格
A trip to Macao - > see the world from a non line city to Macao
导入 SQL 时出现 Invalid default value for ‘create_time‘ 报错解决方法
Django运行报错:Error loading MySQLdb module解决方法
npm一个错误 npm ERR code ENOENT npm ERR syscall open
Win10: how to modify the priority of dual network cards?
Ansible实战系列二 _ Playbook入门
虚拟机Ping通主机,主机Ping不通虚拟机
QT creator shape
Postman environment variable settings
Basic use of redis