Home Technology peripherals AI The once popular InstantID has a new way to play: stylized image generation, which has been open source

The once popular InstantID has a new way to play: stylized image generation, which has been open source

Apr 15, 2024 pm 03:58 PM
git project

InstantID The original team launched InstantStyle, a new method of style migration.

Stylized image generation is often called style transfer, and its goal is to generate images that are consistent in style with the reference image and consistent with the original image content. This technology is based on diffusion methods (such as LoRA) for batch training of the same style data and cannot be migrated to new styles. Or based on inversion operations (such as StyleAlign), by restoring the style image to latent noise, the K and V obtained by forward propagation are used to replace the style image in generation. This method often degrades the generation style due to the inversion operation.

Recently, the original team of InstantID launched InstantStyle, a new method of style migration. Unlike Face ID, it is a general image style injection framework that uses two simple but very effective techniques to achieve effective separation of style and content from reference images. This method provides a simple but very effective technique to achieve effective separation of style and content from the reference image, thus achieving an effective fusion of style and content.

曾爆火的 InstantID又有了新玩法:风格化图像生成,已开源

  • Thesis: InstantStyle: Free Lunch towards Style-Preserving in Text-to-Image Generation

  • Paper address: https://huggingface.co/papers/2404.02733

  • Project homepage: https://instantstyle.github.io/

  • Code link: https://github.com/InstantStyle/InstantStyle

  • Demo address: https://huggingface.co/spaces/InstantX/InstantStyle

曾爆火的 InstantID又有了新玩法:风格化图像生成,已开源

As a motivation for automatic introduction, (1) First of all, style is undefined and there is no clear standard to define it. It includes many elements, such as color, atmosphere, material , layout, etc., even with manual evaluation, it is difficult to reach a unified conclusion; (2) The previous inversion-based method will produce obvious style degradation, which is unacceptable for some styles, such as texture; (3) Image style Injection, the most critical issue is how to balance the intensity of style injection and the content leakage of the reference image.

曾爆火的 InstantID又有了新玩法:风格化图像生成,已开源

In this regard, the author's team conducted a series of experimental analyses. They found that the problems of IP-Adapter were obviously exaggerated by many other methods. The author only manually adjusted the image The weight of feature injection solves the content leakage problem claimed in most papers. Nonetheless, in some cases it is still difficult for the IP-Adapter to find a suitable threshold to balance. Since the current Adapter-based methods generally use CLIP to extract image features, the author confirmed through the example of image retrieval that in the CLIP feature space, the features of images and text can be added and subtracted. The answer is obvious, why not display it before injecting it into the network? How to decouple content and style from image features by subtracting content information that may be leaked?

Finally, inspired by the B-LoRA method, the author carefully analyzed the effect of IP-Adapter injection at each layer, and was surprised to find that there are two independent layers that respond to style and spatial layout information respectively. To this end, the authors introduce the proposed method.

Method introduction

Based on the above observations and experiments, the author proposed the InstantStyle method, as shown in the figure. The core of this method contains two modules:

曾爆火的 InstantID又有了新玩法:风格化图像生成,已开源

(1) Feature subtraction: Use the idle characteristics of CLIP to explicitly perform feature subtraction, remove the content information in the image features, and reduce the impact of the reference image content on the generated image. Compared with the underdetermination of style, content information is often easy to describe simply through text, so CLIP's text encoder can be used to extract content features for decoupling.

(2) Style layer injection only: Feature injection is only completed in a specific style layer, implicitly achieving decoupling of style and content. Near the mid block of UNet, the author discovered two specific layers that control style and spatial layout respectively, and found that in some styles, spatial layout may also be a type of style.

Overall, the idea of ​​InstantStyle is quite simple and easy to understand. With just a few lines of code, it alleviates the most troublesome content leakage problem in style migration.

Experimental results

The author shows the generation results of two strategies in the article. These two strategies are not limited to specific models and can be used separately and independently. Both are implemented. Excellent results.

Result of feature subtraction:

曾爆火的 InstantID又有了新玩法:风格化图像生成,已开源

Only style layer injection:

曾爆火的 InstantID又有了新玩法:风格化图像生成,已开源

曾爆火的 InstantID又有了新玩法:风格化图像生成,已开源

