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
- 参考文档references/api-reference.md6.0 KB
- 参考文档references/model-overview.md5.0 KB
- 参考文档references/pipelines.md6.1 KB
- 参考文档references/troubleshooting.md5.6 KB
- 脚本scripts/inspect_classifier_checkpoint.py3.8 KB
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_classificationfor one RGB image andbatch_image_classificationfor 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"orversion="v2"; v2 is the constructor default.AI4GOpossum: binary Opossum/non-opossum sigmoid classifier.AI4GSnapshotSerengeti: 10-class PlainResNet classifier (nine named animals plusother).DeepfauneClassifier: TIMM/DINOv2 classifier; selectclass_name_langexplicitly 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-basedclass_namesmatching 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
- 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_Transformunless a model-specific transform is required. - Instantiate the selected class with an explicit
device("cpu"or a verified CUDA device), localweightswhen available, and the exact model parameters in the reference tables. Do not use pretrained constructors in a no-network check. - Call the single or batch method with exactly one source:
data_pathordet_results. Preserve the returned order; the DataLoader does not shuffle, but filesystem traversal order should not be mistaken for sorted order. TIMM models additionally exposebatch_sizeandnum_workers. - Validate each result's
img_id,prediction,class_id, andconfidence. Treatall_confidencesas a full class distribution only for models that emit it and only with the batch caveat documented in the API reference. - 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:DetectionCropsfilters to animal class0and returns only those crops. - 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
yolov5compatibility 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_stripis Python stringstripbehavior, not a guaranteed path-prefix removal. Normalize identifiers explicitly before relying on exact joins.
Bundled references
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).