Skip to main content

Convolutional Autoencoder (CAE) in Python

An implementation of a convolutional autoencoder in python and keras.

Installation

pip install cae

Usage

from cae import cae
import numpy as np

# create a fake dataset, here: 1000 random 224x224 RGB images
images = np.random.normal(size=(1000, 224, 224, 3))

latent_dim = 8 # desired latent dimensionality

model = cae(images.shape[1:], latent_dim) # there are a number of **kwargs
                                          # parameters that are likely
                                          # worth tuning!!!

# TRAIN THE NETWORK
model.fit(images)

# SAVE THE WEIGHTS FOR EASY RELOADING LATER WITH model.load_weights(path)
model.save_weights('PATH/TO/SAVE/')

Final words

cae.py contains the implementation, which is tested on the MNIST dataset in mnist_test.ipynb.

In general, auto-encoders map an input x to a latent representation y (generally in a much smaller dimensional space), using deterministic functions of the type y = sigma(Wx+b). In order to encode images, it is useful to implement a convolutional architecture. Here, we utilize convolutional layers and max-pooling layers (which allow translation-invariant representations), followed by a flattening and dense layer to encode the images in a reduced-dimensional space. For decoding, you essentially need to perform the inverse operation. For more information on CAEs, consult e.g. http://people.idsia.ch/~ciresan/data/icann2011.pdf.

Download files

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

Source Distribution

cae-0.4.tar.gz (2.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cae-0.4-py3-none-any.whl (15.4 kB view details)

Uploaded Python 3

File details

Details for the file cae-0.4.tar.gz.

File metadata

  • Download URL: cae-0.4.tar.gz
  • Upload date:
  • Size: 2.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/46.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4

File hashes

Hashes for cae-0.4.tar.gz
Algorithm Hash digest
SHA256 fc3dfe259f536dcab550cb35322814005365679d6cc7cfc6e232be393ef40d34
MD5 25df042d102e992660d6024c1d45a9c0
BLAKE2b-256 61a5be9cca82f6d49003960671c15f58738eeff3b78290eba6164b1e6c448290

See more details on using hashes here.

File details

Details for the file cae-0.4-py3-none-any.whl.

File metadata

  • Download URL: cae-0.4-py3-none-any.whl
  • Upload date:
  • Size: 15.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/46.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4

File hashes

Hashes for cae-0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 3b4f773027939f41434be8df619938b6825c84140de3d689aef8accf6318eadf
MD5 fba4341c548b67886a90f3df9f2b6dcc
BLAKE2b-256 adcb19e5bb785208b1eebe48cbb1c7acbe68837387bf7757777004f490e8f55d

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.4 This release

2 files

0.3

2 files

0.2

2 files

0.1.1

2 files

0.1

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page