Skip to content

shaitanzx/Fooocus_extend

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

I would like to introduce a new fork of the popular generative neural network Fooocus - Fooocus extend. I would like to point out that this fork can be run both locally on your computer and via Google Colab. Let's look at everything in order.

Full list of differences from the original Fooocus

  1. Modules running during generation
    • OneButtonPrompt
    • Prompt Translate
    • PhotoMaker
    • InstantID
    • Inswapper
    • CodeFormer
    • Vector
  2. Additional modules
    • Image Batch
    • Prompt Batch
    • X/Y/Z Plot
    • Inswapper
    • CodeFormer
    • Remove Background
    • Vector
  3. Tools
    • Civitai Helper
    • TextMask
    • SVGcode
    • Roller
    • OpenPoseEditor
    • Logo
    • Photopea
  4. Select the resolution and aspect ratio of the generated image
  5. Wildcard
  6. OpenPose ControlNet
  7. Recolor ControlNet
  8. Scribble ControlNet
  9. Manga Recolor ControlNet
  10. Save Image Grid for Each Batch
  11. Filename Prefix
  12. Paths and Presets
  13. Load file of style
  14. View LoRA trigger words and view the models page on civitai.com
  15. Seamless tiling
  16. Transparency

Launch. If you will run it on a local machine, you can safely skip this item.

image

Before launching you are offered to choose the following settings Fooocus Profile - select which profile will be loaded at startup (default, anime, realistic). Fooocus Theme - select a theme - light or dark. Tunnel - select launch tunnel. When it happens that gradio stops working for some reason, you can choose cloudflared tunnel. However, the generation is a bit slower Memory patch - adds a few keys to the launch bar that allow you to optimise your graphics card if you are using the free version of Google Colab. If you have paid access, this item can be disabled GoogleDrive output - connects your GoogleDisk and save all of your generation directly to it.

image

The “Extensions” panel is divided into three groups:

  • in generation - modules working during generation
  • modules - generation modules
  • tools - auxiliary tools

“in generation” panel

OneButtonPrompt - allows you to generate prompts, generate variations of your prompt and runs to generate images from them. I will not dwell on the detailed description of this module - I will only point out the main functions

image

On the "Main" tab, you can select a preset for the hint generation theme, as well as specify additional hint prefixes and suffixes. You can also create and save your own preset in this tab.

image

On the "Prompt assist" tab, you can generate 5 prompts and move each of them to the Fooocus prompt field. When you select the "Prompt assist" mode, during image generation, not a new prompt will be generated, but variations of the prompt specified in the prompt field. The strength of variation is selected by the slider located directly below it.

image

In this tab you can select the hint syntax for different generation models, the hint length, enable the hint generation enhancement tool, and specify the number of iterations of the prompt generation for one image.

image

This is where you can control the generation of negative prompts

Prompt Translate image

Allows to translate both positive and negative prompts from any language into English, both before generation and directly during generation.

PhotoMaker (works only in the local version)

image

The module allows you to generate an image with a reference face Upload a photo of your face - your reference face should be uploaded here. Unlike normal generation, this 30-step generation on Nvidia 3060 12GB takes about 4 minutes.

InstantID (works only in the local version) image

The module allows you to generate an image with a reference face Upload a photo of your face - your reference face should be uploaded here.

Upload a reference pose image (Optional) - a reference pose image will be uploaded here. Optional.

Pregeneration image - if this mode is enabled, then a new image will be generated as a reference pose image based on your Prompt.

If you have not specified a pose reference image, an image will be generated from your prompt based only on the face image and the same resolution.

If a pose reference image is present, the dimensions will be the same as the pose reference image.

IdentityNet strength (for fidelity) - responsible for the accuracy of face repetition.

Image adapter strength (for detail) - responsible for details

ContrloNet

  • canny - used to define image contours
  • depth - used to create a depth map of the image Schedulers - select the Schedulers that will be used when generating the image with our face. Enhance non-face region - enhance non-face parts of the image

Unlike normal generation, this 30-step generation on Nvidia 3060 12GB takes about 7 minutes.

Inswapper image

This module is also intended for face replacement.

Source Image Index - index of the face in the reference image. Faces are numbered from left to right from top to bottom starting from zero. If you specify -1, the average mixed face of all available faces will be taken as the reference face

Target Image Index - index of the face in the output image. This is the index of the face to be replaced in the output image. If you specify -1, all faces will be replaced.

Source Face Image - image with face

CodeFormer

image

Face enhancement module with upscale capability

Pre_Face_Align - aligns the face if it is tilted

