


How to implement AI image expansion function using PAI-DSW and SD WebUI
Tutorial Brief
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.
Use PAI-DSW to quickly start SD WebUI
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
- For new users of interactive modeling PAI-DSW, Alibaba Cloud provides 5000CU*H free trial resources, which can be obtained directly on the event page (for trial rules, please refer to Alibaba Cloud Free Trial: https://free. aliyun.com/); or you can purchase the interactive modeling PAI-DSW resource package to participate in the event, purchase link: PAI-DSW 100CU*H resource package, price starts at 59 yuan; if you do not purchase the resource package, PAI-DSW will For billing, please refer to Alibaba Cloud product pricing for billing standards.
1.2 Create PAI-DSW instance
- Go to the artificial intelligence platform PAI console, link: https://pai.console.aliyun.com/
- Open artificial intelligence PAI and create a default workspace. See Provisioning and Creating a Default Workspace.
- In the artificial intelligence platform PAI console, select interactive modeling PAI-DSW, or click the link
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
- Click the instance you want to open Open under the Operation column to enter the PAI-DSW instance development environment.
- On the Launcher page of the Notebook tab, click Browse Gallery## under the Quick Start areaTool #, open the Gallery page
AI Image Expansion Artifact: Release Your Imagination tutorial, and click Open in DSW in the tutorial card.
AI image expansion tool: let your imagination run wild Notebook best practices.
1.4 Run tutorial file
- In the open tutorial file
- stable_diffusion_inpaint.ipynb file, you can directly see the tutorial text, and you can run each code snippet directly in the tutorial file. After successfully running a step command, run the next step command sequentially.
- Download stable-diffusion-webui open source library
- Download model
- Start WebUI
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.
- Please set the size according to the original image size and image enlargement requirements. Note that the proportions of the original image cannot remain the same when enlarging the image.
- In this example, the width is set to 1024 and the height is 512. We look forward to seeing the result of horizontal extension of the image.
2.3 ControlNet configuration
Next, you need to configure ControlNet with the following parameters:
- Select Enable, Upload independent control image and Pixel Perfect. The first two are to allow ControlNet to control the generation of images through images, and the latter are to improve the generation effect. Upload the same image as above here.
- Controltype: Select partial redraw.
- Preprocessor: Select inpaint_only.
- Model: Select control_v11p_sd15_inpaint, which is the ControlNet expansion model of SD1.5.
- ControlMode: It is more important to choose Controlnet.
- Screen zoom mode: Select resize and fill.
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
- After the experiment is completed, you can go to the corresponding product console to stop or delete the instance (both operations are acceptable). Avoid the instance continuing to run, which will cause additional deductions after the free trial limit is exceeded. ;
- The instance will still be considered for use in the future>>Stop; the instance will no longer be used in the future>>Delete. Resource consumption will stop after successful stop.
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!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Vibe coding is reshaping the world of software development by letting us create applications using natural language instead of endless lines of code. Inspired by visionaries like Andrej Karpathy, this innovative approach lets dev

DALL-E 3: A Generative AI Image Creation Tool Generative AI is revolutionizing content creation, and DALL-E 3, OpenAI's latest image generation model, is at the forefront. Released in October 2023, it builds upon its predecessors, DALL-E and DALL-E 2

YOLO (You Only Look Once) has been a leading real-time object detection framework, with each iteration improving upon the previous versions. The latest version YOLO v12 introduces advancements that significantly enhance accuracy

February 2025 has been yet another game-changing month for generative AI, bringing us some of the most anticipated model upgrades and groundbreaking new features. From xAI’s Grok 3 and Anthropic’s Claude 3.7 Sonnet, to OpenAI’s G

The $500 billion Stargate AI project, backed by tech giants like OpenAI, SoftBank, Oracle, and Nvidia, and supported by the U.S. government, aims to solidify American AI leadership. This ambitious undertaking promises a future shaped by AI advanceme

Google's Veo 2 and OpenAI's Sora: Which AI video generator reigns supreme? Both platforms generate impressive AI videos, but their strengths lie in different areas. This comparison, using various prompts, reveals which tool best suits your needs. T

Google DeepMind's GenCast: A Revolutionary AI for Weather Forecasting Weather forecasting has undergone a dramatic transformation, moving from rudimentary observations to sophisticated AI-powered predictions. Google DeepMind's GenCast, a groundbreak

The article discusses AI models surpassing ChatGPT, like LaMDA, LLaMA, and Grok, highlighting their advantages in accuracy, understanding, and industry impact.(159 characters)
