This project provides a web application for processing space-related images, offering two main functionalities:
- Lunar Surface Segmentation
- Space Image Colorization
The application consists of a FastAPI backend for image processing and a Streamlit frontend for user interaction.
Streamlit allows Python users to create interactive web apps for data visualization with minimal effort. FastAPI is a high-performance Python framework for building APIs quickly and efficiently with automatic validation.
Note: For Lunar Surface Segmentation i am using my previous repo as a reference
- Lunar Surface Segmentation: Segments different features on lunar surface images.
- Space Image Colorization: Adds color to grayscale space images using a GAN model.
- Interactive web interface for uploading and processing images.
- Image enhancement options for colorized images.
backend.py
: FastAPI server handling image processing requests.frontend.py
: Streamlit web interface for user interaction.utils.py
: Utility functions for image preprocessing and model loading.requirements.txt
: List of Python dependencies.report.md
: Report of this project.models/
: Directory containing pre-trained models.LunarModel.h5
: Model for lunar surface segmentationgenerator_60_efficientb4.h5
: Model for space image colorization
notebooks/
: Directory containing Jupyter notebooks for model training.lunar_segmentation_training.ipynb
: Notebook for training the lunar surface segmentation model.space_colorization_gan_training.ipynb
: Notebook for training the space image colorization GAN model.
To see the Space Image Processing tool in action, check out our demo video:
recording-2024-09-06-011352_K2RADaZR.mp4
-
Clone or Download the Repository and open the project directory in your editor (VS Code)
-
Create a virtual environment and activate it:
python -m venv venv source venv/bin/activate # On Windows, use `venv\Scripts\activate`
-
Install the required dependencies:
python -m pip install -r requirements.txt
-
The pre-trained models are included in the
models/
directory, so no additional download is necessary.
Note: If the bandwidth limit for GitHub LFS is exceeded and you cannot download the models, you can also use this Google Drive link to download the models.
-
Start the FastAPI backend:
uvicorn backend:app --reload
-
In a separate terminal, run the Streamlit frontend:
streamlit run frontend.py
-
Open a web browser and navigate to the URL provided by Streamlit (usually
http://localhost:8501
).
- Select the desired operation: "Lunar Surface Segmentation" or "Space Image Colorization".
- Upload an image using the file uploader.
- For colorization, you can adjust enhancement settings in the sidebar.
- Click the "Process Image" button to perform the selected operation.
- View the processed image and download it if desired.
For instructions on training the models used in this project, please refer to the Jupyter notebooks provided in the notebooks/
directory:
lunar_segmentation_training.ipynb
: Notebook for training the lunar surface segmentation model.space_colorization_gan_training.ipynb
: Notebook for training the space image colorization GAN model.
You can also use Kaggle to train these models. Simply import the provided notebooks into Kaggle:
- Create a Kaggle account if you don't have one.
- Go to the "Notebooks" section on Kaggle.
- Click on "New Notebook" or "Create".
- Choose "File" > "Upload Notebook" and select the desired training notebook from this repository.
- Run the notebook on Kaggle, which provides free GPU resources.
- After training, download the model files and replace the existing ones in the
models/
directory.
Using Kaggle can be beneficial as it provides free GPU resources and easy access to datasets, which can significantly speed up the training process.
The GAN model for space image colorization is currently undergoing further refinement. Once the training process is complete and optimal results are achieved, the final version of the training notebook will be made public on Kaggle.
Future Kaggle Resources:
Finalized GAN training notebook: [Link will be provided upon completion]
Kaggle profile: [https://www.kaggle.com/anshkgoyal]
This project uses publicly available datasets for training the machine learning models. These datasets come with their own licensing conditions, which are applicable to any derived models.
-
Artificial Lunar Rocky Landscape Dataset by Romain Pessia and Genya Ishigami of the Space Robotics Group, Keio University, Japan
- License: CC BY-NC-SA 4.0
- Source: Kaggle Dataset Link
- Note: Models trained using this dataset (e.g.,
LunarModel.h5
) are licensed under the same terms (non-commercial, ShareAlike).
-
Top 100 Hubble Telescope Images by the Original Authors
- License: Data files © Original Authors
- Source: Kaggle Dataset Link
- Note: Models derived from this dataset, including
generator_60_efficientb4.h5
, may be subject to additional restrictions imposed by the original authors.
-
ESA Hubble Images (3 Classes) by Subham Shome
- License: CC BY 4.0
- Source: Kaggle Dataset Link
- Note: Models derived from this dataset, including
generator_60_efficientb4.h5
, must include proper attribution as required by the CC BY 4.0 license.
-
SpaceNet Astronomy Data by Raza Imam
- License: CC BY-SA 4.0
- Source: Kaggle Dataset Link
- Note: Models derived from this dataset, including
generator_60_efficientb4.h5
, are subject to the same ShareAlike license terms (CC BY-SA 4.0).
-
Code: The code in this repository (including the FastAPI backend, Streamlit frontend, and related scripts) is licensed under the Apache 2.0 license.
-
Models: Models trained on the above datasets are governed by the respective dataset licenses. Please refer to the Datasets section for details.
Please note that while the code in this repository is licensed under the Apache 2.0 license, the models included in the models/
directory are subject to the following restrictions:
-
Models trained on datasets licensed under CC BY-NC-SA 4.0: These models can only be used for non-commercial purposes, and any derivatives must be shared under the same terms (ShareAlike). Proper attribution to the original dataset creators is required.
-
Models trained on datasets licensed under CC BY 4.0: These models can be used for both commercial and non-commercial purposes, provided that proper attribution is given to the dataset creators.
Please refer to the respective dataset licenses in the README.md
for further details.
Contributions to this project are welcome. Please fork the repository and submit a pull request with your changes.