Background Enchanced - improve background quality

Face Upsample - adjust reference face to the size of the input image face

Upscale - image enlargement

Codeformer_Fidelity - signability coefficient, inversely proportional to quality

Vector

image

This module allows you to get images in svg format in b/w mode.

Transparent PNG - Pre-Create Transparency

Noise Tolerance - setting for cutting off noise in the original image

Quantize - the level of image quantization

Keep temp images - do not save the intermediate transparency file

Threshold - line curvature threshold

“modules” panel

Image Batch (batch image processing)

image

In a nutshell, this module allows you to perform group scaling of images, as well as create images based on a group of existing images using ImagePromt (ControlNet). To better understand this module, I suggest you conduct some experiments yourself. But I want to note that using it allows you to use your images as references and change their style depending on the prompt and model you choose. First, depending on the "Uplode ZIP-file" selector, you need to upload several reference images or a zip archive with them. The archive should not contain subfolders, file names should not contain non-Latin characters and spaces.

Next, select the mode of changing the image resolution

  • NOT scale - the source image resolution will not be taken into account during generation
  • to ORIGINAL - this means that immediately before generation the resolution equal to the resolution of the source image will be selected.
  • to OUTPUT - in this case, before generation the resolution of the source image will be changed to the generated one with preserving the proportions

Depending on what you want to do with the source images, select Action - Upscale or ImagePrompt. From the Method drop-down list, select the appropriate image processing method. If you are using ImagePrompt, you must also select the "Stop at" and "Weight" options.

Start batch - starts the process for execution.

When the process is finished, click on Output->Zip button to create an archive with all previously created images from the output folder. The archive itself will appear in the "Download a Zip file" window. You can download it from there.

Clear Output - clear the output folder. It should be noted that not only the folder for the current date is cleared, but also the whole folder.

Prompt Batch (batch processing of prompts)

image

This module allows you to run generation of several hints sequentially one after another. To do this, you should fill in the table. Enter a positive hint in the hint column and a negative hint in the negative hint column respectively. Clicking the New Row button will add an empty row to the end of the table. Delete Last Row deletes the last row of the table. Start batch starts the execution of the list of prompts to generate. You can also choose to add basic positive and negative hints. None - no base hints will be added. Prefix - base hints will be added before the table hints. Suffix - basic hints will be added after hints from the table.

only positive prompts - if this item is active, all prompts in the file will be considered positive, otherwise, both positive and negative prompts will be loaded Load prompts from file - allows to load the list of positive and negative prompts from a text file into the table. The file can have any extension

As an example, consider a file with the following contents

---- start of file -------

image

------ end of file --------

If the item ‘only positive prompts’ is active, then the table with prompts will have the following form

image

Otherwise

image

This means that in the first case all prompts in the file are treated as positive, and empty lines are ignored. In the second case, the file first contains a line with a positive prompt, followed by a line with a negative prompt. If you don't need to specify a negative hint, leave this line blank, but the positive hint line must always be there.

X/Y/Z Plot

019

This extension allows you to make image grids to make it easier to see the difference between different generation settings and choose the best option. You can change the following parameters - Styles, Steps, Aspect Ratio, Seed, Sharpness, CFG (Guidance) Scale, Checkpoint, Refiner, Clip skip, Sampler, Scheduler, VAE, Refiner swap method, Softness of ControlNet, and also replace words in the prompt and change their order

Inswapper

image

The full analog of this module in the “in generation” panel, unlike which you need to load an additional input image

CodeFormer

image

The full analog of this module in the “in generation” panel, unlike which you need to load an additional input image

Remove Background

008

This extension is designed to add background removal, image/video processing, and blending to your projects. It provides precise background removal with support for multiple models, chroma keying, foreground adjustments, and advanced effects. Whether you’re working with images or videos, this extension provides everything you need to efficiently process visual content.

Key Features:

Multi-model background removal: Supports u2net, isnet-general-use, and other models.

Chroma keying support: Removes specific colors (green, blue, or red) from the background.

Blending modes: 10 powerful blending modes for image compositing.

Foreground adjustments: Scale, rotate, flip, and position elements precisely.

Video and image support: Easily process images and videos.

Multi-threaded processing: Efficiently process large files with streaming and GPU support. Customizable output formats: Export to PNG, JPEG, MP4, AVI, and more.

All processing results are automatically saved to the output folder without saving to History Log

Vector

image

The full analog of this module in the “in generation” panel, unlike which you need to load an additional input image

“tools” panel

Civitai Helper

014

