entrypoint synthetic image classifier
A command-line tool and Python library for processing and analyzing images, extracting Laplacian residuals to measure fractal and texture complexity, and other comparative analysis methods to discriminate synthetic images from real ones.
Demonstration of the provided test results and visualizations on our synthetic darkshapes/a_slice dataset and private works of human origin provided by consent from the generous artists at https://purelyhuman.xyz.
Important
Requires uv
git clone https://github.com/darkshapes/negate.git
cd negate
uv syncmacos/linux
source .venv/bin/activatewindows
Set-ExecutionPolicy Bypass -Scope Process -Force; .venv\Scripts\Activate.ps1Add human-origin assets to assets/real
python -m tests.test_extract -vusage: negate [-h] [-i INPUT] [-g] [-v] [-o OUTPUT]
Extract Laplacian residuals from images.
options:
-h, --help show this help message and exit
-i, --input INPUT Input folder or individual image.
-g, --graph Graph the distribution of residuals on a plot
-v, --verbose Enable verbose output.
-o, --output OUTPUT (OPTIONAL) Output folder for residuals.python -m negate.trainimport asyncio
from pathlib import Path
from negate import ResidualExtractor, flag_origin
image_path = "some/image/path.jpg"
output_folder = ".output"
residual_extractor = ResidualExtractor(image_path, output_folder, verbose=False)
async def async_main() -> tuple[list,list]:
fractal, texture = await residual_extractor.process_residuals()
return residual_extractor
residual_extractor = asyncio.run(async_main())
flag_origin(residual_extractor)
