Skip to content

dormoyi/InterCentrales

Repository files navigation

InterCentrales Competition 2022

Repository of Inter-Centrales 2022 AI competition: Ceteris Paribus Face Challenge: site of the competition.

alt text

To-Do list

  • 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 ?)

Quick Start

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'}. Example Be_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}. Example A_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

AnyCost GAN tutorial

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 message

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

About

Inter Centrales AI Competition 2022 Ayoub Bao Ines Valentin. Computer vision for data augmentation.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors