Tutorial on using control-seg to generate micro cities / 使用 ControlNet 语义分割生成小城市的教程
Added 2023-04-08 16:13:11 +0000 UTCFirst, please download the color_coding_semantic_segmentation_classes.xlsx file in the attachment.
From this, you can see that the color value of the sky is RGB (6, 230, 230), and the color value of the building is RGB (180, 120, 120).
Using semantic segmentation in ControlNet allows for generating corresponding objects on their respective color blocks. That is to say, if a (180, 120, 120) color block is painted on a blank canvas, a building will be generated in the corresponding position when generating the image.
For example, in the image above, you can see that there are many messy (180, 120, 120) color blocks in the lower half of the picture, which were sprayed randomly with a spray gun. By using this image as a reference and enabling the semantic segmentation model of ControlNet, a small city can be generated in the lower half of the image. The green part in the middle of the image represents the mountains, which can be used with the prompt "mountainous horizon" to generate a horizon composed of mountains, which can be used to transition with the sky and make the image more natural. The blue part at the top represents the sky.
Some parameter recommendations: You can adjust the parameters according to the image. The weight should not be too high, otherwise, it will easily generate a clear boundary between the sky and the ground (usually around 0.45).
----------- 中文 -------------
首先,请下载附件中的 color_coding_semantic_segmentation_classes.xlsx。
从中可以看到,天空 (sky) 的颜色值为 RGB (6, 230, 230),建筑物 (building) 的颜色值为 RGB (180, 120, 120)。
在 ControlNet 中使用语义分割可以控制在对应的色块上生成对应的物体,也就是说在一个空白的画布上涂一个 (180, 120, 120) 的色块,那么生成图的时候对应的位置就会生成建筑物。
比如上面这一张图,可以看到图片下半部分有很多很乱的 (180, 120, 120) 色块,这是用喷枪乱喷的,将这张图用于参考,启用 ControlNet 的语义分割模型后,就能在下半部分生成小城市。图片中间的绿色部分表示的是山脉,可以配合提示词 mountainous horizon 来生成由山脉组成的地平线,可以用于与天空过渡,使得图片更加自然。而最上面的蓝色部分表示的就是天空了。
一些参数推荐:可以按图中的参数调,权重不宜太高,否则容易生成很明显的天空与地面的分界线(通常为 0.45 左右)