Skip to main content

Complex values in Keras - Deep learning for humans

Project description

Complex-Valued Neural Networks in Keras with Tensorflow

Documentation PyPI Status PyPI Versions Build Status PyPI License

Complex-valued convolutions could provide some interesting results in signal processing-based deep learning. A simple(-ish) idea is including explicit phase information of time series in neural networks. This code enables complex-valued convolution in convolutional neural networks in keras with the TensorFlow backend. This makes the network modular and interoperable with standard keras layers and operations.

This code is very much in Alpha. Please consider helping out improving the code to advance together. This repository is based on the code which reproduces experiments presented in the paper Deep Complex Networks. It is a port to Keras with Tensorflow-backend.


  • numpy
  • scipy
  • scikit-learn
  • keras
  • tensorflow 1.X or tensorflow-gpu 1.X

Install requirements for computer vision experiments with pip:

pip install -f requirements.txt

For the non-gpu version:

pip install -f requirements-nogpu.txt

Depending on your Python installation you might want to use anaconda or other tools.


pip install keras-complex


pip install tensorflow-gpu


Build your neural networks with the help of keras.

import complexnn

import keras
from keras import models
from keras import layers
from keras import optimizers

model = models.Sequential()

model.add(complexnn.conv.ComplexConv2D(32, (3, 3), activation='modrelu', padding='same', input_shape=input_shape))
model.add(layers.MaxPooling2D((2, 2), padding='same'))

model.compile(optimizer=optimizers.Adam(), loss='mse')


Please cite the original work as:

@ARTICLE {Trabelsi2017,
    author  = "Chiheb Trabelsi, Olexa Bilaniuk, Ying Zhang, Dmitriy Serdyuk, Sandeep Subramanian, João Felipe Santos, Soroush Mehri, Negar Rostamzadeh, Yoshua Bengio, Christopher J Pal",
    title   = "Deep Complex Networks",
    journal = "arXiv preprint arXiv:1705.09792",
    year    = "2017"

Cite this software version as:

    title     = {Complex-Valued Neural Networks in Keras with Tensorflow}, 
    url       = {}, 
    DOI       = {10.6084/m9.figshare.9783773}, 
    publisher = {figshare}, 
    author    = {Dramsch, Jesper S{\"o}ren and Contributors}, 
    year      = {2019}

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

keras-complex-0.1.3.tar.gz (31.7 kB view hashes)

Uploaded source

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page