mirror of
https://github.com/wiltodelta/remove-ai-watermarks.git
synced 2026-08-06 22:18:36 +02:00
Fix numpy-free metadata mode after the pixel-layer merge
Guard module-level numpy touchpoints so the metadata-only mode imports and runs without numpy installed (deferred annotations, lazy DCT basis); pixel modes now exit early with a clear numpy requirement message.
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
"""Collect all raw metadata over a dataset, for later offline analysis.
|
||||
|
||||
Read-only; analysis is NOT this script's job. For every image it writes
|
||||
one JSONL record containing:
|
||||
|
||||
@@ -55,6 +54,8 @@ Dependencies: pip install pillow piexif c2pa-python pillow-heif
|
||||
(pillow-heif is only needed for HEIC/AVIF inputs).
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import base64
|
||||
import contextlib
|
||||
import csv
|
||||
@@ -954,7 +955,7 @@ def _dct_matrix(n: int = 8) -> np.ndarray:
|
||||
return m * np.sqrt(2 / n)
|
||||
|
||||
|
||||
_DCT_M = _dct_matrix()
|
||||
_DCT_M = _dct_matrix() if np is not None else None
|
||||
|
||||
|
||||
def dct_features(gray: np.ndarray) -> dict[str, Any]:
|
||||
|
||||
Reference in New Issue
Block a user