DeepAscension/DeepFaceLab ShenNong Deepfake Guide
📢 Getting Started
Before we begin, let's make sure you have everything you need. Follow these steps to get set up:
Step 1: Download Required Software
Step 2: Download Additional Tools
Faceset Creation Guide
Now that you have everything ready, let's dive into creating your faceset!
Step 1: Install Python and Required Libraries
- Open the command prompt (cmd) on your computer.
- Run the following command to install the required library:
pip install video2image
Step 2: Gather and Prepare Material
- Collect videos of the person you want to create a faceset for. Get as much variety of angles, lighting, color lighting if you can, and expressions of the person so that your faceset is at least 20k+ images.
- Place all the videos into a single folder on your computer.
Step 3: Extract Frames from Videos
- Open the command prompt (cmd) again.
- Run the following command, replacing
/path/to/video/directory with the actual path to your video folder and /path/to/output/folder with the desired output folder path:
video2image -i /path/to/video/directory -o /path/to/output/folder
- Wait for the process to finish extracting frames from your videos.
Step 4: Run Quick Face Cut and Sort Images
- Open Quick Face Cut, which you downloaded earlier.
- Set the GPU to 0 or 1 (depending on your GPU) or CPU (for AMD GPUs). If using CPU, set the number of cores in the top right.
- Set the input and output paths for Quick Face Cut.
- Click the last button to start the process.
- Once the process is complete, go to the fourth tab in Quick Face Cut.
- Set the extracted folder, and click the first button to sort the images by similarity.
- Remove any unwanted or irrelevant images.
- Move all the remaining images to the
workspace/data_src/aligned folder in DeepAscension.
Faceset Xseg Step (Including AMD DML Guide)
AMD DML Guide
Step 1: Switch to AMD Mode
- If using an AMD GPU, run
rg switch.bat first.
- Select
DML, but do not select RG.
- This switches the system to AMD mode.
Faceset Xseg Step
Step 2: Apply Whole Face Mask
- Run
4.3)--- data_src whole_face mask - apply.bat in DeepFaceLab ShenNong.
Step 3: Prepare for Xseg Training
- Rename or move the
data_dst folder if it contains data.
- Replace the default xseg folder with "Shennong 256x Mask Created By Lau9" from:
Step 4: Train Xseg Model
- Run
4.2)--- train Xseg.bat for about 40 minutes.
Step 5: Manually Xseg Faces
- Run
4.1)--- data_src mask - edit.bat.
- Manually xseg poorly processed faces. (DM me your detailed manual obstruction xseg’d images following criteria if you want to contribute to Obstruction DST.)
Step 6: Retrain Xseg Model (if needed)
- If you manually xseg’d faces, repeat Step 4 for 20 minutes or until results are satisfactory.
Step 7: Apply Xseg
- Apply the xseg model using
4.3)--- data_src trained mask - apply.bat.
Step 8: Faceset Pack
- Pack faceset with
2.5)--- data_src util faceset pack.bat.
🚀 DeepFaceLab Training Guide
- After completing the Faceset Xseg Step and AMD mode setup, follow the guide at:
- Keep the faceset unpacked for about 3% performance uplift.
Many beginners might not have much experience with masks or might not have created any blocking masks before, but they are eager to learn how to draw complex masks. Today’s guide will cover glasses masks specifically.
There are various ways to draw masks, and today we'll focus on glasses. If your glasses accidentally got some shampoo or facial cleanser on them, you’ll need to figure that out on your own.
Common Methods for Drawing Masks
Simple Method
One commonly used method is straightforward and easy to learn. Draw all solid lines, leaving some areas unconnected. Each white area is treated as a separate entity, making it easier to adjust in the later stages if there are issues. However, dividing the face into multiple sections can give a fragmented look, which might affect the overall result.
Examples: https://imgur.com/a/9zxipEo
More Complex Method
A more complex method involves outlining the entire face and glasses with solid lines in one continuous stroke. Use dashed lines to outline the glasses. The arrows indicate areas for easier understanding and intentionally leave gaps. In practice, draw along the lines without leaving any spaces. If issues arise later, adjustments might be more complicated. Irregular lines are often due to not maintaining line overlap.
Examples: https://imgur.com/a/9aWrfaq
Brutal Technique (Sauron’s Secret)
The “brutal one-stroke” method involves drawing all lines in one go—complex but rough. If problems arise later, modifying them is challenging. This method is not very practical and is mostly for showing off to beginners. Precision is crucial; avoid leaving any white gaps. Small flaws are generally inconsequential, with minimal impact.
Examples: https://imgur.com/a/dceML4L
How to Use the Mask Drawing Tool
Detailed explanation of Xseg mask model
The button functions are marked in the picture.
Just use the selection tool to click and enclose the face area. Detailed explanation of Xseg mask model
There are two types of selection: solid lines are for adding selections, and dotted lines are for excluding selections. Take the lipstick of Ouyang Nana in the below picture as an example. Both methods can complete the selection.
Examples: https://imgur.com/a/8bjyOtx
Instructions for Detailed Masking Techniques
The following illustrations are intended for personal use in drawing. If any information is unclear or misleading, please feel free to correct it.
Step-by-Step Process:
-
Select the Desired Area
- First, use a solid line to outline the parts you want to keep (for example, the face).
- Afterward, use the mask channel to verify that the mask aligns correctly with your drawing.
- There are important precautions to keep in mind during this process.
-
Maximize the Image
- When selecting the face, zoom in to its maximum size as shown below.
- At maximum zoom, you'll notice ghosting or virtual shadows around the edges of the face.
- You need to start drawing the mask at this point.
-
Adjust for Virtual Shadows
- The virtual shadow outside the face doesn’t accurately reflect the real shadow.
- It should be drawn midway between the virtual and real shadows.
- Refer to the following images for techniques on how to properly mask.
- Use a solid line to select the face, then use a dotted line to exclude occlusions like hair.
- For occlusions, follow the edges carefully.
-
Handling Small Features (e.g., Mouth, Tongue)
- If the character has a small mouth and isn’t sticking out their tongue, avoid removing the tongue entirely from the mask.
- This can cause the model to misinterpret the tongue’s sensitivity, leading to issues like double teeth when the mouth is opened.
- General suggestion:
- Mask around the tongue while keeping a distance from the teeth.
- Draw close to the teeth to prevent double images later in synthesis.
- Avoid excluding the mouth itself.
-
Biting Objects (e.g., Lotus Root)
- In the second example, the face is biting the root of a lotus flower.
- Use dotted lines along the teeth's edges to exclude the object.
- When selecting the face, also include features like protruding eyelashes and brows, which should be covered during compositing.
-
Edge Selection
- Use a solid line to retain the important parts of the face.
- Ensure the face edge is drawn midway between the virtual and real shadows.
- Occlusions like hair should be drawn along the dotted line.
-
Handling Dark Shadows and Hair
- In the fourth image, solid lines were used to keep the face, and darker lines were used to exclude the hair and shadows.
- If the hair texture or shadows are too dark, and they remain on the face, they could distort the final result.
- Ensure these are masked properly to avoid leaving unwanted shadows behind.
RTT V2 20 Million (224 Res SAEHD LIAE-UDT)
20 million iterations
Extra Trained By Rumateus
Guide By Cxsmo
Settings Based on DeepAscension https://discord.com/channels/1006313128381911151/1008224194884026459/1227030035735773245
Model: https://drive.google.com/file/d/1tpPEUDXr3LMGRPmzxhyvjgPz4b991qI1/view?usp=sharing
For Best Universal Results use this DST:
https://discord.com/channels/1006313128381911151/1006329882386636951/1243809814707179581
(Always Have Auto Backup Enabled)
-
First run the saehd convert bat if you haven't already so that it's ME then save GAN files elsewhere after
-
Run with those settings and enable random warp and super warp and disable pretrain and enable gradient clipping until SRC loss plateaus, on batch 16 or batch 8 for 8GB VRAM GPUs until SRC loss plateaus
-
Turn on LRD and run until expressions in the preview are consistent, and DFM expressions are consistent, then switch the DST faceset to https://discord.com/channels/1006313128381911151/1006329882386636951/1218938081026117652 and then go back and forth between the DSTs until it looks good with expressions, and you can check with a test DFM at this point.
-
Turn off RW & SW, turn on blur out mask, keep LRD on. No hard and fast rules here, until it looks good as a DFM and doesn't flicker
-
Don't start until all teeth and stuff are of good quality. Start GAN with 0.1 power, 28 patch sizes, and 16 dims. Save and exit as soon as this starts; replace GAN files with the ones saved separately above.
-
Run GAN again with the same settings but watch closely - sharp face sets can be done in 15-30 minutes or a lot longer but varies and can be completely unusable with artifacts by 2 hours but varies
For the next SRC delete inter_AB, KEEP inter_B, and go back to the settings in step 2. Use the same GAN files originally put aside in step 1 each time when it comes back to step 5, reusing those further results in worse artifacts
👤✨ Ultimate DST Collab
Welcome to the Ultimate DST Collab channel! We’re excited to have you here and appreciate your interest in contributing to our project. To ensure your contributions align with our goals, please review the following guidelines:
https://discord.com/channels/1006313128381911151/1006329882386636951/1243809814707179581
🌟 How to Contribute
-
Manually Detailed XSeg:
- What We’re Looking For:
- High-quality XSeg images of cartoon characters (e.g., South Park, Family Guy, Muppets), animals, and humans (must have good variety of angles).
- Detailed masks for items such as drinks, eating utensils, food, kitchenware, sports equipment, musical instruments, audio equipment, faceware, hands, fingers, eyewear, headwear, teeth, mouth, tongue, etc.
- Required Tools:
- DeepAscension for precise manual XSeg.
- Quick Face Cut for accurate face extraction (if an image turns out with bad landmarks then manually fix them).
- Image Specs: Minimum 640x head and above.
-
Main Facesets of Interest:
- We are looking to have fully manually XSeg’d facesets based on the criteria for these mainly but also other stuff based on criteria:
-
Submission Instructions:
- Post your XSeg images directly in this channel to showcase your work. Ensure your posts are clear and detailed for effective review and feedback.
-
Recognition:
- Contributors will be acknowledged in the DST contributor credits.
Thank you for your dedication and support. Your contributions are vital to our collaborative success!
👏 Share Your DFM Live Community
- Share your facesets and models in the Share Your DFM Live Community. Posting your work helps others learn and fosters collaboration within our community.