Giter Site home page Giter Site logo

hdluffy / stylegan2 Goto Github PK

View Code? Open in Web Editor NEW

This project forked from nvlabs/stylegan2

1.0 1.0 0.0 602 KB

StyleGAN2 - Official TensorFlow Implementation

Home Page: http://arxiv.org/abs/1912.04958

License: Other

Dockerfile 0.09% Python 93.90% Cuda 5.79% Shell 0.23%

stylegan2's Introduction

stylegan2风格迁移快速上手

环境搭建

  • git clone源码

    git clone https://github.com/hDluffy/stylegan2.git
    

    同时下载源github中提供的预训练模型stylegan2-ffhq-config-f.pkl,放置networks目录下

  • 安装训练环境

    conda配置

    conda create --name stylegan2-tf python=3.6
    
    source activate stylegan2-tf
    
    ##注意cuda版本与系统安装版本无关
    conda install tensorflow-gpu=1.14
    
    pip install scipy==1.3.3
    pip install requests==2.22.0
    pip install Pillow==6.2.1
    pip install typer
    

    docker环境

    docker build .
    
  • 数据处理

    1024x1024对齐后的raw数据,通过dataset_tool.py转为tfrecords数据集

    #转为tfrecords数据集
    ./make_dataset.sh
    
    #转为tfrecords数据集的具体指令
    python dataset_tool.py create_from_images ~/datasets/my-custom-dataset ~/my-custom-images
    #可以查看数据
    python dataset_tool.py display ~/datasets/my-custom-dataset
    
  • 模型训练

    ./train.sh
    
    #CUDA_VISIBLE_DEVICES=0,1,2,3 python run_training.py --num-gpus=4 --data-dir=~/datasets --config=config-f --dataset=my-custom-dataset --mirror-augment=true
    

    注:
    可能的错误undefined symbol: _ZN10tensorflow12OpDefBuilder6OutputESs
    解决方案:https://blog.csdn.net/zaf0516/article/details/103618601
    可能的错误#error "C++ versions less than C++11 are not supported
    解决方案:https://blog.csdn.net/qq1483661204/article/details/105442426

    1.通过设置./traing/training_loop.py中的resume_pkl路径,可以修改预训练模型
    2.建议注释掉评估,可以加快训练【metrics】

  • 测试及批量处理

    #task='GenShow',显示不同层融合的效果对比;task='GenBatch',进行特定层融合效果的批量生成;
    ./gen_images.sh
    
    #处理完的数据,可以通过指令copy到本地处理
    scp username@ip:/path/data /mnt/g/DataSets
    

stylegan2's People

Contributors

tkarras avatar hdluffy avatar jannehellsten avatar

Stargazers

 avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.