算法艺术创作
algorithmic-art
通过代码和可调参数创作生成艺术与交互式视觉效果。
sampling-and-analysis【设计与创意】Use trained StudioGAN checkpoints for sampling, visual analysis, memorization checks, latent studies, CAS, iFID, SeFa, truncation, and Langevin/DDLS-aware command construction.
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
Use this sub-skill when a user already has a trained StudioGAN checkpoint and asks to sample images, save real/fake image folders, visualize generated canvases, check memorization with KNN, run latent interpolation, inspect frequency spectra, plot t-SNE embeddings, compute intra-class FID, run CAS, explore SeFa axes, or apply truncation/Langevin sampling during checkpoint analysis.
src/evaluate.py, route to evaluation-metrics.src/main.py, stay here and read the workflow references below.A future agent should have:
/path/to/PyTorch-StudioGAN.Do not use DDP for these analyses. StudioGAN supports many of them only with a single visible GPU or DataParallel; the bundled command builder intentionally has no DDP option.
Use scripts/build_checkpoint_analysis_command.py to build, validate, and print a native python /path/to/PyTorch-StudioGAN/src/main.py ... command without executing it. The helper suppresses default FID evaluation with -metrics none so visual/sampling analyses do not unexpectedly run long metric jobs.
Example command construction:
python scripts/build_checkpoint_analysis_command.py \
--repo-root /path/to/PyTorch-StudioGAN \
--cfg src/configs/CIFAR10/ContraGAN.yaml \
--checkpoint /path/to/checkpoints/run-name \
--save-dir /path/to/analysis-output \
--data-dir /path/to/data \
--gpus 0 \
--visualize --save-fake --fake-count 64 \
--truncation-factor 0.7
Then inspect the printed command, adjust paths if needed, and run it from a shell only after confirming that its output directory is safe to use.
src/main.py flags, requirements, incompatibilities, and outputs.| User intent | Use | Must have data? | Main output |
|---|---|---|---|
| Save generated PNGs for another tool | --save-fake --fake-count N | Usually no | samples/<run_name>/fake/<class>/*.png |
| Save reference PNGs | --save-real | Yes | samples/<run_name>/real/<class>/*.png |
| Make a generated-image canvas | --visualize | Usually checkpoint/config; pass data if config asserts | figures/<run_name>/generated_canvas_<step>.png |
| Check memorization against real images | --knn | Yes | figures/<run_name>/fake_anchor_*NN_*_classes.png |
| Interpolate latent/class directions | --interpolation | Usually no | figures/<run_name>/*_Interpolated_images_*.png |
| Compare real/fake frequency spectra | --frequency | Yes | figures/<run_name>/dfft_spectrum.png |
| Plot discriminator embedding t-SNE | --tsne | Yes | figures/<run_name>/tsne_scatter_real.png, tsne_scatter_fake.png |
| Intra-class diversity | --ifid | Yes | statistics/<run_name>/iFID.npy plus logs |
| CAS recall/precision | --gan-train or --gan-test | Yes | classifier checkpoints and top-1/top-5 logs |
| Semantic axes | --sefa --sefa-axis K --sefa-max V | Usually no | figures/<run_name>/*_sefa_images.png |
If a user asks for interpolation on a StyleGAN2/StyleGAN3 checkpoint, do not try to force it: StudioGAN rejects interpolation outside Big ResNet-style backbones. If a user asks for DDP with KNN and Langevin/DDLS, route them to a single visible GPU or DataParallel command and keep -DDP out of the analysis command.