Aller au contenu
ModelPrésentéExterne
Browse files

Hat Srx4 Engravings

Fine-tuned HAT base model for 4x super-resolution of historical engravings and black-and-white printed illustrations.

TypeOtherVersionNet g 1000BClasse

Source du modèle

Type
Other
Taille du fichier
81,0–162 MB
Version
vNet g 1000
Mis à jour
9 oct. 2026
Source
Hugging Face

Description de la source

HAT SRx4 Engravings

Fine-tuned HAT base model for 4x super-resolution of historical engravings and black-and-white printed illustrations.

The selected checkpoint corresponds to 5,000 fine-tuning iterations. The recommended inference file is net_g_best.safetensors, which contains only the params_ema model weights. The original BasicSR/HAT checkpoint is also preserved as net_g_best.pth.

Visual tests on held-out historical illustrations showed clear improvement over the base pretrained model, with no meaningful visible gains from later checkpoints up to 50,000 iterations.

Visual Comparison

The sheet below compares traditional interpolation, the base HAT SRx4 ImageNet-pretrained model, and the selected fine-tuned checkpoint on held-out historical illustrations.

Comparison of bicubic, lanczos, base HAT, and fine-tuned HAT outputs

Model

  • Architecture: HAT base
  • Scale: 4x
  • Base checkpoint: HAT_SRx4_ImageNet-pretrain.pth
  • Fine-tuning checkpoint: net_g_5000.pth
  • Published checkpoint names: net_g_best.safetensors, net_g_best.pth
  • Parameter key: params_ema
  • Training loss: L1
  • Training framework: BasicSR + HAT
  • License: Apache License 2.0

This is a fine-tuned checkpoint for the original HAT architecture, not a new model architecture. Cite and refer to the upstream project when reusing it:

  • Original repository: https://github.com/XPixelGroup/HAT
  • Paper: Activating More Pixels in Image Super-Resolution Transformer, CVPR 2023
  • Authors: Xiangyu Chen, Xintao Wang, Jiantao Zhou, Yu Qiao, and Chao Dong

Intended Use

This model is intended for visual upscaling of scanned engravings, line art, and historical printed illustrations. It is not a factual restoration model and should not be used as evidence that details were present in the original print.

Limitations

  • May alter or regularize micro-textures in dense hatching.
  • May sharpen paper noise or scanning artifacts.
  • Not trained for colorized engravings, photographs, handwriting, or modern raster graphics.
  • Visual inspection is recommended before production use.

Files

net_g_best.safetensors  # recommended inference weights, params_ema only
net_g_best.pth          # original BasicSR/HAT checkpoint with params and params_ema
train_config.yml        # training configuration used for the fine-tune
inference.py            # tiled inference helper
checkpoints/            # historical numbered checkpoints from training

Inference

This repository contains the selected checkpoint and a tiled inference helper. The script expects the HAT/BasicSR environment used during training, with HAT available through the HAT_PATH environment variable or in a local hat/ folder next to inference.py.

Use net_g_best.safetensors when a loader supports HAT safetensors directly. It stores only the final params_ema tensors and avoids Python pickle serialization. Use net_g_best.pth with the provided inference.py helper or BasicSR/HAT tooling that expects the original checkpoint format.

Install the Python dependencies, clone the original HAT repository, and point HAT_PATH to it:

git clone https://github.com/XPixelGroup/HAT.git
python -m venv .venv
.\.venv\Scripts\python.exe -m pip install -r requirements.txt
$env:HAT_PATH="C:\path\to\HAT"

Example:

python inference.py `
  --input path\to\images `
  --output path\to\output `
  --checkpoint net_g_best.pth `
  --tile-size 128 `
  --tile-pad 16

For large scans, tiled inference is recommended to avoid exhausting VRAM. The script processes images serially.

ComfyUI

The recommended ComfyUI file is net_g_best.safetensors. It is a HAT/BasicSR state dict containing the params_ema weights. It is not a Stable Diffusion upscaler checkpoint.

To try it in ComfyUI, place net_g_best.safetensors in:

ComfyUI/models/upscale_models/

Then use the standard upscale workflow with Load Image, UpscaleModelLoader, ImageUpscaleWithModel, and Save Image.

If ComfyUI does not recognize the file, update ComfyUI and its upscale-model dependencies, especially spandrel and spandrel-extra-arches. If it still does not recognize the file, the installed upscale backend does not support this exact HAT checkpoint format. In that case, use inference.py from this repository, or create/use a ComfyUI custom node that instantiates the original HAT architecture with the settings in train_config.yml and loads the safetensors state dict.

Training Notes

The model was fine-tuned on curated engraving crops with synthetic Real-ESRGAN-style degradations. Validation used fixed LQ/GT pairs generated from held-out crops. External visual testing was performed on historical illustrations not included in training.

Checkpoint selection favored visual fidelity in hatching, line stability, and avoidance of invented texture over raw iteration count.

The checkpoints/ folder preserves the numbered training history. The selected production model is net_g_best.safetensors / net_g_best.pth / checkpoints/net_g_5000.pth.

License

This fine-tuned model is released under the Apache License 2.0. The upstream HAT architecture and pretrained checkpoint are also distributed under Apache License 2.0 by the original HAT authors.

Dataset Manifest

The curated training split is documented separately as a reconstruction manifest:

https://huggingface.co/datasets/PhSchneider/rijksmuseum-engraving-crops

That dataset repository stores crop coordinates, split files, hashes, and preprocessing metadata rather than redistributing the full crop image set.

Sources

1 source
Hugging FacePrincipalVersion 5b43e31a8822551e83b43e4565cd6b253f6cb0d9
huggingface.co/PhSchneider/hat-srx4-engravings/tree/5b43e31a8822551e83b43e4565cd6b253f6cb0d9

Vérifié 9 oct.

Download files

Artefacts du modèle

14 artefacts

checkpoints/net_g_1000.pth

pth · 162 MB · SHA-256 cc5df834281a…06a0 · Hugging Face

Download file

checkpoints/net_g_10000.pth

pth · 162 MB · SHA-256 e6b63eac6053…c7c7 · Hugging Face

Download file

checkpoints/net_g_15000.pth

pth · 162 MB · SHA-256 94d606824b6e…6044 · Hugging Face

Download file

checkpoints/net_g_20000.pth

pth · 162 MB · SHA-256 71719d65374d…551a · Hugging Face

Download file

checkpoints/net_g_25000.pth

pth · 162 MB · SHA-256 0787b5833200…0477 · Hugging Face

Download file

checkpoints/net_g_30000.pth

pth · 162 MB · SHA-256 9f4a2145e06e…2382 · Hugging Face

Download file

checkpoints/net_g_35000.pth

pth · 162 MB · SHA-256 8dbf0d85ece1…0d8c · Hugging Face

Download file

checkpoints/net_g_40000.pth

pth · 162 MB · SHA-256 92000e3115f4…04c4 · Hugging Face

Download file

checkpoints/net_g_45000.pth

pth · 162 MB · SHA-256 6aa61c1d2696…8fd8 · Hugging Face

Download file

checkpoints/net_g_500.pth

pth · 162 MB · SHA-256 0e616d5eaf64…c9a9 · Hugging Face

Download file

checkpoints/net_g_5000.pth

pth · 162 MB · SHA-256 b1d9f529649e…41ab · Hugging Face

Download file

checkpoints/net_g_50000.pth

pth · 162 MB · SHA-256 4d06bce6c840…ebb3 · Hugging Face

Download file

net_g_best.pth

pth · 162 MB · SHA-256 b1d9f529649e…41ab · Hugging Face

Download file

net_g_best.safetensors

safetensors · 81,0 MB · SHA-256 d6d011b85423…7eec · Hugging Face

Download file

Extraits de sources

2 extraits

--- license: apache-2.0 library_name: pytorch tags: - image-super-resolution - super-resolution - historical-documents - engravings - HAT - BasicSR pipeline_tag: image-to-image --- # HAT SRx4 Engravings Fine-tuned HAT base model for 4x super-resolution of historical engravings and black-and-white printed illustrations. The selected checkpoint corresponds to 5,000 fine-tuning iterations. The recommended inference file is `net_g_best.safetensors`, which contains only the `params_ema` model weights. The original BasicSR/HAT checkpoint is also preserved as `net_g_best.pth`. Visual tests on held-out historical illustrations showed clear improvement over the base pretrained model, with no meaningful visible gains from later checkpoints up to 50,000 iterations. ## Visual Comparison The sheet below compares traditional interpolation, the base HAT SRx4 ImageNet-pretrained model, and the selected fine-tuned checkpoint on held-out historical illustrations. ![Comparison of bicubic, lanczos, base HAT, and fine-tuned HAT outputs](assets/comparison_contact_sheet.png) ## Model - Architecture: HAT base - Scale: 4x - Base checkpoint: `HAT_SRx4_ImageNet-pretrain.pth` - Fine-tuning checkpoint: `net_g_5000.pth` - Published checkpoint names: `net_g_best.safetensors`, `net_g_best.pth` - Parameter key: `params_ema` - Training loss: L1 - Training framework: BasicSR + HAT - License: Apache License 2.0 This is a fine-tuned checkpoint for the original HAT architecture, not a new model architecture. Cite and refer to the upstream project when reusing it: - Original repository: https://github.com/XPixelGroup/HAT - Paper: *Activating More Pixels in Image Super-Resolution Transformer*, CVPR 2023 - Authors: Xiangyu Chen, Xintao Wang, Jiantao Zhou, Yu Qiao, and Chao Dong ## Intended Use This model is intended for visual upscaling of scanned engravings, line art, and historical printed illustrations. It is not a factual restoration model and should not be used as evidence that details were present in the original print. ## Limitations - May alter or regularize micro-textures in dense hatching. - May sharpen paper noise or scanning artifacts. - Not trained for colorized engravings, photographs, handwriting, or modern raster graphics. - Visual inspection is recommended before production use. ## Files ```text net_g_best.safetensors # recommended inference weights, param...

Source context: 0 downloads · 0 likes · Pipeline image-to-image · Library pytorch · Repo PhSchneider/hat-srx4-engravings