Sign In

Felldude's Secret for 1M+ Datasets - SFW/NSFW Face/Chest/Person (Auto Segment 100x faster)

12

Felldude's Secret for 1M+ Datasets - SFW/NSFW Face/Chest/Person (Auto Segment 100x faster)

YOLOv8 Face, Person & Chest Cropper

This Python script detects faces, persons, and chest regions in images and creates zoomed crops of the detected areas. It includes a simple GUI for selecting options and running the process.


Features

  • Detect faces, persons, and chest regions.

  • Generate square and portrait-style crops.

  • Optional zoom effect for multiple crop sizes.

  • Set a minimum crop size to avoid very small crops.

  • Supports .jpg, .jpeg, .png, .bmp images.

  • Saves crops into organized subfolders:

    • crops_face_square, crops_face_portrait

    • crops_person_square, crops_person_portrait

    • crops_chest_square, crops_chest_portrait


GUI Overview

  1. Face Detection Threshold – Adjust confidence threshold for face detection.

  2. Person Detection Threshold – Adjust confidence threshold for person detection.

  3. Enable Face Detection – Checkbox to turn face detection on/off.

  4. Enable Person Detection – Checkbox to turn person detection on/off.

  5. Enable Chest Detection – Checkbox to turn chest detection on/off (requires face detection).

  6. Minimum Crop Size – Enter a pixel value to prevent very small crops; leave blank to disable.

  7. Enable Zoom Effect – Checkbox to generate multiple zoomed crops; uncheck for a single crop per detection. Leaving Zoom checked effect is highly recommended as it does not resize the image but rather "zooms out" from the detection area to the edges of the picture.

  8. Select Image Folder & Start – Opens folder selector and starts processing.


How to Use

  1. Run the script or launch start.bat

python Auto_crop_yolo.py
  1. Adjust thresholds, minimum crop size, and zoom effect as needed.

  2. Check the detection types you want.

  3. Click Select Image Folder & Start and choose a folder with images.

  4. Crops are saved automatically in the folder under organized subfolders.


Requirements

  • Python 3.9+

  • Packages:

pip install ultralytics opencv-python numpy tk
  • YOLOv8 models Included:

    • yolov8n-face.pt (face detection)

    • yolov8n.pt (person detection)

12