Billboard-Segmentation-using-Segformer
Use Segformer pretrained model to perform billboard segmentation through semantic segmentation. It specifically targets Indian billboards, and the model precisely delineates billboards within images, allowing for efficient detection and analysis.
Overview
This project is split into two key sections:
Training: We fine-tune the Segformer model on a custom Indian billboard dataset using semantic segmentation techniques.
API for Billboard Replacement: Once the billboards are segmented, the API provides a method to replace billboards using a perspective transformation approach to accurately fit new content onto existing billboards.
For details on training the model, follow the dedicated Training README and explore the Google Colab Notebook for downstream tasks.
Step 1: Clone the Repository
First, clone the repository to your local machine using Git. Open your terminal and run:
Step 2: Create a Virtual Environment
Creating a virtual environment is crucial to manage dependencies.
For Mac & Linux:
Run the following commands:
For Windows:
Run these commands in your Command Prompt or PowerShell:
Step 3: Install dependencies
With your virtual environment active, install the required Python packages:
For Windows:
For Mac & Linux:
Step 4: Run the Flask API
Run the Flask API using the following command:
API Endpoints:
The application provides the following endpoints:
/transform_image
Method: POST
Description: This endpoint removes the background from a billboard and replaces it with the provided image, using perspective transformation to adjust the replacement image to fit the billboard's orientation and perspective.
Request Body:
Response:
Success:
Demo
https://github.com/user-attachments/assets/85e492ff-0ca4-4734-965f-1a41aa8dcd27
Training
For those interested in training or fine-tuning the Segformer model, follow the dedicated training instructions in the Training README or use the provided Google Colab Notebook for downstream tasks such as segmentation and billboard replacement.
Contribution
Last updated