inference-evaluation
Run and troubleshoot DeepDanbooru image-tag inference through the project or explicit model/tag APIs, including preprocessing, folder traversal, thresholds, and text outputs.
- License 许可
- MIT
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- inference-evaluation
- license
- MIT
- metadata
- { "disco-role": "operating" }
- description
- Run and troubleshoot DeepDanbooru image-tag inference through the project or explicit model/tag APIs, including preprocessing, folder traversal, thresholds, and text outputs.
- disable-model-invocation
- true
02 资源文件 8
- 参考文档references/api-reference.md5.9 KB
- 参考文档references/cli-reference.md4.6 KB
- 参考文档references/image-inputs-and-tags.md4.3 KB
- 参考文档references/troubleshooting.md7.3 KB
- 脚本scripts/dummy_evaluate_smoke.py1.7 KB
- 脚本scripts/evaluate_project_smoke.py3.4 KB
- 脚本scripts/image_preprocess_smoke.py1.9 KB
- 脚本scripts/save_txt_guard.py2.3 KB
03 SKILL.md 正文
Inference and evaluation
Use this sub-skill when a trained DeepDanbooru model must turn one or more
images into tags. It covers the evaluate and evaluate-project CLI commands,
the corresponding Python functions, image preprocessing, recursive folder
selection, thresholds, and optional .txt sidecars.
This is an inference skill, not a training or dataset-preparation procedure. For a missing or malformed project, tag file, or dataset, use project-data-setup first. For model conversion or experimental Grad-CAM output, use post-training-tools. The bundled smoke scripts are tiny local checks; they do not download weights, contact a network, or read the original checkout.
Choose the entry point
| Situation | Entry point | Important constraint |
|---|---|---|
| Use a project to select both model and tags | deepdanbooru evaluate TARGET --project-path PROJECT |
Project must contain project.json, tags.txt, and its selected model artifact. |
| Use an explicit saved model and tag file | deepdanbooru evaluate TARGET --model-path MODEL --tags-path TAGS |
Without --project-path, both explicit paths are required. |
| Override only one project component | evaluate with project plus --model-path or --tags-path |
A direct model or tags path takes precedence for that component. |
| Evaluate a file or recursively every recognized image below a folder | deepdanbooru evaluate TARGET --project-path PROJECT --allow-folder |
This is the supported 1.0.0 project-folder path. Native evaluate-project is not recommended because its loader calls a missing symbol; see below. |
| Call inference from Python | deepdanbooru.commands.evaluate_image or evaluate |
Match the model's NHWC input dimensions and tag-output dimension. |
The evaluate function accepts a folder only when allow_folder=True. The
Click CLI defaults that flag off, so passing a directory without --allow-folder
is a common mistake. In the exact 1.0.0 source revision, native
evaluate-project calls the missing dd.data.load_tags_from_project symbol and
raises AttributeError before inference. Use evaluate with --project-path
and --allow-folder for production. The bundled project smoke helper exercises
that supported fallback; it does not claim a native evaluate-project run.
CPU-first prerequisites
The verified environment is Python 3.11 with TensorFlow 2.21.0 and no CUDA
libraries in the verification prefix. CPU correctness is required. By default,
evaluate sets CUDA_VISIBLE_DEVICES=-1 before loading the model; do not remove
that safeguard for a CPU run. --allow-gpu only leaves device selection
unchanged. It is an opt-in switch, not evidence that GPU support is ready;
GPU readiness was not verified for this repository.
Before a real run, confirm:
deepdanbooru --helpanddeepdanbooru evaluate --helpwork in the chosen environment.- The model is loadable and has an image input shape with height at index 1 and
width at index 2, for example
(None, 299, 299, 3). - The tag file is newline-separated and is the exact vocabulary used for the model's output units.
- Target paths exist and contain decodable images.
--save-txtwrites beside each image and the native helper can overwrite an existing sidecar. For a guarded skill-layer write, usescripts/save_txt_guard.py: it rejects an empty selected-tag list, rejects a sibling directory even with overwrite enabled, and requires explicit overwrite permission for regular files.
Fast, inspectable workflow
- Start with one known image and
--threshold 0.5, without--save-txt. - Choose the project route or provide both explicit model and tags paths. Use
--verbosewhen diagnosing path selection or load failures. - Inspect the printed scores and tag order. If no tag is printed, rerun with a
lower diagnostic threshold such as
0.0; do not immediately assume the image decoder or model failed. - Add
--allow-folderand a narrow--folder-filtersonly after one-file inference works. Confirm the discovered set and natural ordering. - Enable
--save-txtonly after output is useful, and verify each sidecar. The native path writes selected tag names only and replaces existing files; use the guard helper when empty output or replacement must be refused. - Use the deterministic helpers when the environment or a fixture is in doubt:
python scripts/image_preprocess_smoke.py,python scripts/dummy_evaluate_smoke.py, andpython scripts/evaluate_project_smoke.py.
Read the focused contracts before changing a command:
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).