UI はローカライズ済みです。スキルの紹介と説明文書は選択した言語へ AI が自動翻訳し、コード・コマンド・パス・専門用語は原文のままです。原作者の文書が優先されます。
スキルを探す
生産性・共同作業 · SKILL.md

image-ai

image-ai

Use ImageAI 3.x PyTorch computer-vision workflows for classification, object detection, video detection, and custom training.

Independent GitHub snapshot · Automated classification · Original documentation governs

スキルの説明

GitHub

name: image-ai description: "Use ImageAI 3.x PyTorch computer-vision workflows for classification, object detection, video detection, and custom training." disable-model-invocation: true metadata: disco-role: operating license: MIT

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

  1. Confirm the user is using ImageAI 3.x / PyTorch assets (.pt or .pth). TensorFlow/Keras .h5 models are legacy ImageAI 2.x artifacts and are not accepted by the current package path.
  2. Confirm local model weights, images/videos, datasets, and JSON config files exist. This skill does not bundle pretrained weights or download assets.
  3. Choose the closest sub-skill route below.
  4. 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 taskRead
Classify a still image with ImageNet weightsclassification-workflows
Run custom image classification from a trained .pt/.pth model and classes JSONclassification-workflows
Detect COCO objects in a still image with RetinaNet, YOLOv3, or TinyYOLOv3object-detection-workflows
Run custom YOLO/TinyYOLO still-image detection from a trained model and detection JSONobject-detection-workflows
Detect objects in videos, camera feeds, or live streamsvideo-detection-workflows
Add per-frame, per-second, per-minute, or whole-video analysis callbacksvideo-detection-workflows
Prepare datasets, convert Pascal VOC to YOLO, validate layouts, or start custom trainingcustom-training-and-data
Resolve install, backend, or model-asset confusioninstallation 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 .pt or .pth; .h5 triggers a TensorFlow-legacy error.
  • Call useCPU() before loadModel() 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

保存したスキル