Stable Diffusionで極端な明暗を表現できない理由とその解決
左 : (プロンプトの0が完全な黒、1は白)
?

>(with an entirely black image being 0, and an entirely white image being 1).
SDは0.5にしようとする
画像下のはプロンプトだと思っていたけど違うな

なんの数値なんだ?
右 : 真っ黒な画像でDreamBoothしても、真っ黒な画像を生成できない(プロンプト : "A solid black image" )
なぜか?
モデルの学習では、画像をノイズに変換していく
しかし、完全な分布には戻せない
最後までノイズに変換されない場所は、ノイズから画像にする処理では最も弱く変化してしまう
>拡散プロセスは、そのような長波長の特徴をどのように変化させればよいのかわからないのです。
この問題は次元が高くなるほど悪化する
SD v1.5は12288次元
>長い波長は短い波長よりも約100倍遅く変化するため、デフォルトでは50程度(高度なサンプラーでは20程度)であるところを、それを捉えるためには数百から数千のプロセスのステップを考慮する必要がある
ステップ数を増やす以外の方法はないか?
現在、モデルのトレーニングには下のようなノイズを使っている
$ noise = torch.randn_like(latents)
代わりにこうする
$ noise = torch.randn_like(latents) + 0.1 * torch.randn(latents.shape[0], latents.shape[1], 1, 1)
グラフにしてみる(合ってるかは分からない)

$ noise1 = torch.randn_like(latents)
$ noise2 = 0.1 * torch.randn(latents.shape[0], latents.shape[1], 1, 1)
$ noise = noise1 + noise2
分散が小さくなっている?

明るい(暗い)画像が生成できるようになっている
このノイズを使ってトレーニングされた大規模モデルの登場が待たれる
他の対策案
形が少し変わってしまう
上の記事を元に作成されたLoRA