Image-to-Image Translation with Conditional Adversarial Networks (Pix2pix) implementation in keras

Overview

pix2pix-keras

Pix2pix implementation in keras.

Original paper: Image-to-Image Translation with Conditional Adversarial Networks (pix2pix)
Paper Authors and Researchers: Phillip Isola, Jun-Yan Zhu, Tinghui Zhou, Alexei A. Efros

To run

# clone repo and step into root dir
git clone https://github.com/williamFalcon/pix2pix-keras.git
cd pix2pix-keras/pix2pix

# download facades dataset   
python utils/facades_dataset.py

# setup conda(or virtual env)
conda create -n pix python=3.4  
source activate pix

# install requirements
pip install requirements.txt

# start training
python main.py 

About this implementation

A full write-up about this implementation is available at my blog https://www.williamfalcon.com/deeplearningimplementations/pix2pix-keras

Comments
  • concatenation error

    concatenation error

    At the moment, when I try to run the main.py script. I get the following error:

    py:222: RuntimeWarning: numpy.dtype size changed, may indicate binary incompatibility. Expected 96, got 88
      return f(*args, **kwds)
    ./pixve/lib/python3.5/importlib/_bootstrap.py:222: RuntimeWarning: numpy.dtype size changed, may indicate binary incompatibility. Expected 96, got 88
      return f(*args, **kwds)
    Traceback (most recent call last):
      File "pix2pix/main.py", line 47, in <module>
        generator_nn = UNETGenerator(input_img_dim=input_img_dim, num_output_channels=output_channels)
      File "./pix2pix/networks/generator.py", line 154, in UNETGenerator
        de_2 = merge([de_2, en_6], mode=merge_mode, concat_axis=1)
      File "./pixve/lib/python3.5/site-packages/keras/engine/topology.py", line 1680, in merge
        name=name)
      File "./pixve/lib/python3.5/site-packages/keras/engine/topology.py", line 1299, in __init__
        node_indices, tensor_indices)
      File "./pixve/lib/python3.5/site-packages/keras/engine/topology.py", line 1371, in _arguments_validation
        'Layer shapes: %s' % (input_shapes))
    ValueError: "concat" mode can only merge layers with matching output shapes except for the concat axis. Layer shapes: [(None, 6, 4, 1024), (None, 1, 4, 512)]
    

    I wonder if this could be caused by using a different version of tensorflow, as the version used was not specified anywhere. I tried tensorflow versions 1.9 and 1.7, with the same results. Perhaps you could state what version you used, and that would rule out this one variable.

    opened by jclevesque 1
  • Testing

    Testing

    Hi, Impressive work.

    I would like to ask you that in testing phase. I only feed the input to Unet generator to get the final input, am I right?.

    Thank you so much for implementing cGAN using keras.

    Bests,

    opened by 32nguyen 1
  • impossible convolution output dim

    impossible convolution output dim

    Dear all,

    I am getting this error when I keep patch size as (64,64) and image size (256, 256).--> ValueError: impossible convolution output dim: expected 1x512x1x1 but received 1x512x2x2. Can someone tell me what is going wrong here? any help is appreciated.

    opened by pranitapradhan91 3
  • Code compilation error, DCGAN, UNETGenerator incompatible shapes

    Code compilation error, DCGAN, UNETGenerator incompatible shapes

    Hi!

    I'm trying to get main.py to run, fresh out the box, after I've set up the conda environment as suggested.

    In generator.py UNETGenerator I get errors that the combined net works are not compatible size, so I have to resize each decoder to have the same size as the encoder layer, e.g. from de_6 = Convolution2D(nb_filter=512, nb_row=4, nb_col=4, border_mode='same')(de_6) to de_6 = Convolution2D(nb_filter=128, nb_row=4, nb_col=4, border_mode='same')(de_6)

    otherwise this fails: de_6 = merge([de_6, en_2], mode=merge_mode, concat_axis=1)

    Then once adjusted I get an error with DCGAN

    telling me: "ValueError: Dimensions must be equal, but are 1 and 64 for 'Conv2D_168' (op: 'Conv2D') with input shapes: [?,510,64,1], [4,4,64,64]."

    Could you suggest what I'm doing wrong?

    Thanks,

    Ben

    opened by hoyleb 0
  • Datasets for pix2pix

    Datasets for pix2pix

    Have you tried running your model on more datasets for pix2pix? If yes could you post the results of those datasets on readme. And it would be useful for people if you even add the results of facades dataset on readme as well.

    Thank You

    opened by divamgupta 1
Owner
William Falcon
PyTorch Lightning Creator. CEO Grid AI. AI PhD Researcher @nyu. Former @facebookresearch, Goldman Sachs, Columbia, NextGenVest (co-founder, acquired).
William Falcon
This repository contains several image-to-image translation models, whcih were tested for RGB to NIR image generation. The models are Pix2Pix, Pix2PixHD, CycleGAN and PointWise.

