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
$ pip install -r requirements.txt
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
It is now 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'
It is also possible to use the same real identity from a source image into multiple target photos. To avoid malicious uses, only verified trusted users have access to this feature. If you are interested, please contact us via Discord. To use a real identity from a source photo '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, use the command
$ python3 main.py --filepath 'mydir/myfile.jpg' --identity_filepath 'mydir/myfile.jpg' --identity_name 'myidentityname' --hair
It is possible to change the default generation parameters, to do that use the command (you need to be a premium user)
$ python3 main.py --filepath 'mydir/myfile.jpg' --identity_filepath 'mydir/myfile.jpg' --identity_name 'myidentityname' --guidance_scale '1.5' --controlnet_scale '0.1' --prompt_strength '0.5'
It is now 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