RTX 3050 - Order Now
Home / Blog / Model Guides / How to Run PaddleOCR on a Private GPU Server
Model Guides

How to Run PaddleOCR on a Private GPU Server

Deploy PaddleOCR on a private GPU server for high-speed, privacy-first document processing. Covers installation, GPU acceleration, batch processing, and API wrapper setup.

Why Run OCR on a Private GPU Server

Organisations processing invoices, contracts, medical records, or identity documents need OCR that never sends data to third-party APIs. Running PaddleOCR on a private GPU server keeps every document within your own infrastructure while delivering throughput that cloud OCR APIs cannot match at scale. GigaGPU offers dedicated PaddleOCR hosting for teams that want a turnkey solution, but this guide covers the full manual setup.

GPU-accelerated PaddleOCR processes pages 10-20x faster than CPU-only deployments. For high-volume document pipelines, that difference translates directly into processing capacity and cost savings. Check our OCR speed benchmarks to see throughput numbers across GPU tiers.

PaddleOCR Models and GPU Requirements

PaddleOCR is lightweight compared with large language models, but GPU acceleration is still essential for production throughput. The detection, recognition, and layout analysis models each consume modest VRAM individually, but running the full pipeline with batch processing benefits from dedicated GPU memory.

Workload Min VRAM Recommended GPU Throughput (pages/min)
Single-page OCR 4 GB RTX 3090 / RTX 4060 Ti 16 GB 60-80
Batch document processing 8 GB RTX 5090 / RTX 5080 120-200
Layout analysis + table extraction 12 GB RTX 5090 / RTX 6000 Pro 80-120
Multi-language with handwriting 16 GB RTX 5080 / RTX 6000 Pro 60-100

For most document processing pipelines, an RTX 5090 or RTX 5080 provides excellent price-to-performance. If you are combining OCR with downstream LLM processing, factor in the additional VRAM for both models. For a broader look at GPU selection, our GPU guide for inference workloads covers the key trade-offs.

Installation and Environment Setup

Start with a GigaGPU server running Ubuntu 22.04 with CUDA drivers pre-installed. PaddlePaddle requires its own CUDA-compatible build.

# Create virtual environment
python3 -m venv ~/paddleocr-env
source ~/paddleocr-env/bin/activate

# Install PaddlePaddle GPU version
pip install paddlepaddle-gpu==2.6.1.post120 -f https://www.paddlepaddle.org.cn/whl/linux/mkl/avx/stable.html

# Install PaddleOCR
pip install paddleocr

# Verify GPU is available to PaddlePaddle
python -c "import paddle; print(paddle.device.is_compiled_with_cuda())"

If you see True, PaddlePaddle has detected your GPU correctly. If not, verify your CUDA version matches the PaddlePaddle build. Our GPU driver setup guide covers CUDA troubleshooting that applies to any deep learning framework.

Running PaddleOCR Inference

With PaddleOCR installed, test basic inference on a sample document:

from paddleocr import PaddleOCR
import json

# Initialize with GPU acceleration
ocr = PaddleOCR(
    use_angle_cls=True,
    lang='en',
    use_gpu=True,
    gpu_mem=4000,          # GPU memory limit in MB
    det_db_thresh=0.3,
    det_db_box_thresh=0.5
)

# Process a document image
result = ocr.ocr('/path/to/document.png', cls=True)

# Extract text with confidence scores
for line in result[0]:
    bbox, (text, confidence) = line
    print(f"[{confidence:.3f}] {text}")

For multi-language support, change the lang parameter. PaddleOCR supports over 80 languages out of the box, including Chinese, Japanese, Korean, Arabic, and Devanagari. Combined with vision model hosting, you can build comprehensive document understanding pipelines.

# Multi-language OCR
ocr_multi = PaddleOCR(use_angle_cls=True, lang='ch', use_gpu=True)
result = ocr_multi.ocr('/path/to/chinese_document.png', cls=True)

Building a REST API Wrapper

Wrap PaddleOCR in a FastAPI service so other applications can submit documents for processing over HTTP:

