Look is a powerful machine learning tool designed to uplscale satellite images, including infrared (IR), ultraviolet (UV), and visible spectrum images, generated by a ESRGAN built with TensorFlow Keras. Integrated with fastapi, it ensures high-quality scaling while preserving details and consistency, making the images ready for further use or visualization. Look is ideal for enhancing images while maintaining precision
- Upload infrared (IR), ultraviolet (UV), or visible spectrum images, including satellite imagery and scientific visuals.
- Enhance image resolution using the powerful ESRGAN super-resolution model.
- Download high-quality, upscaled images with improved clarity and detail.
- Experience a sleek, user-friendly web interface built with FastAPI, Jinja2 templates, and custom-styled CSS for seamless interaction.
To set up the project locally, follow these steps:
git clone https://github.com/RijoSLal/Look.git
cd Look
Make sure you have a Python environment ready. Then, install the necessary dependencies via pip
:
pip install -r requirements.txt
The model requires TensorFlow to run. Ensure your system is equipped with the appropriate version of TensorFlow and has GPU support for faster inference (optional). If you're using a CPU-only environment, set the environment variable CUDA_VISIBLE_DEVICES=-1
to avoid GPU usage.
This application uses the ESRGAN model from TensorFlow Hub:
- Model URL: ESRGAN TF2 Model
No manual download is necessary, as the model is loaded directly from TensorFlow Hub. Try building from scratch if you have powerful GPU like 3050 or above.
To launch the FastAPI server, use the following command:
uvicorn main:app --reload
The server will be accessible at http://localhost:8000
.
Once the server is running, navigate to the home page and upload an image. The image must be in a supported format (e.g., .jpg
, .jpeg
, .png
). The image will then be processed by the ESRGAN model to generate the enhanced version.
After the image is processed, a download link for the upscaled image will be provided on the same page. You can download the enhanced image in JPEG format.
- Method:
GET
- Description: Renders the home page with a file upload form for image submission.
- Method:
POST
- Description: Accepts an image file, processes it with the ESRGAN model, and returns the URL of the upscaled image for download.
- Parameters:
file
(image file, required)
- Method:
GET
- Description: Provides a download link for the upscaled image if it exists.
- Response: The upscaled image file (JPEG format).
.
├── main.py # FastAPI application and route definitions
├── model_gan.py # GAN model handling and image processing logic
├── static/ # Directory for storing uploaded and upscaled images
│ ├── image/ # Directory for images
│ │ ├── unclear_image.jpeg # Example of uploaded image
│ │ └── super_resolution.jpeg # Upscaled image
│ └── styling/ # Directory for CSS and styling resources
│ └── style.css # Custom styling for the web interface
├── templates/ # Jinja2 HTML templates
│ └── index.html # Main page template
├── requirements.txt # List of dependencies
└── README.md # Project overview and instructions
- FastAPI: Web framework for building APIs with Python 3.7+.
- Uvicorn: ASGI server to run the FastAPI application.
- TensorFlow: Machine learning framework for building and deploying models.
- TensorFlow Hub: Pre-trained model repository used to load ESRGAN.
- Pillow (PIL): Image processing library for saving and manipulating images.
- Jinja2: Template engine for rendering HTML views.
To install all dependencies:
pip install -r requirements.txt
If you have a compatible GPU and want to enable TensorFlow GPU acceleration, ensure you have the necessary CUDA and cuDNN libraries installed. Set the environment variable CUDA_VISIBLE_DEVICES=0
for GPU usage. If you prefer to use the CPU, set CUDA_VISIBLE_DEVICES=-1
.
This project is licensed under the MIT License. See the LICENSE file for more details.
- TensorFlow Hub for the pre-trained ESRGAN model.
- FastAPI for building the API server.
- Uvicorn for the ASGI server.
- Pillow for image handling.
This application is designed to be a robust, efficient, and scalable solution for processing images with state-of-the-art deep learning model, and is intended for use cases where high-quality image enhancement is needed.Feel free to play around with it and experiment!