Inpaint with NovelAIDiffusion!

Anlatan
8 min readMay 25, 2023

As alluded to in our recent Clio text model release video it’s time to bring Inpainting into NovelAI!

Inpainting is a new tool that allows you to restore or regenerate specific areas in generations or uploaded images. It allows you to select a region of the image, and change what was already there.

Some practical ways in which you can use Inpaint include:

  • Partially changing the style of a picture. For example you can change the color of the hair of a character, or their clothes.
  • Fixing problems with images. If you don’t like a part of an image, you can give it some more generation attempts while keeping the rest of it intact.
  • Create new content in an existing picture. Add new characters or background elements. Maybe inpaint some cats on your frogs. Sky’s the limit!

To use this new feature, you can start by generating an image using one of the existing models, and then clicking on the “Inpaint” button on the top of the UI.

This will open the inpainting editor, where you can select the part of the image that will be inpainted. Once you’re done, click “Save & Close”, and then click the generate button.

You can also upload your own images to inpaint them. To do this, use the “Add a Base Image” button (same as you would for Image2Image, controlnet, etc.) and then click the “Inpaint Image” button. This will also open the inpainting editor.

Inpainting does have some limitations. Artifacts may show up in some rare cases, and unfortunately the usual limitations of image generation models still apply.

For example, it is not possible in general to use inpainting to fix hands or other similar intricate structures that the models don’t know how to generate properly to begin with. That said, it is still good to get more attempts at a particularly tricky region of your generation while keeping the rest of the image constant.

One interesting note is, we are also interested to see if pretraining with inpainting as a base task could actually yield even better results for our future image models. The reasoning for this is that the model would be able to learn structural relationships and how to place things in context.

We’ve also updated our Documentation page with the necessary information surrounding the Inpaint feature. Make sure to stop by https://docs.novelai.net/ if you run into any issues or have questions!

We’re excited to see what you’ll create with this tool, and how it will transform your new or existing generations to give them new meanings!

日本語訳:

画像生成:インペイント機能

先日、Clioテキストモデル公開動画(英語版)で紹介したように、NovelAIにインペインティングが導入されました!

インペインティングは、生成した画像やアップロードした画像の特定の領域を再生成する事ができる新しいツールです。画像の一部を選択し、選択領域内に描かれたものを変更することができます。

例えばこんな使い方も:

画像のレイアウトを部分的に変更。キャラクターの髪の色や、服装だけを変えることができます。

画像の破綻箇所の修正。画像の一部が気に入らない場合、残りの部分をそのままに、さらなるクオリティアップを試せます!

既存の絵の中に新しいコンテンツを作成し、新しいキャラクターや背景を追加。池の中のカエルの上にネコを置いてみたり? これまで描けなかった複雑なモノにもチャレンジしましょう!

この新機能を使うには、画像を新たに生成するか、既存の画像をアップロードする事が必要となります。

新たに生成する場合、まずは画像を生成しましょう! この時に使うモデルの種類は問いません!

画像が出力されたらページ上部の「インペイント」ボタンをクリックします。

インペイントエディターが表示され、変更を加えたい箇所を選択することができます。

選択が完了したら、「Save & Close/保存して閉じる」をクリックし、生成ボタンをクリックします。

または、自分で作成した画像をアップロードしてインペイントすることも可能です。

その場合は、まず「参照用画像を追加」ボタン(i2i、controlnetを使う前に押すボタンです)を使い、画像をインポートします。次に「Inpaint Image/画像をインペイント」ボタンをクリックします。

インペイントエディタが開いたら、好きな場所を選択し、保存して生成ボタンをクリックしましょう。

インペインティングには、いくつかの制限があります。まれにアーティファクト(ノイズ的に表れる画像の破綻)が現れることがありますし、残念ながら画像生成モデルの限界も適用されます。

モデルの限界の一例として、人間の手指といった複雑な構造をインペインティングで修正することは、ほぼ不可能です。モデル自体が手指を正確に生成する事が出来ないため、モデルが生成方法を知らないものはインペイント機能でも修正する事が出来ません。

とはいえ、他の部分を変化させずに、破綻しやすい箇所の生成をより多く試みるのは良いことです。

また、今後の展望として、私達はこの新しい技術をベースタスクとした事前学習が、より正確な出力を行う画像生成モデルの開発につながるかにも興味をもっています。インペインティング技術の発展により、モデルが構造的な関係や、全体のデザインを踏まえたキャラや背景のレイアウトを学習できるようになる、と私達は考えています。

さて今回、私達のドキュメントページも更新され、インペイント機能に関する必要な情報を掲載しました。何か問題が発生したり、質問がある場合は、https://docs.novelai.net/までお越しください!

このツールを使って、新しい画像を生成したり、既存の作品をどのように変容させ、新たな意味を持たせていくのか……皆さんの作品にお目にかかれるのを楽しみにしています!

--

--

novelai.net Driven by AI, painlessly construct unique stories, thrilling tales, seductive romances, or just fool around. Anything goes!