This extension allows you to download models for generation from the civitai website. To download a model you first need to specify your Civitai_API_key. In the Download Model section in the Civitai URL field you need to specify a link to the required model from the browser address bar and click Get Model Info by Civitai URL. After analysing the link you will be given information about the model. You will also be able to select the version of the model before downloading. This extension also allows you to find duplicates of downloaded models and check for updates. In addition, there is a group download option.

TextMask

image

Fast text editor with mask creation for ControlNet and Inpaint!

What this tool can do:

  • Adds up to 5 text blocks to any image
  • Supports fonts of any size up to 300px
  • Works with Cyrillic, hieroglyphics and other non-Latin characters
  • Generates black and white mask with one click
  • Lets you forget Photoshop for 90% of simple text tasks
  • Supports a sufficient number of fonts

How to use:

  1. Upload an image
  2. Add and edit the text as you like
  3. Generate a mask in two clicks
  4. Download and use in ControlNet (CPDS or PyraCanny) or as a mask for Inpaint to stylise text and blend into an image.

SVGcode

image

Module for processing raster images for saving from to svg

Roller

image

This module is designed for rolling tiles to give it a more aesthetic appearance without losing the seamless effect.

Y_shift - vertical image shift.

Х_shift - horizontal image shift.

Save to OUTPUT FOLDER - saving the image to the output folder

OpenPoseEditor

image

This module allows you to create skeletons for subsequent image creation using OpenPose ControlNet. You can also create a skeleton from an existing image.

Logo - Logo insertion tool with automatic placement selection based on image content

image

Size ratio - the relative size of the logo to the image. Determines what percentage of the smaller side of the image the logo will occupy.

Margin Ratio - logo offset from image edges. Determines how far from the corner the logo will be placed.

Minimal complexity for background - the background complexity threshold at which a background is automatically added under the logo.

Сorner priority - select the priority of choosing the angle when overlaying the logo.

Photopea - a free online analogue of Photoshop

007

In addition to these extensions, there are several other add-ons available

Select the resolution and aspect ratio of the generated image

image

This setting is located in the generation resolution selection tab. Here you can select the number of horizontal and vertical points, aspect ratio. To apply the settings, click the Set button and select this resolution from the list of proposed resolutions. Your resolution will be the second to last. You can also select a random aspect ratio for each generation from the available list of aspect ratios

Wildcard

image

This module allows you not to memorise existing files with wildcard words, but to select them directly from a list of dictionaries. You can also select directly the item you need from the list.

OpenPose ControlNet

016

Allows you to create an image based on the pose skeleton.

Recolor ControlNet

017

Allows you to colorize an image based on a black and white image.

Scribble ControlNet

018

Allows you to color an image based on a sketch.

Manga Recolor ControlNet

image

This is a specially trained ControlNet model designed to automatically colorize grayscale images in anime style.

The model takes grayscale anime images as input and generates a colorized version.

An anime model is required for proper generation. Works with or without a clarifying prompt.

Save Image Grid for Each Batch

020

Filename Prefix

image

This setting may be useful when working on several projects to separate one from another.

Paths and Presets

image

Here you can change the paths to your models if they are already in other folders on the disk. If your Сheckponts or LORAs are in different folders, then the paths to them can be specified separated by commas (,). After changing the path, it is best to restart FooocusExtend.

Also here you can create a new preset based on the existing settings, and delete any of the existing ones, except for default and initial. The preset saves the following parameters: base model, refiner, refiner_switch, loras settings, cfg scale, sharpness, CFG Mimicking from TSNR, clip_skip, sampler, scheduler, Forced Overwrite of Sampling Step, Forced Overwrite of Refiner Switch Step, performance, image number, prompt negative, styles selections, aspect ratio, vae, inpaint_engine_version

Load file of style

image

Allows you to upload a file (in *.json format) with custom styles

View LoRA trigger words and view the models page on civitai.com

image

If trigger words or links to model pages are not displayed, you will need to scan the models in the Civitai Helper module in the "Scan Models" section.

Seamless tiling

image

Settings for creating seamless tiles. Located in Advanced - Developer Debug Mode - Control - Tiled. Sometimes a little edge refinement is required in any Photo Editor.

Transparency

image image

Settings for creating images on a transparent background and a mask for it are located in the "Advanced" - "Developer Debug Mode" - "Controls" - "Transparency" section.

image

None - the normal generation mode

Attention Injection - This mode uses LoRA rank 256, turning SDXL into a transparent image generator. It transforms the model's latent distribution into a "transparent latent space" that can be decoded by a dedicated VAE pipeline.

