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,.bmpimages.Saves crops into organized subfolders:
crops_face_square,crops_face_portraitcrops_person_square,crops_person_portraitcrops_chest_square,crops_chest_portrait
GUI Overview
Face Detection Threshold – Adjust confidence threshold for face detection.
Person Detection Threshold – Adjust confidence threshold for person detection.
Enable Face Detection – Checkbox to turn face detection on/off.
Enable Person Detection – Checkbox to turn person detection on/off.
Enable Chest Detection – Checkbox to turn chest detection on/off (requires face detection).
Minimum Crop Size – Enter a pixel value to prevent very small crops; leave blank to disable.
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.
Select Image Folder & Start – Opens folder selector and starts processing.
How to Use
Run the script or launch start.bat
python Auto_crop_yolo.py
Adjust thresholds, minimum crop size, and zoom effect as needed.
Check the detection types you want.
Click Select Image Folder & Start and choose a folder with images.
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)






