Guides computer vision tasks (classification, detection, segmentation) with PyTorch, TensorFlow, OpenCV — model selection criteria, annotated pipelines, copyable snippets, and edge/cloud deployment optimization.
Ships in claude-skills-collection. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Guide opérationnel pour concevoir, entraîner et déployer des solutions de vision par ordinateur : classification, détection d'objets, segmentation sémantique/d'instance.
| Besoin | Tâche | Modèles recommandés (2026) |
|---|---|---|
| « Qu'est-ce que c'est ? » | Classification | EfficientNetV2, ConvNeXt-v2, ViT-S/16 |
| « Où est l'objet ? » (boîtes) | Détection | YOLOv10/v11, RT-DETR, Co-DETR |
| « Pixel par pixel, quelle classe ? » | Segmentation sémantique | SegFormer-B4, OneFormer |
| « Chaque instance séparément ? » | Segmentation d'instance | Mask2Former, YOLOv8-seg |
| « N'importe quel objet à prompter » | Segmentation zéro-shot | SAM 2 (Meta) |
| Traitement bas-niveau (filtrage, calibration) | Vision classique | OpenCV (pas de DL) |
Règle de décision rapide :
data/
train/
chien/ img001.jpg …
chat/ img002.jpg …
val/
test/
| Outil | Détection | Segmentation | Gratuit |
|---|---|---|---|
| CVAT (auto-annotate avec SAM) | ✓ | ✓ | ✓ |
| Roboflow | ✓ | ✓ | freemium |
| LabelImg | ✓ | ✗ | ✓ |
pip install roboflow
# ou directement via la CLI Roboflow
roboflow convert -f yolov8 -i coco_annotations.json -o ./yolo_dataset
from collections import Counter
import json
with open("annotations/instances_train.json") as f:
coco = json.load(f)
cat_ids = {c["id"]: c["name"] for c in coco["categories"]}
counts = Counter(ann["category_id"] for ann in coco["annotations"])
for cid, n in counts.most_common():
print(f"{cat_ids[cid]}: {n}")
Seuils pratiques :
import albumentations as A
from albumentations.pytorch import ToTensorV2
train_transform = A.Compose([
A.RandomResizedCrop(640, 640, scale=(0.5, 1.0)),
A.HorizontalFlip(p=0.5),
A.ColorJitter(brightness=0.3, contrast=0.3, saturation=0.2, hue=0.05, p=0.7),
A.GaussNoise(var_limit=(10, 50), p=0.3),
A.MotionBlur(blur_limit=7, p=0.2),
A.Normalize(mean=(0.485, 0.456, 0.406), std=(0.229, 0.224, 0.225)),
ToTensorV2(),
], bbox_params=A.BboxParams(format="yolo", label_fields=["class_labels"]))
val_transform = A.Compose([
A.Resize(640, 640),
A.Normalize(mean=(0.485, 0.456, 0.406), std=(0.229, 0.224, 0.225)),
ToTensorV2(),
])
Augmentations avancées :
Mosaic (4 images en une) : intégrée dans YOLOv8+, activer avec mosaic=1.0Mixup : efficace en classification, moins utile en détectionCopyPaste : excellent pour les objets rares ou petitspip install ultralytics
from ultralytics import YOLO
# Entraînement détection
model = YOLO("yolov8m.pt") # n/s/m/l/x selon le compromis taille/perf
results = model.train(
data="dataset.yaml", # chemins train/val/test + noms de classes
epochs=100,
imgsz=640,
batch=16,
lr0=1e-3,
lrf=0.01,
optimizer="AdamW",
amp=True, # mixed precision automatique
patience=20, # early stopping
project="runs/detect",
name="exp1",
)
# Évaluation
metrics = model.val()
print(f"mAP50: {metrics.box.map50:.3f}")
print(f"mAP50-95: {metrics.box.map:.3f}")
import torch
import torchvision.models as models
import torch.nn as nn
model = models.efficientnet_v2_s(weights="IMAGENET1K_V1")
# Geler le backbone
for param in model.features.parameters():
param.requires_grad = False
# Remplacer la tête
model.classifier[1] = nn.Linear(model.classifier[1].in_features, NUM_CLASSES)
optimizer = torch.optim.AdamW([
{"params": model.features.parameters(), "lr": 1e-5}, # backbone dégelé au cycle 2
{"params": model.classifier.parameters(), "lr": 1e-3},
], weight_decay=1e-4)
scheduler = torch.optim.lr_scheduler.CosineAnnealingLR(optimizer, T_max=30)
| Tâche | Métrique principale | Métriques secondaires |
|---|---|---|
| Classification | Top-1 Accuracy | Top-5, F1 par classe |
| Détection | [email protected]:0.95 | [email protected], precision, recall par classe |
| Segmentation | mIoU | Dice, precision par classe |
# Matrice de confusion (classification)
from sklearn.metrics import classification_report, ConfusionMatrixDisplay
import matplotlib.pyplot as plt
report = classification_report(y_true, y_pred, target_names=class_names)
print(report)
ConfusionMatrixDisplay.from_predictions(y_true, y_pred, display_labels=class_names)
plt.savefig("confusion_matrix.png", dpi=150)
model.export(format="onnx", opset=17, simplify=True, dynamic=False, imgsz=640)
import onnxruntime as ort
import numpy as np
session = ort.InferenceSession("model.onnx", providers=["CUDAExecutionProvider", "CPUExecutionProvider"])
input_name = session.get_inputs()[0].name
outputs = session.run(None, {input_name: img_tensor.numpy()})
# Via trtexec
trtexec --onnx=model.onnx --int8 --saveEngine=model_int8.trt --minShapes=input:1x3x640x640 --maxShapes=input:8x3x640x640
| Format | Latence | Taille | Compatibilité |
|---|---|---|---|
| PyTorch (FP32) | baseline | baseline | GPU/CPU Python |
| ONNX (FP32) | −10 à −20 % | = | Multi-runtime, multi-OS |
| TensorRT INT8 | −50 à −80 % | /4 | NVIDIA GPU uniquement |
| TFLite INT8 | −40 % | /4 | Mobile Android/iOS |
| Core ML | −30 % | /2 | Apple silicon |
WeightedRandomSampler ou Focal Loss, jamais se contenter de la distribution brute.iou_threshold trop bas = faux doublons supprimés ; trop haut = objets superposés non détectés. Tester 0.45–0.65.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
/claude-skills-collection:ai-ml-computer-vision-guidefrom claude-skills-collection
npx claudepluginhub vantaflow/claude-skills-collection --plugin claude-skills-collection348 skills in this plugin
/agent-a2a-protocol-guideGuide du protocole Agent-to-Agent (A2A) de Google pour l'interopérabilité entre agents IA — découverte, communication et collaboration inter-agents, avec exemples de code, critères de décision et pièges à éviter. Se déclenche avec "A2A", "agent-to-agent", "protocole A2A", "Google A2A", "interopérabilité agents". Also triggers on "agent-to-agent protocol", "agent interoperability", "connect two agents"./agent-agent-observabilityInstrumentation technique d'un agent IA — tracing distribué des appels LLM et outils, spans, métriques custom, corrélation de logs et dashboards de supervision. Pour les alertes et garde-fous de production, voir agent-monitoring-setup. Se déclenche avec "observabilité agent", "tracing agent", "LangSmith", "Langfuse", "OpenTelemetry agent", "spans LLM", "corréler les logs agent". Also triggers on "trace my agent", "LLM tracing", "agent spans"./agent-api-caller-subagentSous-agent spécialisé dans les appels API REST/GraphQL avec retry, auth et transformation de données. Se déclenche avec "sous-agent API", "API caller agent", "agent qui appelle une API", "REST agent", "HTTP agent", "API integration subagent", "external API agent". Also triggers on "subagent that calls an API", "API calling agent", "agent HTTP requests".Other plugins' skills for the same job