Conv Injection - This method uses an alternative model to transform SDXL into a transparent image generator. It uses biases on all convolutional layers (and, in fact, on all layers that are not q, k, v in any of the attention layers). These biases can be combined with any XL model to change the latent distribution to transparent images. Since learning the biases on all q, k, v layers was eliminated, the understanding of SDXL should be fully preserved. However, in practice, this first method has proven to yield better results. This method is used for some special cases that require special understanding. This method can have a strong impact on the style of the underlying model. This extension is based on layerdiffuse by lllyasviel (https://github.com/lllyasviel/sd-forge-layerdiffuse)

Open In ColabFooocus_extend. Base version 2.5.5
Open In ColabOriginal Fooocus Colab

All suggestions and questions can be voiced in the Telegram-group

image

Change log

v9.2.3

  1. View the models page on civitai.com

v9.2.2

  1. Settings for Transparency generation

v9.2.1

  1. Add Logo in tools

v9.2.0

  1. Add Vector Style
  2. Add SVGcode
  3. Add Vector in generate mode
  4. Add Vector in module
  5. Add batch in Codeformer in module
  6. Add batch in Inswapper in module
  7. Optimized ImageBatch
  8. The x/y/z-plot module has been updated with the following parameters: Lora Name, Lora weight, Codeforeme, refiner settings, aspect ratio selection
  9. Final preview of ImageBatch
  10. Final preview of PromptBatch

v9.1.7

  1. Add Roller in tools

v9.1.6

  1. Settings for Seamless tiling

v9.1.5

  1. A deeper integration of the OneButtonPrompt module has been carried out and it has been moved to the 'in generation' group

v9.1.4

  1. Some bug fix

v9.1.3

  1. Add Manga Recolor ControlNet

v9.1.2

  1. Added selector for choosing to load individual files or zip archive in Image Batch module

v9.1.1

  1. Add view trigger words of LoRA
  2. Bug fix in wildcards
  3. Add Civitai_API_key saving
  4. Add preview files for InstantId and Photomaker styles

v9.1.0

  1. Add PhotoMaker module
  2. Add PhotoMaker styles
  3. Add Random Aspect Ratio

v9.0.0

  1. Dividing extensions into groups
  2. Add InstantID module
  3. Add Inswapper module
  4. Add CodeFormer module
  5. Add InstanID styles

v8.1.0

  1. Some bug fix
  2. Add TextMask - Fast text editor with mask creation for ControlNet and Inpaint

v8.0.4

  1. User style upload
  2. Fixed maximum height of PromptBatch
  3. Option to load only positive prompts

v8.0.3

  1. Some bug fix
  2. Add load prompt from files in PromptBatch
  3. The ImageBatch extension interface has been simplified

v8.0.2

  1. Some bug fix

v8.0.1

  1. Add Filename Prefix
  2. Add Paths and Presets Settings

V8

  1. Save Image Grid for Each Batch
  2. Add X/Y/Z Plot Extention
  3. Prompt Batch is now in the extensions panel
  4. Images Batch has become easier to manage while retaining its functionality
  5. Images Batch is now in the extensions panel
  6. Add support VAE and LyCoris in Civitai_Helper
  7. The extension Remove Background has been changed
  8. Add auto update on startup

V7

  1. Add OpenPoseEditor
  2. Fix bug in Image Batch Mode
  3. Added cell selection in Image Batch Mode
  4. Added selection of adding base prompts in Prompt Batch Mode
  5. Add OpenPose ControlNet
  6. Add Recolor ControlNet
  7. Add Scribble ControlNet

V6

  1. Add Prompt Batch Mode
  2. Rename Batch Mode to Images Batch Mode
  3. Fixed an incorrect start random number in Batch Mode
  4. Add visual management of Wildcard and Words/phrases of wildcard
  5. Added the ability to set any resolution for the generated image
  6. Add OneButtonPrompt

V5

  1. Model Downloader replaced with Civitai Helper

V4

  1. Add VAE download
  2. Add Batch mode

V3

  1. Add Photopea
  2. Add Remove Background
  3. Add Extention Panel
  4. All extensions are available in Extention Panel

V2

  1. Added a Model Downloader to Fooocus webui instead of colab

V1

  1. added the ability to download models from the civitai.com
  2. saving the generated image to Google Drive
  3. added prompt translator
  4. added a patch for the ability to work in free colab mode

About

Focus on prompting and generating

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Languages

  • Python 92.9%
  • JavaScript 2.8%
  • HTML 1.6%
  • Cuda 1.4%
  • C++ 0.9%
  • CSS 0.2%
  • Other 0.2%