JCTN commited on
Commit
01c563a
·
verified ·
1 Parent(s): 3508e02

Upload README.md

Browse files
Files changed (1) hide show
  1. README.md +169 -0
README.md ADDED
@@ -0,0 +1,169 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # WarpTuber
2
+
3
+ A real-time face animation tool that brings static images and videos to life using your webcam.
4
+
5
+ Tutorial: https://www.youtube.com/watch?v=w1_KY5E7Aig
6
+
7
+ ## Overview
8
+
9
+ WarpTuber allows you to animate portraits or character images by mapping your facial expressions and movements to them in real-time. It supports both static images and video animations, making it perfect for virtual avatars, content creation, and streaming.
10
+
11
+ ## Quick Start
12
+
13
+ 1. Connect your webcam
14
+ 2. Choose one of the following launch options:
15
+ - `camera_image.bat` - For animating a static image
16
+ - `camera_video.bat` - For using a video animation with facial expressions
17
+
18
+ ## Setup Requirements
19
+
20
+ - Windows 10/11
21
+ - Webcam
22
+ - Python environment (included in the `venv` folder)
23
+ - NVIDIA GPU with CUDA support (recommended)
24
+ - Python local install
25
+
26
+ ## Usage Instructions
27
+
28
+ ### Using Static Images (`camera_image.bat`)
29
+
30
+ Use this mode when you want to animate a single static portrait or character image with your facial movements.
31
+
32
+ 1. Place your image in `assets/examples/source/` and name it `main.jpg`
33
+ 2. Run `camera_image.bat`
34
+ 3. When prompted, select your webcam index (usually 0 for the default webcam)
35
+ 4. The application will open with your animated image
36
+
37
+ ### Using Video Animations (`camera_video.bat`)
38
+
39
+ Use this mode when you want to combine a pre-recorded animation/idle loop with your facial expressions.
40
+
41
+ 1. Place your video in `assets/examples/source/` and name it `main.mp4`
42
+ 2. Run `camera_video.bat`
43
+ 3. When prompted, select your webcam index (usually 0 for the default webcam)
44
+ 4. The application will open with your video animation that responds to your facial movements
45
+
46
+ ### File Requirements
47
+
48
+ - **Static Image**: Must be named `main.jpg` and placed in `assets/examples/source/`
49
+ - **Animation Video**: Must be named `main.mp4` and placed in `assets/examples/source/`
50
+
51
+ For best results:
52
+ - Images should be clear portraits with visible facial features
53
+ - Videos should be looping animations with consistent lighting
54
+ - Both should have dimensions of at least 512x512 pixels
55
+
56
+ ### Image Compatibility and Facial Landmark Detection
57
+
58
+ WarpTuber relies on facial landmark detection to animate images. Not all images will work properly, especially:
59
+
60
+ - Highly stylized anime or cartoon characters
61
+ - Images with unusual facial proportions
62
+ - Artwork with abstract facial features
63
+ - Images with poor lighting or low contrast
64
+ - Side-profile portraits (faces should be mostly front-facing)
65
+
66
+ If you encounter an error message like `"no face in [image path]! exit!"`, this means the system failed to detect facial landmarks in your image.
67
+
68
+ **Solutions for facial landmark detection issues:**
69
+
70
+ 1. **Try a different image**: Use photographs or realistic illustrations with clear facial features
71
+ 2. **Enable animal mode**: For cartoon characters, try running with the `--animal` parameter:
72
+ ```
73
+ camera_image.bat --animal
74
+ ```
75
+ 3. **Adjust the image**: Edit your image to make facial features more prominent:
76
+ - Increase contrast around eyes, nose, and mouth
77
+ - Ensure the face is well-lit and centered
78
+ - Crop the image to focus more on the face
79
+ - Convert stylized characters to a more realistic style using AI tools
80
+
81
+ 4. **Pre-process with face enhancement**: Use photo editing software to enhance facial features before using with WarpTuber
82
+
83
+ Note that even with these adjustments, some highly stylized images may not work with the current facial landmark detection system.
84
+
85
+ ## Advanced Configuration
86
+
87
+ ### Command Line Parameters
88
+
89
+ Both batch files support additional parameters:
90
+
91
+ - `--src_image [path]` - Specify a custom source image/video path
92
+ - `--animal` - Enable animal face mode
93
+ - `--paste_back` - Enable background preservation (enabled by default)
94
+ - `--interactive` - Enable interactive controls (enabled by default)
95
+ - `--advanced_ui` - Enable advanced UI controls
96
+
97
+ Example: `camera_image.bat --src_image assets/my_custom_folder/portrait.jpg --animal`
98
+
99
+ ### TensorRT Optimization
100
+
101
+ This repository includes pre-compiled TensorRT models for optimal performance. If you encounter issues with the included models, you may need to compile your own:
102
+
103
+ 1. Navigate to the `checkpoints` directory and locate any existing `.trt` files:
104
+ - Human model files: `checkpoints/liveportrait_onnx/*.trt`
105
+ - Animal model files: `checkpoints/liveportrait_animal_onnx/*.trt`
106
+ - Example path: `C:\FLivePort\WarpTuber\checkpoints\liveportrait_onnx\stitching_lip.trt`
107
+
108
+ 2. Delete these `.trt` files if you're experiencing compatibility issues
109
+
110
+ 3. Run `scripts/all_onnx2trt.bat` to recompile all models
111
+ - This will convert all ONNX models to TensorRT format optimized for your specific GPU
112
+ - The conversion process may take several minutes to complete
113
+
114
+ Note: Compiling your own TensorRT models is only necessary if the pre-compiled models don't work on your system. The compilation process creates optimized models specifically for your GPU hardware.
115
+
116
+ ## Troubleshooting
117
+
118
+ - If no webcams are detected, ensure your camera is properly connected and not in use by another application
119
+ - If the animation appears laggy, try closing other GPU-intensive applications
120
+ - If you encounter model loading errors, try running the `scripts/all_onnx2trt.bat` script to compile models for your specific GPU
121
+ - If you see the error `"no face in driving frame"`, ensure your webcam can clearly see your face with good lighting
122
+
123
+ ## License
124
+
125
+ MIT License
126
+
127
+ Copyright (c) 2024 Kuaishou Visual Generation and Interaction Center
128
+
129
+ Permission is hereby granted, free of charge, to any person obtaining a copy
130
+ of this software and associated documentation files (the "Software"), to deal
131
+ in the Software without restriction, including without limitation the rights
132
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
133
+ copies of the Software, and to permit persons to whom the Software is
134
+ furnished to do so, subject to the following conditions:
135
+
136
+ The above copyright notice and this permission notice shall be included in all
137
+ copies or substantial portions of the Software.
138
+
139
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
140
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
141
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
142
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
143
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
144
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
145
+ SOFTWARE.
146
+
147
+ ---
148
+
149
+ **Important Note**:
150
+ - The code of InsightFace is released under the MIT License.
151
+ - The models of InsightFace are for non-commercial research purposes only.
152
+ - If you want to use the WarpTuber project for commercial purposes, you should remove and replace InsightFace's detection models to fully comply with the MIT license.
153
+
154
+ ## Acknowledgements
155
+
156
+ This project is based on [FasterLivePortrait](https://github.com/warmshao/FasterLivePortrait) by [warmshao](https://github.com/warmshao), which is an optimized implementation of the original [LivePortrait](https://github.com/KwaiVGI/LivePortrait) technology developed by the Kuaishou Technology team.
157
+
158
+ The original LivePortrait technology was created by Jianzhu Guo, Dingyun Zhang, Xiaoqiang Liu, Zhizhou Zhong, Yuan Zhang, Pengfei Wan, and Di Zhang from Kuaishou Technology and academic institutions.
159
+
160
+ WarpTuber is a customized implementation that simplifies the usage of this technology with a focus on ease of use for content creators and streamers.
161
+
162
+ Key technologies used:
163
+ - Face landmark detection and tracking
164
+ - Neural rendering for portrait animation
165
+ - TensorRT optimization for real-time performance
166
+
167
+ Special thanks to the original developers for making this technology accessible and open source.
168
+
169
+ For more information about the original research, please visit [liveportrait.github.io](https://liveportrait.github.io/).