Repository of Inter-Centrales 2022 AI competition: Ceteris Paribus Face Challenge: site of the competition.
- Project images in latent space
- Modify bounds of the direction
- Find translations in latent space
- Saving pipeline for direction
- Solve bald issue
- Detect and improve bad translations
- Saving pipeline for edited images
- Solve specific issues (manually or with other methods)
- Fix artifacts (using original images)
- Improve resolution (super resolution ?)
First create a new virtual environment and install all the required packages:
pip install -r requirements.txt
Then download the dataset of the competition available here: drive dataset
And unzip the content in the data/input_images
folder.
Then you can run the script editor_API.py
to start the image editing API. Don't forget to change the config at the beginning of the script if you want to use the flexible config.
python editor_API.py
Or if you are using a Nvidia GPU:
FORCE_NATIVE=1 python editor_API.py
To save the latent direction you want in the data/
folder, you can click on the 'Save' button. The name of the translation should follow the name convention:
-
for 'cursor' transformation (min - max):
{carac}_{'min' or 'max'}
. ExampleBe_min
means cursor transformation to minimal bags under the eyes (Be_min). -
for default transformation (transformation that doesn't depend on the current value of the caracteristic):
{carac}_{new_value}
. Example:Hc_0
means default transformation to black hair color (Hc_0) -
for specific transformation (transformation that depends on the current value of the caracteristic) that will overwrite default transformation:
{carac}_{new_value}_fr_{old_value}
. ExampleA_0_fr_1
means specific transformation from intermediate age (A_1) to young age (A_0), 'fr' means 'from'.
All required transformations must be treated for all input caracterisics to make a valid submission.
Now, given an input image, the transformations to create caracterisitcs that are not in the initial image can automatically be got with the script utils/translation.py
. Finally you can run the script tools/translate.py
to generate the new images in a folder respecting the naming convention of the competition (the images are generated in data/{latent_dir}/edited_images/
)
python tools/translate.py
Or if you are using a Nvidia GPU:
FORCE_NATIVE=1 tools/translate.py
Of course, you can generate only a subset of images or caracteristics by removing some latent vectors or by removing keys of the dictionary containing the translations.
If all the 72 images with all caracteristics are generated (1731 images in total), you can zip the folder containing the images and run the following script to check the submission (if all the required images are inside, with the good name, type, size...):
python tools/check_submission.py
The tutorial of AnyCostGAN is in the file AnycostGAN tuto.md
and the tutorial notebooks are in the notebooks
folder. The original repository is here: AnyCosGAN. Note that the script demo.py
was renamed to editor_API.py
in this repository.
Commit messages are written in present tense (e.g. :art: refactor training loop
instead of :art: refactored training loop
).
They also start with one or two applicable emoji. This does not only look great but also makes you rethink what to add to a commit (one kind of action per commit!).
Make many but small commits!
Emoji | Description |
---|---|
๐ :tada: |
Initial Commit |
โจ :sparkles: |
Add features |
๐ฅ :fire: |
Remove code or feature |
โ :heavy_plus_sign: |
Add file (without adding features) |
โ :heavy_minus_sign: |
Remove file (without removing features) |
๐ชฒ :beetle: |
Fix bug |
๐จ :art: |
Improve structure/format of code (including PEP) |
๐ :memo: |
Add/update docstring, comment or readme |
โก :zap: |
Improve performance |
โ๏ธ :pencil2: |
Fix typo |
โ
:white_check_mark: |
Add, update or pass tests |
โฌ๏ธ :arrow_up: |
Update dependency or requirements |
๐ง :wrench: |
Add/update configuration or configuration files |
๐ :truck: |
Deplace or rename files or folders |
๐ง :construction: |
Work in progress |
๐ :twisted_rightwards_arrows: |
Branch Merging |
โช :rewind: |
Revert commit or changes |
๐ฌ :speech_balloon: |
Unknown category |