Наш алгоритм поддерживает редактирование прически и цвета волос по отдельности или совместно, а условные входные данные могут поступать либо из графического, либо из текстового домена.
Начало:
$ conda install --yes -c pytorch pytorch=1.7.1 torchvision cudatoolkit=11.0
$ pip install ftfy regex tqdm
$ pip install git+https://github.com/openai/CLIP.git
$ pip install tensorflow-io
Предварительно обученная модель
Загрузите предварительно обученную модель по следующей ссылке. Модель HairCLIP содержит всю архитектуру, включая веса преобразователя и декодера.
Основной скрипт обучения можно найти в scripts/train.py.
Промежуточные результаты обучения сохраняются в opts.exp_dir. Сюда входят контрольные точки, выходы и выходы тестов.
Кроме того, если у вас установлен tensorboard, вы можете визуализировать журналы tensorboard в opts.exp_dir/logs.
cd mapper
python scripts/train.py \
--exp_dir=/path/to/experiment \
--hairstyle_description="hairstyle_list.txt" \
--color_description="purple, red, orange, yellow, green, blue, gray, brown, black, white, blond, pink" \
--latents_train_path=/path/to/train_faces.pt \
--latents_test_path=/path/to/test_faces.pt \
--hairstyle_ref_img_train_path=/path/to/celeba_hq_train \
--hairstyle_ref_img_test_path=/path/to/celeba_hq_val \
--color_ref_img_train_path=/path/to/celeba_hq_train \
--color_ref_img_test_path=/path/to/celeba_hq_val \
--color_ref_img_in_domain_path=/path/to/generated_hair_of_various colors \
--hairstyle_manipulation_prob=0.5 \
--color_manipulation_prob=0.2 \
--both_manipulation_prob=0.27 \
--hairstyle_text_manipulation_prob=0.5 \
--color_text_manipulation_prob=0.5 \
--color_in_domain_ref_manipulation_prob=0.25 \
GitHub:
https://github.com/wty-ustc/HairCLIP
Web demo: https://huggingface.co/spaces/Gradio-Blocks/HairCLIP
#machinelearning #artificialintelligence #ai #datascience #python #programming #technology #deeplearning #coding #bigdata