{"id":24426094,"url":"https://github.com/paraglondhe098/image-colorization","last_synced_at":"2026-04-24T17:35:54.127Z","repository":{"id":268783168,"uuid":"905457458","full_name":"paraglondhe098/image-colorization","owner":"paraglondhe098","description":"Developed a cGAN to learn color distributions in images conditioned on their grayscale representations (luminance).","archived":false,"fork":false,"pushed_at":"2025-01-14T07:22:54.000Z","size":167,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-14T07:42:19.696Z","etag":null,"topics":["computer-vision","deep-learning","generative-adversarial-network","generative-ai","image-processing","pytorch","u-net"],"latest_commit_sha":null,"homepage":"https://www.kaggle.com/code/paraglondhe/imagecol3","language":"Jupyter Notebook","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/paraglondhe098.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":"2024-12-18T21:41:17.000Z","updated_at":"2025-01-14T07:22:57.000Z","dependencies_parsed_at":"2024-12-18T22:33:52.067Z","dependency_job_id":"cd69d27d-6cfd-4197-982a-4c050ec12afa","html_url":"https://github.com/paraglondhe098/image-colorization","commit_stats":null,"previous_names":["paraglondhe098/image-colorization-gan","paraglondhe098/image-colorization"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paraglondhe098%2Fimage-colorization","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paraglondhe098%2Fimage-colorization/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paraglondhe098%2Fimage-colorization/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paraglondhe098%2Fimage-colorization/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/paraglondhe098","download_url":"https://codeload.github.com/paraglondhe098/image-colorization/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243437999,"owners_count":20290863,"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","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":["computer-vision","deep-learning","generative-adversarial-network","generative-ai","image-processing","pytorch","u-net"],"created_at":"2025-01-20T11:15:36.145Z","updated_at":"2025-12-26T17:40:24.334Z","avatar_url":"https://github.com/paraglondhe098.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Image Colorization using GANs (Advanced computer vision project)\n\nThis project provides an implementation of Image colorization using GANs (Generative Adversarial Networks), specifically using a U-Net architecture \nfor the generator and a PatchCNN for the discriminator. The project is constructed in Python with [PyTorch](https://pytorch.org/docs/stable/index.html) as the deep learning framework, and \n[PyTorch-Candle](https://github.com/paraglondhe098/pytorch-candle) for efficient training process.\n\n![Example](style/horizontal.png)\n\n## Project structure\nFollowing are the main components:\n- `notebook.ipynb`: This is the Jupyter notebook file containing the model training implementation and execution steps.\n- `README.md`: The file you are currently reading which contains detailed explanation about the project and the implementation.\n- `requirements.txt`: It contains the list of required libraries and dependencies for the project.\n- `callbacks.py`: It contains custom callback classes for saving images and checkpoints during the training process.\n- `models.py`: It houses the neural network models used in this project.\n- `app.py`: Streamlit web application for image colorization.\n- `utils/`: Directory containing utility functions and helper classes:\n\n### Web Interface\nThe project includes a user-friendly web interface built with Streamlit that allows users to:\n- Upload grayscale images in common formats (PNG, JPG, JPEG)\n- View the original image in real-time\n- Colorize images with a single click\n- Download the colorized results\n\nTo run the web interface:\n```bash\nstreamlit run app.py\n```\n\n## Components\n\n### Training\nDuring the training, the discriminator and the generator are trained alternately in the defined number of epochs. The progress of the training can be tracked and visualized.\n\n\n### Callbacks\nThere are two callbacks employed:\n1. `ImageSaver`: This callback is used to save the generated images after each epoch during training. As a result, we can review the progress of the generator in creating images.\n2. `CheckpointSaver`: This callback is invoked to save the model after every specific number of steps. This can be particularly helpful during long training processes or when training is expected to be interrupted.\n\n### Models\nThis project comprises of two main models, namely a generator and a discriminator model.\n1. `Unet`: The generator model used is a U-Net model. This model is particularly effective for image-to-image translation problems.\n2. `PatchDiscriminator`: The discriminator is implementing a PatchGAN style, which operates over patches of the image, rather than the whole image. It helps to make the model faster and more efficient.\n3. `ImageColorizationModel`: The main model class holding the generator and discriminator models.\n\n## Dataset\nThe data used for training this project is available on [kaggle](https://www.kaggle.com/datasets/paraglondhe/coco-01-40k).\n\n## Usage\nIn order to run the project, you need to have Python installed on your system. You can install the required libraries using the following command:\n```bash\npip install -r requirements.txt\n```\n\nThe training code is contained in the [`notebook.ipynb`](notebook.ipynb) Jupyter notebook file. You can run the notebook in a Jupyter notebook environment or on cloud platforms like Google Colab.\nThe implementation on Kaggle is available here: [Image Colorization on Kaggle](https://www.kaggle.com/code/paraglondhe/image-colorization-unet-gan)\n\n### Using the Web Interface\n1. Install the required dependencies:\n```bash\npip install streamlit pillow\n```\n2. Run the Streamlit app:\n```bash\nstreamlit run app.py\n```\n3. Open your web browser and navigate to the provided local URL\n4. Upload a grayscale image and click the \"Colorize Image\" button\n5. Download the colorized result using the download button\n\n### Results \n#### (After 45 epochs)\n![Example](style/horizontal_res.png)\n\n### Inspired from article: [Colorizing black \u0026 white images with U-Net and conditional GAN — A Tutorial](https://towardsdatascience.com/colorizing-black-white-images-with-u-net-and-conditional-gan-a-tutorial-81b2df111cd8)\nby *Moein Shariatnia*\n\n## Future Objectives\nThe project's current configuration parameters, such as the number of epochs and batch size, are tailored for learning and experimentation.\nThese parameters may require further tuning based on the specific dataset and computational resources available. To achieve superior results, \nfuture work could include:\n\n- Advanced Techniques: Incorporating more sophisticated techniques to enhance the model's accuracy and efficiency.\n- Larger Datasets: Utilizing more extensive datasets to improve the generalization and robustness of the model.\n- Extended Training Times: Allowing for longer training periods to enable the model to learn more complex patterns and features.\n- UI Enhancements: Adding features like batch processing, additional image preprocessing options, and different colorization styles.\n- API Development: Creating a REST API to allow integration with other applications.\n\nThis project serves as a flexible foundation, open to modifications and enhancements. Users are encouraged to adapt and expand upon the provided code to explore the vast possibilities of conditional GANs and image colorization, aiming for innovative solutions and improved outcomes.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fparaglondhe098%2Fimage-colorization","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fparaglondhe098%2Fimage-colorization","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fparaglondhe098%2Fimage-colorization/lists"}