slegarraga/originlens-ai-image-detector

Private, offline AI-image evidence for Chrome — WebGPU/WASM, Manifest V3, MIT.

JavaScript

0

22 commits

updated Aug 14, 2026

See the code

README

OriginLens aperture mark

OriginLens

Calm, local evidence for likely AI-generated images in Chrome.
Every inference stays on the device. No account, telemetry, cloud API, or local server.

Created by Sebastian Legarraga.

OriginLens is an MIT-licensed Chrome Manifest V3 extension. It discovers ordinary webpage images—including dynamically inserted images, open shadow roots, and same-page frames—then attaches an accessible confidence badge to each eligible image. Click a badge to inspect the score, evidence source, inference backend, and limitations.

The default operating point is 65%, matching POIDH Arbitrum bounty #323. A score is evidence, not proof: OriginLens deliberately says “likely” and never presents the output as a factual authorship verdict.

OriginLens verified-model setup showing local WebGPU ready state

What makes it different

  • Local by construction. Image preprocessing, metadata inspection, and neural inference run inside the extension.
  • Offline after setup. The 43.8 MB public model is downloaded once, verified by byte length and SHA-256, and stored in Origin Private File System (OPFS).
  • Two local backends. Hardware WebGPU is preferred; SIMD WebAssembly is an automatic fallback.
  • Evidence before verdict. Bounded C2PA/generator strings are shown only as unverified embedded claims. They never change the neural score or bypass inference; missing metadata never counts as evidence of a real photo.
  • Quiet on real pages. Viewport-aware scheduling, deduplicated in-flight work, a bounded result cache, and a single serial inference queue avoid page jank.
  • Auditable supply chain. The model and all three runtime artifacts are pinned by exact hashes; setup rejects anything else.
  • Accessible controls. Keyboard-operable badges, visible focus, labelled controls, reduced-motion support, and an explicit uncertainty state.

Evaluation

Held-out model benchmark

The exact pinned FT1 weight was produced and evaluated by the upstream Sieve project on a 36,384-image proxy benchmark disjoint from training. The benchmark combines SynthBuster, OpenFake test/reddit, COCO val2017, and OpenFake real images. These are upstream-reported results at the frozen 0.65 threshold:

ConditionBalanced accuracyAI recallReal-photo accuracy
Clean91.3%85.6%97.1%
Web: ≤768 px, JPEG q6087.3%78.8%95.7%
Hard: ≤512 px, JPEG q4084.6%74.1%95.0%

OriginLens does not relabel these numbers as a new benchmark. It pins the exact evaluated artifact and independently verifies extension behavior, preprocessing, backend parity, and UI integration. See BENCHMARK.md for the evidence boundary, commands, smoke-set results, and limitations.

Architecture

flowchart LR
  A["Webpage <img>"] --> B["Viewport-aware discovery"]
  B --> C["MV3 service worker<br/>dedupe + bounded LRU"]
  C --> D["Offscreen document"]
  D --> E["Bounded metadata hint scan"]
  E --> F["ViT-S/16 @ 384<br/>always runs"]
  F --> G["WebGPU"]
  F --> H["WASM SIMD fallback"]
  E -. "unverified hints" .-> I["Confidence badge + evidence panel"]
  G --> I
  H --> I
  J["One-time public weight download"] --> K["size + SHA-256 verification"]
  K --> L["OPFS model store"]
  L --> D

Only the setup step downloads an inference asset. ONNX Runtime code and WASM are packaged with the extension; the model is read from OPFS on later launches.

Install from source

Requirements: Chrome 124+, Node.js 20+, and npm.

git clone https://github.com/slegarraga/originlens-ai-image-detector.git
cd originlens-ai-image-detector/extension
npm ci
npm run check

# Optional deterministic distributable + SHA256SUMS
npm run package:release

Then:

  1. Open chrome://extensions.
  2. Enable Developer mode.
  3. Choose Load unpacked and select the repository's extension directory.
  4. Open OriginLens and select Set up local model.
  5. Download the pinned model, or choose the same file manually. Setup will accept it only if both size and SHA-256 match.
  6. After “Offline ready” appears, disable the network and test any already available page; inference requires no further asset download.

Pinned model:

FieldValue
Fileft1_best_fp16.onnx
Bytes43,779,538
SHA-25687277637277f7d4f82222f0aaf1b4b114132ca13e5e4f02f71a65693e9606aed
SourceSieve v0.1.0 release

Verify

# Static policy, unit, hash, icon, CSP, and build checks
cd extension
npm ci
npm run check

