<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>Diffusion Model on NCJ Tech Blog</title>
    <link>https://blog.chong-zeng.com/tags/diffusion-model/</link>
    <description>Recent content in Diffusion Model on NCJ Tech Blog</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en</language>
    <lastBuildDate>Sun, 04 Sep 2022 00:00:00 +0000</lastBuildDate>
    <atom:link href="https://blog.chong-zeng.com/tags/diffusion-model/rss.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>我用 AI 画了个新 Logo</title>
      <link>https://blog.chong-zeng.com/posts/2022-09-03_new_logo_with_stable_diffusion/</link>
      <pubDate>Sun, 04 Sep 2022 00:00:00 +0000</pubDate>
      <guid>https://blog.chong-zeng.com/posts/2022-09-03_new_logo_with_stable_diffusion/</guid>
      <description>最近扩散模型加持的 AI Art 有点🔥，周末想着也玩一玩，又受到 OctoSQL 作者的启发，决定体验一下这玩意的同时顺手翻新一下已经用了六年的头像。有一说一最近看到的不少 AI Art 的作品还是很惊艳我的。 不觉得这很酷吗？作为一名理工男我觉得这太酷了，很符合我对未来生活的想象，科技并带着趣味
我选用的模型是 Stable Diffusion，原因非常简单——这玩意真·开源，你可以在本地真正的运行它而不是调云端的 API，同时它生成效果不错且相对来说占用资源还是比较少的。本来一开始想用官方的 codebase，但后来发现 huggingface 出了一个 Diffusers，而且还提供了 fp16 版本的权重，果断换用抱抱脸🤗的产品。然后就开始了玄学的人工 prompt engineering。
改造老 Logo 首先第一想法是能不能用这玩意改造一下现在的 logo。于是找出老 logo，加上一段简单的 prompt，得到了第一个能看的结果：
A silver specular logo saying &amp;lsquo;NCJ&amp;rsquo;, unreal engine, bright color 效果还行，但感觉还缺一点点细节，多加一点元素进 prompt 试试：
a huge transparent glass dome, a logo saying text &amp;lsquo;NCJ&amp;rsquo;, unreal engine, Artstation, PCB electronic design, Massive scale, Fog, Highly detailed, Cinematic, Colorful 感觉有点味道了，于是我悄悄把这个头像换上了，但半天内都没人发现我换头像了！ 一气之下，我决定从头弄一个新的（X
白底黑字的原始图片 Stable Diffusion 和 DALL·E 2 这类 work 的一个缺陷在于他们不能很好的把完整的单词/字母弄到生成的图片上，因此对于 logo 而言还是很有必要把要展示的文字/形象在一开始就放好。</description>
      <content:encoded><![CDATA[<p><img loading="lazy" src="/2022-09-03_new_logo_with_stable_diffusion.assets/1662191295.png" alt="成品图"  />
</p>
<p>最近扩散模型加持的 AI Art 有点🔥，周末想着也玩一玩，又受到 <a href="https://jacobmartins.com/posts/how-i-used-dalle2-to-generate-the-logo-for-octosql/">OctoSQL 作者的启发</a>，决定体验一下这玩意的同时顺手翻新一下已经用了六年的头像。有一说一最近看到的不少 AI Art 的作品还是很惊艳我的。 <del>不觉得这很酷吗？作为一名理工男我觉得这太酷了，很符合我对未来生活的想象，科技并带着趣味</del></p>
<p>我选用的模型是 Stable Diffusion，原因非常简单——这玩意真·开源，你可以在本地真正的运行它而不是调云端的 API，同时它生成效果不错且相对来说占用资源还是比较少的。本来一开始想用<a href="https://github.com/CompVis/stable-diffusion">官方的 codebase</a>，但后来发现 huggingface 出了一个 <a href="https://github.com/huggingface/diffusers">Diffusers</a>，而且还提供了 fp16 版本的权重，果断换用抱抱脸🤗的产品。然后就开始了玄学的人工 prompt engineering。</p>
<h1 id="改造老-logo">改造老 Logo</h1>
<p>首先第一想法是能不能用这玩意改造一下现在的 logo。于是找出老 logo，加上一段简单的 prompt，得到了第一个能看的结果：</p>
<table>
<thead>
<tr>
<th style="text-align:center"><img loading="lazy" src="/2022-09-03_new_logo_with_stable_diffusion.assets/new_logo_1662169331.png" alt=""  />
</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:center">A silver specular logo saying &lsquo;NCJ&rsquo;, unreal engine, bright color</td>
</tr>
</tbody>
</table>
<p>效果还行，但感觉还缺一点点细节，多加一点元素进 prompt 试试：</p>
<table>
<thead>
<tr>
<th style="text-align:center"><img loading="lazy" src="/2022-09-03_new_logo_with_stable_diffusion.assets/1662173897.png" alt=""  />
</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:center">a huge transparent glass dome, a logo saying text &lsquo;NCJ&rsquo;, unreal engine, Artstation, PCB electronic design, Massive scale, Fog, Highly detailed, Cinematic, Colorful</td>
</tr>
</tbody>
</table>
<p>感觉有点味道了，于是我悄悄把这个头像换上了，但半天内都没人发现我换头像了！ <del>一气之下</del>，我决定从头弄一个新的（X</p>
<h1 id="白底黑字的原始图片">白底黑字的原始图片</h1>
<p>Stable Diffusion 和 DALL·E 2 这类 work 的一个缺陷在于他们不能很好的把完整的单词/字母弄到生成的图片上，因此对于 logo 而言还是很有必要把要展示的文字/形象在一开始就放好。</p>
<table>
<thead>
<tr>
<th style="text-align:center"><img loading="lazy" src="/2022-09-03_new_logo_with_stable_diffusion.assets/ncj_mask.png" alt=""  />
</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:center">啊，白底黑字~</td>
</tr>
</tbody>
</table>
<p>选用一些类似 设计稿、蓝图 的 prompt，还是有些效果不错的：</p>
<table>
<thead>
<tr>
<th style="text-align:center"><img loading="lazy" src="/2022-09-03_new_logo_with_stable_diffusion.assets/1662176433.png" alt=""  />
</th>
<th style="text-align:center"><img loading="lazy" src="/2022-09-03_new_logo_with_stable_diffusion.assets/1662176482.png" alt=""  />
</th>
<th style="text-align:center"><img loading="lazy" src="/2022-09-03_new_logo_with_stable_diffusion.assets/1662176697.png" alt=""  />
</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:center">design, draft, blueprint</td>
<td style="text-align:center">design, draft, blueprint</td>
<td style="text-align:center">design, logo, colorful, pencil sketch</td>
</tr>
</tbody>
</table>
<p>但也有摆烂的：</p>
<table>
<thead>
<tr>
<th style="text-align:center"><img loading="lazy" src="/2022-09-03_new_logo_with_stable_diffusion.assets/1662176509.png" alt=""  />
</th>
<th style="text-align:center"><img loading="lazy" src="/2022-09-03_new_logo_with_stable_diffusion.assets/1662176572.png" alt=""  />
</th>
<th style="text-align:center"><img loading="lazy" src="/2022-09-03_new_logo_with_stable_diffusion.assets/1662176761.png" alt=""  />
</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:center">design, draft, blueprint, icon, logo</td>
<td style="text-align:center">design, draft, blueprint, icon, logo, colorful, pencil sketch</td>
<td style="text-align:center">logo, colorful, design sketch, highly detailed</td>
</tr>
</tbody>
</table>
<p>此时我意识到一个问题，就是说即便不摆烂的输出，它在外围的内容还是偏少，会不会是因为我没有在外围勾画些东西来告诉模型你要在上面画点啥，于是我在原始图片上随手画了一些线条，并把中间的字母改为了镂空的：</p>
<table>
<thead>
<tr>
<th style="text-align:center"><img loading="lazy" src="/2022-09-03_new_logo_with_stable_diffusion.assets/ncj_sketch.png" alt=""  />
</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:center">sketch</td>
</tr>
</tbody>
</table>
<p>果然好多了，除了有时候字母还是会被模型给改掉：</p>
<table>
<thead>
<tr>
<th style="text-align:center"><img loading="lazy" src="/2022-09-03_new_logo_with_stable_diffusion.assets/1662177128.png" alt=""  />
</th>
<th style="text-align:center"><img loading="lazy" src="/2022-09-03_new_logo_with_stable_diffusion.assets/1662177310.png" alt=""  />
</th>
<th style="text-align:center"><img loading="lazy" src="/2022-09-03_new_logo_with_stable_diffusion.assets/1662177562.png" alt=""  />
</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:center">logo, colorful, design sketch, highly detailed</td>
<td style="text-align:center">logo, colorful, design sketch, electronic PCB design</td>
<td style="text-align:center">electronic PCB design</td>
</tr>
<tr>
<td style="text-align:center"><img loading="lazy" src="/2022-09-03_new_logo_with_stable_diffusion.assets/1662193186.png" alt=""  />
</td>
<td style="text-align:center"><img loading="lazy" src="/2022-09-03_new_logo_with_stable_diffusion.assets/1662193199.png" alt=""  />
</td>
<td style="text-align:center"><img loading="lazy" src="/2022-09-03_new_logo_with_stable_diffusion.assets/1662193137.png" alt=""  />
</td>
</tr>
<tr>
<td style="text-align:center">3D, colorful, Artstation, modern, academic, lasers in the room, rays scattering, neon</td>
<td style="text-align:center">3D, colorful, Artstation, modern, academic, lasers in the room, rays scattering, neon</td>
<td style="text-align:center">3D, colorful, Artstation, modern, academic, lasers in the room, rays scattering, neon</td>
</tr>
</tbody>
</table>
<p>不过感觉这些结果还是不太对胃口， <del>场景还是太单调了</del>，要不我先搭一个场景，然后让模型给我补细节吧（X</p>
<h1 id="cornell-box">Cornell Box</h1>
<p><del>但我哪里会搭场景啊（雾</del>，于是找来了经典的 Cornell Box，然后在上面恬不知耻的加上了 NCJ 三个字母：</p>
<table>
<thead>
<tr>
<th style="text-align:center"><img loading="lazy" src="/2022-09-03_new_logo_with_stable_diffusion.assets/ncj_cornell_box.png" alt=""  />
</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:center">Cornell Box</td>
</tr>
</tbody>
</table>
<p>不得不说经典场景的配色确实看着还是挺舒服的（</p>
<table>
<thead>
<tr>
<th style="text-align:center"><img loading="lazy" src="/2022-09-03_new_logo_with_stable_diffusion.assets/1662188006.png" alt=""  />
</th>
<th style="text-align:center"><img loading="lazy" src="/2022-09-03_new_logo_with_stable_diffusion.assets/1662189637.png" alt=""  />
</th>
<th style="text-align:center"><img loading="lazy" src="/2022-09-03_new_logo_with_stable_diffusion.assets/1662189645.png" alt=""  />
</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:center">3D, colorful, Artstation</td>
<td style="text-align:center">3D, colorful, Artstation, Information Technology, modern</td>
<td style="text-align:center">3D, colorful, Artstation, Information Technology, modern</td>
</tr>
<tr>
<td style="text-align:center"><img loading="lazy" src="/2022-09-03_new_logo_with_stable_diffusion.assets/1662189910.png" alt=""  />
</td>
<td style="text-align:center"><img loading="lazy" src="/2022-09-03_new_logo_with_stable_diffusion.assets/1662189941.png" alt=""  />
</td>
<td style="text-align:center"><img loading="lazy" src="/2022-09-03_new_logo_with_stable_diffusion.assets/1662189645.png" alt=""  />
</td>
</tr>
<tr>
<td style="text-align:center">3D, colorful, Artstation, Information Technology, modern, academic, CTO</td>
<td style="text-align:center">3D, colorful, Artstation, Information Technology, modern, academic, CTO</td>
<td style="text-align:center">3D, colorful, Artstation, modern, academic</td>
</tr>
<tr>
<td style="text-align:center"><img loading="lazy" src="/2022-09-03_new_logo_with_stable_diffusion.assets/1662190771.png" alt=""  />
</td>
<td style="text-align:center"><img loading="lazy" src="/2022-09-03_new_logo_with_stable_diffusion.assets/1662191432.png" alt=""  />
</td>
<td style="text-align:center"><img loading="lazy" src="/2022-09-03_new_logo_with_stable_diffusion.assets/1662191588.png" alt=""  />
</td>
</tr>
<tr>
<td style="text-align:center">3D, colorful, Artstation, modern, academic, papers</td>
<td style="text-align:center">3D letters placed in the air in the room, 3D, colorful, Artstation, modern, academic, CTO, college</td>
<td style="text-align:center">3D, colorful, Artstation, modern, academic, CTO, lasers in the room, rays scattering</td>
</tr>
</tbody>
</table>
<p>最后，选了开头的那张，它的 prompt 是 3D, colorful, Artstation, modern, academic, CTO</p>
<p>不过这些 prompt 多少还是带了猜和蒙的味道，比如里面的 CTO，本来是想加入一点高端商务风，后来检查发现 stable diffusion 其实都没见过这种图，因为当你直接把 CTO 交给模型，它会给你这样一张图：</p>
<p><img loading="lazy" src="/2022-09-03_new_logo_with_stable_diffusion.assets/1662191772.png" alt=""  />
</p>
<p>所以说写 prompt 前还是应该检查一下模型认识啥不认识啥的（X</p>
<p>总的来说，模型的生成能力还是非常惊艳的，但写 prompt 实在是太玄学了，希望 NLP 的学者们赶紧研究研究怎么把正儿八经的 prompt engineering 用到 diffusion 上。</p>
]]></content:encoded>
    </item>
  </channel>
</rss>
