This is an official pytorch implementation of "Learning Fractals by Gradient Descent," in AAAI 2023.
- python3.6
- torch==1.10.2
- torchvision==0.11.3
- cv2==4.5.5
- numba==0.53.1
We present the instructions on learning fractals for the MNIST images. Similar steps can be followed for the FMNIST and the KMNIST images.
Use the following command to download and store the MNIST images.
$ python generate_mnist.py data/
The MNIST dataset will be downloaded into data/
and the images will be stored into mnist_images/
.
Use the following command to to reconstruct the MNIST images by learning fractal parameters.
$ bash run_reconstruct_100_mnist_images.sh ${GPUIDX}
The argument ${GPUIDX}
indicates the GPU used for training fractals, which can usually be set to 0.
Note that this script only reconstructs 100 MNIST images (random 10 images for each of the 10 classes). The target images, the reconstructed images, and the learned fractals parameters will be stored in IMAGEMATCH_MNIST/
.
Use the following command to compute the MSE loss between the target and the reconstructed images.
$ python evaluate_mse.py IMAGEMATCH_MNIST/
If you have any questions, please contact Cheng-Hao Tu(tu.343@osu.edu).