AGENT SKILL

classification-workflows

Use ImageAI ImageNet and custom image classification inference workflows with PyTorch model weights.

License 许可
MIT
最近更新
2026-09-03
Stars
★ 351
Forks
27

01 前言 Front Matter

name
classification-workflows
license
MIT
metadata
{ "disco-role": "operating" }
description
Use ImageAI ImageNet and custom image classification inference workflows with PyTorch model weights.
disable-model-invocation
true

02 资源文件 4

03 SKILL.md 正文

Classification Workflows

Use this sub-skill when the task is to classify still images with ImageAI's PyTorch classification APIs:

  • ImageNet classification with ImageClassification and built-in ImageNet class labels.
  • Custom classification inference with CustomImageClassification, an ImageAI-trained .pt/.pth model, and the matching JSON class mapping.
  • CPU-forced classification, result_count selection, file/numpy/PIL image inputs, and the returned label/probability arrays.

Do not use this sub-skill for custom model training or dataset preparation; route those requests to custom-training-and-data. Do not use it for object detection or video detection; route those to the detection sub-skills.

Runtime references

  • API reference: verified class names, call order, method signatures, model type mapping, input forms, return shapes, and model extension behavior.
  • Workflows: ImageNet and custom classification recipes, asset prerequisites, CPU-only commands, validation steps, and in-process examples.
  • Troubleshooting: classification-specific recovery for missing dependencies, TensorFlow .h5 files, mismatched model type/weights, bad JSON mappings, image input errors, and warning noise.
  • Helper script: parameterized CLI wrapper around ImageClassification and CustomImageClassification that prints JSON and never downloads weights.

For package-wide installation, backend, and model-asset policy, also check the root skill's installation and model assets notes.

Quick routing checklist

  1. Ask whether the user has ImageNet release weights or a custom ImageAI-trained classifier. ImageNet mode needs only the model file; custom mode also needs the JSON class mapping produced during training.
  2. Match --model-type or the setter method to the architecture used by the weights: mobilenetv2, resnet50, inceptionv3, or densenet121.
  3. Reject TensorFlow-era .h5 weights for ImageAI 3.x. Use .pt or .pth; for .h5, explain the ImageAI 2.1.6-or-earlier compatibility path instead of trying to load it.
  4. Call the model type setter, setModelPath(...), custom setJsonPath(...) when needed, optional useCPU(), then loadModel() before classifyImage(...).
  5. Treat outputs as two parallel arrays: labels: list[str] and probabilities: list[float] in descending score order.

Safe helper use

Use the bundled helper for command-line classification when the user supplies local asset paths:

python scripts/classify_image.py \
  --mode imagenet \
  --model-type resnet50 \
  --model-path /path/to/resnet50-weights.pth \
  --image /path/to/image.jpg \
  --result-count 5 \
  --cpu

For custom classification, add --json-path /path/to/model_classes.json and keep --model-type aligned with the architecture used during training. The helper accepts image files only; in-process API usage can pass str paths, numpy.ndarray, or PIL.Image.Image objects as described in the API reference.

04 同仓库更多 Skills

VectorSpaceLab
VectorSpaceLab/AREX-Skill

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.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

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.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

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.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

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.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

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.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

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).

★ 351