This repository contains a PyTorch implementation of an autoencoder for image reconstruction using the MNIST dataset. The autoencoder model is designed to mask images with random patches and then reconstruct the original images from the masked inputs.
Python 3.x PyTorch torchvision numpy matplotlib
- Clone the repository
- cd CNN_Autoencoder
- Install the required dependencies:
pip install -r requirements.txt
- Run the main script:
python came.py
- Monitor the training process:
- The script will train the autoencoder model over multiple epochs, displaying the training and testing loss for each epoch.
- Additionally, it will save comparison images showing the original, masked, and reconstructed images.
- Check the output:
- The comparison images for selected epochs will be saved as show_per_<SHOW_PER_EPOCH>epoch.png.
- The loss curve plot will be saved as image_loss.png.
EPOCH_COUNT
: Number of epochs for trainingBATCH_SIZE
: Batch size for trainingLR
: Learning rate for the optimizerSHOW_PER_EPOCH
: Frequency of displaying results per epochSHOW_IMG_COUNT
: Number of images to display in the comparisonPATCH_SIZE
: Size of the image patches for maskingMASK_RATE
: Percentage of image patches to mask