AGENT SKILL

classification

Route and execute PytorchWildlife wildlife image-classification workflows, including pretrained, custom-weight, batch, and detector-crop inference.

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

01 前言 Front Matter

name
classification
license
MIT
metadata
{ "disco-role": "operating" }
description
Route and execute PytorchWildlife wildlife image-classification workflows, including pretrained, custom-weight, batch, and detector-crop inference.
disable-model-invocation
true

02 资源文件 5

03 SKILL.md 正文

Classification

Use this sub-skill when the request is to classify wildlife images or crops, choose a PytorchWildlife classifier, load a local classifier checkpoint, run single/batch inference, or attach species labels to detector animals. The package target is PytorchWildlife 1.3.0 on Python >=3.10.

Route first

  • Choose a classifier from the model overview before constructing it. Check the model's class count, label vocabulary, language (Deepfaune), input size, and checkpoint format.
  • Use single_image_classification for one RGB image and batch_image_classification for an image directory or detector results. The exact signatures and result-shape caveats are in the API reference.
  • For a detector-to-classifier request, let the detection workflow construct and run the detector, then pass its results to the crop workflow described in pipelines. Do not configure detectors here; route that part to ../detection/SKILL.md.
  • Route JSON/timelapse/image/video serialization to ../data-and-postprocessing/SKILL.md; route training or fine-tuning to ../fine-tuning/SKILL.md.

Model selection

  • AI4GAmazonRainforest: PlainResNet, 36 classes, version="v1" or version="v2"; v2 is the constructor default.
  • AI4GOpossum: binary Opossum/non-opossum sigmoid classifier.
  • AI4GSnapshotSerengeti: 10-class PlainResNet classifier (nine named animals plus other).
  • DeepfauneClassifier: TIMM/DINOv2 classifier; select class_name_lang explicitly when labels must be French, English, Italian, or German.
  • DFNE: the Deepfaune-New-England TIMM classifier with its fixed English vocabulary.
  • CustomWeights: PlainResNet-50 checkpoint loader. Supply complete, zero-based class_names matching the checkpoint output dimension; inspect a local checkpoint with the bundled diagnostic helper before constructing it.

pretrained=True may download model weights. Construction and inference do not imply that weights are cached. Prefer an explicit local weights path in offline or reproducible runs; never start a download merely to diagnose an API or shape problem.

Safe operating sequence

  1. Normalize the input: use a readable RGB path or an HWC RGB array for single inference; use a directory of supported image extensions for folder inference. Use Classification_Inference_Transform unless a model-specific transform is required.
  2. Instantiate the selected class with an explicit device ("cpu" or a verified CUDA device), local weights when available, and the exact model parameters in the reference tables. Do not use pretrained constructors in a no-network check.
  3. Call the single or batch method with exactly one source: data_path or det_results. Preserve the returned order; the DataLoader does not shuffle, but filesystem traversal order should not be mistaken for sorted order. TIMM models additionally expose batch_size and num_workers.
  4. Validate each result's img_id, prediction, class_id, and confidence. Treat all_confidences as a full class distribution only for models that emit it and only with the batch caveat documented in the API reference.
  5. If crops came from detections, retain a parallel (img_id, detection index, bbox) mapping while building or consuming crops. Do not align labels by a single global counter across all detections: DetectionCrops filters to animal class 0 and returns only those crops.
  6. If anything fails, use troubleshooting and run the read-only checkpoint helper before changing model architecture or class names.

Input and output contract

ClassificationImageFolder yields (tensor, image_path) and recursively accepts common raster extensions. DetectionCrops yields (tensor, crop_path) and retains only detections whose class_id == animal_cls_id (default 0). The classifier result is a dictionary for single inference and a list of such dictionaries for batch inference. Most multiclass implementations emit:

{"img_id", "prediction", "class_id", "confidence", "all_confidences"}

AI4GOpossum emits the first four fields only. See the API reference before feeding results to a serializer, and route serialization to data-and- postprocessing rather than inventing a new output schema here.

Boundaries and limitations

  • This skill does not select thresholds or construct detector models.
  • It does not download weights, launch a service, run training, or claim a CUDA forward pass unless that pass was separately verified.
  • The package eagerly imports many model families. A legacy yolov5 compatibility failure can prevent importing classification even when the classifier code itself is usable; apply the actionable recovery in troubleshooting without publishing environment-specific shims.
  • The source's id_strip is Python string strip behavior, not a guaranteed path-prefix removal. Normalize identifiers explicitly before relying on exact joins.

Bundled references

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