No description
Find a file
2026-05-05 10:54:29 +02:00
.gitignore Standardize Python project setup 2026-05-05 10:54:29 +02:00
FaceDetectionSort.py git init 2025-04-09 11:23:20 +02:00
LICENSE Initial Commit 2025-04-09 13:51:44 +02:00
README.de.md Standardize Python project setup 2026-05-05 10:54:29 +02:00
README.md Standardize Python project setup 2026-05-05 10:54:29 +02:00
requirements.txt Create Readme 2025-04-09 11:31:51 +02:00

Face Detection Filter for Images

This Python script filters .jpg images in a folder by face detection and file size. Matching images are copied to a target folder.

Face detection is done with MediaPipe. The source files stay untouched.

Features

  • Select source and target folders via a simple GUI (Tkinter)
  • Face detection using MediaPipe
  • Progress display with tqdm
  • Filters images based on minimum and maximum file size
  • Automatically copies valid images

Requirements

  • Python 3.7 or higher

Python Dependencies

Install the required packages with:

pip install -r requirements.txt

Required packages:

  • mediapipe
  • pillow
  • numpy
  • tqdm

Alternatively:

pip install mediapipe pillow numpy tqdm

Usage

  1. Run the script:
python FaceDetectionSort.py

Start file: FaceDetectionSort.py.

  1. A dialog window will open asking you to select the source folder that contains the images.
  2. Then, select the target folder where the filtered images should be copied.
  3. The script will process all .jpg images:
    • Skips images that are below or above the defined size threshold
    • Detects faces with a configurable confidence threshold (default: 0.75)
    • Displays progress and status in the console

Configurable Parameters

You can change these at the top of FaceDetectionSort.py:

FACE_DETECTION_THRESHOLD = 0.75  # Confidence threshold for face detection
MIN_FILE_SIZE_KB = 100           # Minimum file size in KB
MAX_FILE_SIZE_MB = 15            # Maximum file size in MB

Notes

  • Only .jpg files are processed.
  • Images outside the configured file-size range are skipped.
  • The script copies matching images and does not delete or move the originals.