forked from PaddlePaddle/Paddle
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from LielinJiang/init-commit
Add cyclegan and pixel2pixel model
- Loading branch information
Showing
42 changed files
with
2,848 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
# Byte-compiled / optimized / DLL files | ||
__pycache__/ | ||
*.py[cod] | ||
*$py.class | ||
|
||
# C extensions | ||
|
||
# Distribution / packaging | ||
.Python | ||
build/ | ||
develop-eggs/ | ||
dist/ | ||
downloads/ | ||
eggs/ | ||
.eggs/ | ||
lib/ | ||
lib64/ | ||
parts/ | ||
sdist/ | ||
var/ | ||
wheels/ | ||
*.egg-info/ | ||
.installed.cfg | ||
*.egg | ||
MANIFEST | ||
|
||
# PyInstaller | ||
# Usually these files are written by a python script from a template | ||
# before PyInstaller builds the exe, so as to inject date/other infos into it. | ||
*.manifest | ||
*.spec | ||
|
||
# Installer logs | ||
pip-log.txt | ||
pip-delete-this-directory.txt | ||
|
||
# Unit test / coverage reports | ||
htmlcov/ | ||
.tox/ | ||
.coverage | ||
.coverage.* | ||
.cache | ||
nosetests.xml | ||
coverage.xml | ||
*.cover | ||
.hypothesis/ | ||
.pytest_cache/ | ||
|
||
# Translations | ||
*.mo | ||
*.pot | ||
|
||
# Django stuff: | ||
*.log | ||
local_settings.py | ||
db.sqlite3 | ||
|
||
# Flask stuff: | ||
instance/ | ||
.webassets-cache | ||
|
||
# Scrapy stuff: | ||
.scrapy | ||
|
||
# Sphinx documentation | ||
docs/_build/ | ||
|
||
# PyBuilder | ||
target/ | ||
|
||
# Jupyter Notebook | ||
.ipynb_checkpoints | ||
|
||
# pyenv | ||
.python-version | ||
|
||
# celery beat schedule file | ||
celerybeat-schedule | ||
|
||
# SageMath parsed files | ||
*.sage.py | ||
|
||
# Environments | ||
.env | ||
.venv | ||
env/ | ||
venv/ | ||
ENV/ | ||
env.bak/ | ||
venv.bak/ | ||
|
||
# Spyder project settings | ||
.spyderproject | ||
.spyproject | ||
|
||
# Rope project settings | ||
.ropeproject | ||
|
||
# mkdocs documentation | ||
/site | ||
|
||
# mypy | ||
.mypy_cache/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,23 @@ | ||
# PaddleGAN | ||
# PaddleGAN | ||
|
||
still under development!! | ||
|
||
## Train | ||
``` | ||
python -u tools/main.py --config-file configs/cyclegan-cityscapes.yaml | ||
``` | ||
|
||
continue train from last checkpoint | ||
``` | ||
python -u tools/main.py --config-file configs/cyclegan-cityscapes.yaml --resume your_checkpoint_path | ||
``` | ||
|
||
multiple gpus train: | ||
``` | ||
CUDA_VISIBLE_DEVICES=0,1 python -m paddle.distributed.launch tools/main.py --config-file configs/pix2pix-cityscapes.yaml | ||
``` | ||
|
||
## Evaluate | ||
``` | ||
python tools/main.py --config-file configs/cyclegan-cityscapes.yaml --evaluate-only --load your_weight_path | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
epochs: 200 | ||
isTrain: True | ||
output_dir: output_dir | ||
lambda_A: 10.0 | ||
lambda_B: 10.0 | ||
lambda_identity: 0.5 | ||
|
||
model: | ||
name: CycleGANModel | ||
defaults: &defaults | ||
norm_type: instance | ||
input_nc: 3 | ||
generator: | ||
name: ResnetGenerator | ||
output_nc: 3 | ||
n_blocks: 9 | ||
ngf: 64 | ||
use_dropout: False | ||
<<: *defaults | ||
discriminator: | ||
name: NLayerDiscriminator | ||
ndf: 64 | ||
n_layers: 3 | ||
<<: *defaults | ||
gan_mode: lsgan | ||
|
||
dataset: | ||
train: | ||
name: UnalignedDataset | ||
dataroot: data/cityscapes | ||
phase: train | ||
max_dataset_size: inf | ||
direction: AtoB | ||
input_nc: 3 | ||
output_nc: 3 | ||
serial_batches: False | ||
pool_size: 50 | ||
transform: | ||
load_size: 286 | ||
crop_size: 256 | ||
preprocess: resize_and_crop | ||
no_flip: False | ||
test: | ||
name: SingleDataset | ||
dataroot: data/cityscapes/testB | ||
max_dataset_size: inf | ||
direction: BtoA | ||
input_nc: 3 | ||
output_nc: 3 | ||
serial_batches: False | ||
pool_size: 50 | ||
transform: | ||
load_size: 256 | ||
crop_size: 256 | ||
preprocess: resize_and_crop | ||
no_flip: True | ||
|
||
|
||
optimizer: | ||
name: Adam | ||
beta1: 0.5 | ||
lr_scheduler: | ||
name: linear | ||
learning_rate: 0.0002 | ||
start_epoch: 100 | ||
decay_epochs: 100 | ||
|
||
log_config: | ||
interval: 100 | ||
visiual_interval: 500 | ||
|
||
snapshot_config: | ||
interval: 5 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
epochs: 200 | ||
isTrain: True | ||
output_dir: output_dir | ||
lambda_A: 10.0 | ||
lambda_B: 10.0 | ||
lambda_identity: 0.5 | ||
|
||
model: | ||
name: CycleGANModel | ||
defaults: &defaults | ||
norm_type: instance | ||
input_nc: 3 | ||
generator: | ||
name: ResnetGenerator | ||
output_nc: 3 | ||
n_blocks: 9 | ||
ngf: 64 | ||
use_dropout: False | ||
<<: *defaults | ||
discriminator: | ||
name: NLayerDiscriminator | ||
ndf: 64 | ||
n_layers: 3 | ||
<<: *defaults | ||
gan_mode: lsgan | ||
|
||
dataset: | ||
train: | ||
name: UnalignedDataset | ||
dataroot: data/horse2zebra | ||
phase: train | ||
max_dataset_size: inf | ||
direction: AtoB | ||
input_nc: 3 | ||
output_nc: 3 | ||
serial_batches: False | ||
pool_size: 50 | ||
transform: | ||
load_size: 286 | ||
crop_size: 256 | ||
preprocess: resize_and_crop | ||
no_flip: False | ||
test: | ||
name: SingleDataset | ||
dataroot: data/horse2zebra/testA | ||
max_dataset_size: inf | ||
direction: AtoB | ||
input_nc: 3 | ||
output_nc: 3 | ||
serial_batches: False | ||
pool_size: 50 | ||
transform: | ||
load_size: 256 | ||
crop_size: 256 | ||
preprocess: resize_and_crop | ||
no_flip: True | ||
|
||
|
||
optimizer: | ||
name: Adam | ||
beta1: 0.5 | ||
lr_scheduler: | ||
name: linear | ||
learning_rate: 0.0002 | ||
start_epoch: 100 | ||
decay_epochs: 100 | ||
|
||
log_config: | ||
interval: 100 | ||
visiual_interval: 500 | ||
|
||
snapshot_config: | ||
interval: 5 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
epochs: 200 | ||
isTrain: True | ||
output_dir: output_dir | ||
lambda_L1: 100 | ||
|
||
model: | ||
name: Pix2PixModel | ||
generator: | ||
name: UnetGenerator | ||
norm_type: batch | ||
input_nc: 3 | ||
output_nc: 3 | ||
num_downs: 8 #unet256 | ||
ngf: 64 | ||
use_dropout: False | ||
discriminator: | ||
name: NLayerDiscriminator | ||
ndf: 64 | ||
n_layers: 3 | ||
input_nc: 6 | ||
norm_type: batch | ||
gan_mode: vanilla | ||
|
||
dataset: | ||
train: | ||
name: AlignedDataset | ||
dataroot: data/cityscapes | ||
phase: train | ||
max_dataset_size: inf | ||
direction: BtoA | ||
input_nc: 3 | ||
output_nc: 3 | ||
serial_batches: False | ||
pool_size: 0 | ||
transform: | ||
load_size: 286 | ||
crop_size: 256 | ||
preprocess: resize_and_crop | ||
no_flip: False | ||
test: | ||
name: AlignedDataset | ||
dataroot: data/cityscapes/ | ||
phase: test | ||
max_dataset_size: inf | ||
direction: BtoA | ||
input_nc: 3 | ||
output_nc: 3 | ||
serial_batches: True | ||
pool_size: 50 | ||
transform: | ||
load_size: 256 | ||
crop_size: 256 | ||
preprocess: resize_and_crop | ||
no_flip: True | ||
|
||
optimizer: | ||
name: Adam | ||
beta1: 0.5 | ||
lr_scheduler: | ||
name: linear | ||
learning_rate: 0.0004 | ||
start_epoch: 100 | ||
decay_epochs: 100 | ||
|
||
log_config: | ||
interval: 100 | ||
visiual_interval: 500 | ||
|
||
snapshot_config: | ||
interval: 5 | ||
|
Oops, something went wrong.