GithubHelp home page GithubHelp logo

1234happy / dcgan-keras Goto Github PK

View Code? Open in Web Editor NEW

This project forked from bubbliiiing/dcgan-keras

0.0 0.0 0.0 13.65 MB

这是一个dcgan-keras的源码,可以用于训练自己的模型。

License: MIT License

Python 100.00%

dcgan-keras's Introduction

DCGAN:Deep Convolutional Generative Adversarial Networks模型在Keras当中的实现


目录

  1. 所需环境 Environment
  2. 文件下载 Download
  3. 预测步骤 How2predict
  4. 训练步骤 How2train
  5. 参考资料 Reference

所需环境

tensorflow-gpu==1.13.1
keras==2.1.5

文件下载

为了验证模型的有效性,我使用了花的例子进行了训练。
训练好的生成器与判别器模型Generator_Flower.h5Discriminator_Flower.h5可以通过百度网盘下载或者通过GITHUB下载
权值的百度网盘地址如下:
链接: https://pan.baidu.com/s/1U1PtEqDWW0Xg_zYpxwqn0A 提取码: 56kb

花的数据集可以通过百度网盘下载:
链接: https://pan.baidu.com/s/1ITA1Lw_K28B3nbNPnI3_Kw 提取码: 11yt

预测步骤

a、使用预训练权重

  1. 下载完库后解压,直接运行predict.py,在终端点击enter,即可生成图片,生成图片位于results/predict_out/predict_1x1_results.png,results/predict_out/predict_5x5_results.png。

b、使用自己训练的权重

  1. 按照训练步骤训练。
  2. 在dcgan.py文件里面,在如下部分修改model_path使其对应训练好的文件;model_path对应logs文件夹下面的权值文件
_defaults = {
    #-----------------------------------------------#
    #   model_path指向logs文件夹下的权值文件
    #-----------------------------------------------#
    "model_path"        : 'model_data/Generator_Flower.h5',
    #-----------------------------------------------#
    #   卷积通道数的设置
    #-----------------------------------------------#
    "channel"           : 64,
    #-----------------------------------------------#
    #   输入图像大小的设置
    #-----------------------------------------------#
    "input_shape"       : [64, 64],
}
  1. 运行predict.py,在终端点击enter,即可生成图片,生成图片位于results/predict_out/predict_1x1_results.png,results/predict_out/predict_5x5_results.png。

训练步骤

  1. 训练前将期望生成的图片文件放在datasets文件夹下(参考花的数据集)。
  2. 运行根目录下面的txt_annotation.py,生成train_lines.txt,保证train_lines.txt内部是有文件路径内容的。
  3. 运行train.py文件进行训练,训练过程中生成的图片可查看results/train_out文件夹下的图片。

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.