{"id":13672561,"url":"https://github.com/koishi70/Style_Migration_For_Artistic_Font_With_CNN","last_synced_at":"2025-04-27T22:32:32.041Z","repository":{"id":126247450,"uuid":"135918691","full_name":"koishi70/Style_Migration_For_Artistic_Font_With_CNN","owner":"koishi70","description":"基于卷积神经网络的风格迁移，制造出带有艺术风格的字体（艺术字），部分效果可达PS水平，可以辅助设计人员做设计；Convolutional neural network based style migration to create a font with artistic style (WordArt), some effects up to PhotoShop level, it can assist designers to do design","archived":false,"fork":false,"pushed_at":"2018-07-13T05:04:16.000Z","size":6147,"stargazers_count":228,"open_issues_count":5,"forks_count":50,"subscribers_count":8,"default_branch":"master","last_synced_at":"2024-11-11T10:42:33.604Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/koishi70.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2018-06-03T15:58:06.000Z","updated_at":"2024-11-11T10:24:20.000Z","dependencies_parsed_at":null,"dependency_job_id":"dbefde1d-1b04-4d8e-b9ec-b6bc0825d91f","html_url":"https://github.com/koishi70/Style_Migration_For_Artistic_Font_With_CNN","commit_stats":null,"previous_names":["yuweiming70/style_migration_for_artistic_font_with_cnn"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/koishi70%2FStyle_Migration_For_Artistic_Font_With_CNN","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/koishi70%2FStyle_Migration_For_Artistic_Font_With_CNN/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/koishi70%2FStyle_Migration_For_Artistic_Font_With_CNN/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/koishi70%2FStyle_Migration_For_Artistic_Font_With_CNN/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/koishi70","download_url":"https://codeload.github.com/koishi70/Style_Migration_For_Artistic_Font_With_CNN/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251219601,"owners_count":21554444,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-02T09:01:39.355Z","updated_at":"2025-04-27T22:32:27.030Z","avatar_url":"https://github.com/koishi70.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"# Style Migration For Artistic Font With CNN\n基于卷积神经网络的风格迁移，超越艺术字\n===\n使用方法很简单，只需要输入：\u003cbr\u003e\npython.exe neural_style_transfer.py \"风格图片所在目录\"  \"输出文件夹\"\n\u003cbr\u003e  --chars 花  # 要生成的文字，支持一次输入多个文字\n\u003cbr\u003e  --pictrue_size 300  # 生成图片大小\n\u003cbr\u003e  --background_color (0,0,0)   # 文字图片中背景的颜色\n\u003cbr\u003e  --text_color (255,255,255)   # 文字图片中文字的颜色\n\u003cbr\u003e  --iter 50   # 迭代次数，一般50代左右就行\n\u003cbr\u003e  --smooth_times 20   # 文字图片是否进行模糊化处理\n\u003cbr\u003e  --noise 10   # 文字图片加入随机噪声的等级\n\u003cbr\u003e  --image_enhance True    # 生成图片是否进行增强，包括色度，亮度，锐度增强\n\u003cbr\u003e  --font_name  宋体  # 文字字体，支持宋体，楷体，黑体，仿宋，等线\n\u003cbr\u003e  --reverse_color False  # True-黑纸白字，False-白纸黑字，默认白纸黑字\n\u003cbr\u003e  --output_per_iter 2  # 每隔多少次迭代输出一张图片\n\u003cbr\u003e  --image_input_mode  one_pic  # 输入的风格图片允许使用一下mode： 'one_pic:一张风格图片'，'one_pic_T:一张风格图片，但是这张图片经过旋转90度后当作第二张,特别适合汉字的横竖笔画'，'two_pic:两张风格图片'\n\u003cbr\u003e  --style_reference_image2_path  # 第二张风格图片的位置，没有第二张不填\n\u003cbr\u003e  --two_style_k 0.9  # 两张图片的相对权重，第一张*k+第二张*(1-k)\n\n## 一些使用的例子\n单一风格：\u003cbr\u003e\n\"C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\Anaconda3_64\\python.exe\" \"E:\\学习\\大三下\\人工智能导论\\风格转移字体\\neural_style_transfer.py\"  \"E:\\学习\\大三下\\人工智能导论\\风格转移字体\\style\\bamboo\\5.jpg\" E:\\学习\\大三下\\人工智能导论\\风格转移字体\\输出\\ --pictrue_size 300 --background_color (255,255,255) --text_color (0,0,0) --iter 30 --chars 竹 --smooth_times 20 --noise 10 --image_enhance True --image_input_mode one_pic\n\n两个风格：\u003cbr\u003e\n\"C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\Anaconda3_64\\python.exe\" \"E:\\学习\\大三下\\人工智能导论\\风格转移字体\\neural_style_transfer.py\"  \"E:\\学习\\大三下\\人工智能导论\\风格转移字体\\style\\stone\\2.jpg\" E:\\学习\\大三下\\人工智能导论\\风格转移字体\\输出\\ --pictrue_size 300 --background_color (255,255,255) --text_color (0,0,0) --iter 50 --chars 石 --smooth_times 20 --noise  10 --image_enhance True --image_input_mode two_pic --style_reference_image2_path \"E:\\学习\\大三下\\人工智能导论\\风格转移字体\\style\\stone\\3.jpg\" --two_style_k 0.6\n\n# 7.13更新\n##### 1.更新了使用例子\n##### 2.代码稍作调整\n\n## 6.13更新\n##### 1.支持两张风格图片，使用第一张*k+第二张*(1-k)，可以平滑调节两张图片的风格过渡。\n##### 2.支持调节随机噪音的强度，为图片加上“noise×图片边长”个噪点。\n##### 3.精细调参，三层卷积层的权重改为10:1:1，颜色更艳丽。\n\n## 一些说明\n神经网络基于[keras](https://github.com/keras-team/keras/blob/master/examples/neural_style_transfer.py)官方的风格迁移的例子，经过一定的调整loss函数和调参后得到最适合于艺术风格字体的代码。\u003cbr\u003e\n调整包括：\u003cbr\u003e\n##### 1.加入生成文字图片的方法，以及提供一系列图片生成相关接口，便于您第一时间修改结果\n##### 2.修改了loss函数，经过大量实验，确定使用keras提供的VGG19网络的'block1_conv1','block2_conv1','block3_conv1'三层作为风格损失，去除内容损失\n##### 3.加入一些图片的增强方法，使得结果更加色彩丰富\n##### 4.在style文件夹下提供了一系列图片供您探索\n##### 4.运行需要Keras支持，建议使用GPU运算，在\tNvidia GeForce GTX 1050 Ti (4 GB)上，一次迭代大约3s，一张图片耗时2-3min\n\n\t\n## 下面给出一些例子，在example文件夹下有其对应的风格图片\n![花](https://github.com/yuweiming70/Style_Migration_For_Artistic_Font_With_CNN/blob/master/example/%E8%8A%B1_%E4%BB%A3%E6%95%B0_49.png)  \n![雨](https://github.com/yuweiming70/Style_Migration_For_Artistic_Font_With_CNN/blob/master/example/%E9%9B%A8_%E4%BB%A3%E6%95%B0_49.png)  \n![竹](https://github.com/yuweiming70/Style_Migration_For_Artistic_Font_With_CNN/blob/master/example/%E7%AB%B9_%E4%BB%A3%E6%95%B0_49.png)  \n![雾](https://github.com/yuweiming70/Style_Migration_For_Artistic_Font_With_CNN/blob/master/example/%E9%9B%BE_%E4%BB%A3%E6%95%B0_49.png)  \n![墨](https://github.com/yuweiming70/Style_Migration_For_Artistic_Font_With_CNN/blob/master/example/%E5%A2%A8_%E4%BB%A3%E6%95%B0_49.png)  \n![木](https://github.com/yuweiming70/Style_Migration_For_Artistic_Font_With_CNN/blob/master/example/%E6%9C%A8_%E4%BB%A3%E6%95%B0_49.png)  \n![火](https://github.com/yuweiming70/Style_Migration_For_Artistic_Font_With_CNN/blob/master/example/%E7%81%AB_%E4%BB%A3%E6%95%B0_49.png)  \n![星](https://github.com/yuweiming70/Style_Migration_For_Artistic_Font_With_CNN/blob/master/example/%E6%98%9F_%E4%BB%A3%E6%95%B0_49.png)  \n![石](https://github.com/yuweiming70/Style_Migration_For_Artistic_Font_With_CNN/blob/master/example/%E7%9F%B3_%E4%BB%A3%E6%95%B0_150.png)  \n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkoishi70%2FStyle_Migration_For_Artistic_Font_With_CNN","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkoishi70%2FStyle_Migration_For_Artistic_Font_With_CNN","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkoishi70%2FStyle_Migration_For_Artistic_Font_With_CNN/lists"}