算法艺术创作
algorithmic-art
通过代码和可调参数创作生成艺术与交互式视觉效果。
post-training-tools【设计与创意】Use after DeepDanbooru training to convert a saved Keras model to TensorFlow Lite or generate experimental Grad-CAM visualizations, with explicit artifact, dependency, and CPU-backend checks.
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
Use this sub-skill after a DeepDanbooru project has a loadable trained Keras model. It routes two post-training workflows:
.tflite artifact.Do not use this skill to train, repair a dataset, or judge model quality. Route ordinary predictions, thresholds, and tag alignment to Inference and evaluation. Route missing or stale models and retraining to Model training. For exact details, read the focused references before running a command.
| Goal | Entry point | Read first |
|---|---|---|
| Convert a saved Keras model | deepdanbooru conv2tflite | TFLite conversion |
| Visualize input gradients | deepdanbooru grad-cam | Grad-CAM workflow |
| Check paths without loading a model | post_training_preflight.py | Troubleshooting |
| Verify conversion in isolation | tflite_conversion_smoke.py | TFLite conversion |
--allow-existing-output only permits replacing an existing regular file;
an existing directory at --save-path is always rejected. Use a disposable
output directory for Grad-CAM because files can be overwritten.project.json, tags.txt, and the model
selected by project.json. The project loader searches
model-{model}.keras, then model-{model}.h5.[0,1].The CLI requires --save-path, a project or direct model path, and at least one
optimization method. The exact flags are --project-path, --model-path,
--save-path, --optimize-default, --optimize-experimental-sparsity, and
--verbose; do not substitute similarly named flags. A direct --model-path
takes precedence over a project. The converter API and artifact checks are in
references/tflite-conversion.md.
After conversion, require test -s OUTPUT.tflite; then, when possible, load it
with a CPU TFLite interpreter and call allocate_tensors(). A non-empty file
alone does not prove compatible preprocessing, tag metadata, delegates, or
model quality. If sparsity or a layer is incompatible, retry without sparsity
before changing the original model.
grad-cam is explicitly experimental. It requires a project and target path,
accepts an optional output directory (default .), and uses --threshold
default 0.5; selection is inclusive (score >= threshold). It creates an
input image and per-selected-tag maps under a folder named for each input
basename. No selected tags means no result maps, not necessarily a failed
inference. Read the output contract and limitations in
references/grad-cam-workflow.md.
Use references/troubleshooting.md for missing
model/save/optimization inputs, incompatible conversion operators, absent
SciPy or Pillow imports, malformed projects, and threshold cases with no maps.
Do not import the old deepdanbooru.gradcam module as a generic helper: its
source-level experimental test runs at import time. After any artifact or map
run, compare predictions and prerequisites through
Inference and evaluation; if the model is
missing, use Model training.