
Computer Vision
- 29 installs
- 4 repo stars
- Updated January 5, 2026
- pluginagentmarketplace/custom-plugin-ai-data-scientist
computer-vision is a Claude Code skill for ai & agent building.
About
computer-vision is a Claude Code skill for ai & agent building. It helps solo builders move faster with AI-assisted development.
- computer-vision
- AI & Agent Building
- AI-coding skill
Computer Vision by the numbers
- 29 all-time installs (skills.sh)
- Ranked #9,417 of 16,546 AI & Agent Building skills by installs in the Skillselion catalog
- Data as of Aug 4, 2026 (Skillselion catalog sync)
npx skills add https://github.com/pluginagentmarketplace/custom-plugin-ai-data-scientist --skill computer-visionAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 29 |
|---|---|
| repo stars | ★ 4 |
| Last updated | January 5, 2026 |
| Repository | pluginagentmarketplace/custom-plugin-ai-data-scientist ↗ |
How do I helps with ai & agent building tasks.?
Helps with ai & agent building tasks.
Who is it for?
Best when you're working on ai & agent building and need structured help with computer vision.
Skip if: Teams with no ai & agent building needs, or anyone wanting a generic chat assistant without this specific workflow.
When should I use this skill?
When you need to helps with ai & agent building tasks., or when computer-vision is a claude code skill for ai & agent building.
What you get
Structured output aligned to computer-vision: computer-vision, AI & Agent Building.
Files
Computer Vision
Build models to analyze and understand visual data.
Quick Start
Image Classification
import torch
import torchvision.models as models
import torchvision.transforms as transforms
from PIL import Image
# Load pre-trained model
model = models.resnet50(pretrained=True)
model.eval()
# Preprocess image
transform = transforms.Compose([
transforms.Resize(256),
transforms.CenterCrop(224),
transforms.ToTensor(),
transforms.Normalize(
mean=[0.485, 0.456, 0.406],
std=[0.229, 0.224, 0.225]
)
])
img = Image.open('image.jpg')
img_tensor = transform(img).unsqueeze(0)
# Predict
with torch.no_grad():
output = model(img_tensor)
probabilities = torch.nn.functional.softmax(output[0], dim=0)
top5 = torch.topk(probabilities, 5)
print(top5)Custom CNN
import torch.nn as nn
class SimpleCNN(nn.Module):
def __init__(self, num_classes=10):
super(SimpleCNN, self).__init__()
self.features = nn.Sequential(
nn.Conv2d(3, 32, kernel_size=3, padding=1),
nn.ReLU(),
nn.MaxPool2d(2, 2),
nn.Conv2d(32, 64, kernel_size=3, padding=1),
nn.ReLU(),
nn.MaxPool2d(2, 2),
nn.Conv2d(64, 128, kernel_size=3, padding=1),
nn.ReLU(),
nn.MaxPool2d(2, 2)
)
self.classifier = nn.Sequential(
nn.Flatten(),
nn.Linear(128 * 4 * 4, 512),
nn.ReLU(),
nn.Dropout(0.5),
nn.Linear(512, num_classes)
)
def forward(self, x):
x = self.features(x)
x = self.classifier(x)
return xData Augmentation
from torchvision import transforms
train_transform = transforms.Compose([
transforms.RandomResizedCrop(224),
transforms.RandomHorizontalFlip(),
transforms.RandomRotation(15),
transforms.ColorJitter(
brightness=0.2,
contrast=0.2,
saturation=0.2,
hue=0.1
),
transforms.ToTensor(),
transforms.Normalize(
mean=[0.485, 0.456, 0.406],
std=[0.229, 0.224, 0.225]
)
])Object Detection with YOLO
from ultralytics import YOLO
# Load model
model = YOLO('yolov8n.pt')
# Predict
results = model('image.jpg')
# Process results
for result in results:
boxes = result.boxes
for box in boxes:
x1, y1, x2, y2 = box.xyxy[0]
confidence = box.conf[0]
class_id = box.cls[0]
print(f"Class: {class_id}, Confidence: {confidence:.2f}")
print(f"Box: ({x1}, {y1}, {x2}, {y2})")
# Save results
results[0].save('output.jpg')Image Segmentation
# Semantic segmentation with DeepLab
model = torch.hub.load(
'pytorch/vision:v0.10.0',
'deeplabv3_resnet50',
pretrained=True
)
model.eval()
# Preprocess
preprocess = transforms.Compose([
transforms.ToTensor(),
transforms.Normalize(
mean=[0.485, 0.456, 0.406],
std=[0.229, 0.224, 0.225]
)
])
input_tensor = preprocess(img).unsqueeze(0)
# Predict
with torch.no_grad():
output = model(input_tensor)['out'][0]
output_predictions = output.argmax(0)Transfer Learning
from torchvision import models
# Load pre-trained ResNet
model = models.resnet50(pretrained=True)
# Freeze all layers
for param in model.parameters():
param.requires_grad = False
# Replace final layer
num_features = model.fc.in_features
model.fc = nn.Linear(num_features, num_classes)
# Train only final layer
optimizer = optim.Adam(model.fc.parameters(), lr=0.001)Image Processing with OpenCV
import cv2
# Read image
img = cv2.imread('image.jpg')
# Convert to grayscale
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
# Edge detection
edges = cv2.Canny(gray, 100, 200)
# Blur
blurred = cv2.GaussianBlur(img, (5, 5), 0)
# Resize
resized = cv2.resize(img, (224, 224))
# Draw rectangle
cv2.rectangle(img, (x1, y1), (x2, y2), (0, 255, 0), 2)
# Save
cv2.imwrite('output.jpg', img)Face Detection
# Haar Cascade
face_cascade = cv2.CascadeClassifier(
cv2.data.haarcascades + 'haarcascade_frontalface_default.xml'
)
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
faces = face_cascade.detectMultiScale(gray, 1.1, 4)
for (x, y, w, h) in faces:
cv2.rectangle(img, (x, y), (x+w, y+h), (255, 0, 0), 2)Common Architectures
Image Classification:
- ResNet: Skip connections, deep networks
- EfficientNet: Compound scaling, efficient
- Vision Transformer (ViT): Attention-based
Object Detection:
- YOLO: Real-time, one-stage
- Faster R-CNN: Two-stage, accurate
- RetinaNet: Focal loss, handles class imbalance
Segmentation:
- U-Net: Encoder-decoder, medical imaging
- DeepLab: Atrous convolution, semantic segmentation
- Mask R-CNN: Instance segmentation
Tips
1. Use pre-trained models for transfer learning 2. Apply data augmentation to prevent overfitting 3. Normalize images (ImageNet statistics) 4. Use appropriate loss functions (CrossEntropy, Focal Loss) 5. Monitor training with visualization 6. Test on diverse images
# Computer Vision Object Detection Configuration
# Supports YOLO, Faster R-CNN, SSD architectures
# Model Configuration
model:
architecture: "yolov8" # yolov8, yolov5, faster_rcnn, ssd
backbone: "csp_darknet" # csp_darknet, resnet50, mobilenetv3
pretrained: true
num_classes: 80 # COCO default
# Input Configuration
input:
size: [640, 640] # width, height
channels: 3
normalize: true
mean: [0.485, 0.456, 0.406]
std: [0.229, 0.224, 0.225]
# Anchor Configuration (for anchor-based detectors)
anchors:
enabled: true
sizes: [[10, 13], [16, 30], [33, 23],
[30, 61], [62, 45], [59, 119],
[116, 90], [156, 198], [373, 326]]
strides: [8, 16, 32]
# Detection Settings
detection:
confidence_threshold: 0.25
nms_threshold: 0.45
max_detections: 100
# Multi-scale inference
multi_scale:
enabled: false
scales: [0.5, 1.0, 1.5]
# Training Configuration
training:
epochs: 100
batch_size: 16
optimizer:
name: "sgd"
lr: 0.01
momentum: 0.937
weight_decay: 0.0005
nesterov: true
scheduler:
name: "cosine"
warmup_epochs: 3
warmup_momentum: 0.8
warmup_bias_lr: 0.1
# Loss weights
loss:
box: 0.05
cls: 0.5
obj: 1.0
# Data Augmentation
augmentation:
# Mosaic augmentation
mosaic: 1.0
mosaic_scale: [0.5, 1.5]
# MixUp augmentation
mixup: 0.1
# Standard augmentations
hsv_h: 0.015 # Hue
hsv_s: 0.7 # Saturation
hsv_v: 0.4 # Value
# Geometric
degrees: 0.0
translate: 0.1
scale: 0.5
shear: 0.0
perspective: 0.0
flipud: 0.0
fliplr: 0.5
# Dataset Configuration
dataset:
format: "coco" # coco, yolo, voc, custom
train_path: "data/train"
val_path: "data/val"
test_path: "data/test"
# Class mapping
classes:
0: "person"
1: "bicycle"
2: "car"
# ... add your classes
# Evaluation Metrics
evaluation:
iou_thresholds: [0.5, 0.75]
metrics:
- "mAP@0.5"
- "mAP@0.5:0.95"
- "precision"
- "recall"
- "f1"
# Export Configuration
export:
formats:
- "onnx"
- "torchscript"
- "tensorrt"
onnx:
opset: 12
simplify: true
dynamic: false
tensorrt:
fp16: true
int8: false
workspace: 4 # GB
# Hardware
hardware:
device: "cuda:0"
workers: 8
pin_memory: true
Computer Vision Tasks Guide
Task Selection Decision Tree
What is your CV task?
│
├─► Image Classification
│ └─► "What object is in this image?"
│ • Single label per image
│ • Models: ResNet, EfficientNet, ViT
│
├─► Object Detection
│ └─► "What objects are where in this image?"
│ • Bounding boxes + labels
│ • Models: YOLO, Faster R-CNN, DETR
│
├─► Semantic Segmentation
│ └─► "What class is each pixel?"
│ • Pixel-level classification
│ • Models: U-Net, DeepLab, FCN
│
├─► Instance Segmentation
│ └─► "Which pixels belong to which object instance?"
│ • Separate masks per object
│ • Models: Mask R-CNN, YOLACT
│
├─► Pose Estimation
│ └─► "Where are the body keypoints?"
│ • Joint/keypoint locations
│ • Models: OpenPose, HRNet, MediaPipe
│
├─► Face Recognition
│ └─► "Whose face is this?"
│ • Face detection + embedding
│ • Models: ArcFace, FaceNet, InsightFace
│
└─► Image Generation
└─► "Generate new images"
• Text-to-image, style transfer
• Models: Stable Diffusion, DALL-E, GANModel Selection Matrix
| Task | Real-time | High Accuracy | Edge Device |
|---|---|---|---|
| Classification | MobileNet | EfficientNet-B7 | MobileNetV3 |
| Detection | YOLOv8n | Faster R-CNN | YOLOv8n-INT8 |
| Segmentation | BiSeNet | DeepLabV3+ | ENet |
| Pose | MoveNet | HRNet-W48 | MoveNet Lightning |
Metrics by Task
Classification
Accuracy = Correct / Total
Precision = TP / (TP + FP)
Recall = TP / (TP + FN)
F1 = 2 × (Precision × Recall) / (Precision + Recall)Object Detection
mAP@0.5 = Mean AP at IoU threshold 0.5
mAP@0.5:0.95 = Mean AP averaged over IoU 0.5-0.95
AP (Area) = AP for small/medium/large objectsSegmentation
IoU (Jaccard) = Intersection / Union
Dice = 2 × Intersection / (Pred + Truth)
Pixel Accuracy = Correct Pixels / Total PixelsData Augmentation by Task
| Augmentation | Classification | Detection | Segmentation |
|---|---|---|---|
| Flip H/V | ✅ | ✅ (adjust boxes) | ✅ (adjust mask) |
| Rotation | ✅ | ⚠️ (complex) | ⚠️ (complex) |
| Color Jitter | ✅ | ✅ | ✅ |
| Mosaic | ❌ | ✅ | ❌ |
| MixUp | ✅ | ✅ | ⚠️ |
| CutOut | ✅ | ⚠️ | ❌ |
| Elastic | ⚠️ | ⚠️ | ✅ (medical) |
Common Datasets
| Dataset | Task | Classes | Size |
|---|---|---|---|
| ImageNet | Classification | 1000 | 14M |
| COCO | Detection/Seg | 80 | 330K |
| Pascal VOC | Detection/Seg | 20 | 11K |
| ADE20K | Segmentation | 150 | 25K |
| MPII | Pose | 16 joints | 25K |
| LFW | Face | 5749 people | 13K |
Preprocessing Pipeline
# Standard CV preprocessing pipeline
def preprocess_pipeline(image, task='classification'):
# 1. Load and decode
img = cv2.imread(image_path)
img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
# 2. Resize (task-specific)
if task == 'classification':
img = cv2.resize(img, (224, 224)) # Square resize
elif task == 'detection':
img = letterbox_resize(img, (640, 640)) # Maintain aspect
# 3. Normalize
img = img.astype(np.float32) / 255.0
img = (img - [0.485, 0.456, 0.406]) / [0.229, 0.224, 0.225]
# 4. To tensor format [C, H, W]
img = np.transpose(img, (2, 0, 1))
return imgDeployment Considerations
| Factor | Consideration |
|---|---|
| Latency | Use lightweight models (MobileNet, YOLOv8n) |
| Memory | Quantization (INT8), pruning |
| Accuracy | Larger models, ensemble |
| Edge | TensorRT, ONNX, CoreML |
| Cloud | GPU inference, batching |
References
#!/usr/bin/env python3
"""
Computer Vision Image Processing Utilities
Preprocessing, augmentation, and visualization tools
"""
import cv2
import numpy as np
from pathlib import Path
from typing import List, Tuple, Optional, Union
import json
class ImageProcessor:
"""Comprehensive image processing utilities for CV tasks."""
def __init__(self, target_size: Tuple[int, int] = (640, 640)):
self.target_size = target_size
def load_image(self, path: Union[str, Path]) -> np.ndarray:
"""Load image from file path."""
img = cv2.imread(str(path))
if img is None:
raise ValueError(f"Failed to load image: {path}")
return cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
def resize_with_padding(self, image: np.ndarray,
keep_aspect: bool = True) -> Tuple[np.ndarray, dict]:
"""
Resize image with letterbox padding to maintain aspect ratio.
Returns:
Tuple of (resized_image, scale_info)
"""
h, w = image.shape[:2]
target_w, target_h = self.target_size
if keep_aspect:
scale = min(target_w / w, target_h / h)
new_w = int(w * scale)
new_h = int(h * scale)
resized = cv2.resize(image, (new_w, new_h), interpolation=cv2.INTER_LINEAR)
# Create padded image
padded = np.full((target_h, target_w, 3), 114, dtype=np.uint8)
# Center the image
pad_w = (target_w - new_w) // 2
pad_h = (target_h - new_h) // 2
padded[pad_h:pad_h + new_h, pad_w:pad_w + new_w] = resized
scale_info = {
'scale': scale,
'pad_w': pad_w,
'pad_h': pad_h,
'original_size': (w, h),
'new_size': (new_w, new_h)
}
else:
padded = cv2.resize(image, (target_w, target_h))
scale_info = {
'scale_x': target_w / w,
'scale_y': target_h / h,
'original_size': (w, h)
}
return padded, scale_info
def normalize(self, image: np.ndarray,
mean: List[float] = [0.485, 0.456, 0.406],
std: List[float] = [0.229, 0.224, 0.225]) -> np.ndarray:
"""Normalize image with ImageNet statistics."""
image = image.astype(np.float32) / 255.0
image = (image - np.array(mean)) / np.array(std)
return image
def denormalize(self, image: np.ndarray,
mean: List[float] = [0.485, 0.456, 0.406],
std: List[float] = [0.229, 0.224, 0.225]) -> np.ndarray:
"""Denormalize image back to [0, 255] range."""
image = image * np.array(std) + np.array(mean)
image = (image * 255).clip(0, 255).astype(np.uint8)
return image
class BoundingBoxUtils:
"""Utilities for bounding box operations."""
@staticmethod
def xyxy_to_xywh(boxes: np.ndarray) -> np.ndarray:
"""Convert [x1, y1, x2, y2] to [x_center, y_center, width, height]."""
result = boxes.copy()
result[:, 0] = (boxes[:, 0] + boxes[:, 2]) / 2 # x_center
result[:, 1] = (boxes[:, 1] + boxes[:, 3]) / 2 # y_center
result[:, 2] = boxes[:, 2] - boxes[:, 0] # width
result[:, 3] = boxes[:, 3] - boxes[:, 1] # height
return result
@staticmethod
def xywh_to_xyxy(boxes: np.ndarray) -> np.ndarray:
"""Convert [x_center, y_center, width, height] to [x1, y1, x2, y2]."""
result = boxes.copy()
result[:, 0] = boxes[:, 0] - boxes[:, 2] / 2 # x1
result[:, 1] = boxes[:, 1] - boxes[:, 3] / 2 # y1
result[:, 2] = boxes[:, 0] + boxes[:, 2] / 2 # x2
result[:, 3] = boxes[:, 1] + boxes[:, 3] / 2 # y2
return result
@staticmethod
def calculate_iou(box1: np.ndarray, box2: np.ndarray) -> float:
"""Calculate Intersection over Union between two boxes."""
x1 = max(box1[0], box2[0])
y1 = max(box1[1], box2[1])
x2 = min(box1[2], box2[2])
y2 = min(box1[3], box2[3])
intersection = max(0, x2 - x1) * max(0, y2 - y1)
area1 = (box1[2] - box1[0]) * (box1[3] - box1[1])
area2 = (box2[2] - box2[0]) * (box2[3] - box2[1])
union = area1 + area2 - intersection
return intersection / union if union > 0 else 0
@staticmethod
def non_max_suppression(boxes: np.ndarray, scores: np.ndarray,
iou_threshold: float = 0.5) -> List[int]:
"""Apply Non-Maximum Suppression to filter overlapping boxes."""
if len(boxes) == 0:
return []
# Sort by scores
indices = np.argsort(scores)[::-1]
keep = []
while len(indices) > 0:
current = indices[0]
keep.append(current)
if len(indices) == 1:
break
# Calculate IoU with remaining boxes
remaining = indices[1:]
ious = np.array([
BoundingBoxUtils.calculate_iou(boxes[current], boxes[i])
for i in remaining
])
# Keep boxes with IoU below threshold
indices = remaining[ious < iou_threshold]
return keep
class Visualizer:
"""Visualization utilities for CV results."""
COLORS = [
(255, 0, 0), (0, 255, 0), (0, 0, 255), (255, 255, 0),
(255, 0, 255), (0, 255, 255), (128, 0, 0), (0, 128, 0)
]
@staticmethod
def draw_boxes(image: np.ndarray, boxes: np.ndarray,
labels: Optional[List[str]] = None,
scores: Optional[np.ndarray] = None,
class_names: Optional[List[str]] = None) -> np.ndarray:
"""Draw bounding boxes on image."""
img = image.copy()
for i, box in enumerate(boxes):
x1, y1, x2, y2 = map(int, box[:4])
color = Visualizer.COLORS[i % len(Visualizer.COLORS)]
# Draw box
cv2.rectangle(img, (x1, y1), (x2, y2), color, 2)
# Draw label
if labels is not None or scores is not None:
label_parts = []
if labels is not None:
label_parts.append(str(labels[i]))
if scores is not None:
label_parts.append(f"{scores[i]:.2f}")
label = " ".join(label_parts)
(w, h), _ = cv2.getTextSize(label, cv2.FONT_HERSHEY_SIMPLEX, 0.5, 1)
cv2.rectangle(img, (x1, y1 - h - 5), (x1 + w, y1), color, -1)
cv2.putText(img, label, (x1, y1 - 5),
cv2.FONT_HERSHEY_SIMPLEX, 0.5, (255, 255, 255), 1)
return img
@staticmethod
def draw_segmentation_mask(image: np.ndarray, mask: np.ndarray,
alpha: float = 0.5) -> np.ndarray:
"""Overlay segmentation mask on image."""
colored_mask = np.zeros_like(image)
for class_id in np.unique(mask):
if class_id == 0: # Skip background
continue
color = Visualizer.COLORS[class_id % len(Visualizer.COLORS)]
colored_mask[mask == class_id] = color
return cv2.addWeighted(image, 1 - alpha, colored_mask, alpha, 0)
def main():
"""Demo usage of CV utilities."""
print("Computer Vision Utilities Demo")
print("=" * 50)
# Initialize processor
processor = ImageProcessor(target_size=(640, 640))
# Example bounding box operations
boxes = np.array([
[100, 100, 200, 200],
[150, 150, 250, 250],
[400, 400, 500, 500]
])
scores = np.array([0.9, 0.8, 0.7])
# Convert formats
xywh = BoundingBoxUtils.xyxy_to_xywh(boxes)
print(f"XYXY to XYWH conversion:")
print(f" Original: {boxes[0]}")
print(f" Converted: {xywh[0]}")
# Calculate IoU
iou = BoundingBoxUtils.calculate_iou(boxes[0], boxes[1])
print(f"\nIoU between box 0 and 1: {iou:.4f}")
# Apply NMS
keep = BoundingBoxUtils.non_max_suppression(boxes, scores, iou_threshold=0.3)
print(f"\nNMS kept indices: {keep}")
print("\n[SUCCESS] CV utilities ready for use!")
if __name__ == '__main__':
main()
Related skills
FAQ
What does computer-vision do?
computer-vision is a Claude Code skill for ai & agent building.
When should I use computer-vision?
When you need to helps with ai & agent building tasks., or when computer-vision is a claude code skill for ai & agent building.
What are the main capabilities?
computer-vision; AI & Agent Building; AI-coding skill.