ADetailer

Introduction

ADetailer is a PyTorch-based model hosted on Hugging Face, developed using the Ultralytics library. It supports tasks such as face, hand, and person detection along with clothing segmentation using datasets like wider_face, skytnt/anime-segmentation, and deepfashion2.

Architecture

The model utilizes the YOLOv8 detection architecture to perform 2D object detection and segmentation. It is optimized for different object categories, including faces, hands, and clothing. The architecture outputs bounding boxes and segmentation masks, with performance metrics provided in terms of mean Average Precision (mAP).

Training

ADetailer is trained on diverse datasets such as:

  • Face: wider_face
  • Hand: AnHDet
  • Person: COCO2017, AniSeg
  • Fashion: deepfashion2

These datasets support various object detection tasks, enhancing the model's generalization capabilities across different domains.

Guide: Running Locally

Basic Steps

  1. Install Dependencies: Ensure you have ultralytics, huggingface_hub, opencv-python, and Pillow installed:

    pip install ultralytics huggingface_hub opencv-python pillow
    
  2. Download the Model: Use the huggingface_hub to download the model:

    from huggingface_hub import hf_hub_download
    from ultralytics import YOLO
    
    path = hf_hub_download("Bingsu/adetailer", "face_yolov8n.pt")
    model = YOLO(path)
    
  3. Inference: Load an image and perform inference:

    import cv2
    from PIL import Image
    
    img = "https://farm5.staticflickr.com/4139/4887614566_6b57ec4422_z.jpg"
    output = model(img)
    pred = output[0].plot()
    pred = cv2.cvtColor(pred, cv2.COLOR_BGR2RGB)
    pred = Image.fromarray(pred)
    pred.show()
    

Cloud GPUs

Consider using cloud GPU services like AWS EC2, Google Cloud Platform, or Azure for faster inference and training processes.

License

ADetailer is licensed under the Apache 2.0 License, allowing for free use and distribution with proper attribution.

More Related APIs