https://github.com/rijoslal/look
Look is a powerful ML tool that upscale satellite images generated using ESRGAN built with TensorFlow Keras & Fastapi. It ensures high-quality scaling, preserving details and consistency, making images ready for further use or visualization. Ideal for enhancing images while maintaining precision
https://github.com/rijoslal/look
bootstrap5 cv2 fastapi html-css-javascript jinja2-templates python3 tensorflow tensorflow-hub
Last synced: about 1 month ago
JSON representation
Look is a powerful ML tool that upscale satellite images generated using ESRGAN built with TensorFlow Keras & Fastapi. It ensures high-quality scaling, preserving details and consistency, making images ready for further use or visualization. Ideal for enhancing images while maintaining precision
- Host: GitHub
- URL: https://github.com/rijoslal/look
- Owner: RijoSLal
- Created: 2025-01-08T10:26:27.000Z (4 months ago)
- Default Branch: main
- Last Pushed: 2025-01-30T15:32:37.000Z (4 months ago)
- Last Synced: 2025-03-26T05:42:06.762Z (about 2 months ago)
- Topics: bootstrap5, cv2, fastapi, html-css-javascript, jinja2-templates, python3, tensorflow, tensorflow-hub
- Language: HTML
- Homepage:
- Size: 163 KB
- Stars: 4
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Look
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## Features
- 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.## Installation
To set up the project locally, follow these steps:
### 1. Clone the repository
```bash
git clone https://github.com/RijoSLal/Look.git
cd Look
```### 2. Install dependencies
Make sure you have a Python environment ready. Then, install the necessary dependencies via `pip`:
```bash
pip install -r requirements.txt
```### 3. Set up TensorFlow environment
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.
### 4. Download the ESRGAN Model
This application uses the ESRGAN model from TensorFlow Hub:
- **Model URL**: [ESRGAN TF2 Model](https://tfhub.dev/captain-pool/esrgan-tf2/1)
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.## Usage
### 1. Run the FastAPI server
To launch the FastAPI server, use the following command:
```bash
uvicorn main:app --reload
```The server will be accessible at `http://localhost:8000`.
### 2. Upload an Image
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.
### 3. Download the Upscaled Image
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.
## API Endpoints
### `/`
- **Method**: `GET`
- **Description**: Renders the home page with a file upload form for image submission.### `/upload`
- **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)### `/download`
- **Method**: `GET`
- **Description**: Provides a download link for the upscaled image if it exists.
- **Response**: The upscaled image file (JPEG format).## Project Structure
```
.
├── 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
```## Dependencies
- **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:
```bash
pip install -r requirements.txt
```### Optional: TensorFlow GPU Support
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`.
## License
This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for more details.
## Acknowledgements
- [TensorFlow Hub](https://www.tensorflow.org/hub) for the pre-trained ESRGAN model.
- [FastAPI](https://fastapi.tiangolo.com/) for building the API server.
- [Uvicorn](https://www.uvicorn.org/) for the ASGI server.
- [Pillow](https://pillow.readthedocs.io/en/stable/) 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!