RGB2NIR_Experimental This repository contains several image-to-image translation models, whcih were tested for RGB to NIR image generation. The models

null 5 Jan 4, 2023
Implementation of the pix2pix model on satellite images

This repo shows how to implement and use the pix2pix GAN model for image to image translation. The model is demonstrated on satellite images, and the

null 3 May 24, 2022
StudioGAN is a Pytorch library providing implementations of representative Generative Adversarial Networks (GANs) for conditional/unconditional image generation.

StudioGAN is a Pytorch library providing implementations of representative Generative Adversarial Networks (GANs) for conditional/unconditional image generation.

null 3k Jan 8, 2023
A large dataset of 100k Google Satellite and matching Map images, resembling pix2pix's Google Maps dataset.

Larger Google Sat2Map dataset This dataset extends the aerial ⟷ Maps dataset used in pix2pix (Isola et al., CVPR17). The provide script download_sat2m

null 34 Dec 28, 2022
pix2pix in tensorflow.js

pix2pix in tensorflow.js This repo is moved to https://github.com/yining1023/pix2pix_tensorflowjs_lite See a live demo here: https://yining1023.github

Yining Shi 47 Oct 4, 2022
This is an implementation of Googles Yogi-Optimizer in Keras (tf.keras)

Yogi-Optimizer_Keras This is an implementation of Googles Yogi-Optimizer in Keras (tf.keras) The NeurIPS-Paper can be found here: http://papers.nips.c

null 14 Sep 13, 2022
Keras udrl - Keras implementation of Upside Down Reinforcement Learning

keras_udrl Keras implementation of Upside Down Reinforcement Learning This is me

Eder Santana 7 Jan 24, 2022
VITS: Conditional Variational Autoencoder with Adversarial Learning for End-to-End Text-to-Speech

VITS: Conditional Variational Autoencoder with Adversarial Learning for End-to-End Text-to-Speech Jaehyeon Kim, Jungil Kong, and Juhee Son In our rece

Jaehyeon Kim 1.7k Jan 8, 2023
Unofficial implement with paper SpeakerGAN: Speaker identification with conditional generative adversarial network

Introduction This repository is about paper SpeakerGAN , and is unofficially implemented by Mingming Huang ([email protected]), Tiezheng Wang (wtz920729

null 7 Jan 3, 2023
Example-custom-ml-block-keras - Custom Keras ML block example for Edge Impulse

Custom Keras ML block example for Edge Impulse This repository is an example on

Edge Impulse 8 Nov 2, 2022
Classification models 1D Zoo - Keras and TF.Keras

Classification models 1D Zoo - Keras and TF.Keras This repository contains 1D variants of popular CNN models for classification like ResNets, DenseNet

Roman Solovyev 12 Jan 6, 2023
LBK 26 Dec 28, 2022
Super-Fast-Adversarial-Training - A PyTorch Implementation code for developing super fast adversarial training

Super-Fast-Adversarial-Training This is a PyTorch Implementation code for develo

LBK 26 Dec 2, 2022
Official implementation of the paper DeFlow: Learning Complex Image Degradations from Unpaired Data with Conditional Flows

DeFlow: Learning Complex Image Degradations from Unpaired Data with Conditional Flows Official implementation of the paper DeFlow: Learning Complex Im

Valentin Wolf 86 Nov 16, 2022
Official PyTorch code for Hierarchical Conditional Flow: A Unified Framework for Image Super-Resolution and Image Rescaling (HCFlow, ICCV2021)

Hierarchical Conditional Flow: A Unified Framework for Image Super-Resolution and Image Rescaling (HCFlow, ICCV2021) This repository is the official P

Jingyun Liang 159 Dec 30, 2022
Official PyTorch code for Hierarchical Conditional Flow: A Unified Framework for Image Super-Resolution and Image Rescaling (HCFlow, ICCV2021)

Hierarchical Conditional Flow: A Unified Framework for Image Super-Resolution and Image Rescaling (HCFlow, ICCV2021) This repository is the official P

Jingyun Liang 159 Dec 30, 2022
Pytorch implementation for reproducing StackGAN_v2 results in the paper StackGAN++: Realistic Image Synthesis with Stacked Generative Adversarial Networks

StackGAN-v2 StackGAN-v1: Tensorflow implementation StackGAN-v1: Pytorch implementation Inception score evaluation Pytorch implementation for reproduci

Han Zhang 809 Dec 16, 2022
Keras implementation of Normalizer-Free Networks and SGD - Adaptive Gradient Clipping

Keras implementation of Normalizer-Free Networks and SGD - Adaptive Gradient Clipping

Yam Peleg 63 Sep 21, 2022
Code for the paper: Adversarial Training Against Location-Optimized Adversarial Patches. ECCV-W 2020.

Adversarial Training Against Location-Optimized Adversarial Patches arXiv | Paper | Code | Video | Slides Code for the paper: Sukrut Rao, David Stutz,

Sukrut Rao 32 Dec 13, 2022