image-ai
Use ImageAI 3.x PyTorch computer-vision workflows for classification, object detection, video detection, and custom training.
- License 许可
- MIT
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- image-ai
- license
- MIT
- metadata
- { "disco-role": "operating" }
- description
- Use ImageAI 3.x PyTorch computer-vision workflows for classification, object detection, video detection, and custom training.
- disable-model-invocation
- true
02 资源文件 5
- 参考文档references/installation-and-model-assets.md4.6 KB
- 参考文档references/repo-provenance.md2.1 KB
- 参考文档references/repo-routing-metadata.json415 B
- 参考文档references/troubleshooting.md4.9 KB
- 脚本scripts/check_imageai_env.py5.0 KB
03 SKILL.md 正文
ImageAI Repo Skill
Use this repo skill when a task involves the ImageAI Python package (imageai), especially ImageAI 3.x PyTorch workflows for simple computer-vision applications.
Start here
- Confirm the user is using ImageAI 3.x / PyTorch assets (
.ptor.pth). TensorFlow/Keras.h5models are legacy ImageAI 2.x artifacts and are not accepted by the current package path. - Confirm local model weights, images/videos, datasets, and JSON config files exist. This skill does not bundle pretrained weights or download assets.
- Choose the closest sub-skill route below.
- For environment uncertainty, run the bundled smoke checker before loading large weights:
python scripts/check_imageai_env.py
python scripts/check_imageai_env.py --require-cuda
Route by task
| User task | Read |
|---|---|
| Classify a still image with ImageNet weights | classification-workflows |
Run custom image classification from a trained .pt/.pth model and classes JSON |
classification-workflows |
| Detect COCO objects in a still image with RetinaNet, YOLOv3, or TinyYOLOv3 | object-detection-workflows |
| Run custom YOLO/TinyYOLO still-image detection from a trained model and detection JSON | object-detection-workflows |
| Detect objects in videos, camera feeds, or live streams | video-detection-workflows |
| Add per-frame, per-second, per-minute, or whole-video analysis callbacks | video-detection-workflows |
| Prepare datasets, convert Pascal VOC to YOLO, validate layouts, or start custom training | custom-training-and-data |
| Resolve install, backend, or model-asset confusion | installation and model assets and troubleshooting |
Package and install essentials
ImageAI 3.x uses PyTorch. A typical CPU-oriented setup follows the package docs and requirements:
pip install imageai
pip install cython "pillow>=7.0.0" "numpy>=1.18.1" "opencv-python>=4.1.2" \
"torch>=1.9.0" "torchvision>=0.10.0" tqdm scipy matplotlib mock
Use a PyTorch CUDA wheel only when the runtime has compatible NVIDIA drivers and the task needs acceleration. CUDA is helpful for video and real training, but CPU is enough for import/API checks and small validation helpers. See installation and model assets for dependency variants, model-weight expectations, and legacy TensorFlow notes.
Minimal import/API check
from imageai.Classification import ImageClassification
from imageai.Detection import ObjectDetection, VideoObjectDetection
from imageai.Classification.Custom import ClassificationModelTrainer, CustomImageClassification
from imageai.Detection.Custom import DetectionModelTrainer, CustomObjectDetection, CustomVideoObjectDetection
for cls in [
ImageClassification, ObjectDetection, VideoObjectDetection,
ClassificationModelTrainer, CustomImageClassification,
DetectionModelTrainer, CustomObjectDetection, CustomVideoObjectDetection,
]:
cls()
If this fails, do not proceed to weight loading. Use the root troubleshooting reference first.
Shared operating rules
- Always choose the model-type setter that matches the weight architecture. Filenames are hints, not proof.
- Current ImageAI 3.x model files must be
.ptor.pth;.h5triggers a TensorFlow-legacy error. - Call
useCPU()beforeloadModel()when forcing CPU. - Load large weights once and reuse the detector/classifier object for repeated images or frames.
- Treat pretrained weights, custom models, JSON mappings, datasets, videos, and camera streams as caller-supplied assets.
- Do not run full video detection or training as a quick smoke test unless the user supplies bounded assets and compute expectations.
Provenance and routing metadata
- repo-provenance.md records the source snapshot and evidence paths used to create this skill.
- repo-routing-metadata.json records managed repo-skills-router placement for import tooling.
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).