# Real Chrome extension + model smoke tests
cd ../eval/e2e
npm ci
npx puppeteer browsers install chrome
npm run e2e -- --download --headless
npm run e2e -- --model /absolute/path/to/ft1_best_fp16.onnx --headless
npm run e2e -- --model /absolute/path/to/ft1_best_fp16.onnx --headless --disable-gpu
npm run offline -- --model /absolute/path/to/ft1_best_fp16.onnx
npm run ui -- --model /absolute/path/to/ft1_best_fp16.onnx

Use --out /absolute/path/scores.json with npm run e2e only when you want to save scores. Full details are in BENCHMARK.md.

Privacy and permissions

OriginLens has no analytics endpoint and no account system. It stores only the model, user settings, and a bounded local result cache. The broad HTTP/HTTPS host permission is necessary to discover and read webpage images in a content script; it is not used to transmit images elsewhere. See PRIVACY.md for the complete data and network inventory.

Scope and limitations

  • Scores can be wrong, especially after crops, screenshots, heavy edits, aggressive compression, or for generators not represented by evaluation data.
  • OriginLens analyzes eligible <img> elements. It does not currently analyze CSS backgrounds, canvas pixels, video frames, PDFs, or closed shadow roots.
  • Images below the configured minimum size are skipped. Every image that reaches a completed analysis receives a score or an explicit error state.
  • Do not use a score as the sole basis for moderation, journalism, employment, legal, financial, or other consequential decisions.
  • Provenance credentials can be removed. Their absence says nothing about whether an image is real.

See MODEL_CARD.md for model-specific risks and COMPLIANCE.md for a requirement-by-requirement audit.

Lineage and license

OriginLens was created and is maintained by Sebastian Legarraga. GitHub's Cite this repository panel is backed by CITATION.cff.

OriginLens is derived from Sieve and retains its copyright notice and MIT terms. The classifier begins with the MIT-licensed Community Forensics ViT-S/16 by Jeongsoo Park and Andrew Owens, then uses Sieve's FT1 fine-tune. Third-party attributions and font licenses are recorded in THIRD_PARTY_NOTICES.md.

Code is licensed under MIT.

ai-image-detection
chrome-extension
manifest-v3
on-device
privacy
wasm
webgpu

slegarraga/originlens-ai-image-detector

Private, offline AI-image evidence for Chrome — WebGPU/WASM, Manifest V3, MIT.

JavaScript

0

22 commits

updated Aug 14, 2026

See the code

README

OriginLens aperture mark

OriginLens

Calm, local evidence for likely AI-generated images in Chrome.
Every inference stays on the device. No account, telemetry, cloud API, or local server.

Created by Sebastian Legarraga.

OriginLens is an MIT-licensed Chrome Manifest V3 extension. It discovers ordinary webpage images—including dynamically inserted images, open shadow roots, and same-page frames—then attaches an accessible confidence badge to each eligible image. Click a badge to inspect the score, evidence source, inference backend, and limitations.

The default operating point is 65%, matching POIDH Arbitrum bounty #323. A score is evidence, not proof: OriginLens deliberately says “likely” and never presents the output as a factual authorship verdict.

OriginLens verified-model setup showing local WebGPU ready state

What makes it different

  • Local by construction. Image preprocessing, metadata inspection, and neural inference run inside the extension.
  • Offline after setup. The 43.8 MB public model is downloaded once, verified by byte length and SHA-256, and stored in Origin Private File System (OPFS).
  • Two local backends. Hardware WebGPU is preferred; SIMD WebAssembly is an automatic fallback.
  • Evidence before verdict. Bounded C2PA/generator strings are shown only as unverified embedded claims. They never change the neural score or bypass inference; missing metadata never counts as evidence of a real photo.
  • Quiet on real pages. Viewport-aware scheduling, deduplicated in-flight work, a bounded result cache, and a single serial inference queue avoid page jank.
  • Auditable supply chain. The model and all three runtime artifacts are pinned by exact hashes; setup rejects anything else.
  • Accessible controls. Keyboard-operable badges, visible focus, labelled controls, reduced-motion support, and an explicit uncertainty state.

Evaluation

Held-out model benchmark

The exact pinned FT1 weight was produced and evaluated by the upstream Sieve project on a 36,384-image proxy benchmark disjoint from training. The benchmark combines SynthBuster, OpenFake test/reddit, COCO val2017, and OpenFake real images. These are upstream-reported results at the frozen 0.65 threshold:

