All Projects → hila-chefer → TargetCLIP

hila-chefer / TargetCLIP

Licence: other
Official PyTorch implementation of the paper Image-Based CLIP-Guided Essence Transfer.

Programming Languages

Jupyter Notebook
11667 projects
python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to TargetCLIP

vqgan-clip-app
Local image generation using VQGAN-CLIP or CLIP guided diffusion
Stars: ✭ 94 (-40.51%)
Mutual labels:  image-generation, clip
Semantic Pyramid for Image Generation
PyTorch reimplementation of the paper: "Semantic Pyramid for Image Generation" [CVPR 2020].
Stars: ✭ 45 (-71.52%)
Mutual labels:  image-generation
MoTIS
Mobile(iOS) Text-to-Image search powered by multimodal semantic representation models(e.g., OpenAI's CLIP). Accepted at NAACL 2022.
Stars: ✭ 60 (-62.03%)
Mutual labels:  clip
OASIS
Official implementation of the paper "You Only Need Adversarial Supervision for Semantic Image Synthesis" (ICLR 2021)
Stars: ✭ 232 (+46.84%)
Mutual labels:  image-generation
photo-magician
🎨 provide some common image process apis with canvas
Stars: ✭ 12 (-92.41%)
Mutual labels:  clip
naver-webtoon-faces
Generative models on NAVER Webtoon faces
Stars: ✭ 254 (+60.76%)
Mutual labels:  image-generation
SuperStyleNet
SuperStyleNet: Deep Image Synthesis with Superpixel Based Style Encoder (BMVC 2021)
Stars: ✭ 28 (-82.28%)
Mutual labels:  image-generation
Awesome-Text-to-Image
A Survey on Text-to-Image Generation/Synthesis.
Stars: ✭ 251 (+58.86%)
Mutual labels:  image-generation
AODA
Official implementation of "Adversarial Open Domain Adaptation for Sketch-to-Photo Synthesis"(WACV 2022/CVPRW 2021)
Stars: ✭ 44 (-72.15%)
Mutual labels:  image-generation
TimeSeries2DBarChartImageCNN
Conversion of the time series values to 2-D stock bar chart images and prediction using CNN (using Keras-Tensorflow)
Stars: ✭ 25 (-84.18%)
Mutual labels:  image-generation
clip-container
A containerized REST API around OpenAI's CLIP model.
Stars: ✭ 46 (-70.89%)
Mutual labels:  clip
SDEdit
PyTorch implementation for SDEdit: Image Synthesis and Editing with Stochastic Differential Equations
Stars: ✭ 394 (+149.37%)
Mutual labels:  image-generation
CWR
Code and dataset for Single Underwater Image Restoration by Contrastive Learning, IGARSS 2021, oral.
Stars: ✭ 43 (-72.78%)
Mutual labels:  image-generation
stylegan2
StyleGAN2 - Official TensorFlow Implementation with practical improvements
Stars: ✭ 121 (-23.42%)
Mutual labels:  stylegan2
vue-pic-clip
一个简单的移动端裁剪图片上传插件
Stars: ✭ 30 (-81.01%)
Mutual labels:  clip
NeuralTexGen
Image-space texture optimization of 3D meshes using PyTorch
Stars: ✭ 60 (-62.03%)
Mutual labels:  image-generation
overlord
Official pytorch implementation of "Scaling-up Disentanglement for Image Translation", ICCV 2021.
Stars: ✭ 35 (-77.85%)
Mutual labels:  stylegan2
cfg-gan
CFG-GAN: Composite functional gradient learning of generative adversarial models
Stars: ✭ 15 (-90.51%)
Mutual labels:  image-generation
DLCV2018SPRING
Deep Learning for Computer Vision (CommE 5052) in NTU
Stars: ✭ 38 (-75.95%)
Mutual labels:  image-generation
PASSL
PASSL包含 SimCLR,MoCo v1/v2,BYOL,CLIP,PixPro,BEiT,MAE等图像自监督算法以及 Vision Transformer,DEiT,Swin Transformer,CvT,T2T-ViT,MLP-Mixer,XCiT,ConvNeXt,PVTv2 等基础视觉算法
Stars: ✭ 134 (-15.19%)
Mutual labels:  clip

TargetCLIP- official pytorch implementation of the paper Image-Based CLIP-Guided Essence Transfer

This repository finds a global direction in StyleGAN's space to edit images according to a target image. We transfer the essence of a target image to any source image.

Pretrained directions notebooks:

Notebook for celebrity sources/ your own pre-inverted latents:

Open In Colab

The notebook allows to use the directions on the sources presented in the examples. In addition, there's an option to edit your own inverted images with the pretrained directions, by uploading your latent vector to the dirs folder. We use images inverted by e4e.

Notebook for e4e+TargetCLIP (inversion and manipulation in one notebook):

Open In Colab

Training new directions:

To train new directions for your own targets, use the find_dirs.py script under the optimization folder.

Our code supports both targets from images the were not inverted and targets for inverted images. For example, our Elsa, The Joker, Pocahontas, Keanu Reeves, and more examples were not inverted, while our Trump example was inverted. When possible, an inverted target usually gives better results.

We recommend to use inverted images for the training process. Our experiments use the inverted latents from the StyleCLIP repo.

Using targets that were not inverted

The code uses --num_directions differnet random initializations for the essence vector. After training, you can choose your favorite one (usually, all are very similar).

  1. Download the inverted latents from the StyleCLIP repo for training.
  2. Upload your target image to the dirs/tragets folder. Note that png images are not supported.
  3. Run the find_dirs.py script with your target:
PYTHONPATH=`pwd` python optimization/find_dirs.py --target_path dirs/targets/your_target.jpg --dir_name results_folder --weight_decay 3e-3 --lambda_consistency 0.6 --step 1000 --lr 0.2 --num_directions 8 --num_images 8 --data_path path_to_styleclip_latents

The intermediate best results for your training samples will appear under the path specified in --dir_name. In addition, the optimal essence vectors for all your initializations will be saved as direction{i}.npy, and you can use them on other images or upload them to the notebook to experiment with other sources.

Note: for targets that require extreme or difficult semantic edits (e.g. avatar, thanos, etc.), try to increase the influence of the transfer loss using the lambda_transfer argument (default is set to 1).

Using inverted targets

We will initialize the essence vector to be the latent of your target.

  1. Download the inverted latents from the StyleCLIP repo for training.
  2. Upload your target's latent to the dirs/tragets folder. We use e4e to invert all our images.
  3. Run the find_dirs.py script with your target latnet:
PYTHONPATH=`pwd` python optimization/find_dirs.py  --dir_initialition dirs/tragets/your_target.pt --num_directions 8  --num_images 8 --dir_name results_folder --weight_decay 3e-3 --lambda_consistency 0.6 --step 1000 --lr 0.2 --data_path path_to_styleclip_latents

The intermediate best results for your training samples will appear under the path specified in --dir_name. In addition, the optimal essence vectors for all your initializations will be saved as direction0.npy, which is the essence vector derived from your input latent.

Examples:

NOTE: all the examples presented are available in our colab notebook. The recommended coefficient to use is between 0.5-1

Targets that were not inverted- The Joker and Keanu Reeves

The targets are plain images, that were not inverted, the direction optimization is initialized at random.

NOTE: for the joker, we use relatively large coefficients- 0.9-1.3

Out of domain targets- Elsa and Pocahontas

The targets are plain images that are out of the domain StyleGAN was trained on, the direction optimization is initialized at random.

Targets that were inverted- Trump

The targets are inverted images, and the latents are used as initialization for the optimization.

Updates:

10/27/21: Pretrained directions added for Doc Brown (Back to the Future), Morgan Freeman, Beyonce, and Ariel (The Little Mermaid)!

11/2/21: Pretrained directions added for Wolverine, Avatar, and Gargamel!

11/12/21: New pretrained directions added for Ed Sheeran, Dumbledore, Moana, Zendaya, Thanos, and more!

Citing our paper

If you make use of our work, please cite our paper:

@article{chefer2021targetclip,
  title={Image-Based CLIP-Guided Essence Transfer},
  author={Chefer, Hila and Benaim, Sagie and Paiss, Roni and Wolf, Lior},
  journal={arXiv preprint arXiv: 2110.12427},
  year={2021}
}

Credits

The code in this repo draws from the StyleCLIP code base.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].