This commit is contained in:
jude committed 2026-10-14 20:16:39 +01:00
1 parent c3bb015d2f
commit e1e49904a8
8 files changed
+32 -68

No files matched your search

+1 -20
View File
@@ -19,31 +19,12 @@ python3 scripts/split_nsfw_test_image.py /path/to/input.jpg --output-dir tests/f
python3 scripts/split_nsfw_test_image.py /path/to/safe.jpg --output-dir tests/fixtures/non_nsfw
```
Each command automatically selects the first unused positive index, starting with
`image_1a.png` and `image_1b.png`. Indices with either part already present are skipped.
You can override the selection with `--index 2`; existing parts are never overwritten.
Each part contains random-looking
RGBA pixels. The original decoded pixels, including alpha, are recovered by XORing the two
parts. Only the first frame of animated input is used. Keep both files unchanged: resizing,
re-encoding with loss or flattening their alpha channels prevents correct reconstruction.
Both parts together reconstruct the original image, so splitting is not access control.
Run the splitter's round-trip and overwrite checks with
`python3 -m unittest discover -s scripts -p 'test_*.py'`.
The directories initially contain no images. The two dataset tests are explicitly ignored
until you provide fixtures. To run them after adding pairs to both directories:
To run the tests:
```sh
SQLX_OFFLINE=true cargo test --locked directory_images -- --ignored
```
The tests load all numbered pairs, recombine them in memory and pass the reconstructed PNG
through the production upload moderation function using the bundled model and its current
threshold. They also check that disabling moderation accepts the reconstructed images.
Empty directories, missing partners, mismatched dimensions, unexpected names and unexpected
moderation results fail the tests. Recombined images are never written to disk.
## Deterministic model fixtures
To regenerate them with Python's `onnx` package:
View File
Whitespace-only changes.
View File
Whitespace-only changes.