GitHub License PaddlePaddle HuggingFace

🎨 唐卡修复AI模型 / Thangka Restoration AI Models

English | 中文

The Thangka Restoration AI Models are a collection of deep learning models specifically designed for Tibetan Buddhist Thangka art restoration. Built upon the latest Stable Diffusion 2.1 architecture and LoRA (Low-Rank Adaptation) fine-tuning technology, these models are meticulously trained on 1376 professionally annotated high-quality Thangka images.

Why AI for Thangka Restoration?

Thangka, as an important art form of Tibetan Buddhism, carries profound religious and cultural significance, known as the "Encyclopedia of Tibet". However:

  • 📜 Fragile Materials: Cotton, silk, and mineral pigments are easily damaged
  • Historical Age: Many Thangkas are centuries old
  • 💰 Expensive Restoration: Traditional manual restoration is costly and time-consuming
  • 👨‍🎨 Expert Scarcity: Limited number of professional restorers
  • ⚠️ High Risk: Chemical restoration may cause secondary damage

This project leverages AI technology to provide:

  • Efficient Restoration: Complete initial restoration in minutes
  • Cultural Accuracy: >95% cultural feature preservation
  • Cost Reduction: Significantly lower restoration barriers
  • Non-destructive: Virtual restoration without damaging originals

项目链接

🌟 项目简介

这是一套专门用于藏传佛教唐卡艺术修复的AI模型集合,基于Stable Diffusion 2.1LoRA微调技术,在专业标注的唐卡图像上训练而成。

核心特点

  • 高效修复: 基于LoRA技术,快速适应不同风格
  • 多种模型: 提供多个LoRA模型,适应不同修复需求
  • PaddlePaddle: 完全适配PaddlePaddle深度学习框架

开发信息

  • 开发者: Wangchuk Mind
  • 机构: 四川大学计算机学院
  • 框架: PaddlePaddle 2.6.2
  • 基础模型: Stable Diffusion 2.1
  • 许可证: MIT License

📦 模型列表

1. 基础模型

Stable Diffusion 2.1 Base (PaddlePaddle版)

  • 输入分辨率: 512×512 (标准), 768×768, 1024×1024

2. LoRA微调模型

thangka_21_Status_140 ⭐ (推荐)

thangka_21_ACD_250

3. PaddlePaddle专用模型

位于 models/finetuned_paddle/models/sd2.1_base_paddle/,这些是转换为PaddlePaddle格式的模型文件(.pdparams),可直接在PaddlePaddle框架中使用。

💻 使用方法

环境要求

# Python版本
Python >= 3.9

# 核心依赖
paddlepaddle-gpu >= 2.6.0  # GPU版本 (推荐)
# 或
paddlepaddle >= 2.6.0      # CPU版本

# 其他依赖
pip install Pillow opencv-python numpy

快速开始

1. 基础修复示例

import paddle
from PIL import Image
import numpy as np

# 这里是简化的示例,完整代码请参考GitHub仓库
# https://github.com/WangchukMind/thangka-restoration-ai

# 加载模型 (伪代码 - 实际使用请参考完整系统)
from diffusion_paddle import load_model, load_lora, inpaint

# 加载基础模型
pipe = load_model(
    model_path="models/sd2.1_base_paddle",
    device="gpu"  # 或 "cpu"
)

# 加载LoRA模型
load_lora(pipe, "models/finetuned/thangka_21_Status_140.safetensors")

# 加载待修复图像
image = Image.open("damaged_thangka.png").resize((512, 512))
mask = Image.open("damage_mask.png").resize((512, 512))

# 执行修复
result = inpaint(
    pipe=pipe,
    image=image,
    mask=mask,
    prompt="traditional thangka art, Buddha, detailed, vibrant colors, gold outlines",
    negative_prompt="low quality, blurry, distorted, modern style",
    num_inference_steps=30,
    guidance_scale=7.5,
    strength=0.8
)

# 保存结果
result.save("restored_thangka.png")

2. 使用ControlNet边缘控制

# 加载ControlNet
from diffusion_paddle import load_controlnet

controlnet = load_controlnet("models/control_v11p_sd21_canny_paddle")

# 提取边缘
from skimage.feature import canny
edges = canny(np.array(image.convert('L')), sigma=1)
edge_image = Image.fromarray((edges * 255).astype(np.uint8))

# 使用ControlNet修复
result = inpaint_with_control(
    pipe=pipe,
    image=image,
    mask=mask,
    control_image=edge_image,
    controlnet=controlnet,
    prompt="traditional thangka art, detailed restoration",
    num_inference_steps=30
)

完整系统安装

完整的Web应用系统请访问GitHub:

# 克隆完整系统
git clone https://github.com/WangchukMind/thangka-restoration-ai.git
cd thangka-restoration-ai

# 安装依赖
cd Django
pip install -r requirements_paddle.txt

# 下载模型文件
# 模型文件较大,请从以下地址下载:
# Hugging Face: https://huggingface.co/Wangchuk1376/ThangkaModels
# 或参考 MODEL_DOWNLOAD.md

# 启动系统
python start_server.py runserver

# 或使用MVP简化版本
cd ..
python start_mvp_product.py

访问 http://localhost:3000 使用Web界面。

问题反馈


🌟 Star History

如果这个项目对您有帮助,请给我们一个⭐️!

Star History Chart

Contact


🎨 Preserving millennium-old Thangka culture with AI technology!

Downloads last month
-
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support