domain-and-restoration
Operate Keras-GAN CCGAN, ContextEncoder, PixelDA, and SRGAN workflows for inpainting, domain adaptation, and super-resolution.
- License 许可
- MIT
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- domain-and-restoration
- license
- MIT
- metadata
- { "disco-role": "operating" }
- description
- Operate Keras-GAN CCGAN, ContextEncoder, PixelDA, and SRGAN workflows for inpainting, domain adaptation, and super-resolution.
- disable-model-invocation
- true
02 资源文件 5
- 参考文档references/data-formats.md7.3 KB
- 参考文档references/model-api-reference.md11.7 KB
- 参考文档references/troubleshooting.md8.7 KB
- 参考文档references/workflows.md9.8 KB
- 脚本scripts/check_restoration_layout.py11.7 KB
03 SKILL.md 正文
Domain Adaptation and Restoration Workflows
Use this sub-skill when the task involves Keras-GAN's specialized image restoration or domain-adaptation examples:
- context-conditional MNIST inpainting with
CCGAN - CIFAR-10 cat/dog context encoding with
ContextEncoder - MNIST to MNIST-M pixel-level domain adaptation with
PixelDA - CelebA-style 4x super-resolution with
SRGAN
Do not use this sub-skill for CycleGAN, DiscoGAN, or Pix2Pix image translation, and do not use it for baseline MNIST/Wasserstein generators. Route those requests to the sibling image-translation or mnist-generators sub-skills instead.
Fast routing
- Identify the workflow and data risk:
CCGAN: MNIST, grayscale 32x32, 10x10 random zero mask, can request a Keras MNIST download if the dataset cache is absent.ContextEncoder: CIFAR-10 cats/dogs, RGB 32x32, 8x8 random zero mask, can request a Keras CIFAR-10 download if the dataset cache is absent.PixelDA: MNIST domain A and MNIST-M domain B, RGB 32x32 cached arrays, may try to fetch or rebuild MNIST-M artifacts if cache files are incomplete.SRGAN: image directory namedimg_align_celeba, derived 64x64 low-resolution and 256x256 high-resolution pairs, constructor can request VGG19 ImageNet weights.
- Before training or adapting code, read the reference that matches the issue:
- Model/API reference for class names, method signatures, shapes, losses, and outputs.
- Workflow playbook for safe dry runs, short-run setup, and adaptation steps.
- Data formats for expected dataset/cache layouts and normalization.
- Troubleshooting for legacy Keras/TensorFlow, SciPy image APIs, PixelDA cache/network, and SRGAN VGG19 failures.
- Use the bundled safe checker instead of importing Keras or running full training when validating local files:
python sub-skills/domain-and-restoration/scripts/check_restoration_layout.py --help
python sub-skills/domain-and-restoration/scripts/check_restoration_layout.py --workflow srgan --data-root ./datasets --dataset-name img_align_celeba --min-images 8
python sub-skills/domain-and-restoration/scripts/check_restoration_layout.py --workflow pixelda --data-root ./datasets --json
python sub-skills/domain-and-restoration/scripts/check_restoration_layout.py --workflow ccgan --check-output-dirs --output-root .
The checker only uses the Python standard library. It never downloads data, imports Keras, mutates datasets, or launches training.
Operating constraints
- Treat this repository as a stale educational script collection, not as an installable Python package.
- Use a legacy-compatible runtime for actual model construction or training: the scripts were verified around Python 3.7-era, TensorFlow 1.15.x, Keras 2.2.x, keras-contrib 2.0.x, NumPy 1.18.x, SciPy 1.2.x, Matplotlib, Pillow, and scikit-image.
- Avoid network access unless the user explicitly permits dataset or VGG19 weight downloads.
- Avoid full default training loops: the upstream defaults are tens of thousands of epochs.
- Create or validate output directories before short runs; several scripts save figures or model JSON/weights into relative
images/andsaved_model/paths. - For SRGAN dry runs, do not instantiate
SRGAN()unless VGG19 ImageNet weights are already cached or the user accepts the download risk.
Expected deliverables for common tasks
- Dataset-readiness diagnosis: run
scripts/check_restoration_layout.py, report missing files/directories, and cite the relevant data format section. - Adaptation plan: identify the model class, expected input/label shapes, data-loader behavior, output paths, and the smallest safe smoke test from workflows.
- Troubleshooting answer: map the error to the closest symptom in troubleshooting, then give a bounded fix that does not require reopening the original repository.
04 同仓库更多 Skills
passnet-triton-opt
Make a single PassNet Triton kernel fast AND numerically faithful: performance model (when a replacement can win at all), block/grid/warp tuning, autotune policy, launch overhead, and per-op numeric recipes to pass the dtype baseline tolerances. Use when a pass matches and is correct but speedup below expected, or when correctness fails by small numeric margins.
passnet-solve
END-TO-END playbook for solving one PassNet sample: analyze the computation graphs, decide the optimization strategy (what to fuse, what to replace, what to leave alone), drive the iteration loop, and maximize the sample score. This is the ENTRY skill — invoke it first for any PassNet optimization task; it tells you when to use passnet-pattern-fusion, passnet-triton-opt and passnet-feedback.
passnet-skill
PassNet GPU kernel optimization via compiler passes. Design and implement Triton-based optimization passes, create pass files under ./pass_dir/, self-evaluate with pass_evaluator, and iterate to maximize GPU speedup.
passnet-pattern-fusion
Author PassNet pass files: write patterns that actually MATCH the FX graph, pick fusion regions (which ops to absorb into one Triton kernel), and structure multi-pass submissions with the mandatory shared-dispatch architecture. Use when creating or fixing pattern()/replacement_args()/replacement_func() files, when a pass "failed to match", or when deciding how to fuse multiple kernels/ops.
passnet-orchestrate
Round/batch planning and decision support for PassNet graph optimization. Use for multi-sample triage, worker allocation, eval-budget policy, and post-eval keep/revert decisions. For solving one concrete sample end to end, use passnet-solve as the entry skill; consult this skill only when you need broader planning or a specific decision gate.
passnet-feedback
Fast, deterministic feedback for PassNet work: pre-flight pattern/match verification WITHOUT burning a GPU evaluation, per-node bottleneck analysis of a sample's graphs, and eval-log parsing into per-variant status + estimated score + failure classification. Use BEFORE every GPU evaluation (check_pattern), at the START of a sample (analyze_graph), and AFTER every evaluation (parse_eval_log).