In this tutorial, you will learn how to use Stable-Diffusion-WebUI to implement the AI map expansion function in Alibaba Cloud Interactive Modeling (PAI-DSW).
With the continuous development of AIGC technology, AI image expansion has become an innovative gameplay. By giving the AI a picture, the AI is able to predict and supplement the image boundaries to generate larger-sized images. AI image enlargement can save useless photos and expand half-length photos into full-body photos, but sometimes overturns occur, and the resulting images make people laugh or cry.
This tutorial uses Stable Diffusion WebUI to implement the AI image expansion function. The effect is shown below:
Based on this tutorial you can experience:
New users can receive free trial resources of the artificial intelligence platform PAI worth 10,000 yuan
Learn how to quickly create an interactive training and development environment on Alibaba Cloud.
Learn how to launch WebUI in DSW.
Learn how to implement AI image expansion function in DSW.
1. Prepare environment and resources
1.1 Get the free trial rights of interactive modeling PAI-DSW
Go to the event page and receive the interactive modeling PAI-DSW product free trial resource package
1.2 Create PAI-DSW instance
4. Click to create an instance (as shown above)
5. Customize input instance name
6. Select the instance model, GPU category-ecs.gn6v-c8g1.2xlarge (supports resource package deduction), if there is no such model in stock, you can try changing the region;
7. Select the image, stable-diffusion-webui-develop:1.0.0-pytorch2.01-gpu-py310-cu117-ubuntu22.04
8. Click "Next"
9. Confirm [Resource Configuration] and [Mirror] as shown in the figure, click Create Instance;
10. Wait about 3-5 minutes, the instance status changes to "Running", and the instance creation is completed;
1.3 Open the tutorial file in DSW
3. In the DSW Gallery page, search and find the
AI Image Expansion Artifact: Release Your Imagination tutorial, and click Open in DSW in the tutorial card.
4. The folder "demos" appears on the right, click the "demos" folder, click the "stable_diffusion_inpaint" folder, click the "stable_diffusion_inpaint.ipynb" file, and open the prepared Notebook best practice tutorial. The specific steps are as follows As shown in the picture
5. Complete the above steps and successfully open the
AI image expansion tool: let your imagination run wild Notebook best practices.
1.4 Run tutorial file
2. This tutorial has a total of 3 running steps:
Start WebUI is completed, click the URL link in the returned running details result to enter the WebUI page. You can then complete the AI image enlargement on this page.
2. Complete the deployment and start experiencing AI image expansion
In order to realize the ability of AI image expansion, the following configuration needs to be performed on the Stable Diffusion WebUI page.
2.1 Enter the drawing interface
Enter the graph generation interface,Stable Diffusion model and VAE of the model can be kept as default.
2.2 Basic configuration
Tushengtu configuration, complete image upload and Tushengtu parameter configuration. Please refer to the figure below for details.
1.Zoom mode: Select fill.
2. Redraw amplitude: Select 1.0. — Generally speaking, the larger the redraw amplitude parameter, the lower the similarity between the generated image and the original image. However, when using controlnet inpaint to expand the image, it needs to be full.
3. Width and height: Fill in the size after expanding the image.
2.3 ControlNet configuration
Next, you need to configure ControlNet with the following parameters:
2.4 Enter prompt to complete AI image expansion
According to personal preference, enter positive and negative prompts to complete AI image expansion. The following is an example for reference.
heart-shape balloons——Heart-shaped balloons
Christmas tree——Christmas tree
The theme of this event: After AI enlargement of the image, there is a tree in the image. After completing the AI image expansion by the artificial intelligence platform PAI (PAI-DSW), please upload the works that match the theme of the event to the event page>> "Work with PAI, Play with AI Every Week" Issue 5: Use PAI-DSW to achieve AI image expansion function
3. Resource cleanup and follow-up
3.1 Cleanup
3.2 Follow-up
During the trial validity period, you can continue to use DSW instances for model training and inference verification.
Original link: https://developer.aliyun.com/article/1417423?utm_content=g_1000388102
This article is original content of Alibaba Cloud and may not be reproduced without permission.
The above is the detailed content of How to implement AI image expansion function using PAI-DSW and SD WebUI. For more information, please follow other related articles on the PHP Chinese website!