https://github.com/thisisiron/spectral_normalization-tf2
🌈 Spectral Normalization implemented as Tensorflow 2
https://github.com/thisisiron/spectral_normalization-tf2
gan keras spectral-normalization tensorflow tensorflow2 tf2
Last synced: 2 months ago
JSON representation
🌈 Spectral Normalization implemented as Tensorflow 2
- Host: GitHub
- URL: https://github.com/thisisiron/spectral_normalization-tf2
- Owner: thisisiron
- License: mit
- Created: 2019-10-03T16:28:38.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2019-10-13T04:49:04.000Z (over 5 years ago)
- Last Synced: 2025-03-28T11:43:01.593Z (3 months ago)
- Topics: gan, keras, spectral-normalization, tensorflow, tensorflow2, tf2
- Language: Python
- Homepage:
- Size: 54.7 KB
- Stars: 34
- Watchers: 3
- Forks: 4
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Spectral Normalization TF2
Spectral Normalization implemented as Tensorflow 2.0## TODO
- [ ] Convert simple conv2d model to DCGAN model## Run Test Code
This is currently a test code using a simple image classification model.
```
python main.py
```## Algorithm
## How to use
1. Sequential API
```
from sn import SpectralNormalizationmodel = models.Sequential()
model.add(SpectralNormalization(layers.Conv2D(32, (3, 3), activation='relu')))
...
```2. Functional API
```
from sn import SpectralNormalizationinputs = layers.Input(shape=(28,28,1))
x = SpectralNormalization(layers.Conv2D(32, (3, 3), activation='relu'))(inputs)
...
````3. Custom Layer Method
```
from sn import SpectralNormalizationclass CustomLayer(tf.keras.layers.Layer):
def __init__(self):
self.conv2DSN = SpectralNormalization(layers.Conv2D(32, (3, 3), activation='relu'))
...
def call(self, inputs):
x = self.conv2DSN(inputs)
...
```## Rerference
[Spectral Normalization for Generative Adversarial Networks](https://arxiv.org/abs/1802.05957)