Skip to content

Repository files navigation

Regtech Video Compliance Checker

An AI-powered web application for automatically checking video compliance against regulatory guidelines using 100% open source models.

Features

  • Video Content Extraction

    • Frame extraction with scene change detection (OpenCV + FFmpeg)
    • Audio transcription (Whisper - local)
    • Visual analysis (LLaVA/BLIP-2 + YOLO v8)
    • OCR text extraction (EasyOCR/PaddleOCR)
  • Semantic Vectorization

    • Embedding generation (sentence-transformers)
    • Vector search (Weaviate)
    • Semantic matching against guidelines
  • Compliance Checking

    • Guideline parsing and structuring (LangChain)
    • Automated compliance analysis (Llama 3.1 via Ollama)
    • Evidence-based violation detection (LangGraph agent)
    • Interactive timeline reports

Technology Stack

Backend

  • FastAPI - Modern async web framework
  • LangChain + LangGraph - AI orchestration
  • Celery + Redis - Task queue for video processing
  • PostgreSQL - Relational database
  • MinIO - S3-compatible object storage
  • Weaviate - Vector database

AI/ML Models (All Open Source, Run Locally)

  • Whisper - Audio transcription
  • LLaVA 1.6/BLIP-2 - Vision-language understanding
  • YOLO v8 - Object detection
  • EasyOCR - Optical character recognition
  • sentence-transformers - Text embeddings
  • Llama 3.1 - Large language model (via Ollama)

Frontend

  • React + TypeScript - UI framework
  • Vite - Build tool
  • TailwindCSS - Styling
  • React Query - Data fetching

Prerequisites

Hardware Requirements

  • Minimum: 16GB RAM, 8GB VRAM GPU (RTX 3070, GTX 1080 Ti or better)
  • Recommended: 32GB RAM, 16GB+ VRAM GPU (RTX 4080/4090, A4000)
  • CPU: Multi-core processor (8+ cores recommended)
  • Storage: 100GB+ free space (for models and video storage)

Software Requirements

  • Python 3.10+
  • Node.js 18+
  • Docker & Docker Compose
  • NVIDIA CUDA 12.1+ (for GPU acceleration)
  • FFmpeg
  • Ollama (https://ollama.ai)

Quick Start

1. Clone and Setup

git clone <repository-url>
cd Regtech
cp .env.example .env

Edit .env with your configuration.

2. Install Ollama and Pull Models

# Install Ollama from https://ollama.ai
# Then pull the required model
ollama pull llama3.1:8b

3. Start Infrastructure with Docker

cd docker
docker-compose up -d

This starts:

  • PostgreSQL (port 5433)
  • Redis (port 6379)
  • Weaviate (port 8080)
  • MinIO (port 9000, console: 9001)

4. Setup Backend

cd backend

# Create virtual environment
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

# Install dependencies
pip install -r requirements.txt

# Run migrations
alembic upgrade head

# Start FastAPI server
uvicorn app.main:app --reload --host 0.0.0.0 --port 8000

5. Start Celery Worker (New Terminal)

cd backend
source venv/bin/activate  # On Windows: venv\Scripts\activate
celery -A app.tasks.celery_app worker --loglevel=info

6. Setup Frontend (New Terminal)

cd frontend
npm install
npm run dev

Access the app at http://localhost:5173

Usage

  1. Upload Guideline Document

    • Go to Guidelines page
    • Upload a PDF regulatory document
    • System will parse and structure the requirements
  2. Upload Video for Compliance Check

    • Go to Video Upload page
    • Drag and drop or select video file
    • Monitor processing progress in real-time
  3. Review Compliance Report

    • View overall compliance status
    • Interactive timeline showing violations at specific timestamps
    • Click on violations to see evidence frames and guideline references
    • Export report as PDF

Development

Run Tests

# Backend tests
cd backend
pytest tests/ -v --cov=app

# Frontend tests
cd frontend
npm test

Project Structure

Regtech/
├── backend/          # FastAPI backend
│   ├── app/
│   │   ├── api/      # API routes
│   │   ├── models/   # Database models
│   │   ├── services/ # Business logic
│   │   ├── langchain_components/  # LangChain chains & agents
│   │   └── tasks/    # Celery tasks
│   └── tests/
├── frontend/         # React frontend
│   └── src/
│       ├── components/
│       ├── pages/
│       └── services/
└── docker/           # Docker configuration

Cost Comparison

Using Open Source Models (This Project)

  • API Costs: $0 per video
  • Operational Costs: Electricity only (~$0.10-0.50 per video hour)

Alternative: Using Commercial APIs

  • API Costs: ~$10-23 per video hour
    • OpenAI Whisper API: $0.36/hour
    • GPT-4 Vision: $5-15/hour
    • AWS Rekognition: $0.60/hour
    • Google Cloud Vision: $1.50/hour
    • OpenAI Embeddings: $0.10/hour
    • Claude API: $2-5/hour

Savings: 100% of API costs eliminated!

Performance

  • Video Processing: 5-10 minutes per hour of video
  • Compliance Check: 2-5 minutes per guideline set
  • Report Generation: < 30 seconds
  • Concurrent Videos: 10+ (with 4 Celery workers)

License

This project is licensed under the MIT License. See the LICENSE file for details.

Contributing

This is a personal/portfolio project. Issues and pull requests are welcome, but there's no formal contribution process in place yet. Feel free to open an issue to discuss a change before submitting a PR.

Support

For issues and questions, please open a GitHub issue.

About

AI-powered video compliance checker for DPDPA regulations using RAG, object detection, and OCR

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages