# afc **Repository Path**: afuna/afc ## Basic Information - **Project Name**: afc - **Description**: This is a anime face converter, input a pic or draw by yourself, you can get a anime face. - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2022-04-01 - **Last Updated**: 2023-03-23 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Animation Face Converter ## Description Our work is heavily based on [this work](https://github.com/lernapparat/lernapparat/tree/master/style_gan). We convert a [pre-trained StyleGAN model](https://mega.nz/#!vawjXISI!F7s13yRicxDA3QYqYDL2kjnc2K7Zk3DwCIYETREmBP4) (tensorflow model) to a pytorch model. In order to do image to image transformation, a simple [network](./model.py) is trained to reconstruct the disentangled latent code from a 32x32x3 image. ## Quick Start python ./generator.py ## Usage * cvt file: convert a file to an animation face * trc file: cvt file with truncation trick ([0, 1)) * inj file1 file2: "inject" the style of file2 into file1 (style mixing) * lerp file1 file2: do interpolation between file1 and file2 ### Results Assume that we have two pictures 1.jpg and 2.jpg 1.jpg ![1.jpg](./targetImg/1.jpg) 2.jpg ![2.jpg](./targetImg/2.jpg) Then run the following code and the results are shown below: >> cvt ./1.jpg ![cvt1](./cache/cvt_1.jpg/1.jpg_cvt_.jpg) >> cvt ./2.jpg ![cvt2](./cache/cvt_2.jpg/2.jpg_cvt_.jpg) >> trc ./1.jpg ![trc11](./cache/trc_1.jpg/1.jpg_trc_1.jpg) ![trc13](./cache/trc_1.jpg/1.jpg_trc_3.jpg) ![trc17](./cache/trc_1.jpg/1.jpg_trc_7.jpg) >> inj ./1.jpg ./2.jpg ![inj121](./cache/inj_1.jpg_2.jpg/1.jpg_inject_0_4.jpg) ![inj122](./cache/inj_1.jpg_2.jpg/1.jpg_inject_4_8.jpg) ![inj123](./cache/inj_1.jpg_2.jpg/1.jpg_inject_8_16.jpg) >> inj ./2.jpg ./1.jpg ![inj121](./cache/inj_2.jpg_1.jpg/2.jpg_inject_0_4.jpg) ![inj122](./cache/inj_2.jpg_1.jpg/2.jpg_inject_4_8.jpg) ![inj123](./cache/inj_2.jpg_1.jpg/2.jpg_inject_8_16.jpg) >> lerp ./1.jpg ./2.jpg ![lerp121](./cache/lerp_1.jpg_2.jpg/1.jpg_lerp_1.jpg) ![lerp123](./cache/lerp_1.jpg_2.jpg/1.jpg_lerp_3.jpg) ![lerp125](./cache/lerp_1.jpg_2.jpg/1.jpg_lerp_5.jpg) ![lerp127](./cache/lerp_1.jpg_2.jpg/1.jpg_lerp_7.jpg) ![lerp129](./cache/lerp_1.jpg_2.jpg/1.jpg_lerp_9.jpg)