Giter Club home page Giter Club logo

tf_autoencoder's Introduction

Denoising Autoencoder as TensorFlow estimator

This repository contains an implementation of a (Denoising) Autoencoder using TensorFlow's Estimator and Dataset API. You can find a more detailed description in my blog post.

Two flavors of autoencoders are currently implemented

  1. fully_connected: Uses fully-connected layers with 128, 64, and 32 units, respectively.
  2. convolutional: Uses 2D convolutional layers with 3x3 kernels and 16, 8, and 8 filters, respectively.

Training

You can train an autoencoder on the MNIST dataset using train_mnist_autoencoder.py. The first argument specifies which autoencoder to train (fully_connected or convolutional), the remaining arguments are listed below.

Argument Description
--model_dir Output directory for model and training stats.
--data_dir Directory to download the data to.
--noise_factor Amount of noise to add to input (default: 0)
--learning_rate Learning rate (default: 0.001)
--batch_size Batch size (default: 256)
--epochs Number of epochs to perform for training (default: 50)
--weight_decay Amount of weight decay to apply (default: 1e-5)
--dropout The probability that each element is kept in dropout layers (default: 1)
--save-images Path to directory to store pairs of input and reconstructed images after each epoch (default: disabled)

If --noise_factor is non-zero, a denoising autoencoder will be trained.

Prediction

After training an autoencoder, you can inspect the model using test_mnist_autoencoder.py. You can visualize a model's predictions on the MNIST test dataset or save the output of the encoder to display it in TensorBoard. The first argument specifies which autoencoder to evaluate (fully_connected or convolutional), the remaining arguments are listed below.

Argument Description
--model_dir Output directory for model and training stats.
--data_dir Directory to download the data to.
--noise_factor Amount of noise to add to input (default: 0)
--dropout The probability that each element is kept in dropout layers (default: 1)
--images Number of test images to reconstruct or save embedding for (default: 10)
--what How to visualize a trained model. reconstruction displays input and reconstructed images next to each other. embedding creates a checkpoint that can be used with TensorBoard to visualize the low-dimensional embedding of the encoder (default: reconstruction)

Make sure you pass the same values you used during training.

tf_autoencoder's People

Contributors

sebp avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

tf_autoencoder's Issues

Another questions about the loss function

Hi~
I have noticed that you use the sigmoid cross entropy loss function to learning the autoencoder.
But if my data is a RGB image, It is impossible to use this loss.
I wonder if my opinion is true?

why convolution decoder no repeat operation?

Thanks for your sharing this!
I read your code and blog and found that when encoder, convolutions before maxpooling will repeat, but in decoder you just do convolution once on a spatial size.
I wonder if there are some reference for do this operation?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.