keras arxiv:1910.09700 region:us
---
# For reference on model card metadata, see the spec: https://github.com/huggingface/hub-docs/blob/main/modelcard.md?plain=1
# Doc / guide: https://huggingface.co/docs/hub/model-cards
{}
---

# Auto-Encoders

<!-- Provide a quick summary of what the model is/does. -->

This model deals with auto-encoders, specifically experimenting and tweaking the architecture, we train a MNIST dataset with artifical Gaussian noise in order to obtain model output of the orginal denoised image.

## Model Details

Model outputs include:

With 5.4 million parameters, the autoencoder could reconstruct the a 256x256 image of my profile picture from a 8x8 representation.

![image/gif](https://cdn-uploads.huggingface.co/production/uploads/6319030647a84df2a5dd106c/nqZULm7A30EptQ9pNAQki.gif)


With 1.2k parameters,

![image/gif](https://cdn-uploads.huggingface.co/production/uploads/6319030647a84df2a5dd106c/pzA2citmpIvtZR403buHa.gif)



------------------
![Example Autoencoder Diagram](https://cdn-uploads.huggingface.co/production/uploads/6319030647a84df2a5dd106c/_nxtemAHJm6fPVY6qkrJF.png)

An image of 256x256 to be encoded by 4x4 images with some loss, but we will be learning weights that allows the decoder and encoder to work together to minimize the loss.
The output and input is never the same statistically, because we have some sort of reconstruction loss, and we can design systems that can detect anomolies.

We have input data that can be reconstructed. We can use this to detect anomalies.


Encoding Typical Processing:

- Conv2D
- MaxPooling2D (downsamples)



Decoding Typical Processing:

- UpSampling2D
- Conv2D


Here we are fitting:
```python
    model.fit(x, x, epochs=5, shuffle=True)
```

Use cases for autoencoders:
- **Anomaly detection**, if we have a datastream from a microscope, and monitoring the output intensity, and many different metrics, 

    ![Signal Anomaly Detection](https://cdn-uploads.huggingface.co/production/uploads/6319030647a84df2a5dd106c/Y8MxdWRJrsL2quw4uHvpI.png)

    When we have this data, and we have failures, we can detect failure or even predict failures occuring. When we give a input, we want to reconstruction, if there is an anomaly, then the reconstruction error is large and passed a specific threshold, then we can assume that there is an anomaly.

- **Denoising**, which we learned in the previous section, is obtaining a reconstruction of the input image, without the noise, as we have been training on it.

- **Domain Adaptation**, we are fitting x to x, while training the autoencoder, but we can also fit x to y, and then we can use the encoder to encode the input, to a different domain image. For example training a model to go from Einstein image to a Mona Lisa image.

- **Image Colorization**, we can use the encoder to encode a grayscale image, and then use the decoder to decode the image to a color image.



-------------------
<!-- Provide a longer summary of what this model is. -->

- **Developed by:** Michael Peres
- **Model type:** AutoEncoder



## Environmental Impact

<!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->

Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).

- **Hardware Type:** RTX 3070Ti
- **Hours used:** 0.05hr

