Giter Site home page Giter Site logo

synioe / style_migration_for_artistic_font_with_cnn Goto Github PK

View Code? Open in Web Editor NEW

This project forked from koishi70/style_migration_for_artistic_font_with_cnn

0.0 1.0 0.0 5.59 MB

基于卷积神经网络的风格迁移,制造出带有艺术风格的字体

License: MIT License

Python 100.00%

style_migration_for_artistic_font_with_cnn's Introduction

Style Migration For Artistic Font With CNN

基于卷积神经网络的风格迁移,超越艺术字

使用方法很简单,只需要输入:
python.exe neural_style_transfer.py 风格图片所在目录 输出文件夹
--chars 花 # 要生成的文字,支持一次输入多个文字
--pictrue_size 300 # 生成图片大小
--background_color (0,0,0) # 文字图片中背景的颜色
--text_color (255,255,255) # 文字图片中文字的颜色
--iter 50 # 迭代次数,一般50代左右就行
--smooth_times 20 # 文字图片是否进行模糊化处理
--noise True # 文字图片是否加入随机噪声
--image_enhance True # 生成图片是否进行增强,包括色度,亮度,锐度增强
--font_name 宋体 # 文字字体,支持宋体,楷体,黑体,仿宋,等线
--reverse_color False # True-黑纸白字,False-白纸黑字,默认白纸黑字
--output_per_iter 2 # 每隔多少次迭代输出一张图片

一些说明

神经网络基于keras官方的风格迁移的例子,经过一定的调整loss函数和调参后得到最适合于艺术风格字体的代码。
调整包括:

1.加入生成文字图片的方法,以及提供一系列图片生成相关接口,便于您第一时间修改结果
2.修改了loss函数,经过大量实验,确定使用keras提供的VGG19网络的'block1_conv1','block2_conv1','block3_conv1'三层作为风格损失,去除内容损失
3.加入一些图片的增强方法,使得结果更加色彩丰富
4.在style文件夹下提供了一系列图片供您探索
4.运行需要Keras支持,建议使用GPU运算,在 Nvidia GeForce GTX 1050 Ti (4 GB)上,一次迭代大约3s,一张图片耗时2-3min

下面给出一些例子,在example文件夹下有其对应的风格图片

花
雨
竹
雾
墨
木
火
星

style_migration_for_artistic_font_with_cnn's People

Contributors

koishi70 avatar d-miracleace avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.