plain text format this and remove any amount of these * # 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**
- Download Python from the official website: https://www.python.org/downloads/
- Download DeepAscension from this Discord link: 
https://discord.com/channels/1006313128381911151/1008224194884026459/1227030035735773245

**Step 2: Download Additional Tools**
- Download Quick Face Cut following the install guide here:
https://discord.com/channels/1006313128381911151/1008224194884026459/1234949913322852432

**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 in 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:
  - https://discord.com/channels/1006313128381911151/1070781954800242888/1228825279045304330

**> 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:
  - https://discord.com/channels/1006313128381911151/1069808268878282833/1070448823417180221
- 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:**

1. **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.

2. **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.

3. **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.
4. **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.

5. **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.

6. **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.

7. **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)**

1. First run the saehd convert bat if you haven't already so that it's ME then save GAN files elsewhere after

2. 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

3. 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.

4. 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

5. 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.

6. 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**

1. **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 a image turns out with bad landmarks then manually fix them.)
   - **Image Specs:** Minimum 640x Head and above.

2. **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:
     - Face Occlusion Generation: <https://github.com/kennyvoo/face-occlusion-generation>
     - PetFace: <https://github.com/mapooon/PetFace>
     - FEED: <https://github.com/neeek2303/FEED>
     - MEAD: <https://github.com/uniBruce/Mead>


3. **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.

4. **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.