Skip to main content

hfs-score

Historical Fidelity Score (HFS) is a Python starter library for evaluating the historical fidelity of AI-generated cultural heritage images.

This project implements the methodological scoring framework proposed in:

A Mathematical Scoring Model for Historical Fidelity in Text-to-Image Reconstruction of Cultural Heritage Scenes

The goal is not to train a new AI model.
The goal is to provide a reusable scoring toolkit for researchers, museums, heritage experts, and AI practitioners.


What HFS measures

HFS combines five positive dimensions:

Symbol Meaning
TIA Text-Image Alignment
VSS Visual Similarity Score
ACS Architectural Consistency Score
CHP Cultural and Historical Plausibility
EVS Expert Validation Score

And two penalties:

Symbol Meaning
UP Uncertainty Penalty
BP Bias and Hallucination Penalty

The global score is:

HFS(I) = 100 × clip(
w1*TIA + w2*VSS + w3*ACS + w4*CHP + w5*EVS
- w6*UP - w7*BP,
0, 1
)

Default illustrative weights:

(w1, w2, w3, w4, w5, w6, w7)
=
(0.20, 0.18, 0.17, 0.20, 0.15, 0.05, 0.05)

These weights are initial values and should be validated using expert elicitation and sensitivity analysis.


Installation for development

Clone or unzip this project, then run:

cd hfs-score
python -m pip install -e .

For tests:

python -m pip install -e ".[dev]"
pytest

Basic usage

from hfs_score import (
    compute_hfs,
    compute_tia,
    compute_vss,
    compute_acs,
    compute_chp,
    compute_evs,
    compute_up,
    compute_bp,
)

TIA = compute_tia(clip_score=0.84, tifa_score=0.78)
VSS = compute_vss(ssim_score=0.72, lpips_distance=0.30)
ACS = compute_acs(layout=0.80, proportions=0.70, structure=0.65)
CHP = compute_chp(
    temporal=0.90,
    artifacts=0.75,
    materials=0.80,
    anachronism_absence=0.70
)
EVS = compute_evs([0.85, 0.90, 0.80])
UP = compute_up(seed_variance=0.20, expert_disagreement=0.15)
BP = compute_bp(hallucination_rate=0.10, bias_rate=0.15)

score = compute_hfs(
    TIA=TIA,
    VSS=VSS,
    ACS=ACS,
    CHP=CHP,
    EVS=EVS,
    UP=UP,
    BP=BP,
)

print(f"HFS = {score:.2f}/100")

CLI usage

After installation:

hfs-score --tia 0.80 --vss 0.70 --acs 0.60 --chp 0.75 --evs 0.90 --up 0.20 --bp 0.10

Expected output:

HFS = 65.80/100

Project roadmap

Version 0.1

  • Core HFS formula
  • Criteria formulas
  • Basic CLI
  • Tests
  • Example usage

Version 0.2

  • Batch CSV evaluation
  • Export JSON/CSV reports
  • Weight sensitivity analysis

Version 0.3

  • Integration with CLIPScore, SSIM, LPIPS
  • Expert rubric forms

Version 1.0

  • Full research-ready toolkit
  • Benchmark comparison
  • Automatic report generation

Scientific note

This package implements a methodological framework.
It does not claim that an HFS score is an absolute historical truth.
The score should be interpreted as a transparent decision-support measure combining automatic metrics, expert rubrics, and explicit risk penalties.


Publishing on PyPI

For detailed instructions, see:

  • PUBLISHING_PYPI_FR.md
  • PUBLISHING_PYPI_EN.md

Quick commands:

python -m pip install --upgrade build twine
python -m build
python -m twine check dist/*
python -m twine upload --repository testpypi dist/*
python -m twine upload dist/*

Metadata

Release files for hfs-score 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for hfs-score 0.1.0
File Size Uploaded Provenance Actions
hfs_score-0.1.0.tar.gz 10.2 kB Without provenance Details for hfs_score-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for hfs-score 0.1.0
File Interpreter ABI Platform Actions
hfs_score-0.1.0-py3-none-any.whl Python 3 none any Details for hfs_score-0.1.0-py3-none-any.whl

Total release size: 19.5 kB

Release files / hfs_score-0.1.0.tar.gz

Download URL hfs_score-0.1.0.tar.gz
Size 10.2 kB
Tags Source
SHA-256 checksum
How to use checksums
44b13edaf534f1a8176164cf0735cba2530dce0680877b08f77d167e476e4531
BLAKE2b-256 checksum
How to use checksums
8ac1ef96ebb4c177a6c2aaa36f2b974489872a504845bf659c53df7b8b88ad8c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.5

Release files / hfs_score-0.1.0-py3-none-any.whl

Download URL hfs_score-0.1.0-py3-none-any.whl
Size 9.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6b0dffd46fec4ef519c5e86e4e2676185a0a63ff767e8a1b69b4b9718341df42
BLAKE2b-256 checksum
How to use checksums
39fcddb5c9ea6877811c7fa2edfb29f000a2c0c759b1310b86516531bfa4076c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.5

Security for hfs-score 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page