Author: Elisa Warner
Email: elisawa@umich.edu
Date: 04/12/2023
This code is a written implementation of the Diffusion model for Jupyter Notebook.
- Python 3.9 or higher
- Package:
torchvision - Package:
torch(recommended 1.11 or higher) - Package:
os - Package:
matplotlib - Package:
jupyter - For
Preprocess.ipynb, Package:glob,shutil
Preprocess.ipynb[Jupyter Notebook]: This notebook contains code for moving the images downloaded from Kaggle into a single folder.DiffusionModel.ipynb[Jupyter Notebook] : This notebook contains the Diffusion Model code.unet_mha.py[Executable Script]: This code contains the architecture for the U-Net with Multi-Head Attention. The advantage of this code is that the MHA layers ensure a greater probability that facial landmarks on the cat will be properly placed, but require many more parameters. Therefore, the recommended SQ_SIZE for this network is 32.unet_stripped.py[Executable Script]: This code contains the architecture for the U-Net without Multi-Head Attention. The advantage of this code is that the stripped-down model contains less parameters, which means more data can be fit onto the GPU. Therefore, the recommend SQ_SIZE for this network is 64.config.py[Executable Script]: This code contains the hyperparameter adjustments set by the user. Edit this code before runningDiffusionModel.ipynb.pre_train_example.pth: A pretrained 32x32 model example to load. This was trained for over 1200 epochs.results_example.txt: An example output for the model.
results.txt: Will contain the Epoch number as well as the loss.model.pth: The most recently saved model from the latest epoch run onDiffusionModel.ipynb.