kiddobellamy
commited on
Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,66 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
Title: Face Swapping with InsightFace
|
3 |
+
|
4 |
+
Description:
|
5 |
+
|
6 |
+
This Python application utilizes Hugging Face's InsightFace library to swap faces between two images. It leverages pre-trained models for face detection and face swapping, allowing for easy experimentation.
|
7 |
+
|
8 |
+
Features:
|
9 |
+
|
10 |
+
Detects faces in two separate images.
|
11 |
+
Swaps the detected faces between the images.
|
12 |
+
Optionally displays the original and swapped images for visual verification.
|
13 |
+
|
14 |
+
Requirements:
|
15 |
+
|
16 |
+
Python (tested with version 3.x)
|
17 |
+
Hugging Face Transformers library
|
18 |
+
InsightFace library (installable via pip install insightface)
|
19 |
+
OpenCV-Python (for image processing)
|
20 |
+
matplotlib (for plotting)
|
21 |
+
NumPy (for numerical operations)
|
22 |
+
|
23 |
+
Installation:
|
24 |
+
|
25 |
+
Create a virtual environment (recommended) to isolate project dependencies.
|
26 |
+
|
27 |
+
Install the required libraries using pip:
|
28 |
+
Bash
|
29 |
+
|
30 |
+
pip install -r requirements.txt
|
31 |
+
|
32 |
+
Usa el c贸digo con precauci贸n.
|
33 |
+
|
34 |
+
Note: Create a requirements.txt file in your project directory with the list of requirements mentioned above.
|
35 |
+
|
36 |
+
Usage:
|
37 |
+
|
38 |
+
Save two images (image1.jpg and image2.jpg) in the same directory as your script (app.py).
|
39 |
+
|
40 |
+
Run the script from the terminal:
|
41 |
+
Bash
|
42 |
+
|
43 |
+
python app.py
|
44 |
+
|
45 |
+
Usa el c贸digo con precauci贸n.
|
46 |
+
|
47 |
+
Explanation of the Code (app.py):
|
48 |
+
|
49 |
+
The provided code defines functions for:
|
50 |
+
|
51 |
+
Initializing the FaceAnalysis application and face swapper model.
|
52 |
+
Reading images and detecting faces.
|
53 |
+
Swapping faces and optionally displaying the results.
|
54 |
+
|
55 |
+
Further Customization:
|
56 |
+
|
57 |
+
Modify the swap_n_show function to customize the plotting behavior or add functionalities like saving the swapped images.
|
58 |
+
Explore other functionalities offered by InsightFace for advanced face manipulation tasks.
|
59 |
+
|
60 |
+
Contributing:
|
61 |
+
|
62 |
+
Feel free to submit pull requests for bug fixes or improvements to this code.
|
63 |
+
|
64 |
+
License:
|
65 |
+
|
66 |
+
[Specify the license you want to use for your code, e.g., MIT License]
|