The YOLO models are the backbone of aDetailer, enabling it to detect faces, hands, and bodies with precision. Installing and configuring these models is essential for using aDetailer effectively. In this tutorial, we’ll walk you through the process of setting up YOLO models, explaining everything from where to find them to how to integrate them into aDetailer.


What Are YOLO Models?

YOLO (You Only Look Once) models are advanced object detection algorithms. They identify specific areas within an image—like faces, hands, or full bodies—at lightning speed. In aDetailer, these models create detailed masks for targeted inpainting, enabling the tool to enhance specific regions automatically.


Why Do You Need YOLO Models?

Each YOLO model serves a specialized purpose:

  • Face Models (e.g., face_yolov8n.pt): Detect and enhance faces.
  • Hand Models (e.g., hand_yolov8n.pt): Address distortions in hands, fixing issues like extra or missing fingers.
  • Person Models (e.g., person_yolov8n-seg.pt): Focus on full-body detection and segmentation.

Selecting and installing the right model is critical for achieving the best results in your projects.


Step 1: Finding YOLO Models

YOLO models compatible with aDetailer are hosted on trusted platforms like Hugging Face and GitHub.

  1. Recommended Source:
  2. Available Models:
    • Face Models:
      • face_yolov8n.pt: Lightweight and fast, ideal for general face detection.
      • face_yolov8s.pt: Slightly more robust for challenging scenarios.
    • Hand Models:
      • hand_yolov8n.pt: Optimized for hand detection and correction.
    • Person Models:
      • person_yolov8n-seg.pt: Detects entire bodies with segmentation for inpainting.
      • person_yolov8s-seg.pt: Higher accuracy for more detailed body corrections.

Step 2: Installing YOLO Models

Once you’ve chosen the models you want to use, follow these steps to install them into aDetailer:

  1. Locate the Models Directory:
    • Go to your Stable Diffusion WebUI installation folder.
    • Navigate to the directory: extensions/adetailer/models/adetailer.
  2. Download the Models:
    • Download the desired .pt files (e.g., face_yolov8n.pt) from Hugging Face.
    • Place these files into the models/adetailer directory.
  3. Verify Installation:
    • Restart the Stable Diffusion WebUI.
    • Open the aDetailer settings tab under txt2img or img2img.
    • Check if the installed models appear in the Model Dropdown menu.

Step 3: Configuring YOLO Models

After installation, you need to configure aDetailer to use the models effectively.

  1. Enable aDetailer:
    • In the aDetailer tab, tick the box to Enable ADetailer.
  2. Select a Model:
    • Use the dropdown menu to select a model (e.g., face_yolov8n.pt).
  3. Adjust Detection Settings:
    • Detection Confidence Threshold: Set this to determine the accuracy of detections.
      • Recommended: 0.3 for faces, 0.5 for hands, and 0.4 for bodies.
    • Mask Min/Max Area Ratio: Define the size of masks relative to the image.
      • Example: Use a minimum ratio of 0.01 to ignore tiny, irrelevant objects.

Step 4: Testing YOLO Models

Now that your models are installed and configured, it’s time to test them!

  1. Generate an Image:
    • Go to txt2img or img2img.
    • Input a prompt and enable aDetailer.
    • Example prompt: A high-quality portrait of a smiling woman, detailed face, realistic lighting.
  2. Check the Results:
    • Observe how the selected YOLO model detects and enhances the desired regions.
    • Try different detection models to see how they handle faces, hands, or full bodies.

Step 5: Managing Multiple Models

You can use multiple YOLO models simultaneously in aDetailer.

  1. Enable Multi-Model Detection:
    • Open a second aDetailer tab and select an additional model.
    • Example: Use face_yolov8n.pt for faces and hand_yolov8n.pt for hands.
  2. Sequential Processing:
    • aDetailer applies each model in sequence, allowing you to correct multiple regions in one pass.

Step 6: Keeping YOLO Models Updated

As new models are released, it’s a good idea to keep your library up to date.

  1. Check for Updates:
    • Periodically visit the Hugging Face or GitHub repository to see if new models are available.
    • Download and replace older models as needed.
  2. Restart and Verify:
    • After updating, restart the WebUI and ensure the models appear correctly.

Common Issues and Troubleshooting

  • Model Not Found: Ensure .pt files are in the correct directory (models/adetailer).
  • Detection Failures: Lower the confidence threshold or adjust mask size settings.
  • Slow Performance: Use lighter models like face_yolov8n.pt instead of face_yolov8s.pt.

Conclusion

Installing and configuring YOLO models is a crucial step in unlocking the full potential of aDetailer. With these models, you can take your Stable Diffusion images to the next level, enhancing faces, hands, and bodies with precision and ease. Whether you’re just starting or looking to refine your workflow, these steps will get you on the right track.

Next up: Learn how to use aDetailer to fix distorted faces like a pro in “Fixing Faces: A Beginner’s Guide.” Stay tuned! 🚀