Study-Mate
Miaotofu01
你的AI学习搭档:定路线、讲知识、做项目,边学边做,学透一门科目
PerryLink/dsh-image-integrity
Image integrity checks for DeepSeek Harness: zero-dependency 8-bit PNG decoding (grey/RGB/RGBA) with mean-threshold block fingerprints and NCC confirmation to find duplicated or mirrored regions inside one figure or shared between two figures, plus REP evidence and Markdown/SARIF reports. Finds reused pixels, not manipulation intent; JPEG is out of
PROJECT TOPICS
INSTALL REFERENCE
dsh plugin --profile web add github:PerryLink/dsh-image-integrity
该命令指向仓库当前默认分支;尚无绑定当前 commit 的完整验证结果。
PROJECT README
Is that panel reused — duplicated in place, or pasted mirrored from another figure?
Zero-dependency PNG decoding, mean-threshold block fingerprints with NCC confirmation, duplicate/mirror region reports, REP evidence and SARIF. It finds reused pixels, not manipulation intent.
English · 简体中文
image_check — finds a textured block that appears twice (or mirrored) inside one image.image_compare — finds blocks shared between two images, including mirrored copies.image_report — Markdown + SARIF 2.1.0, one warning per matched region with coordinates, Hamming distance and NCC.How it works: decode PNG → luma → 16×16 blocks → mean-threshold bit pattern (robust to brightness offsets) + zero-mean NCC confirmation. Blocks that are flat or close to a fitted plane are skipped, so a smooth gradient is not reported as "duplicated".
image_check{ path, persist?, blockSize?, maxShiftBits?, minVariance?, nccThreshold? } → { ok, analysis, evidenceId?, recordPath? }.
image_compare{ pathA, pathB, persist?, ...thresholds } → { ok, analysis, evidenceId?, recordPath? }.
image_report{ analysis, imageId? } → { ok, markdown, sarif }.
INVALID_INPUT · NOT_FOUND · PATH_ESCAPE · NOT_A_FILE · TOO_LARGE · UNSUPPORTED_IMAGE · STORE_ERROR
| DeepSeek Harness | dsh-v0.2.1-rc.5 (verified 2026-11-08); peer >=0.2.1-0 <0.3.0 \|\| >=0.2.2-0 <0.3.0 |
| Node | ^22.19.0 \|\| >=24.9.0 (tested 24.22.1), ESM only |
| Peers | @perrylink/dsh-research-core ^0.1.0, @deepseek-ai/cordis ^4.0.5-alpha.1, @deepseek-ai/dsh-tools, @deepseek-ai/schemastery ^3.18.5-alpha.1 |
| Runtime dependencies | zero (PNG via node:zlib) |
dsh plugin --profile <name> add @perrylink/dsh-research-core dsh-image-integrity
dsh --profile <name> --dump-config | grep dsh-image-integrity
| Key | Default | Meaning |
|---|---|---|
enabled |
true |
false mounts nothing |
root |
.image-integrity |
store/record root |
workspaceRoot |
process.cwd() |
paths must resolve inside it |
maxBytes |
20971520 |
file cap (fails, never truncates) |
maxPixels |
4000000 |
decoded pixel cap |
persist |
true |
store images as REP evidence + record |
blockSize / maxShiftBits |
16 / 6 |
block side (2–256); bit tolerance (0–blockSize²) |
minVariance / nccThreshold |
6 / 0.97 |
texture floor; NCC confirmation |
root.realpath containment rejects symlink escapes.inflateSync is bounded by the expected output
size. Failures are loud.blockSize 2–256, maxShiftBits
0–blockSize², NCC 0–1); an invalid threshold is INVALID_INPUT, not a crash.23 tests: PNG round-trip, non-PNG / 16-bit / truncated rejection, pixel-cap rejection from the IHDR before inflation (configured and default), Hamming and NCC primitives, duplicate block detection, horizontal mirror detection, flat-image and gradient false-positive controls, small-image effective block size, pair matching, dimension-mismatch refusal, runtime (valid REP record, two snapshots per comparison, traversal/JPEG/byte-and-pixel oversize rejection, invalid threshold rejection), tools (schemas, check→report, compare, malformed report, failure branch), mount contract (disabled mounts nothing, enabled registers three unique tools), package contract.
Benchmark — 100 synthetic pairs. pnpm run bench:images scores the plugin against the frozen set (dataset version 0.1.0) in the companion dsh-research-bench repository (data/images): 25 duplicate + 25 flip + 25 unrelated + 25 hard-negative pairs of 64×64 8-bit grey PNGs, fixed seed, with positives copying grid-aligned 16×16 blocks. The adapter runs against the built lib/, writes bench/results-images.json with no timestamps (rerunning on the same data is byte-identical), and reads a sibling ../dsh-research-bench checkout by default. Set BENCH_DIR or pass node bench/run-images.mjs --data <dir> for another location.
| Metric (50 manipulated / 50 clean) | Value |
|---|---|
| Manipulated precision | 1.0000 |
| Manipulated recall | 1.0000 |
| Manipulated F1 | 1.0000 |
| False-positive rate (unrelated + hard-negative) | 0.0000 |
| Subtype recall — duplicate | 1.0000 |
| Subtype recall — flip (horizontal 13 / vertical 12) | 1.0000 |
Confusion: TP 50, FP 0, TN 50, FN 0; no pair was misclassified. Per-category accuracy is 1.0000 in all four categories (25/25 each). Scope: the positives copy grid-aligned 16×16 blocks, i.e. the detector's own unit; sub-grid shifts, JPEG recompression, scaling and rotation are outside this set and remain documented limitations. These are synthetic numbers on a frozen fixture, not a claim about how often real figures reuse panels. The dataset and generator live in the companion repository and are not published with this package.
Apache-2.0. No third-party runtime code.
CLASSIFICATION EVIDENCE
系统优先读取 GitHub Topics,再与站内分类词典和词根规则比对。当前命中: research。