Abysstree渊林ovc
Back to notes返回笔记

Draft草稿 / 2026-07-04

Photo Moire Removal: An AI Camera Restoration DemoPhoto Moire Removal:一个 AI 相机图像恢复 Demo

A draft project page for a small photo demoireing portfolio demo under the broader AI camera restoration line.一个小型拍屏去摩尔纹作品集 Demo 草稿,属于更长期的 AI 相机图像恢复方向。

The Artifact: Why Screen Photos Produce Moire

Photo moire appears when a camera photographs a display. The screen has its own pixel and subpixel structure. The camera sensor has its own sampling grid. The image then passes through demosaicing, denoising, sharpening, compression, and other ISP stages.

When these systems interact, structured artifacts can appear: colored bands, repetitive ripples, false textures, and local patterns that do not belong to the original displayed content.

This is not just ordinary noise. It is an imaging artifact caused by the interaction between display structure, camera sampling, optics, and image processing.

That makes photo moire removal a good small project for an AI camera restoration portfolio.

Why This Belongs to AI Camera Restoration

AI camera restoration is about improving images produced by real camera pipelines. The important word is “real.” Real images contain artifacts that come from hardware, optics, sensors, ISP decisions, and usage conditions.

Photo demoireing connects several of my interests:

  • smartphone photography;
  • computational imaging;
  • ISP-aware image restoration;
  • display-camera sampling artifacts;
  • practical before/after visual demos;
  • deployable restoration systems.

It is also small enough to finish. That matters. This project should not become a new paper direction or a full AI camera platform. It should become a polished, reproducible demo.

Baseline First: UHDM / ESDNet

The first rule of this project is simple:

Do not start by inventing a new model.

The current baseline is UHDM/ESDNet. I selected it first because it targets practical high-resolution screen photographs, provides pretrained weights, and is suitable for building a reproducible inference pipeline.

The current foundation includes:

  • a separate WSL code repository;
  • a dedicated code repository for the demo pipeline;
  • a modern CUDA-enabled PyTorch environment;
  • imported and modernized UHDM/ESDNet inference code;
  • official baseline checkpoint loading;
  • strict state-dict verification;
  • first GPU inference on a sample image;
  • a measured first forward pass around the sub-second range on the current GPU setup.

This is enough to justify building a result gallery before considering training or architecture changes.

Demo Pipeline

The minimum demo should be clear:

moire-corrupted photo -> ESDNet inference -> restored image -> before/after comparison

The portfolio version should include:

  • upload or select an input image;
  • run the demoireing model;
  • show input and output side by side;
  • show synchronized crop or zoom comparisons;
  • report inference time;
  • include several sample images;
  • mark failure cases honestly.

The goal is not to claim that the baseline solves every case. The goal is to build a trustworthy demo that shows what works, what fails, and what should be improved next.

What Makes a Result Convincing

A good demoireing result is not just a smoother image.

It should remove visible moire patterns while preserving text edges, UI lines, local contrast, and meaningful texture. It should avoid over-smoothing, color shifts, and new artifacts near high-frequency regions.

For the first evaluation set, I want a small sample manifest rather than a huge unorganized folder. The sample set should cover:

  • text and UI screenshots;
  • photographs displayed on screens;
  • flat colors;
  • dark backgrounds;
  • fine grids;
  • mixed content;
  • several moire scales and shooting conditions.

Every sample should have known provenance and a clear public/private status. A portfolio demo should not depend on unclear sample licensing.

Failure Cases I Want To Keep

Failure cases are useful. They keep the project honest and make later improvements more meaningful.

The first gallery should label results such as:

  • good;
  • partial;
  • failed;
  • over-smoothed.

I want to record residual color bands, text damage, texture loss, color shifts, and boundary artifacts. If training or fine-tuning becomes necessary later, it should be motivated by repeated observed failures, not by the vague desire to “improve the model.”

Next Steps

The next milestone is an evidence-backed baseline gallery.

The immediate tasks are:

  1. define a sample manifest with image metadata and license status;
  2. collect a small real-photo set;
  3. add reproducible batch inference;
  4. measure runtime correctly with warm-up and repeated runs;
  5. select strong examples and honest failure cases;
  6. generate standardized before/after and crop comparison assets;
  7. build a lightweight local demo or static result gallery;
  8. write a GitHub-facing README.

Only after that should I decide whether training, synthetic moire generation, ONNX export, or a second baseline is worth the time.

For now, the best version of this project is small, visual, reproducible, and easy to understand.

伪影:为什么拍屏照片会产生摩尔纹

