training-and-model
Train, fine-tune, and understand zi2zi's TensorFlow 1.x conditional adversarial U-Net, experiment layout, losses, label shuffling, and checkpoint monitoring.
- License 许可
- Apache-2.0
- 最近更新
- 2026-10-08
- Stars
- ★ 11
- Forks
- 3
01 前言 Front Matter
- name
- training-and-model
- license
- Apache 2.0
- metadata
- { "disco-role": "operating" }
- description
- Train, fine-tune, and understand zi2zi's TensorFlow 1.x conditional adversarial U-Net, experiment layout, losses, label shuffling, and checkpoint monitoring.
- disable-model-invocation
- true
02 资源文件 3
- 参考文档references/model-architecture.md2.6 KB
- 参考文档references/training-workflow.md2.8 KB
- 参考文档references/troubleshooting.md2.3 KB
03 SKILL.md 正文
zi2zi training and model
Use this sub-skill when a task is about zi2zi training, fine-tuning, model structure, loss terms, checkpoint management, or experiment diagnostics. It does not run long training automatically; it explains the legacy workflow and gives safe command planning and preflight checks.
Use this sub-skill when
- The user wants to train zi2zi from
train.objandval.obj. - The user wants to fine-tune only a subset of labels or freeze the encoder.
- The task mentions
train.py,experiment_dir,checkpoint,sample,logs,flip_labels,fine_tune,inst_norm,freeze_encoder, or loss names such as L1, constant, category, or total variation. - The user needs to understand why
d_losssaturates, why label shuffling was added, or how checkpoints and TensorBoard outputs are organized.
Route elsewhere
- Data rendering and
.objpackaging go to data-preparation. - Inference, interpolation, and export go to inference-and-export.
- Cross-cutting compatibility issues go to the root compatibility and troubleshooting references.
Core training model facts
UNetis a pix2pix-like encoder/decoder generator with skip connections and a discriminator that predicts real/fake and style category.- The model combines several losses: adversarial cheat loss, L1 loss, category loss, constant/encoding loss, and optional total variation loss.
flip_labels=1enables the no-target-source branch used for label shuffling and saturation recovery.freeze_encoder=1excludes encoder variables from generator updates.fine_tuneaccepts a comma-separated list of integer labels, which the data provider uses to filter training and validation records.inst_norm=1switches decoder normalization to conditional instance normalization instead of batch normalization.
Standard experiment layout
The README and source expect an experiment tree like this:
experiment/
data/
train.obj
val.obj
checkpoint/
logs/
sample/
train.py creates the checkpoint, log, and sample directories if they do not
exist. Checkpoints are saved under a batch-size-specific model directory named
experiment_<id>_batch_<batch>.
Recommended workflow
- Confirm
train.objandval.objare present and non-empty. - Choose
--embedding_numlarge enough for the highest label in the data. - Decide whether you want batch norm or conditional instance norm.
- For a normal full run, set batch size, learning rate, epoch count, and sample /checkpoint cadence deliberately rather than accepting defaults blindly.
- Use
--resume=1only when you want to continue an existing experiment. - Use
--fine_tunefor label-subset adaptation and--flip_labels=1when the discriminator saturates during later fine-tuning. - Watch TensorBoard logs and the
sample/images for collapse or label issues.
Read training-workflow.md for command shapes, preflight checks, and safe run-planning. Read model-architecture.md for architecture and loss details. Read troubleshooting.md for TensorFlow, checkpoint, OOM, and data-layout failures.
Bundled helper
- scripts/plan_zi2zi_training.py validates a training command and prints the intended legacy zi2zi invocation without launching the TensorFlow loop.
What not to promise automatically
- Do not promise a successful long training run without a compatible legacy
TensorFlow environment, valid
.objfiles, and explicit runtime budget. - Do not claim GPU verification from a CPU-only graph build.
- Do not infer checkpoint compatibility across different batch sizes, embedding sizes, or normalization settings without checking the variable names and shapes.
04 同仓库更多 Skills
obsidian-clipper-template-creator
Guide for creating templates for the Obsidian Web Clipper. Use when you want to create a new clipping template, understand available variables, or format clipped content.
obsidian-clipper-template-creator
Guide for creating templates for the Obsidian Web Clipper. Use when you want to create a new clipping template, understand available variables, or format clipped content.
python-api
Programmatic Object-Detection-Metrics API guidance for BoundingBox, BoundingBoxes, Evaluator, enums, coordinate conversion, AP/mAP semantics, and source-style import diagnostics.
file-evaluation
Folder-based PASCAL VOC AP/mAP evaluation from ground-truth and detection text files.
object-detection-metrics
Guides legacy Object-Detection-Metrics PASCAL VOC AP/mAP evaluation from detection text folders and direct Python API classes.
nx-workspace-patterns
Configure and optimize Nx monorepo workspaces. Use when setting up Nx, configuring project boundaries, optimizing build caching, or implementing affected commands.