DCGAN on CelebA Dataset using Libtorch (PyTorch C++ Frontend API)
|
DCGAN Implementation (on CelebA dataset) using PyTorch C++ Frontend API (Libtorch)
src/main.cpp
include/network.hpp
include/dataset.hpp
and src/dataset.cpp
How is this different from dcgan sample of PyTorch?
Utility Functions (to visualize images & create animation), and architecture is inherited from the PyTorch Example on DCGAN (https://github.com/pytorch/examples/blob/master/cpp/dcgan/).
Please note that this is in no way targeted to achieve a certain accuracy, but only focuses on creating an example template for DCGAN using Libtorch on CelebA Dataset.
Note: This project requires OpenCV built from source. Make sure you also have Pillow (to save animation), NumPy, Matplotlib for running files in utils/ folder.
mkdir build/
libtorch
in CMakeLists.txt file. Then configure using CMake: cmake ..
mkdir output/
make
./bin/example/
output/
directorycd ../
python3 utils/display_samples.py
build/output/output_images/
directorypython3 utils/visualize.py
and it will save the animation for you in build/output/output_animation/
directoryFind more about DCGAN on my blogs here:
This is the output from random noise (batch of) images after ~10 epochs of training:
Happy learning!