Skip to content

Commit

Permalink
Fix bug of conditional gan and building wheels (PaddlePaddle#185)
Browse files Browse the repository at this point in the history
* fix bugs
  • Loading branch information
LielinJiang authored Feb 26, 2021
1 parent 130bd7f commit 925bd9c
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 18 deletions.
41 changes: 26 additions & 15 deletions configs/cond_dcgan_mnist.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,46 +18,57 @@ model:
norm_type: batch
n_class: 10
use_sigmoid: True
gan_mode: vanilla
gan_criterion:
name: GANLoss
gan_mode: vanilla

dataset:
train:
name: CommonVisionDataset
class_name: MNIST
dataroot: None
dataset_name: MNIST
num_workers: 4
batch_size: 64
mode: train
return_cls: True
return_label: True
transforms:
- name: Normalize
mean: [127.5]
std: [127.5]
keys: [image]
params:
mode: train
test:
name: CommonVisionDataset
class_name: MNIST
dataroot: None
dataset_name: MNIST
num_workers: 0
batch_size: 64
mode: test
return_label: True
params:
mode: train
transforms:
- name: Normalize
mean: [127.5]
std: [127.5]
keys: [image]
return_cls: True


optimizer:
name: Adam
beta1: 0.5

lr_scheduler:
name: linear
name: LinearDecay
learning_rate: 0.0002
start_epoch: 100
decay_epochs: 100
# will get from real dataset
iters_per_epoch: 1

optimizer:
optimizer_G:
name: Adam
net_names:
- netG
beta1: 0.5
optimizer_D:
name: Adam
net_names:
- netD
beta1: 0.5

log_config:
interval: 100
Expand Down
3 changes: 3 additions & 0 deletions configs/pix2pix_facades.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ dataset:
preprocess:
- name: LoadImageFromFile
key: pair
- name: SplitPairedImage
key: pair
paired_keys: [A, B]
- name: Transforms
input_keys: [A, B]
pipeline:
Expand Down
2 changes: 1 addition & 1 deletion ppgan/apps/animegan_predictor.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

import paddle
from .base_predictor import BasePredictor
from ppgan.datasets.transforms import ResizeToScale
from ppgan.datasets.preprocess.transforms import ResizeToScale
import paddle.vision.transforms as T
from ppgan.models.generators import AnimeGenerator
from ppgan.utils.download import get_path_from_url
Expand Down
1 change: 1 addition & 0 deletions ppgan/datasets/preprocess/transforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
TRANSFORMS.register(T.RandomVerticalFlip)
TRANSFORMS.register(T.Normalize)
TRANSFORMS.register(T.Transpose)
TRANSFORMS.register(T.Grayscale)


@PREPROCESS.register()
Expand Down
5 changes: 3 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# limitations under the License.

from setuptools import setup
from setuptools import find_packages
from io import open

with open('requirements.txt', encoding="utf-8-sig") as f:
Expand All @@ -27,11 +28,11 @@ def readme():

setup(
name='ppgan',
packages=['ppgan'],
packages=find_packages(),
include_package_data=True,
entry_points={"console_scripts": ["paddlegan= paddlegan.paddlegan:main"]},
author='PaddlePaddle Author',
version='0.1.0',
version='2.0.0-beta',
install_requires=requirements,
license='Apache License 2.0',
description='Awesome GAN toolkits based on PaddlePaddle',
Expand Down

0 comments on commit 925bd9c

Please sign in to comment.