EraseID is an AI face changer and anonymizer. It automatically changes and replaces faces in existing images based on users' inputs, enabling full control of all human identities.
EraseID utilizes generative models to intelligently create real-looking synthetic humans that perfectly fit your photos. It can be extremely useful for:
- Enterprises: Expand your portfolio and add diversity. Unique high-resolution face replacement and editing. Enhanced variety for stock photos. No model release needed for commercial use.
- Marketing: Customize models and fit them to any market. Adapt models for targeted campaigns worldwide. Use photos without model release for commercial purposes. Retarget advertising photos for specific groups.
- Graphic designers: Enhance your creativity with AI-generated faces. Easy face retouching. Unique faces and expressions. Speed up work.
- Photographers: Edit models with the help of AI. Diversify the portfolio. Adapt faces to customers' needs.
The following instructions suppose you have already installed a recent version of Python. For a general overview, please visit the API documentation. To use any PiktID API, an access token is required.
Step 0 - Register here. 10 credits are given for free to all new users.
Step 1 - Clone the EraseID library
# Installation commands
$ git clone https://github.com/piktid/eraseid.git
$ cd eraseid
Step 2 - Export the email and password as environmental variables. If you want to authenticate via token, check the colab implementation.
$ export ERASEID_EMAIL={Your email here}
$ export ERASEID_PASSWORD={Your password here}
Step 3 - You can either provide the URL or the absolute path of the image (containing people). Add the arguments
...
--url 'your-url'
or
--filepath 'mydir/myfile.jpg'
...
Step 4 - Run the main function
$ python3 main.py --url 'your-url'
Without any additional argument, EraseID only changes the first face it finds in your image, and provides the result asynchronously. If you want to change also the hair and change all the faces in the photo, use the following command:
$ python3 main.py --hair --all_faces
You can fine-tune the generation process using the following parameters:
--guidance_scale
: Float value between 1 and 20 that controls the guidance scale--prompt_strength
: Float value between 0 and 1 that controls the diversity of generated faces--var_strength
: Float value between 0 and 1 that controls the creativity of generated faces--controlnet_scale
: Float value between 0 and 2 that controls the conditioning scale--seed
: Integer value for generation seed (default: random between 1 and 1000000)
For example, for a more creative generation, you can use:
$ python3 main.py --hair --all_faces --prompt_strength 0.8 --var_strength 0.8
It is possible to edit the original identity in your photos! Use keywords to add a smile or create a surprised look on all the faces.
Choose the EXPRESSION value from the ones available in cfe_keywords.py
$ python3 main.py --all_faces --change_expression_flag --new_expression EXPRESSION
It is also possible to use the same generated identity in multiple photos! To save the generated identity into your database, use the command:
$ python3 main.py --store_identity
The identity will be stored as 'pippo'. The name is hard-coded but you can change it. If you want to reuse 'pippo' in different photos, use the command:
$ python3 main.py --identity_name 'pippo'
Consistent identity (swap real faces, see SwapID)
It is also possible to use the same real identity from a source image into multiple target photos. We recommend to visit SwapID for this particular use case. Since SwapID utilizes the EraseID infrastructure, the results should be identical. To use a real identity from a source photo with local path 'mydir/myfile.jpg', use the command:
$ python3 main.py --filepath 'mydir/myfile.jpg' --identity_filepath 'mydir/myfile.jpg' --identity_name 'myidentityname'
The identity will be stored as 'myidentityname' and it will be used as reference input for the target image 'mydir/myfile.jpg'
If you want to swap also the hair and use an identity located at 'mylink/myfile.jpg', use the command
$ python3 main.py --filepath 'mydir/myfile.jpg' --identity_url 'mylink/myfile.jpg' --identity_name 'myidentityname' --hair
It is possible to change the default consistent generation parameters, to do that use the command
$ python3 main.py --filepath 'mydir/myfile.jpg' --identity_filepath 'mydir/myfile.jpg' --identity_name 'myidentityname' --prompt_strength 0.55 --seed 0
It is now possible to automatically adapt the full-body skin tone to the newly generated face! It is particularly useful when generating different ethnicities.
$ python3 main.py --skin