Stable diffusion tutorial. ULTIMATE guide - everything you need to know!
Creating AI Images in 5 Minutes
In this tutorial, Seb guides viewers through the process of creating AI images in just five minutes. He provides step-by-step instructions on how to download and install the necessary software, as well as how to use it to create stunning AI-generated images.
Downloading and Installing Required Software
- Google "Automatic One One One" and enter the GitHub page.
- Scroll down to find installation instructions for Windows.
- Download the Windows installer 64-bit and run it, making sure to check the box that says "Add Python to PATH."
- Download Git for Windows 64-bit and leave everything at default settings.
- Open Command Prompt by typing CMD in the search bar. Copy and paste "git clone" followed by a link from Hugging Face into Command Prompt.
Downloading Models
- Create an account on Hugging Face's website and download the standard weights file.
- Enter your user folder, then navigate to Stable Fusion Web UI > models > stable diffusion. Drag the downloaded model file into this folder and rename it "model."
Running Stable Diffusion
- Open Notepad and add "git pull" before running web UI Dash User. This will ensure that you have the latest files from GitHub.
- Wait for Stable Diffusion to finish installing (this may take some time), then access it through a web browser using a specific URL provided by Seb.
Using Stable Diffusion
- Stable Diffusion's user interface includes several tabs, including "Text to Image," which allows users to create images out of pure text.
- Use the web user interface to create AI-generated images quickly and easily.
Generating Images with Stable Diffusion
In this section, the speaker explains how to generate images using stable diffusion. They discuss the importance of prompts and provide examples of how to use them effectively.
Using Prompts
- The first step in generating an image is to work with prompts.
- Prompts allow you to specify what you want in your image, such as the object or additional details like hyper-realism or 8K resolution.
- To find prompts, visit lexica.art, a stable diffusion search engine that provides a library of images and their corresponding prompts.
- If you're feeling lost with prompts, look at some great stable diffusion images and copy those prompts before changing them to suit your needs.
Changing Settings
- Sampling steps are one of the many options available when generating an image with stable diffusion.
- The speaker recommends starting with klms for consistent results and using at least 50 sampling steps.
- Other samplers like Euler ancestral can handle lower sampling steps but may be inconsistent in their results.
Overall, generating images with stable diffusion requires working with effective prompts and adjusting settings like sampling steps to achieve desired results.
Understanding Stable Diffusion Web UI
In this section, the speaker explains how to use the Stable Diffusion Web UI and its various features.
Restoring Faces
- The "Restore Faces" option can fix certain issues with images.
- However, if you want to restore an image using this function, you cannot simply press "generate" again because the seed is randomized each time.
- If you want to restore an image with the same settings, you need to copy and paste the settings from the previous file.
Batch Count and Batch Size
- The batch count and batch size determine how many images are generated.
- Increasing or decreasing these values will result in a grid of images being generated.
- All generated images are saved in the output folder.
Scale
- The scale determines how closely the AI listens to your prompts.
- A lower scale means that the AI will not listen as closely to your prompt and may create something it likes instead.
- A higher scale means that the AI will pay closer attention to your prompt.
Image Size
- Stable diffusion has been trained on 512x512 pixel images, so using this size will result in more consistent results.
- Using larger sizes may cause crashes.
Seed
- The seed determines what noise is used for generating an image.
- Each new image in a batch gets a new seed, but you can reuse an old seed by pressing "-1".
Restore Faces Example
The speaker demonstrates how restoring faces can improve an image's quality.
Scale Example
The speaker demonstrates how changing the scale affects image generation.
Adapting the Prompt
In this section, the speaker explains how to adapt the prompt by changing its importance and adding emphasis to certain words. They also discuss how to adjust the scale value for better results.
Adapting the Prompt
- To adapt a prompt, change its importance and add emphasis to certain words using parentheses.
- The more emphasis added, the more focus it will give to those words.
- Adjusting the scale value is important for better results. A value between 7 and 14 is usually good.
Image-to-Image Generation
In this section, the speaker discusses image-to-image generation and how it can be used with input images to create new images.
Using Input Images for Image-to-Image Generation
- Image-to-image generation can be used with input images to create new images.
- Denoising strength is an important setting that determines how much noise is added or removed from an image during generation.
- Higher denoising strength values move away from the original image while lower values keep closer to it.
- Adjusting denoising strength is crucial in creating an image that resembles the input image.
Image Manipulation with DALL-E
In this section, the speaker demonstrates how to manipulate images using DALL-E.
Adjusting Strength
- If the generated image does not resemble the input image, adjust the strength parameter.
- Start with a high strength and lower it as you approach your desired output.
Using Inpaint
- Use inpaint to change only part of an image.
- Use a brush to paint over parts of the image that you want to save or remove.
- The masked content setting determines what should be filled before stable diffusion starts creating your new prompt. Choose original or latent noise depending on what was in the original image.
Painting Over Unwanted Parts
- Increase denoising strength to change more of an image.
- Use Photoper (an online Photoshop tool) to paint over unwanted parts of an image so that stable diffusion thinks they are something else.
Working with Stable Diffusion
In this section, the speaker explains how to work with Stable Diffusion from start to finish. They cover topics such as text-to-image, image-to-image, in-painting, and upscaling.
Using Masks for In-Painting
- To use a mask for in-painting, upload the mask image or draw one.
- Adjust the mask blur setting to control how much blur is applied to the edge of the mask.
- Generate multiple images until you find one that you like.
Generating New Images
- To generate a new image from an existing one, send it to "image-to-image."
- Lower the denoising strength if you don't want significant changes made to your image.
- Save the seed if you want to recreate a specific face later on.
Refining Generated Images
- Drag an image back into Stable Diffusion and adjust settings as needed.
- Run multiple batches of images since not every batch will produce good results.
- Use "restore faces" when necessary.
Upscaling Images
- Use an upscaler like SwinIR or LDSR to enlarge your image.
- SwinIR produces high-quality results quickly.
Conclusion
Stable Diffusion offers advanced features like textual immersion, dream booth, and animation. For more information on these features, check out other tutorials on the speaker's channel. The speaker also reveals that only one of six images shown at the beginning was real.