Comparison with the current leading method:

曾爆火的 InstantID又有了新玩法:风格化图像生成,已开源

Stylization based on the original image:

曾爆火的 InstantID又有了新玩法:风格化图像生成,已开源

Community gameplay

InstantStyle Rich code implementations have been provided, and developers can find them directly through GitHub, including Wenshengtu, Tushengtu and Inpainting. Recently, it has also been used as a recommended stylization tool by the video generation project AnyV2V. For community users, InstantStyle also natively supports ComfyUI (the author of this node is also a co-author of InstantStyle), and users can quickly try it by updating the IP-Adapter node.

曾爆火的 InstantID又有了新玩法:风格化图像生成,已开源

As the author of InstantID, how come we are not co-branded with InstantID? Compared to InstantID which only uses text to control the generated style, InstantStyle can undoubtedly make the style more diverse. The author team will officially support the face stylization function after the GitHub star reaches 1,000.

曾爆火的 InstantID又有了新玩法:风格化图像生成,已开源

#The author also officially supports Huggingface Demo and can be tried online.

曾爆火的 InstantID又有了新玩法:风格化图像生成,已开源

The above is the detailed content of The once popular InstantID has a new way to play: stylized image generation, which has been open source. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Hot Topics

Java Tutorial
1664
14
PHP Tutorial
1268
29
C# Tutorial
1242
24
How to download git projects to local How to download git projects to local Apr 17, 2025 pm 04:36 PM

To download projects locally via Git, follow these steps: Install Git. Navigate to the project directory. cloning the remote repository using the following command: git clone https://github.com/username/repository-name.git

How to update code in git How to update code in git Apr 17, 2025 pm 04:45 PM

Steps to update git code: Check out code: git clone https://github.com/username/repo.git Get the latest changes: git fetch merge changes: git merge origin/master push changes (optional): git push origin master

How to merge code in git How to merge code in git Apr 17, 2025 pm 04:39 PM

Git code merge process: Pull the latest changes to avoid conflicts. Switch to the branch you want to merge. Initiate a merge, specifying the branch to merge. Resolve merge conflicts (if any). Staging and commit merge, providing commit message.

What to do if the git download is not active What to do if the git download is not active Apr 17, 2025 pm 04:54 PM

Resolve: When Git download speed is slow, you can take the following steps: Check the network connection and try to switch the connection method. Optimize Git configuration: Increase the POST buffer size (git config --global http.postBuffer 524288000), and reduce the low-speed limit (git config --global http.lowSpeedLimit 1000). Use a Git proxy (such as git-proxy or git-lfs-proxy). Try using a different Git client (such as Sourcetree or Github Desktop). Check for fire protection

How to use git commit How to use git commit Apr 17, 2025 pm 03:57 PM

Git Commit is a command that records file changes to a Git repository to save a snapshot of the current state of the project. How to use it is as follows: Add changes to the temporary storage area Write a concise and informative submission message to save and exit the submission message to complete the submission optionally: Add a signature for the submission Use git log to view the submission content

How to solve the efficient search problem in PHP projects? Typesense helps you achieve it! How to solve the efficient search problem in PHP projects? Typesense helps you achieve it! Apr 17, 2025 pm 08:15 PM

When developing an e-commerce website, I encountered a difficult problem: How to achieve efficient search functions in large amounts of product data? Traditional database searches are inefficient and have poor user experience. After some research, I discovered the search engine Typesense and solved this problem through its official PHP client typesense/typesense-php, which greatly improved the search performance.

How to delete a repository by git How to delete a repository by git Apr 17, 2025 pm 04:03 PM

To delete a Git repository, follow these steps: Confirm the repository you want to delete. Local deletion of repository: Use the rm -rf command to delete its folder. Remotely delete a warehouse: Navigate to the warehouse settings, find the "Delete Warehouse" option, and confirm the operation.

How to update local code in git How to update local code in git Apr 17, 2025 pm 04:48 PM

How to update local Git code? Use git fetch to pull the latest changes from the remote repository. Merge remote changes to the local branch using git merge origin/<remote branch name>. Resolve conflicts arising from mergers. Use git commit -m "Merge branch <Remote branch name>" to submit merge changes and apply updates.

See all articles