A comprehensive web application for comparing different super-resolution algorithms side-by-side. This project features a FastAPI backend with multiple SR models and a modern React frontend for intuitive image upload and comparison.
- Overview
- Features
- Project Structure
- Tech Stack
- Installation
- Usage
- API Documentation
- Models
- Contributing
- License
This project provides a comparative analysis platform for super-resolution (SR) algorithms. Super-resolution is the process of enhancing the resolution of an image or video. This engine allows users to:
- Upload low-resolution images
- Process them through multiple SR models simultaneously
- Compare results visually and analytically
- Understand the strengths and weaknesses of different approaches
- Multiple SR Models: Compare Bicubic interpolation and SRCNN
- Web Interface: Clean, user-friendly React interface for image upload
- RESTful API: FastAPI backend for robust and scalable processing
- Real-time Processing: Instant comparison of multiple algorithms
- CORS Support: Easy integration with frontend clients
- Pre-trained Models: Includes RealESR weights for enhanced results
- Image Utilities: Comprehensive preprocessing and utility functions
βββ backend/ # FastAPI backend server
β βββ app/
β β βββ api.py # Main API endpoints
β β βββ main.py # Standalone execution example
β β βββ main_api.py # Alternative API configuration
β β βββ engine/
β β β βββ comparator.py # ComparatorEngine for model comparison
β β βββ models/
β β β βββ base.py # Base model class
β β β βββ bicubic.py # Bicubic interpolation model
β β β βββ srcnn.py # SRCNN model
β β β βββ weights/ # Pre-trained model weights
β β β βββ realesr-general-x4v3.pth
β β βββ utils/
β β βββ image_utils.py # Image loading and conversion utilities
β β βββ preprocessing.py # Image preprocessing functions
β βββ requirements.txt # Python dependencies
β βββ README.md
β
βββ frontend/ # React + Vite frontend
β βββ public/ # Static assets
β βββ src/
β β βββ App.jsx # Main App component
β β βββ App.css # App styling
β β βββ main.jsx # Entry point
β β βββ index.css # Global styles
β β βββ assets/ # Additional assets
β βββ package.json
β βββ vite.config.js # Vite configuration
β βββ eslint.config.js # ESLint rules
β βββ index.html
β βββ README.md
β
βββ LICENSE
βββ README.md # This file
- Framework: FastAPI
- Image Processing: OpenCV (cv2)
- Deep Learning: PyTorch
- HTTP Server: Uvicorn
- Library: React 19.2
- Build Tool: Vite with Rolldown
- Styling: CSS3
- Linting: ESLint
- Python 3.8+
- Node.js 16+
- npm or yarn
-
Navigate to the backend directory:
cd backend -
Install Python dependencies:
pip install -r requirements.txt
-
Install any missing dependencies (if requirements.txt is incomplete):
pip install fastapi uvicorn opencv-python numpy torch torchvision
-
Verify the models directory contains required weights:
- Check
app/models/weights/realesr-general-x4v3.pth
- Check
-
Navigate to the frontend directory:
cd frontend -
Install dependencies:
npm install
# From the backend directory
cd backend
# Option 1: Using FastAPI directly
python -m uvicorn app.api:app --reload --port 8000
# Option 2: Using main.py for standalone processing
python app/main.pyThe API will be available at http://localhost:8000
- API Docs:
http://localhost:8000/docs - ReDoc:
http://localhost:8000/redoc
# From the frontend directory
cd frontend
# Development mode with HMR
npm run dev
# Build for production
npm run build
# Preview production build
npm run preview
# Run linting
npm run lintThe frontend will be available at http://localhost:5173
# Terminal 1: Start backend
cd backend
python -m uvicorn app.api:app --reload --port 8000
# Terminal 2: Start frontend
cd frontend
npm run devCompares all available SR models on the uploaded image.
Request:
- Method:
POST - Content-Type:
multipart/form-data - Parameter:
file(image file)
Response:
{
"outputs": {
"bicubic": "bicubic_api_out.jpg",
"srcnn": "srcnn_api_out.jpg"
}
}Health check endpoint.
Response:
{
"status": "API is running"
}- JPEG (.jpg, .jpeg)
- PNG (.png)
- BMP (.bmp)
- TIFF (.tiff)
- Type: Classical interpolation method
- Advantage: Fast, no training required
- Limitation: Limited perceptual quality
- Use Case: Baseline comparison
- Type: Deep learning-based SR
- Advantage: Better perceptual quality than bicubic
- Architecture: 3-layer CNN
- Use Case: Practical SR applications
- ESRGAN: Enhanced Super-Resolution Generative Adversarial Networks (partially implemented)
- RealESR: Real-world super-resolution
- SwinIR: Swin Transformer-based SR
- The project includes pre-trained weights for RealESR in
backend/app/models/weights/ - CORS is configured to accept requests from
http://localhost:5173 - Images are processed and returned in RGB format
- Output images are saved in the working directory with model name prefixes
Edit backend/app/api.py to modify allowed origins:
app.add_middleware(
CORSMiddleware,
allow_origins=["http://localhost:5173"], # Modify as needed
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"]
)Contributions are welcome! Please ensure:
- Code follows PEP 8 style guidelines
- Add appropriate docstrings
- Test new models before submitting
- Update documentation as needed
This project is licensed under the terms specified in the LICENSE file.
Last Updated: April 2026 Version: 1.0.0