AI Damaged Photo Restoration Implementation

We design and deploy artificial intelligence systems: from prototype to production-ready solutions. Our team combines expertise in machine learning, data engineering and MLOps to make AI work not in the lab, but in real business.
Showing 1 of 1 servicesAll 1566 services
AI Damaged Photo Restoration Implementation
Simple
~2-3 business days
FAQ
AI Development Areas
AI Solution Development Stages
Latest works
  • image_website-b2b-advance_0.png
    B2B ADVANCE company website development
    1212
  • image_web-applications_feedme_466_0.webp
    Development of a web application for FEEDME
    1161
  • image_websites_belfingroup_462_0.webp
    Website development for BELFINGROUP
    852
  • image_ecommerce_furnoro_435_0.webp
    Development of an online store for the company FURNORO
    1041
  • image_logo-advance_0.png
    B2B Advance company logo design
    561
  • image_crm_enviok_479_0.webp
    Development of a web application for Enviok
    822

AI Photo Restoration

AI restoration removes damage from old photographs: scratches, stains, scuffs, pixelation, compression artifacts, blur, noise. Combines several specialized models in a pipeline.

Full Restoration Pipeline

from PIL import Image
import cv2
import numpy as np
import io

class PhotoRestorationPipeline:
    def restore(self, damaged_photo: bytes) -> bytes:
        # 1. Remove scratches and stains (GFPGAN + inpainting)
        # 2. Upscaling (Real-ESRGAN)
        # 3. Face restoration (GFPGAN)
        # 4. Denoising

        image = Image.open(io.BytesIO(damaged_photo)).convert("RGB")
        img_np = np.array(image)

        img_np = self.remove_scratches(img_np)
        img_np = self.upscale(img_np)
        img_np = self.restore_faces(img_np)

        result = Image.fromarray(img_np)
        buf = io.BytesIO()
        result.save(buf, format="PNG")
        return buf.getvalue()

Real-ESRGAN Upscaling

from basicsr.archs.rrdbnet_arch import RRDBNet
from realesrgan import RealESRGANer

model = RRDBNet(num_in_ch=3, num_out_ch=3, num_feat=64, num_block=23, num_grow_ch=32, scale=4)
upsampler = RealESRGANer(
    scale=4,
    model_path="RealESRGAN_x4plus.pth",
    model=model,
    tile=512,       # tiling for large images
    tile_pad=10,
    pre_pad=0,
    half=True       # fp16
)

def upscale_image(img_np: np.ndarray, scale: int = 4) -> np.ndarray:
    output, _ = upsampler.enhance(img_np, outscale=scale)
    return output

GFPGAN Face Restoration

from gfpgan import GFPGANer

gfpgan = GFPGANer(
    model_path="GFPGANv1.4.pth",
    upscale=2,
    arch="clean",
    channel_multiplier=2
)

def restore_faces(img_np: np.ndarray) -> np.ndarray:
    _, _, restored_img = gfpgan.enhance(
        img_np,
        has_aligned=False,
        only_center_face=False,
        paste_back=True,
        weight=0.5  # 0 = GFPGAN, 1 = original (balance)
    )
    return restored_img

REST API

from fastapi import FastAPI, UploadFile, File

app = FastAPI()
pipeline = PhotoRestorationPipeline()

@app.post("/restore")
async def restore_photo(file: UploadFile = File(...)):
    original_bytes = await file.read()
    restored_bytes = pipeline.restore(original_bytes)
    return Response(content=restored_bytes, media_type="image/png")

Real-ESRGAN provides 4x upscaling with detail restoration. GFPGAN specializes in faces — critical for family photo archives. Both combined cover 90% of restoration tasks. Timeline: pipeline deployment — 1–2 days. Service with web upload interface and before/after comparison — 1 week.