Fake UPI
Detector.
An AI-powered fraud detection system analyzing manipulated UPI payment screenshots to prevent financial scams.
1. The Problem
With the rise of digital payments in India, bad actors frequently use manipulated screenshots of UPI transactions (Google Pay, PhonePe, Paytm) to deceive merchants. Verifying these manually is slow and error-prone.
2. Technical Architecture
The system was designed as a microservice using FastAPI for rapid, asynchronous handling of image uploads. The core detection logic relies on Optical Character Recognition (OCR) combined with heuristic analysis of font rendering, alignment, and pixel density anomalies.
- Backend API: FastAPI (Python)
- Vision Processing: Tesseract OCR, OpenCV
- Database: MongoDB (for logging detection metadata)
- Deployment: Docker, AWS
3. Engineering Challenges
The primary challenge was reducing latency. Initial OCR passes were taking over 2 seconds per image. By optimizing matrix transformations during the image pre-processing phase (converting to grayscale, applying binary thresholding, and utilizing specific linear algebra shortcuts to calculate bounding boxes), I reduced processing time by 45%.
# Example: Optimized image pre-processing pipeline
def preprocess_receipt(image_path):
img = cv2.imread(image_path)
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
# Applying Otsu's thresholding for dynamic contrast
thresh = cv2.threshold(gray, 0, 255, cv2.THRESH_BINARY_INV | cv2.THRESH_OTSU)[1]
return thresh
4. Future Improvements
The next iteration will replace heuristic rules with a lightweight Convolutional Neural Network (CNN) trained specifically on compression artifacts common in altered JPEGs.