Face Detector is a Python-based tool that performs face detection in videos and identifies specific scenes where a given face appears.
- Detect faces in video frames using a reference image.
- Extract specific scenes from a video where the given face is detected.
- Automatically generate new video files with detected scenes.
- Designed for future extension with a UI.
- Python 3.8+
- ffmpeg installed on your system:
- For Ubuntu/Debian:
sudo apt install ffmpeg
- For macOS:
brew install ffmpeg
- For Windows: Download and install from ffmpeg.org.
- For Ubuntu/Debian:
git clone https://github.com/katanabana/face-detector-project.git
cd face-detector-project
pip install -r requirements.txt
Here's an example of how to use the FaceDetector class in your own script:
from face_detector.face_detector import FaceDetector
video_path = 'video.mp4'
verification_image = 'face.png'
output_directory = 'result'
face_detector = FaceDetector(video_path, verification_image, callback=print)
# Adjust different parameters of processing
scenes = face_detector.relevant_scenes(tolerance=0.7, frequency=10, quality=0.5)
face_detector.write(scenes, output_directory)
To test the module with sample data:
- open terminal and navigate to the root directory of the cloned repository of this project
- run in terminal:
python -m example.example
- check if in
example
folder was created a directoryresult
containing output files of scenes fromexample/video.mp4
where the face onexample/face.png
appears.
- UI Development: We plan to add a graphical user interface to make this tool more accessible to non-developers.
- Additional Features: Advanced face matching, add option to detect specific moments instead of scenes, multiple faces detection, etc.