Skip to content

Add critical preprocessing transforms for robust protection testing#21

Draft
Claude wants to merge 2 commits into
mainfrom
claude/add-critical-preprocessing-transforms
Draft

Add critical preprocessing transforms for robust protection testing#21
Claude wants to merge 2 commits into
mainfrom
claude/add-critical-preprocessing-transforms

Conversation

@Claude

@Claude Claude AI commented Apr 1, 2026

Copy link
Copy Markdown
Contributor

The robustness testing suite included only 4 basic transforms (identity, gaussian blur, 2 resize operations), missing critical preprocessing steps that real-world mimicry pipelines (DreamBooth/LoRA) actually use. This created a false sense of robustness—protection may survive gaussian blur but fail against JPEG compression, center crops, or common training augmentations.

Changes

Extended transform suite from 4 to 12 transforms:

  • JPEG compression (jpeg_compress_decompress) at quality 95/85/75 - most effective purification defense, uses real JPEG artifacts via PIL instead of bilinear resize proxy
  • Center crop (center_crop_and_resize) at 90%/80% - standard data augmentation in training pipelines
  • Random crop (random_crop_and_resize) at 90% - stochastic training augmentation
  • Color jitter (color_jitter) - brightness/contrast/saturation/hue shifts common in training
  • Gaussian noise (add_gaussian_noise) at σ=0.01 - regularization noise testing
  • Stronger blur - added gaussian_blur_medium at σ=2.0 for parameter space exploration

Backward compatibility: Renamed original gaussian_blurgaussian_blur_mild to clarify it's part of a spectrum.

Example

from auralock.core.style import build_style_transform_suite

suite = build_style_transform_suite()
# Returns 12 transforms including:
# - jpeg_quality_95, jpeg_quality_85, jpeg_quality_75
# - center_crop_90, center_crop_80
# - color_jitter_mild, gaussian_noise_small
# - gaussian_blur_mild, gaussian_blur_medium
# - resize_restore_75, resize_restore_50
# - identity

All transforms preserve image shape and bounds [0, 1], handle tensors with gradients (.detach() in JPEG), and include comprehensive test coverage.

Implemented 5 new transform functions and extended the transform suite from 4 to 13 transforms:
- JPEG compression (quality 95, 85, 75) - critical for real-world purification testing
- Center crop (90%, 80%) - standard data augmentation
- Random crop (90%) - stochastic augmentation
- Color jitter - brightness/contrast/saturation/hue shifts
- Gaussian noise injection - regularization testing
- Stronger Gaussian blur (σ=2.0) - parameter space exploration

Added comprehensive tests for all new transforms.

Agent-Logs-Url: https://github.com/VoDaiLocz/Lock-ART./sessions/d2f11000-488b-4c39-b96a-4080dacd0749

Co-authored-by: VoDaiLocz <88762074+VoDaiLocz@users.noreply.github.com>
@Claude Claude AI changed the title [WIP] Add critical preprocessing transformations for robustness testing Add critical preprocessing transforms for robust protection testing Apr 1, 2026
@Claude Claude AI requested a review from VoDaiLocz April 1, 2026 13:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Issue: Weak Robustness Testing - Missing Critical Preprocessing Transformations

2 participants