Coder Social home page Coder Social logo

zhangzp9970 / acgan-pytorch Goto Github PK

View Code? Open in Web Editor NEW

This project forked from 3neutronstar/acgan-pytorch

0.0 1.0 0.0 3.63 MB

Unofficial Auxiliary Classifier GAN implementation (based on https://github.com/clvrai/ACGAN-PyTorch)

License: MIT License

Python 100.00%

acgan-pytorch's Introduction

Conditional Image Synthesis With Auxiliary Classifier GANs

This project is a PyTorch implementation of Conditional Image Synthesis With Auxiliary Classifier GANs. This project is from ACGAN-PyTorch. Just fix the code for implementing correctly.
(PyTorch version 0.4 -> 1.8 is available)
Also, add the image generation code generate_image.py, if the checkpoint exists.

Prerequisites

Usage

Run the following command for details of each arguments.

$ python main.py -h

You should specify the path to the dataset you are using with argument --dataroot, the code will automatically check if you have cifar10 dataset downloaded or not. If not, the code will download it for you. For the ImageNet training you should download the whole dataset on their website, this repository used 2012 version for the training. And you should point the dataroot to the train (or val) directory as the root directory for ImageNet training.

In line 80 of main.py, you can change the classes_idx argument to take into other user-specified imagenet classes, and adjust the num_classes accordingly if it is not 10.

if opt.dataset == 'imagenet':
    # folder dataset
    dataset = ImageFolder(root=opt.dataroot,
                          transform=transforms.Compose([
                              transforms.Scale(opt.imageSize),
                              transforms.CenterCrop(opt.imageSize),
                              transforms.ToTensor(),
                              transforms.Normalize((0.5, 0.5, 0.5), (0.5, 0.5, 0.5)),
                         ]),
                         classes_idx=(10,20))

Train the models

Example training commands, the code will automatically generate images for testing during training to the --outf directory.

$ python main.py --niter=500 --batchSize=100 --cuda --dataset=cifar10 --imageSize=32 --dataroot=/data/path/to/cifar10 --gpu=0

Extract learning images

    python generate_image.py --eval_epoch=/epoch/you/want --cuda --dataset=cifar10 --dataroot=/data/path/to/cifar10 --gpu=0 

Examples

The sample generated images from ImageNet dataset.

The sample generated images from CIFAR-10 dataset.

acgan-pytorch's People

Contributors

3neutronstar avatar

Watchers

 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.