当前位置:网站首页>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)边栏推荐
- Have you mastered the correct posture of golden three silver four job hopping?
- Kubernetes - problems and Solutions
- Deoldify项目问题——OMP:Error#15:Initializing libiomp5md.dll,but found libiomp5md.dll already initialized.
- [number theory] divisor
- SSM integrated notes easy to understand version
- 【博主推荐】C# Winform定时发送邮箱(附源码)
- @controller,@service,@repository,@component区别
- [untitled]
- [Thesis Writing] how to write function description of jsp online examination system
- February 13, 2022-3-middle order traversal of binary tree
猜你喜欢

Idea import / export settings file

Did you forget to register or load this tag 报错解决方法

Swagger、Yapi接口管理服务_SE

windows无法启动MYSQL服务(位于本地计算机)错误1067进程意外终止

Use dapr to shorten software development cycle and improve production efficiency

Other new features of mysql18-mysql8

CSDN问答模块标题推荐任务(二) —— 效果优化

CSDN问答模块标题推荐任务(一) —— 基本框架的搭建

CSDN Q & a tag skill tree (V) -- cloud native skill tree
![[recommended by bloggers] C # generate a good-looking QR code (with source code)](/img/5a/1dbafe5a28f016b815964b9b37c9f1.jpg)
[recommended by bloggers] C # generate a good-looking QR code (with source code)
随机推荐
MySQL的一些随笔记录
Development of C language standard
Some problems in the development of unity3d upgraded 2020 VR
软件测试-面试题分享
JDBC principle
Remember the interview algorithm of a company: find the number of times a number appears in an ordered array
[untitled]
Windows cannot start the MySQL service (located on the local computer) error 1067 the process terminated unexpectedly
Remember a company interview question: merge ordered arrays
【博主推荐】C# Winform定时发送邮箱(附源码)
02-项目实战之后台员工信息管理
自动机器学习框架介绍与使用(flaml、h2o)
Basic use of redis
图像识别问题 — pytesseract.TesseractNotFoundError: tesseract is not installed or it‘s not in your path
Django运行报错:Error loading MySQLdb module解决方法
Asp access Shaoxing tourism graduation design website
Solution: log4j:warn please initialize the log4j system properly
TCP/IP协议(UDP)
Mysql21 - gestion des utilisateurs et des droits
数数字游戏