Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
198 commits
Select commit Hold shift + click to select a range
c0632ec
requires_grad for speedup
junyanz May 28, 2018
cf92db5
support for configurable argparse options by model classes
taesungp Jun 7, 2018
7891385
Multiple changes regarding option management. See below.
taesungp Jun 7, 2018
08f4de1
Display helpful error message and exits when the visdom server is not on
taesungp Jun 8, 2018
508c014
1. datasets are now configured automatically based on dataset_mode op…
taesungp Jun 13, 2018
59d9ced
TestModel now supports model_suffix option that can change the name o…
taesungp Jun 13, 2018
6d9e173
Update README.md
taesungp Jun 13, 2018
06d4d43
fix the error doc in the data init helper function
leVirve Jun 19, 2018
c0a338f
Merge pull request #297 from leVirve-arxiv/master
junyanz Jul 3, 2018
2ecf15f
add init_gain flag for scaling factor in the initialization
junyanz Jul 4, 2018
2dca893
added pretrained models of cyclegan
taesungp Jul 10, 2018
e95f65b
Update README.md
taesungp Jul 10, 2018
0d45962
Update README.md
taesungp Jul 10, 2018
6aa9a27
Forward compatibility between PyTorch 0.4.0 and 0.5.0 on InstanceNorm
taesungp Jul 13, 2018
9451e70
Merge branch 'master' of https://github.com/junyanz/pytorch-CycleGAN-…
taesungp Jul 13, 2018
5726675
Fixed a bug while loading old pix2pix models
taesungp Jul 25, 2018
f70e2ac
merge and reorganize the scripts
junyanz Jul 25, 2018
39ecc01
update README
junyanz Jul 27, 2018
68c10ba
Update README.md
junyanz Jul 27, 2018
5d1b952
update README.md
junyanz Jul 27, 2018
2a20f06
Merge branch 'master' of https://github.com/junyanz/pytorch-CycleGAN-…
junyanz Jul 27, 2018
2636b6a
Update tips.md
taesungp Jul 27, 2018
858d7d2
Update qa.md
taesungp Jul 27, 2018
bcfbb81
Support visdom enviroment option
ssnl Jul 29, 2018
a1c5f06
add "frequently answered questions"
junyanz Aug 27, 2018
568ad02
update README and q & a
junyanz Aug 27, 2018
8c5c380
update q & a
junyanz Aug 27, 2018
47189e6
update README
junyanz Sep 2, 2018
6593b36
update README
junyanz Sep 2, 2018
2b48d70
update README
junyanz Sep 2, 2018
985f3b7
update README
junyanz Sep 2, 2018
bd69f2b
update pix2pix dataset download links
junyanz Sep 2, 2018
2b7c813
add dataset bibtex
junyanz Sep 2, 2018
2a7c96f
Add Q&A section on PyTorch CUDA error.
ssnl Sep 2, 2018
a097c0e
update datasets
junyanz Sep 2, 2018
f7e5888
Merge branch 'master' of https://github.com/junyanz/pytorch-CycleGAN-…
junyanz Sep 2, 2018
67a7ac8
change options names
junyanz Sep 3, 2018
65e3da2
Update networks.py
Naruto-Sasuke Sep 4, 2018
8282ac9
Update train_options.py
Naruto-Sasuke Sep 4, 2018
d7e7ed8
Merge pull request #367 from Naruto-Sasuke/master
junyanz Sep 4, 2018
9fc9eef
remove which_; add day2night model
junyanz Sep 9, 2018
40b8301
move display options to train_options
junyanz Sep 9, 2018
f14391d
Bump min PyTorch version number
ssnl Sep 11, 2018
5a242d7
requires 0.4
ssnl Sep 11, 2018
fc1aca1
Fix ConnectionError not available in py2
ssnl Sep 13, 2018
f8c98b0
move display_winsize to base_options
Sep 14, 2018
7dfdd06
Set eval mode in test.py
ssnl Sep 14, 2018
bf944fe
typo
ssnl Sep 14, 2018
236783d
update README and add comments to test code
junyanz Sep 14, 2018
b0e64d4
add a flag to enable eval mode during test time
junyanz Sep 14, 2018
5db1837
Update tips.md
taesungp Sep 17, 2018
bec9ff8
Update tips.md
taesungp Sep 17, 2018
c692b54
Update tips.md
taesungp Sep 17, 2018
5c1a0ef
update doc
Sep 17, 2018
3f41517
update doc
Sep 17, 2018
6ab64f5
Update tips.md
junyanz Sep 17, 2018
7132304
explain randrange error to q & a
junyanz Sep 18, 2018
bea4b1c
update q & a
junyanz Sep 18, 2018
4399772
update training/test tips
junyanz Sep 19, 2018
fdc7fcd
explain identity loss in q & a
junyanz Sep 19, 2018
a2ab5cc
comments about cycada
taesungp Oct 1, 2018
639fc50
Update networks.py
junyanz Oct 3, 2018
a1c237c
update combine_A_and_B
junyanz Oct 5, 2018
bc2917e
Update networks.py
junyanz Oct 23, 2018
c52c2d9
Moved instruction for deps installation after cloning repo
Oct 25, 2018
1fa94d7
Merge pull request #412 from alkukampela/master
junyanz Oct 25, 2018
fe3bc52
add instructions for test_model
junyanz Nov 9, 2018
4f940f5
update README
junyanz Nov 9, 2018
2e04baa
update README
junyanz Nov 9, 2018
9346db4
Update train.py
Naruto-Sasuke Nov 9, 2018
b557380
Update train_options.py
Naruto-Sasuke Nov 9, 2018
aa959de
Update test_options.py
Naruto-Sasuke Nov 9, 2018
3a3d969
Update base_options.py
Naruto-Sasuke Nov 9, 2018
47ad060
Update base_model.py
Naruto-Sasuke Nov 9, 2018
bcbb699
Fix bug at continue training.
Naruto-Sasuke Nov 9, 2018
9cb41c6
change --iter to --load_iter
Naruto-Sasuke Nov 12, 2018
4ab494a
delete save_iter_freq
Naruto-Sasuke Nov 12, 2018
19e0286
Update train.py
Naruto-Sasuke Nov 12, 2018
b80c46b
nit
Naruto-Sasuke Nov 12, 2018
4a05d21
Merge pull request #434 from Naruto-Sasuke/master
junyanz Nov 12, 2018
c318529
fix small bug, remove load_by_iter
junyanz Nov 12, 2018
1816fc5
fix a typo
junyanz Nov 13, 2018
afbb08a
update README and fix the load_ter str
junyanz Nov 13, 2018
b391d62
update README
junyanz Nov 13, 2018
cfe9071
update README
junyanz Nov 15, 2018
6da58c7
Removed unneeded `self.input` attribute
PeterFogh Nov 16, 2018
74c884a
Merge pull request #444 from PeterFogh/patch-1
junyanz Nov 17, 2018
615fb8a
add dataset preparation tips
junyanz Nov 19, 2018
42d0bc7
Update tips.md
Morpheus3000 Nov 20, 2018
0442670
Merge pull request #447 from Morpheus3000/patch-1
junyanz Nov 20, 2018
dd5cde1
Update qa.md
junyanz Dec 11, 2018
9a9c1ce
add edge detection and cityscape scripts
Dec 11, 2018
c8323f9
update README
Dec 11, 2018
da06d3b
added Dockerfile and pre-built Docker image
taesungp Dec 21, 2018
2ba0912
updated README.md
taesungp Dec 21, 2018
cf116ec
add an assertion (input_nc==output_nc) for identity loss
junyanz Dec 21, 2018
c34e5c9
fix issue about identity loss
Dec 24, 2018
1bc7994
update dataset loader
junyanz Dec 25, 2018
197ca33
add colorization mode
junyanz Dec 25, 2018
0fb7184
fix the test code for colorization
junyanz Dec 26, 2018
2740a99
add documentation to flag options
junyanz Dec 26, 2018
f121b14
update README
Dec 27, 2018
39e6060
update readme and docker instruction
junyanz Dec 27, 2018
0a3cdf4
update docker instruction
junyanz Dec 27, 2018
f138c3f
Fix type
alexkassil Dec 31, 2018
cf0a542
Fix typo
alexkassil Dec 31, 2018
e5ffdf7
Fix incorrect commandline argument
alexkassil Dec 31, 2018
98ef4e3
Merge pull request #480 from alexkassil/patch-1
junyanz Dec 31, 2018
aa86133
Merge pull request #481 from alexkassil/patch-2
junyanz Dec 31, 2018
a91517a
Merge pull request #482 from alexkassil/patch-3
junyanz Dec 31, 2018
e04e31e
add model and dataset templates
junyanz Dec 31, 2018
edf4cf3
replace initializer by __init__ for models and datasets
junyanz Dec 31, 2018
e1158c6
update README
junyanz Dec 31, 2018
5109667
rename pix2pix_colorization by colorization; add overview.md
junyanz Dec 31, 2018
42c8e90
update README
junyanz Jan 1, 2019
032e884
improve GANLoss class
junyanz Jan 1, 2019
49390fa
add sanity check for template model and colorization model
junyanz Jan 1, 2019
144d117
add abstractmethod for base_model and base_dataset
junyanz Jan 1, 2019
2df0919
add documentation about datasets and options
junyanz Jan 1, 2019
92d4afb
remove name functions & update overview
junyanz Jan 2, 2019
dc25d96
add models documentation
junyanz Jan 2, 2019
7cd7c14
update overview
junyanz Jan 2, 2019
e20a472
update README
junyanz Jan 2, 2019
af16cd1
add docstrings: train.py/test.py
junyanz Jan 2, 2019
2253c33
change order for training a model
heaversm Jan 2, 2019
82b7452
Merge pull request #486 from heaversm/patch-3
junyanz Jan 2, 2019
8a76751
renaming: loadSize->load_size; fineSize -> crop_size
junyanz Jan 3, 2019
cbe0857
improve dataset class: max_dataset_size and aligned_dataset
junyanz Jan 3, 2019
7eb2922
improve aligned_dataset
junyanz Jan 3, 2019
c047c55
renaming: resize_or_crop -> preprocess
junyanz Jan 3, 2019
8cc270b
add comments: datasets
junyanz Jan 3, 2019
3bdcc65
add comments: utils and options
junyanz Jan 3, 2019
5c8b122
fix issues about visualizer
junyanz Jan 4, 2019
2215995
update comments for datasets, options, and utils
junyanz Jan 4, 2019
d22bb50
add comments: models
junyanz Jan 4, 2019
48ced5e
add comments: networks.py
Jan 5, 2019
8c0e4b5
update comments: networks
Jan 6, 2019
6693a59
add mini_colorization dataset and remove imagepool from pix2pix
junyanz Jan 6, 2019
24c0b25
update comments
junyanz Jan 6, 2019
d5a8367
"ae_photos" was duplicated, delete it.
yt6t6t Jan 7, 2019
5762f5b
Merge pull request #491 from yt6t6t/patch-1
junyanz Jan 8, 2019
bd73e45
automatically create visdom connections
Jan 10, 2019
4eaf9e4
add self.metric for ReduceLROnPlateau optimizer
junyanz Jan 11, 2019
f27da7d
Refactored the Dataset code to support different preprocess options f…
taesungp Jan 11, 2019
d5cfa4d
Merge branch 'master' of https://github.com/junyanz/pytorch-CycleGAN-…
taesungp Jan 11, 2019
ba80e92
simplify dataset loader code
junyanz Jan 13, 2019
6362195
remove Non-ASCII character '\xef'
micmelesse Jan 14, 2019
4cd98a5
Merge pull request #499 from micmelesse/master
junyanz Jan 14, 2019
24ac152
Update qa.md
junyanz Jan 21, 2019
3010c01
update misplaced comment
yichunk Jan 25, 2019
c028d9f
Merge pull request #506 from jacky841102/patch-1
junyanz Jan 25, 2019
58d37e1
Fixed a typo in the comment of gather_option function
ahmedhasandrlnd Jan 27, 2019
a0f535f
Merge pull request #509 from ahmedhasandrlnd/master
junyanz Jan 28, 2019
28dc61b
add map2sat & update test script
junyanz Jan 31, 2019
e2e4d05
Update tips.md
junyanz Feb 1, 2019
690470c
Update cycle_gan_model.py
junyanz Feb 7, 2019
2686057
Update base_model.py
junyanz Feb 18, 2019
18a40e6
fix html typo
ssnl Mar 4, 2019
3fbec10
fix learning rate policy
junyanz Mar 26, 2019
0bcfcea
Update environment.yml
junyanz Mar 27, 2019
fb1b4f1
Update combine_A_and_B.py
junyanz Mar 31, 2019
c05b30e
separate save train and test options
kagudkovArt Apr 1, 2019
95f3a19
Merge pull request #598 from UPML/master
junyanz Apr 2, 2019
93254a1
Update README.md
junyanz Apr 7, 2019
b775115
fixed error in tips.md
Apr 7, 2019
3a9943c
Merge pull request #605 from stephencwelch/master
junyanz Apr 8, 2019
6613ad1
Update requirements.txt
junyanz Apr 14, 2019
970781f
update cityscape evaluation (based on tinghuiz tips)
junyanz Apr 14, 2019
56f9c09
update cityscape evaluation (based on tinghuiz tips)
junyanz Apr 14, 2019
22fe446
update data loader
junyanz Apr 14, 2019
0bc0833
Corrected the linked lines appropriately.
ecoopnet Apr 24, 2019
f972f32
Merge pull request #628 from ecoopnet/fix/q-and-a
junyanz Apr 27, 2019
7cdcd53
fix bug for none initialization
junyanz Apr 29, 2019
f3d7c40
Create random wgangp alpha directly on device
orenkatzir May 27, 2019
a21052d
Merge pull request #655 from orenkatzir/master
junyanz May 28, 2019
272d7de
Update README.md
junyanz Jun 4, 2019
656b932
Update test_model.py
junyanz Jun 10, 2019
8a61754
Fix a typo suggested by @JingWang18
junyanz Jul 9, 2019
41931e2
Update networks.py
junyanz Jul 9, 2019
858661f
Update datasets.md
taesungp Jul 13, 2019
6c48365
Update README.md
taesungp Jul 13, 2019
aec7ae3
Update README.md
taesungp Jul 13, 2019
07ae2e9
Update dataset directory for colorization
junyanz Jul 18, 2019
e6c1b29
added script to process the Cityscapes dataset.
taesungp Aug 12, 2019
27c4ec0
added documentation about the new Cityscapes dataset download policy
taesungp Aug 13, 2019
dca9002
replace scipy.misc.imresize (suggested by @grochefort)
junyanz Aug 16, 2019
08af6e4
Update README.md
junyanz Aug 23, 2019
43521b0
Update README.md
junyanz Sep 7, 2019
b90e1f0
Add CycleGAN colab notebook
bilal2vec Oct 4, 2019
0cdc993
Add Pix2Pix colab notebook
bilal2vec Oct 4, 2019
7c6c648
Add colab badges to README
bilal2vec Oct 4, 2019
267aca8
update edge processing code
junyanz Oct 6, 2019
53dcbdb
Merge pull request #783 from bkkaggle/master
junyanz Oct 7, 2019
3d89d7f
add colab notebook
Oct 7, 2019
d7d31d0
Update qa.md
junyanz Oct 11, 2019
b463f3e
fix visualizer reset
junyanz Oct 16, 2019
ae74521
Merge branch 'master' of https://github.com/junyanz/pytorch-CycleGAN-…
junyanz Oct 16, 2019
bae31ec
add opt.load_iter to the test code
junyanz Oct 17, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
255 changes: 255 additions & 0 deletions CycleGAN.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,255 @@
{
"nbformat": 4,
"nbformat_minor": 0,
"metadata": {
"colab": {
"name": "CycleGAN",
"provenance": [],
"collapsed_sections": [],
"include_colab_link": true
},
"kernelspec": {
"name": "python3",
"display_name": "Python 3"
},
"accelerator": "GPU"
},
"cells": [
{
"cell_type": "markdown",
"metadata": {
"id": "view-in-github",
"colab_type": "text"
},
"source": [
"<a href=\"https://colab.research.google.com/github/bkkaggle/pytorch-CycleGAN-and-pix2pix/blob/master/CycleGAN.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "5VIGyIus8Vr7",
"colab_type": "text"
},
"source": [
"Take a look at the [repository](https://github.com/junyanz/pytorch-CycleGAN-and-pix2pix) for more information"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "7wNjDKdQy35h",
"colab_type": "text"
},
"source": [
"# Install"
]
},
{
"cell_type": "code",
"metadata": {
"id": "TRm-USlsHgEV",
"colab_type": "code",
"colab": {}
},
"source": [
"!git clone https://github.com/junyanz/pytorch-CycleGAN-and-pix2pix"
],
"execution_count": 0,
"outputs": []
},
{
"cell_type": "code",
"metadata": {
"id": "Pt3igws3eiVp",
"colab_type": "code",
"colab": {}
},
"source": [
"import os\n",
"os.chdir('pytorch-CycleGAN-and-pix2pix/')"
],
"execution_count": 0,
"outputs": []
},
{
"cell_type": "code",
"metadata": {
"id": "z1EySlOXwwoa",
"colab_type": "code",
"colab": {}
},
"source": [
"!pip install -r requirements.txt"
],
"execution_count": 0,
"outputs": []
},
{
"cell_type": "markdown",
"metadata": {
"id": "8daqlgVhw29P",
"colab_type": "text"
},
"source": [
"# Datasets\n",
"\n",
"Download one of the official datasets with:\n",
"\n",
"- `bash ./datasets/download_cyclegan_dataset.sh [apple2orange, orange2apple, summer2winter_yosemite, winter2summer_yosemite, horse2zebra, zebra2horse, monet2photo, style_monet, style_cezanne, style_ukiyoe, style_vangogh, sat2map, map2sat, cityscapes_photo2label, cityscapes_label2photo, facades_photo2label, facades_label2photo, iphone2dslr_flower]`\n",
"\n",
"Or use your own dataset by creating the appropriate folders and adding in the images.\n",
"\n",
"- Create a dataset folder under `/dataset` for your dataset.\n",
"- Create subfolders `testA`, `testB`, `trainA`, and `trainB` under your dataset's folder. Place any images you want to transform from a to b (cat2dog) in the `testA` folder, images you want to transform from b to a (dog2cat) in the `testB` folder, and do the same for the `trainA` and `trainB` folders."
]
},
{
"cell_type": "code",
"metadata": {
"id": "vrdOettJxaCc",
"colab_type": "code",
"colab": {}
},
"source": [
"!bash ./datasets/download_cyclegan_dataset.sh horse2zebra"
],
"execution_count": 0,
"outputs": []
},
{
"cell_type": "markdown",
"metadata": {
"id": "gdUz4116xhpm",
"colab_type": "text"
},
"source": [
"# Pretrained models\n",
"\n",
"Download one of the official pretrained models with:\n",
"\n",
"- `bash ./scripts/download_cyclegan_model.sh [apple2orange, orange2apple, summer2winter_yosemite, winter2summer_yosemite, horse2zebra, zebra2horse, monet2photo, style_monet, style_cezanne, style_ukiyoe, style_vangogh, sat2map, map2sat, cityscapes_photo2label, cityscapes_label2photo, facades_photo2label, facades_label2photo, iphone2dslr_flower]`\n",
"\n",
"Or add your own pretrained model to `./checkpoints/{NAME}_pretrained/latest_net_G.pt`"
]
},
{
"cell_type": "code",
"metadata": {
"id": "B75UqtKhxznS",
"colab_type": "code",
"colab": {}
},
"source": [
"!bash ./scripts/download_cyclegan_model.sh horse2zebra"
],
"execution_count": 0,
"outputs": []
},
{
"cell_type": "markdown",
"metadata": {
"id": "yFw1kDQBx3LN",
"colab_type": "text"
},
"source": [
"# Training\n",
"\n",
"- `python train.py --dataroot ./datasets/horse2zebra --name horse2zebra --model cycle_gan`\n",
"\n",
"Change the `--dataroot` and `--name` to your own dataset's path and model's name. Use `--gpu_ids 0,1,..` to train on multiple GPUs and `--batch_size` to change the batch size. I've found that a batch size of 16 fits onto 4 V100s and can finish training an epoch in ~90s.\n",
"\n",
"Once your model has trained, copy over the last checkpoint to a format that the testing model can automatically detect:\n",
"\n",
"Use `cp ./checkpoints/horse2zebra/latest_net_G_A.pth ./checkpoints/horse2zebra/latest_net_G.pth` if you want to transform images from class A to class B and `cp ./checkpoints/horse2zebra/latest_net_G_B.pth ./checkpoints/horse2zebra/latest_net_G.pth` if you want to transform images from class B to class A.\n"
]
},
{
"cell_type": "code",
"metadata": {
"id": "0sp7TCT2x9dB",
"colab_type": "code",
"colab": {}
},
"source": [
"!python train.py --dataroot ./datasets/horse2zebra --name horse2zebra --model cycle_gan"
],
"execution_count": 0,
"outputs": []
},
{
"cell_type": "markdown",
"metadata": {
"id": "9UkcaFZiyASl",
"colab_type": "text"
},
"source": [
"# Testing\n",
"\n",
"- `python test.py --dataroot datasets/horse2zebra/testA --name horse2zebra_pretrained --model test --no_dropout`\n",
"\n",
"Change the `--dataroot` and `--name` to be consistent with your trained model's configuration.\n",
"\n",
"> from https://github.com/junyanz/pytorch-CycleGAN-and-pix2pix:\n",
"> The option --model test is used for generating results of CycleGAN only for one side. This option will automatically set --dataset_mode single, which only loads the images from one set. On the contrary, using --model cycle_gan requires loading and generating results in both directions, which is sometimes unnecessary. The results will be saved at ./results/. Use --results_dir {directory_path_to_save_result} to specify the results directory.\n",
"\n",
"> For your own experiments, you might want to specify --netG, --norm, --no_dropout to match the generator architecture of the trained model."
]
},
{
"cell_type": "code",
"metadata": {
"id": "uCsKkEq0yGh0",
"colab_type": "code",
"colab": {}
},
"source": [
"!python test.py --dataroot datasets/horse2zebra/testA --name horse2zebra_pretrained --model test --no_dropout"
],
"execution_count": 0,
"outputs": []
},
{
"cell_type": "markdown",
"metadata": {
"id": "OzSKIPUByfiN",
"colab_type": "text"
},
"source": [
"# Visualize"
]
},
{
"cell_type": "code",
"metadata": {
"id": "9Mgg8raPyizq",
"colab_type": "code",
"colab": {}
},
"source": [
"import matplotlib.pyplot as plt\n",
"\n",
"img = plt.imread('./results/horse2zebra_pretrained/test_latest/images/n02381460_1010_fake.png')\n",
"plt.imshow(img)"
],
"execution_count": 0,
"outputs": []
},
{
"cell_type": "code",
"metadata": {
"id": "0G3oVH9DyqLQ",
"colab_type": "code",
"colab": {}
},
"source": [
"import matplotlib.pyplot as plt\n",
"\n",
"img = plt.imread('./results/horse2zebra_pretrained/test_latest/images/n02381460_1010_real.png')\n",
"plt.imshow(img)"
],
"execution_count": 0,
"outputs": []
}
]
}
Loading