# ocr_server.py
from fastapi import FastAPI, UploadFile, File
from paddleocr import PaddleOCR
import tempfile
import os

app = FastAPI()
ocr = PaddleOCR(use_angle_cls=True, lang='en', use_gpu=True, gpu_mem=4000)

@app.post("/ocr")
async def process_document(file: UploadFile = File(...)):
    # Save uploaded file
    with tempfile.NamedTemporaryFile(delete=False, suffix=".png") as tmp:
        content = await file.read()
        tmp.write(content)
        tmp_path = tmp.name

    try:
        result = ocr.ocr(tmp_path, cls=True)
        extracted = []
        for line in result[0]:
            bbox, (text, confidence) = line
            extracted.append({
                "text": text,
                "confidence": round(confidence, 4),
                "bbox": bbox
            })
        return {"status": "success", "results": extracted}
    finally:
        os.unlink(tmp_path)

# Run: uvicorn ocr_server:app --host 0.0.0.0 --port 8000 --workers 1

This pattern is similar to how you would build any production AI inference server — a lightweight HTTP wrapper around a GPU-accelerated model.

Batch Processing and Performance Tuning

For high-volume document pipelines, process files in batches and use multiprocessing for the CPU-bound pre-processing steps:

import glob
from paddleocr import PaddleOCR

ocr = PaddleOCR(use_angle_cls=True, lang='en', use_gpu=True, gpu_mem=6000)

# Process all images in a directory
image_files = glob.glob('/data/documents/*.png')

results = {}
for img_path in image_files:
    result = ocr.ocr(img_path, cls=True)
    texts = [line[1][0] for line in result[0]]
    results[img_path] = ' '.join(texts)
    print(f"Processed: {img_path} -> {len(texts)} text regions")

Key tuning parameters for throughput:

  • gpu_mem: Increase to allow larger batch sizes for the detection model
  • det_db_thresh: Lower values detect more text regions but increase processing time
  • rec_batch_num: Controls recognition model batch size (default 6, increase for faster throughput)
  • use_angle_cls: Disable if all documents are correctly oriented to save processing time

For pipelines that combine OCR with LLM-based extraction, see our guide on OCR and document AI hosting for architecture patterns.

Production Deployment and Monitoring

Wrap the FastAPI server in a systemd service for automatic restarts and boot-time startup:

# /etc/systemd/system/paddleocr.service
[Unit]
Description=PaddleOCR API Server
After=network.target

[Service]
User=deploy
WorkingDirectory=/home/deploy
ExecStart=/home/deploy/paddleocr-env/bin/uvicorn ocr_server:app \
  --host 0.0.0.0 --port 8000 --workers 1
Restart=always
RestartSec=5

[Install]
WantedBy=multi-user.target
sudo systemctl daemon-reload
sudo systemctl enable paddleocr
sudo systemctl start paddleocr

Monitor GPU utilization with nvidia-smi dmon -s u -d 5 to confirm the GPU is being used during OCR processing. If utilization is low, increase rec_batch_num or process multiple documents concurrently. For teams also running LLM workloads, consider a self-hosted LLM on the same server for end-to-end document intelligence, or explore our model deployment guides for other AI workloads that pair well with OCR pipelines. If you are evaluating the cost of running document processing on dedicated hardware versus cloud APIs, our GPU vs API cost comparison tool provides a clear breakeven analysis.

Deploy PaddleOCR on Private GPU Hardware

Process documents with full data privacy on GigaGPU dedicated servers. Pre-configured environments available with PaddleOCR, CUDA drivers, and NVMe storage for high-throughput pipelines.

Browse GPU Servers

Need a Dedicated GPU Server?

Deploy from RTX 3050 to RTX 5090. Full root access, NVMe storage, 1Gbps — UK datacenter.

Browse GPU Servers

gigagpu

We benchmark, deploy, and optimise GPU infrastructure for AI workloads. All data in our guides comes from real-world testing on our UK-based dedicated GPU servers.

Ready to deploy your AI workload?

Dedicated GPU servers from our UK datacenter. NVMe storage, 1Gbps networking, full root access.

Browse GPU Servers Contact Sales

Have a question? Need help?