拍屏摩尔纹会在相机拍摄显示屏时出现。屏幕有自己的像素和子像素结构,相机传感器也有自己的采样网格。图像随后还会经过去马赛克、去噪、锐化、压缩和其他 ISP 阶段。

当这些系统发生交互时,就可能出现结构化伪影:彩色条纹、重复波纹、虚假纹理,以及不属于原始显示内容的局部图案。

这不是普通噪声,而是显示结构、相机采样、光学和图像处理相互作用造成的成像伪影。

因此,拍屏摩尔纹去除很适合作为 AI 相机图像恢复作品集里的一个小项目。

为什么它属于 AI 相机图像恢复

AI 相机图像恢复关注的是改善真实相机流程产生的图像。这里重要的是“真实”。真实图像里的伪影来自硬件、光学、传感器、ISP 决策和使用条件。

拍屏去摩尔纹连接了我的几个兴趣点:

  • 智能手机摄影;
  • 计算成像;
  • ISP 感知图像恢复;
  • 显示屏-相机采样伪影;
  • 实用的前后对比视觉 Demo;
  • 可部署恢复系统。

它也足够小,小到可以完成。这一点很重要。这个项目不应该变成新的论文方向或完整 AI 相机平台,它应该成为一个打磨过、可复现的 Demo。

基线优先:UHDM / ESDNet

这个项目的第一条规则很简单:

不要一开始就发明新模型。

当前基线是 UHDM/ESDNet。我首先选择它,是因为它面向实际高分辨率拍屏照片,提供预训练权重,也适合搭建可复现推理流程。

目前基础已经包括:

  • 独立的 WSL 代码仓库;
  • 专门服务 Demo 流程的代码仓库;
  • 支持 CUDA 的现代 PyTorch 环境;
  • 导入并现代化 UHDM/ESDNet 推理代码;
  • 官方基线检查点加载;
  • 严格的权重字典验证;
  • 样例图像上的首次 GPU 推理;
  • 当前 GPU 配置上接近亚秒级的首次前向传播。

这些已经足够支撑我先做结果画廊,而不是过早考虑训练或架构修改。

Demo 流程

最小 Demo 应该非常清楚:

带摩尔纹的拍屏照片 -> ESDNet 推理 -> 恢复图像 -> 前后对比

作品集版本应该包括:

  • 上传或选择输入图像;
  • 运行去摩尔纹模型;
  • 并排展示输入和输出;
  • 展示同步裁剪或缩放对比;
  • 报告推理时间;
  • 包含几个样例图像;
  • 诚实标注失败案例。

目标不是宣称基线能解决所有情况。目标是做一个可信 Demo,展示哪些有效、哪些失败、下一步应该改进什么。

什么样的结果有说服力

好的去摩尔纹结果不只是更平滑的图像。

它应该去除可见摩尔纹,同时保留文字边缘、UI 线条、局部对比度和有意义的纹理。它应该避免过度平滑、色偏,以及高频区域附近的新伪影。

第一版评估集我希望用小型样本清单,而不是一个巨大但无组织的文件夹。样本集应该覆盖:

  • 文本和 UI 截图;
  • 屏幕上显示的照片;
  • 纯色区域;
  • 暗色背景;
  • 细密网格;
  • 混合内容;
  • 多种摩尔纹尺度和拍摄条件。

每个样本都应该有已知来源和明确的公开/私有状态。作品集 Demo 不应该依赖授权不清的样本。

我想保留的失败案例

失败案例很有用。它们让项目保持诚实,也让后续改进更有意义。

第一版结果画廊应该标注这样的结果:

  • good
  • partial
  • failed
  • over-smoothed

我希望记录残留色带、文本损伤、纹理丢失、色偏和边界伪影。如果之后需要训练或微调,它应该由反复出现的观察失败来驱动,而不是出于“改进模型”这种模糊愿望。

下一步

下一个里程碑是有证据支撑的基线结果画廊。

近期任务包括:

  1. 定义包含图像元数据和授权状态的样本清单;
  2. 收集一个小型真实拍摄样本集;
  3. 加入可复现批量推理;
  4. 用预热和重复运行正确测量运行时间;
  5. 选择强样例和诚实失败案例;
  6. 生成标准化前后对比和裁剪区域对比素材;
  7. 构建轻量本地 Demo 或静态结果画廊;
  8. 写一个面向 GitHub 的 README。

只有在这些完成之后,我才应该决定训练、合成摩尔纹生成、ONNX 导出或第二个基线是否值得投入时间。

目前,这个项目最好的版本是小、可视化、可复现、容易理解。