La interfaz está localizada; las descripciones y documentos de las Skills se traducen automáticamente con IA a su idioma. El código, los comandos, rutas y términos técnicos se mantienen en el original, y prevalece el documento del autor.
Explorar Skills
Diseño y creatividad · SKILL.md

sampling-and-analysis

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.

Independent GitHub snapshot · Automated classification · Original documentation governs

Documentación de la Skill

GitHub

name: sampling-and-analysis description: "Use trained StudioGAN checkpoints for sampling, visual analysis, memorization checks, latent studies, CAS, iFID, SeFa, truncation, and Langevin/DDLS-aware command construction." disable-model-invocation: true metadata: disco-role: operating license: NOASSERTION

Sampling and Analysis

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.

Route first

  • For dataset preparation, config selection, training, HDF5 setup, or producing the checkpoint in the first place, route to training-and-configuration.
  • For standalone image-folder metrics through src/evaluate.py, route to evaluation-metrics.
  • For checkpoint-driven outputs through src/main.py, stay here and read the workflow references below.

Required runtime context

A future agent should have:

  1. A separate StudioGAN checkout, referred to as /path/to/PyTorch-StudioGAN.
  2. The exact YAML config family used for the checkpoint.
  3. A checkpoint directory containing StudioGAN model files, preferably both best and current G/D checkpoint names.
  4. A save directory for analysis outputs.
  5. A dataset/reference directory when running real-image, KNN, frequency, t-SNE, iFID, or CAS workflows.

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.

Start with the bundled command builder

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.

Read these references

  • Checkpoint analysis workflows: end-to-end recipes, checkpoint prerequisites, analysis ordering, output locations, and interpretation guidance.
  • Analysis flags reference: exact builder flags, native src/main.py flags, requirements, incompatibilities, and outputs.
  • Troubleshooting: common checkpoint, data, DDP, batch-size, StyleGAN, SeFa, CAS, metric-backbone, and output-directory failures.

Quick decision guide

User intentUseMust have data?Main output
Save generated PNGs for another tool--save-fake --fake-count NUsually nosamples/<run_name>/fake/<class>/*.png
Save reference PNGs--save-realYessamples/<run_name>/real/<class>/*.png
Make a generated-image canvas--visualizeUsually checkpoint/config; pass data if config assertsfigures/<run_name>/generated_canvas_<step>.png
Check memorization against real images--knnYesfigures/<run_name>/fake_anchor_*NN_*_classes.png
Interpolate latent/class directions--interpolationUsually nofigures/<run_name>/*_Interpolated_images_*.png
Compare real/fake frequency spectra--frequencyYesfigures/<run_name>/dfft_spectrum.png
Plot discriminator embedding t-SNE--tsneYesfigures/<run_name>/tsne_scatter_real.png, tsne_scatter_fake.png
Intra-class diversity--ifidYesstatistics/<run_name>/iFID.npy plus logs
CAS recall/precision--gan-train or --gan-testYesclassifier checkpoints and top-1/top-5 logs
Semantic axes--sefa --sefa-axis K --sefa-max VUsually nofigures/<run_name>/*_sefa_images.png

High-risk prompts

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.

Skills guardadas