{"id":17697684,"url":"https://github.com/krshrimali/dcgan-celeba-pytorch-cpp","last_synced_at":"2025-08-04T02:05:15.724Z","repository":{"id":85219488,"uuid":"203227497","full_name":"krshrimali/DCGAN-CelebA-PyTorch-CPP","owner":"krshrimali","description":"DCGAN Implementation using PyTorch in both C++ and Python","archived":false,"fork":false,"pushed_at":"2020-05-22T07:55:11.000Z","size":3518,"stargazers_count":15,"open_issues_count":3,"forks_count":5,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-05-13T10:46:23.904Z","etag":null,"topics":["celeba","computer-vision","cpp","dcgan","deep-learning","gan","libtorch","pytorch"],"latest_commit_sha":null,"homepage":"https://krshrimali.github.io/DCGAN-CelebA-PyTorch-CPP/html/index.html","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/krshrimali.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-08-19T18:28:10.000Z","updated_at":"2024-05-16T07:27:42.000Z","dependencies_parsed_at":null,"dependency_job_id":"e9c8c02e-cb5d-43ee-8904-3b2889bb065a","html_url":"https://github.com/krshrimali/DCGAN-CelebA-PyTorch-CPP","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/krshrimali/DCGAN-CelebA-PyTorch-CPP","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krshrimali%2FDCGAN-CelebA-PyTorch-CPP","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krshrimali%2FDCGAN-CelebA-PyTorch-CPP/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krshrimali%2FDCGAN-CelebA-PyTorch-CPP/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krshrimali%2FDCGAN-CelebA-PyTorch-CPP/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/krshrimali","download_url":"https://codeload.github.com/krshrimali/DCGAN-CelebA-PyTorch-CPP/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krshrimali%2FDCGAN-CelebA-PyTorch-CPP/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268639637,"owners_count":24282661,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-04T02:00:09.867Z","response_time":79,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["celeba","computer-vision","cpp","dcgan","deep-learning","gan","libtorch","pytorch"],"created_at":"2024-10-24T14:48:14.020Z","updated_at":"2025-08-04T02:05:15.612Z","avatar_url":"https://github.com/krshrimali.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# DCGAN-CelebA-PyTorch-CPP\n\nDCGAN Implementation (on CelebA dataset) using PyTorch C++ Frontend API (Libtorch)\n\n- Training Code location: `src/main.cpp`\n- Generator and Discriminator Definition: `include/network.hpp`\n- Dataset Class: `include/dataset.hpp` and `src/dataset.cpp`\n- Tested on Libtorch Version: Stable 1.4.0 (cxx11 ABI) with and without CUDA (10.1), Linux, OpenCV 4.1.0\n\nHow is this different from dcgan sample of PyTorch?\n\n1. This loads a custom dataset (which is not in the dataset class of PyTorch) - CelebA.\n2. Since some users prefer using Sequential Modules, so this example uses Sequential Module.\n\nUtility Functions (to visualize images \u0026 create animation), and architecture is inherited from the PyTorch Example on DCGAN (https://github.com/pytorch/examples/blob/master/cpp/dcgan/).\n\nPlease 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.\n\n## Steps to Follow\n\nNote: This project requires OpenCV built from source. Make sure you also have Pillow (to save animation), NumPy, Matplotlib for running files in utils/ folder.\n\n1. Create a build directory: `mkdir build/`\n2. Change the directory path (absolute path) to `libtorch` in CMakeLists.txt file. Then configure using CMake: `cmake ..`\n3. Create an output directory (in the build directory) to store the results \u0026 save checkpoints: `mkdir output/`\n4. Build your project: `make`\n5. Execute: `./bin/example/`\n6. The saved checkpoints and outputs will be at `output/` directory\n7. To visualize, go back to the main directory: `cd ../`\n8. Execute: `python3 utils/display_samples.py`\n9. The outputs will be stores in `build/output/output_images/` directory\n10. If you want to make an animation, run: `python3 utils/visualize.py` and it will save the animation for you in `build/output/output_animation/` directory\n\n## Blog\n\nFind more about DCGAN on my blogs here: \n\n1. https://krshrimali.github.io/DCGAN-using-PyTorch-CPP/\n2. https://krshrimali.github.io/DCGAN-using-PyTorch-CPP-Part-2/\n\n## Results\n\nThis is the output from random noise (batch of) images after ~10 epochs of training:\n\n\u003cimg src=\"images/dcgan-output.png\"/\u003e\n\nHappy learning!\n\n## TODOs\n\n1. https://github.com/BuffetCodes/DCGAN-CelebA-PyTorch-CPP/issues/9\n2. https://github.com/BuffetCodes/DCGAN-CelebA-PyTorch-CPP/issues/8\n3. https://github.com/BuffetCodes/DCGAN-CelebA-PyTorch-CPP/issues/6\n\n## Contribution\n\nNote: _We believe, contributing to an open source project is the best way to learn. To help others learn, we decided to add `open source` label to the issues we think can be resolved by others. This will benefit us both._\n\nIf you are eager to contribute to this project, pick up an issue with \u003ca href=\"https://github.com/BuffetCodes/DCGAN-CelebA-PyTorch-CPP/labels/open%20source\"\u003eopen source\u003c/a\u003e label. Before you start working on it, make sure you create an issue and cc to any of the main contributors (@krshrimali / @HimanshuSinghGH), and let us know that you are interested. We do not want to waste your efforts in case someone else is already working on it. Thank you!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkrshrimali%2Fdcgan-celeba-pytorch-cpp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkrshrimali%2Fdcgan-celeba-pytorch-cpp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkrshrimali%2Fdcgan-celeba-pytorch-cpp/lists"}