cvnn
Library to help implement a complex-valued neural network (cvnn) using tensorflow as back-end
Science Score: 77.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
✓CITATION.cff file
Found CITATION.cff file -
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
✓DOI references
Found 3 DOI reference(s) in README -
✓Academic publication links
Links to: arxiv.org, zenodo.org -
✓Committers with academic emails
2 of 3 committers (66.7%) from academic institutions -
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (13.3%) to scientific vocabulary
Keywords
Repository
Library to help implement a complex-valued neural network (cvnn) using tensorflow as back-end
Basic Info
- Host: GitHub
- Owner: NEGU93
- License: mit
- Language: Python
- Default Branch: master
- Homepage: https://complex-valued-neural-networks.readthedocs.io/
- Size: 52.7 MB
Statistics
- Stars: 179
- Watchers: 9
- Forks: 36
- Open Issues: 16
- Releases: 4
Topics
Metadata Files
README.md
Complex-Valued Neural Networks (CVNN)
Done by @NEGU93 - J. Agustin Barrachina
[!WARNING] This library is deprecated. In particular, it seems not to work correctly with TF version 2.16+.
Using this library, the only difference with a Tensorflow code is that you should use cvnn.layers module instead of tf.keras.layers.
This is a library that uses Tensorflow as a back-end to do complex-valued neural networks as CVNNs are barely supported by Tensorflow and not even supported yet for pytorch (reason why I decided to use Tensorflow for this library). To the authors knowledge, this is the first library that actually works with complex data types instead of real value vectors that are interpreted as real and imaginary part.
Update: - Since v1.12 (28 June 2022), Complex32 and Complex Convolutions in PyTorch. - Since v0.2 (25 Jan 2021) complexPyTorch uses complex64 dtype. - Since v1.6 (28 July 2020), pytorch now supports complex vectors and complex gradient as BETA. But still have the same issues that Tensorflow has, so no reason to migrate yet.
Documentation
Please Read the Docs
Instalation Guide:
Using Anaconda
conda install -c negu93 cvnn
Using PIP
pip install cvnn
Short example
From "outside" everything is the same as when using Tensorflow.
``` python import numpy as np import tensorflow as tf
Assume you already have complex data... example numpy arrays of dtype np.complex64
(trainimages, trainlabels), (testimages, testlabels) = get_dataset() # to be done by each user
model = get_model() # Get your model
Compile as any TensorFlow model
model.compile(optimizer='adam', metrics=['accuracy'], loss=tf.keras.losses.SparseCategoricalCrossentropy(from_logits=True)) model.summary()
Train and evaluate
history = model.fit(trainimages, trainlabels, epochs=epochs, validationdata=(testimages, testlabels))
testloss, testacc = model.evaluate(testimages, test_labels, verbose=2)
``
The main difference is that you will be usingcvnn` layers instead of Tensorflow layers.
There are some options on how to do it as shown here:
Sequential API
``` py import cvnn.layers as complex_layers
def getmodel():
model = tf.keras.models.Sequential()
model.add(complexlayers.ComplexInput(inputshape=(32, 32, 3))) # Always use ComplexInput at the start
model.add(complexlayers.ComplexConv2D(32, (3, 3), activation='cartrelu'))
model.add(complexlayers.ComplexAvgPooling2D((2, 2)))
model.add(complexlayers.ComplexConv2D(64, (3, 3), activation='cartrelu'))
model.add(complexlayers.ComplexMaxPooling2D((2, 2)))
model.add(complexlayers.ComplexConv2D(64, (3, 3), activation='cartrelu'))
model.add(complexlayers.ComplexFlatten())
model.add(complexlayers.ComplexDense(64, activation='cartrelu'))
model.add(complexlayers.ComplexDense(10, activation='converttorealwith_abs'))
# An activation that casts to real must be used at the last layer.
# The loss function cannot minimize a complex number
return model
```
Functional API
``` python import cvnn.layers as complexlayers def getmodel(): inputs = complexlayers.complexinput(shape=(128, 128, 3)) c0 = complexlayers.ComplexConv2D(32, activation='cartrelu', kernelsize=3)(inputs) c1 = complexlayers.ComplexConv2D(32, activation='cartrelu', kernelsize=3)(c0) c2 = complexlayers.ComplexMaxPooling2D(poolsize=(2, 2), strides=(2, 2), padding='valid')(c1) t01 = complexlayers.ComplexConv2DTranspose(5, kernelsize=2, strides=(2, 2), activation='cart_relu')(c2) concat01 = tf.keras.layers.concatenate([t01, c1], axis=-1)
c3 = complex_layers.ComplexConv2D(4, activation='cart_relu', kernel_size=3)(concat01)
out = complex_layers.ComplexConv2D(4, activation='cart_relu', kernel_size=3)(c3)
return tf.keras.Model(inputs, out)
```
Project status
I currently work as a full-time employee and therefore the mantainance of this repository has been reduced or stopped. I would happily welcome anyone who wishes to fork the project or volunteer to step in as a maintainer or owner, allowing the project to keep going.
About me & Motivation
I am a PhD student from Ecole CentraleSupelec with a scholarship from ONERA and the DGA
I am basically working with Complex-Valued Neural Networks for my PhD topic. In the need of making my coding more dynamic I build a library not to have to repeat the same code over and over for little changes and accelerate therefore my coding.
Cite Me
Alway prefer the Zenodo citation.
Next you have a model but beware to change the version and date accordingly.
bib
@software{j_agustin_barrachina_2022_7303587,
author = {J Agustin Barrachina},
title = {NEGU93/cvnn: Complex-Valued Neural Networks},
month = nov,
year = 2022,
publisher = {Zenodo},
version = {v2.0},
doi = {10.5281/zenodo.7303587},
url = {https://doi.org/10.5281/zenodo.7303587}
}
Issues
For any issues please report them in here
This library is tested using pytest.

Owner
- Name: J Agustin Barrachina
- Login: NEGU93
- Kind: user
- Location: France
- Company: SAFRAN Data Systems
- Website: https://negu93.github.io/
- Repositories: 3
- Profile: https://github.com/NEGU93
Electronical Engineer with focus on Signal Processing. Interests: Voice Processing, Image Processing, Machine Learning.
Citation (citation.cff)
cff-version: 1.0 message: "If you use this software, please cite it as below." authors: - family-names: "BARRACHINA" given-names: "Jose Agustin" orcid: "https://orcid.org/0000-0002-2139-514X" title: "Complex-Valued Neural Networks (CVNN)" version: 1.0.3 doi: https://doi.org/10.5281/zenodo.4452131 date-released: 2019 url: "https://github.com/NEGU93/cvnn"
GitHub Events
Total
- Issues event: 2
- Watch event: 18
- Issue comment event: 3
- Push event: 3
- Pull request event: 3
- Fork event: 8
- Create event: 2
Last Year
- Issues event: 2
- Watch event: 18
- Issue comment event: 3
- Push event: 3
- Pull request event: 3
- Fork event: 8
- Create event: 2
Committers
Last synced: almost 3 years ago
All Time
- Total Commits: 716
- Total Committers: 3
- Avg Commits per committer: 238.667
- Development Distribution Score (DDS): 0.425
Top Committers
| Name | Commits | |
|---|---|---|
| NEGU93 | j****a@g****m | 412 |
| 2019barrachija | j****a@c****r | 298 |
| Joe Peetz | j****z@d****u | 6 |
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: 9 months ago
All Time
- Total issues: 50
- Total pull requests: 6
- Average time to close issues: 24 days
- Average time to close pull requests: 3 days
- Total issue authors: 38
- Total pull request authors: 4
- Average comments per issue: 3.56
- Average comments per pull request: 0.17
- Merged pull requests: 5
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 5
- Pull requests: 2
- Average time to close issues: N/A
- Average time to close pull requests: less than a minute
- Issue authors: 5
- Pull request authors: 2
- Average comments per issue: 2.0
- Average comments per pull request: 0.0
- Merged pull requests: 1
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- Karn3003 (3)
- SantaTitular (3)
- annabelleYan (3)
- yanbowangbo (2)
- jonasdaugalas (2)
- mhsacampos (2)
- ashkanee (2)
- tahwaru (2)
- teodorf-bit (2)
- zeneggar (1)
- j-peetz (1)
- DiegoLigtenberg (1)
- scuenat (1)
- giuspillo (1)
- osannolik (1)
Pull Request Authors
- NEGU93 (5)
- Angelld23 (2)
- yonikl (2)
- vandluke (1)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 1
-
Total downloads:
- pypi 196 last-month
- Total dependent packages: 0
- Total dependent repositories: 1
- Total versions: 85
- Total maintainers: 1
pypi.org: cvnn
Library to help implement a complex-valued neural network (cvnn) using tensorflow as back-end
- Homepage: https://github.com/NEGU93/cvnn
- Documentation: https://cvnn.readthedocs.io/
- License: MIT
-
Latest release: 1.2.22
published over 3 years ago
Rankings
Maintainers (1)
Dependencies
- ipykernel *
- nbsphinx *