ConditionBalanced accuracyAI recallReal-photo accuracy
Clean91.3%85.6%97.1%
Web: ≤768 px, JPEG q6087.3%78.8%95.7%
Hard: ≤512 px, JPEG q4084.6%74.1%95.0%

OriginLens does not relabel these numbers as a new benchmark. It pins the exact evaluated artifact and independently verifies extension behavior, preprocessing, backend parity, and UI integration. See BENCHMARK.md for the evidence boundary, commands, smoke-set results, and limitations.

Architecture

flowchart LR
  A["Webpage &lt;img&gt;"] --> B["Viewport-aware discovery"]
  B --> C["MV3 service worker<br/>dedupe + bounded LRU"]
  C --> D["Offscreen document"]
  D --> E["Bounded metadata hint scan"]
  E --> F["ViT-S/16 @ 384<br/>always runs"]
  F --> G["WebGPU"]
  F --> H["WASM SIMD fallback"]
  E -. "unverified hints" .-> I["Confidence badge + evidence panel"]
  G --> I
  H --> I
  J["One-time public weight download"] --> K["size + SHA-256 verification"]
  K --> L["OPFS model store"]
  L --> D

Only the setup step downloads an inference asset. ONNX Runtime code and WASM are packaged with the extension; the model is read from OPFS on later launches.

Install from source

Requirements: Chrome 124+, Node.js 20+, and npm.

git clone https://github.com/slegarraga/originlens-ai-image-detector.git
cd originlens-ai-image-detector/extension
npm ci
npm run check

# Optional deterministic distributable + SHA256SUMS
npm run package:release

Then:

  1. Open chrome://extensions.
  2. Enable Developer mode.
  3. Choose Load unpacked and select the repository's extension directory.
  4. Open OriginLens and select Set up local model.
  5. Download the pinned model, or choose the same file manually. Setup will accept it only if both size and SHA-256 match.
  6. After “Offline ready” appears, disable the network and test any already available page; inference requires no further asset download.

Pinned model:

FieldValue
Fileft1_best_fp16.onnx
Bytes43,779,538
SHA-25687277637277f7d4f82222f0aaf1b4b114132ca13e5e4f02f71a65693e9606aed
SourceSieve v0.1.0 release

Verify

# Static policy, unit, hash, icon, CSP, and build checks
cd extension
npm ci
npm run check

# Real Chrome extension + model smoke tests
cd ../eval/e2e
npm ci
npx puppeteer browsers install chrome
npm run e2e -- --download --headless
npm run e2e -- --model /absolute/path/to/ft1_best_fp16.onnx --headless
npm run e2e -- --model /absolute/path/to/ft1_best_fp16.onnx --headless --disable-gpu
npm run offline -- --model /absolute/path/to/ft1_best_fp16.onnx
npm run ui -- --model /absolute/path/to/ft1_best_fp16.onnx

Use --out /absolute/path/scores.json with npm run e2e only when you want to save scores. Full details are in BENCHMARK.md.

Privacy and permissions

OriginLens has no analytics endpoint and no account system. It stores only the model, user settings, and a bounded local result cache. The broad HTTP/HTTPS host permission is necessary to discover and read webpage images in a content script; it is not used to transmit images elsewhere. See PRIVACY.md for the complete data and network inventory.

Scope and limitations

  • Scores can be wrong, especially after crops, screenshots, heavy edits, aggressive compression, or for generators not represented by evaluation data.
  • OriginLens analyzes eligible <img> elements. It does not currently analyze CSS backgrounds, canvas pixels, video frames, PDFs, or closed shadow roots.
  • Images below the configured minimum size are skipped. Every image that reaches a completed analysis receives a score or an explicit error state.
  • Do not use a score as the sole basis for moderation, journalism, employment, legal, financial, or other consequential decisions.
  • Provenance credentials can be removed. Their absence says nothing about whether an image is real.

See MODEL_CARD.md for model-specific risks and COMPLIANCE.md for a requirement-by-requirement audit.

Lineage and license

OriginLens was created and is maintained by Sebastian Legarraga. GitHub's Cite this repository panel is backed by CITATION.cff.

OriginLens is derived from Sieve and retains its copyright notice and MIT terms. The classifier begins with the MIT-licensed Community Forensics ViT-S/16 by Jeongsoo Park and Andrew Owens, then uses Sieve's FT1 fine-tune. Third-party attributions and font licenses are recorded in THIRD_PARTY_NOTICES.md.

Code is licensed under MIT.

ai-image-detection
chrome-extension
manifest-v3
on-device
privacy
wasm
webgpu