遇见数据集

PS_securescan synthetic dataset

收藏
Zenodo2026-03-17 更新2026-05-26 收录
官方服务:

资源简介:

The Dataset contains 40 PNG images in four categories: benign_* – normal creative images (simulated design assets) metadata_* – images with oversized metadata blocks stego_* – images with LSB-style pixel modifications large_* – large-resolution images for resource/decompression tests Example filenames: benign_03.pngmetadata_11.pngstego_18.pnglarge_27.png How to use them in experiments Example batch scan: from ps_securescan import PSSecureScanimport globscanner = PSSecureScan()for f in glob.glob("dataset/*.png"): r = scanner.scan(f) print(f, r.R_total, r.risk_class) Example experiment table (for Results section) Category Expected high module benign none metadata S_meta stego S_steg large S_decomp Typical experiment setup in papers Dataset size: 40–200 images Categories: benign + adversarial Metrics: detection rate false positives module score distribution Python script that generates the synthetic experiment images and packages them into a ZIP. #!/usr/bin/env python3 """ generate_ps_securescan_synth_dataset.py Creates a synthetic image dataset for PS-SecureScan experiments and packages it as a ZIP. It generates PNG images in four categories: - benign_* : normal "creative asset"-like images (random design blocks) - metadata_* : same style, but with oversized PNG text metadata (simulated XMP) - stego_* : LSB-like pixel modifications (simulated steganography) - large_* : large-resolution images (resource/decompression stress tests) Default output: ./ps_securescan_synth_dataset/images/*.png ./ps_securescan_synth_dataset/ps_securescan_synthetic_dataset.zip Dependencies: pillow, numpy Usage: python generate_ps_securescan_synth_dataset.py python generate_ps_securescan_synth_dataset.py --count 80 --out ./outdir --seed 123 """ from __future__ import annotations import argparse import random import zipfile from pathlib import Path import numpy as np from PIL import Image, PngImagePlugin def make_design_image(h: int, w: int, bg_min: int, bg_max: int) -> np.ndarray: img = np.ones((h, w, 3), dtype=np.uint8) * random.randint(bg_min, bg_max) for _ in range(random.randint(3, 8)): y1 = random.randint(0, h - 40) x1 = random.randint(0, w - 40) y2 = min(h, y1 + random.randint(20, 80)) x2 = min(w, x1 + random.randint(20, 80)) color = np.random.randint(0, 255, (3,), dtype=np.uint8) img[y1:y2, x1:x2] = color return img def apply_stego_lsb(img: np.ndarray, flip_prob: float = 0.03) -> np.ndarray: h, w, _ = img.shape out = img.copy() mask = np.random.rand(h, w) < flip_prob out[:, :, 0][mask] ^= 1 return out def add_oversized_metadata(im: Image.Image, size_bytes: int = 200_000) -> PngImagePlugin.PngInfo: meta = PngImagePlugin.PngInfo() meta.add_text("XMP", "A" * int(size_bytes)) return meta def generate_dataset(count: int, out_dir: Path, seed: int | None = None) -> tuple[Path, list[Path]]: if seed is not None: random.seed(seed) np.random.seed(seed) base = out_dir / "ps_securescan_synth_dataset" img_dir = base / "images" img_dir.mkdir(parents=True, exist_ok=True) categories = ["benign", "metadata", "stego", "large"] paths: list[Path] = [] for i in range(count): typ = random.choice(categories) h, w = (1024, 1024) if typ == "large" else (256, 256) arr = make_design_image(h, w, bg_min=180, bg_max=240) if typ == "stego": arr = apply_stego_lsb(arr, flip_prob=0.03) im = Image.fromarray(arr) name = f"{typ}_{i:03d}.png" path = img_dir / name if typ == "metadata": meta = add_oversized_metadata(im, size_bytes=200_000) im.save(path, pnginfo=meta) else: im.save(path) paths.append(path) zip_path = base / "ps_securescan_synthetic_dataset.zip" with zipfile.ZipFile(zip_path, "w", zipfile.ZIP_DEFLATED) as z: for p in paths: z.write(p, arcname=f"images/{p.name}") return zip_path, paths def main() -> None: ap = argparse.ArgumentParser() ap.add_argument("--count", type=int, default=40) ap.add_argument("--out", type=str, default=".") ap.add_argument("--seed", type=int, default=None) args = ap.parse_args() zip_path, paths = generate_dataset(count=args.count, out_dir=Path(args.out), seed=args.seed) print(f"Generated {len(paths)} images.") print(f"ZIP written to: {zip_path.resolve()}") print(f"Images directory: {(zip_path.parent / 'images').resolve()}") if __name__ == "__main__": main()

提供机构:
Zenodo
创建时间:
2026-03-17
二维码
社区交流群
二维码
科研交流群
商业服务