Files
remove-ai-watermarks/tests/test_forensic_124d.py
T
Victor Kuznetsov 925401c905 Add the classify extra for the 2026-08-31 photo freeze. (#90)
Ship Model 1 then gated Model 2 as an explicit CLI and library call.
identify, has_invisible_target, and all do not import it. Weights stay
on Hugging Face wiltodelta/raiw-models at a pinned revision.
2026-08-31 22:45:18 -07:00

33 lines
1.0 KiB
Python

"""124-d freeze extractor: shape and the undersize abstain, no downloads."""
from __future__ import annotations
import numpy as np
from remove_ai_watermarks._internal.forensic_124d import FEATURE_WIDTH, PATCH, image_features
def test_a_full_patch_returns_124_floats() -> None:
pixels = np.random.default_rng(0).integers(0, 256, (PATCH, PATCH, 3), dtype=np.uint8)
vector = image_features(pixels)
assert vector is not None
assert vector.shape == (FEATURE_WIDTH,)
assert vector.dtype == np.float64
def test_a_larger_image_still_returns_124_floats() -> None:
pixels = np.random.default_rng(1).integers(0, 256, (512, 640, 3), dtype=np.uint8)
vector = image_features(pixels)
assert vector is not None
assert vector.shape == (FEATURE_WIDTH,)
def test_an_undersized_image_returns_none() -> None:
pixels = np.zeros((PATCH - 1, PATCH, 3), dtype=np.uint8)
assert image_features(pixels) is None
def test_non_rgb_returns_none() -> None:
pixels = np.zeros((PATCH, PATCH), dtype=np.uint8)
assert image_features(pixels) is None