/ Модель

Характеристики

Лицензия
MIT
Архитектура
inkdetection_resnet3d · dense
Библиотека
transformers
Опубликована
22 июн 2026

PHerc.1667-iteration-2

Сегментация изображенийИзображение → mask3 профессии

Модель ResNet3D-50 с декодером U-Net выделяет следы чернил на объёмных сканах свитков Геркуланума.

53скачиваний за 30 дней0лайковвеса обновлены30 июн 2026

Бенчмарки

Как модель справилась с задачами пользователей ailist и что о ней публикуют открытые лидерборды

Публичные оценки

Из открытых лидербордов. Сравнивайте результаты одного теста при одинаковых условиях — отсутствие оценки не значит, что модель хуже.

В подключённых источниках результатов для этой модели пока нет.

Что умеет модель

Описание составлено по карточке модели и метаданным Hugging Face

PHerc.1667-iteration-2 — модель сегментации чернил для проекта Vesuvius Challenge, обученная авторами репозитория scrollprize на 8 970 фрагментах сегмента l_2 с разметкой l_2_inklabels2.png. Она предназначена для выделения следов чернил на объёмных сканах обугленных свитков Геркуланума и может применяться для построения масок надписей, в том числе на сегментах, не использованных при обучении.

Модель принимает объёмные данные в окнах размером 62 × 256 × 256 вокселей. Энкодер ResNet3D-50, инициализированный весами Kinetics-700, формирует признаки, которые декодер на основе 2D U-Net преобразует в карту вероятностей чернил размером 64 × 64. Для обработки полного сегмента требуется скользящее разбиение на окна и усреднение перекрывающихся предсказаний. Веса Hugging Face побитово совпадают с исходным PyTorch Lightning чекпойнтом. Доступна лицензия MIT.

Модель специализирована на сегментации чернил в томографических данных свитков, а не на распознавании и чтении текста. Предсказание на выходе имеет четвертное разрешение относительно окна; для больших объёмов нужны тайлинг и объединение результатов. README описывает обучение на одном сегменте, поэтому качество на других сегментах может отличаться.

Сценарии применения

  • выделение чернил на томографических сканах свитков
  • создание масок надписей для последующего чтения
  • инференс по окнам большого объёмного сегмента
  • анализ предсказаний на сегментах, не использованных при обучении

Ограничения

Модель предсказывает маску чернил, но не распознаёт и не читает надписи. Она обрабатывает окна 256 × 256 по плоскости и выдаёт карту четвертного разрешения, поэтому полный сегмент требует тайлинга; обучение проводилось на разметке одного сегмента.

Для каких профессий подходит3

Разделы каталога профессий, в задачах которых используется эта модель

Все профессии

Карточка модели

README от автора на Hugging Face, как он его опубликовал

Открыть на Hugging Face

PHerc.1667-iteration-2

Trained on segment l_2 with l_2_inklabels2.png (8,970 tiles).

Ablation 2/5 — 8,970 training tiles (~3x ink1).

This is one of six sibling models released together — five label ablations on segment l_2 (ink1–ink5, increasing label coverage) and one cross-segment baseline (ink0). The full family is listed at the bottom of this card.

Preview

l_2 (training segment) prediction with the training label overlaid in magenta, and l_5 (held-out segment) prediction. All panels are downsampled 16× and rotated 180° to match the publication-figure convention. The full-resolution last.ckpt outputs are at 43008 × ~30000 voxels.

training labell_2 predictionl_5 prediction
labell_2 predl_5 pred

Architecture in one paragraph

A 3-D volumetric input (B, 1, 62, 256, 256) is encoded by a ResNet3D-50 backbone (Hara, Kataoka & Satoh, 2018; initialised from the Kinetics-700 release r3d50_KM_200ep.pth with conv1 weights summed across RGB → 1 grayscale channel). Each of the four backbone stages is collapsed along the z (depth) axis with torch.max, producing a 2-D feature pyramid {(256,64,64), (512,32,32), (1024,16,16), (2048,8,8)}. A small 2-D U-Net decoder upsamples coarse-to-fine with concatenated skip connections; a 1×1 conv head produces a single sigmoid logit channel at quarter resolution (B, 1, 64, 64). Training uses 0.5·Dice + 0.5·SoftBCE against the label down-interpolated to 64×64.

Quick start

import torch
from transformers import AutoModel

model = AutoModel.from_pretrained(
    "YoussefMoNader/PHerc.1667-iteration-2",
    trust_remote_code=True,
).eval().cuda()

# Input: float32, shape (B, 1, D=62, H=256, W=256).
# Intensity should already be in roughly [0, 1] (the training pipeline
# clipped raw uint8 layers to [0, 200] then applied Normalize(mean=0, std=1)
# which keeps the magnitude small).
x = torch.randn(1, 1, 62, 256, 256, device="cuda")

with torch.no_grad():
    out = model(x)

print(out.logits.shape)                        # torch.Size([1, 1, 64, 64])
prob = torch.sigmoid(out.logits)               # ink probability per pixel

Full-segment inference (tiling)

The model only sees 256×256 windows. For a full scroll segment you need to slide the window across the (padded) layer stack and average overlapping predictions:

import numpy as np, cv2, torch
import torch.nn.functional as F
from transformers import AutoModel

model = AutoModel.from_pretrained(
    "YoussefMoNader/PHerc.1667-iteration-2", trust_remote_code=True,
).eval().cuda()

WINDOW, STRIDE = 256, 128       # 128 = 2x oversample; 64 for 8x oversample
D = 62                           # number of z-layers

# image: (H, W, D) uint8 stack of the 62 layers, padded to multiples of 256.
# fmask: (H, W) uint8 fragment mask (0 = outside, 255 = inside).
H, W, _ = image.shape
mask_pred  = np.zeros((H, W), dtype=np.float32)
mask_count = np.zeros((H, W), dtype=np.float32)

with torch.no_grad():
    for y in range(0, H - WINDOW + 1, STRIDE):
        for x in range(0, W - WINDOW + 1, STRIDE):
            if np.any(fmask[y:y+WINDOW, x:x+WINDOW] == 0):
                continue
            tile = image[y:y+WINDOW, x:x+WINDOW]            # (256,256,62)
            t = torch.from_numpy(tile).permute(2, 0, 1)     # (62,256,256)
            t = t.unsqueeze(0).unsqueeze(0).float().cuda()  # (1,1,62,256,256)
            logits = model(t).logits                        # (1,1,64,64)
            prob   = torch.sigmoid(logits)
            prob   = F.interpolate(prob, scale_factor=4,
                                   mode="bilinear").squeeze().cpu().numpy()
            mask_pred[y:y+WINDOW, x:x+WINDOW]  += prob
            mask_count[y:y+WINDOW, x:x+WINDOW] += 1.0

pred = np.divide(mask_pred, mask_count,
                 out=np.zeros_like(mask_pred),
                 where=mask_count != 0)
cv2.imwrite("prediction.png", np.clip(pred * 255, 0, 255).astype(np.uint8))

Training summary

BackboneResNet3D-50 (3-D conv, BN, ReLU residual blocks)
Encoder initr3d50_KM_200ep.pth (Kinetics-700), conv1 summed across RGB
Decoder2-D U-Net (3 up-blocks: bilinear 2× + concat skip + 3×3 conv + BN + ReLU)
Output1 channel, sigmoid logit, quarter-resolution (64×64)
Loss0.5 × Dice + 0.5 × SoftBCE (smooth = 0.25)
OptimizerAdamW, OneCycle lr 2e-5 → 3e-4, pct_start = 0.15
Batch2 (effective 8 via accumulate 4), 16-mixed, grad-clip 1.0
Max steps12,396 (= 3 epochs over the densest ablation label)
Training segment(s)l_2
Training labell_2_inklabels2.png
Training tiles (256×256 sub-tiles at stride 64)8,970
Final train loss (_epoch)0.4841
Final train loss (_step, single-batch noise)0.4879
Wandbvesuvius-challenge/paper/l2_ink2_l5infer
Random seed130697
Determinismcudnn.deterministic = True, cudnn.benchmark = False
Hardware1 × NVIDIA H100 80 GB; ≈ 2 h end-to-end (load + train + inference)

Files

filesizedescription
config.json1 KBarchitecture + provenance metadata; loaded by AutoConfig
configuration_inkdetection.py2 KBInkDetectionConfig(PretrainedConfig)
modeling_inkdetection.py9 KBself-contained InkDetectionModel(PreTrainedModel)
model.safetensors319 MBconverted weights (338 tensors)
last.ckpt963 MBoriginal PyTorch-Lightning checkpoint (incl. optimizer + LR-scheduler state) — load with torch.load(...)["state_dict"]
preview_l_2.png~700 KBlow-res preview of the l_2 prediction (1/16 scale, 180° rotated)
preview_l_5.png~2 MBlow-res preview of the l_5 (held-out) prediction
preview_label.png~50 KBthe training label, same scale + rotation

The HuggingFace weights are bit-perfect identical to the original PyTorch-Lightning checkpoint (verified max abs diff = 0.0e+00 on identical inputs). Use model.safetensors for AutoModel.from_pretrained; use last.ckpt only if you want to resume training from the saved optimizer / scheduler state.

The model family

modeltraining segment(s)labeltileseffective epochs
PHerc.1667-iteration-0500p2a + 658 + 20250910185200 + 20250919125754*(cross-segment baseline)20,075~5
PHerc.1667-iteration-1l_2l_2_inklabels.png3,396~30
PHerc.1667-iteration-2l_2l_2_inklabels2.png8,970~12
PHerc.1667-iteration-3l_2l_2_inklabels3.png15,286~7
PHerc.1667-iteration-4l_2l_2_inklabels4.png24,773~5
PHerc.1667-iteration-5l_2l_2_inklabels5.png33,0613

All six share the architecture, hyperparameters, and a fixed step budget of 12,396 optimizer steps; the only thing that varies between rows is the supervising label (or, for ink0, the training segments).

Citation

If you use this model in published work, please cite the Vesuvius Challenge and the underlying ResNet3D paper:

@inproceedings{hara2018can,
  title  = {Can spatiotemporal 3D CNNs retrace the history of 2D CNNs and ImageNet?},
  author = {Hara, Kensho and Kataoka, Hirokatsu and Satoh, Yutaka},
  booktitle = {CVPR}, year = {2018},
}

Licence

MIT.

Как запустить

На своей GPU в ailist. Цена — по текущим предложениям провайдеров

GPU в ailist

Универсальный рантайм · transformers · image-segmentation

Нельзя запустить

Модели нужен код из репозитория; автор пока не в списке доверенных организаций.

Класс архитектуры
InkDetectionModel
Ревизия весов
bf6053c

0 моделей