From 68fb3dded69476390dfe684fc13670e788a4da06 Mon Sep 17 00:00:00 2001 From: Victor Kuznetsov Date: Thu, 23 Jul 2026 11:13:13 -0700 Subject: [PATCH] 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. --- scripts/scan_dataset.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/scan_dataset.py b/scripts/scan_dataset.py index 46cc986..ff04de6 100644 --- a/scripts/scan_dataset.py +++ b/scripts/scan_dataset.py @@ -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]: