ab-test-analysis
Design and analyze A/B tests, calculate statistical significance, and determine sample sizes for conversion optimization and…
Implement computer vision tasks including image classification, object detection, segmentation, and pose estimation using PyTorch and TensorFlow
Claude Code
$ npx -y skills add aj-geddes/useful-ai-prompts --skill computer-vision --agent claude-code
Codex
$ npx skills add aj-geddes/useful-ai-prompts --skill computer-vision -a codex -y
Cursor
$ npx skills add aj-geddes/useful-ai-prompts --skill computer-vision -a cursor -y
Gemini CLI
$ npx skills add aj-geddes/useful-ai-prompts --skill computer-vision -a gemini-cli -y
GitHub Copilot
$ npx skills add aj-geddes/useful-ai-prompts --skill computer-vision -a github-copilot -y
OpenCode
$ npx skills add aj-geddes/useful-ai-prompts --skill computer-vision -a opencode -y
Windsurf
$ npx skills add aj-geddes/useful-ai-prompts --skill computer-vision -a windsurf -y
name: Computer Vision description: Implement computer vision tasks including image classification, object detection, segmentation, and pose estimation using PyTorch and TensorFlow
Computer vision enables machines to understand visual information from images and videos, powering applications like autonomous driving, medical imaging, and surveillance.
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib.patches as patches
from PIL import Image, ImageDraw
import torch
import torch.nn as nn
from torch.utils.data import DataLoader, TensorDataset
from torchvision import transforms, models, datasets
import tensorflow as tf
from tensorflow import keras
from tensorflow.keras import layers
import cv2
from sklearn.metrics import accuracy_score, confusion_matrix
import seaborn as sns
import warnings
warnings.filterwarnings('ignore')
print("=== 1. Image Classification CNN ===")
# Define image classification model
class ImageClassifierCNN(nn.Module):
def __init__(self, num_classes=10):
super().__init__()
self.features = nn.Sequential(
nn.Conv2d(3, 32, kernel_size=3, padding=1),
nn.ReLU(inplace=True),
nn.BatchNorm2d(32),
nn.MaxPool2d(2, 2),
nn.Conv2d(32, 64, kernel_size=3, padding=1),
nn.ReLU(inplace=True),
nn.BatchNorm2d(64),
nn.MaxPool2d(2, 2),
nn.Conv2d(64, 128, kernel_size=3, padding=1),
nn.ReLU(inplace=True),
nn.BatchNorm2d(128),
nn.MaxPool2d(2, 2),
)
self.classifier = nn.Sequential(
nn.Linear(128 * 4 * 4, 256),
nn.ReLU(inplace=True),
nn.Dropout(0.5),
nn.Linear(256, num_classes)
)
def forward(self, x):
x = self.features(x)
x = x.view(x.size(0), -1)
x = self.classifier(x)
return x
model = ImageClassifierCNN(num_classes=10)
print(f"Model parameters: {sum(p.numel() for p in model.parameters()):,}")
# 2. Object Detection setup
print("\n=== 2. Object Detection Framework ===")
class ObjectDetector(nn.Module):
def __init__(self):
super().__init__()
# Backbone
self.backbone = nn.Sequential(
nn.Conv2d(3, 32, 3, padding=1),
nn.ReLU(),
nn.MaxPool2d(2, 2),
nn.Conv2d(32, 64, 3, padding=1),
nn.ReLU(),
nn.MaxPool2d(2, 2),
)
# Bounding box regression
self.bbox_head = nn.Sequential(
nn.Linear(64 * 8 * 8, 128),
nn.ReLU(),
nn.Linear(128, 4) # x, y, w, h
)
# Class prediction
self.class_head = nn.Sequential(
nn.Linear(64 * 8 * 8, 128),
nn.ReLU(),
nn.Linear(128, 10) # 10 classes
)
def forward(self, x):
features = self.backbone(x)
features_flat = features.view(features.size(0), -1)
bboxes = self.bbox_head(features_flat)
classes = self.class_head(features_flat)
return bboxes, classes
detector = ObjectDetector()
print(f"Detector parameters: {sum(p.numel() for p in detector.parameters()):,}")
# 3. Semantic Segmentation
print("\n=== 3. Semantic Segmentation U-Net ===")
class UNet(nn.Module):
def __init__(self, num_classes=5):
super().__init__()
# Encoder
self.enc1 = self._conv_block(3, 32)
self.pool1 = nn.MaxPool2d(2, 2)
self.enc2 = self._conv_block(32, 64)
self.pool2 = nn.MaxPool2d(2, 2)
# Bottleneck
self.bottleneck = self._conv_block(64, 128)
# Decoder
self.upconv2 = nn.ConvTranspose2d(128, 64, 2, stride=2)
self.dec2 = self._conv_block(128, 64)
self.upconv1 = nn.ConvTranspose2d(64, 32, 2, stride=2)
self.dec1 = self._conv_block(64, 32)
# Final output
self.out = nn.Conv2d(32, num_classes, 1)
def _conv_block(self, in_channels, out_channels):
return nn.Sequential(
nn.Conv2d(in_channels, out_channels, 3, padding=1),
nn.ReLU(inplace=True),
nn.Conv2d(out_channels, out_channels, 3, padding=1),
nn.ReLU(inplace=True)
)
def forward(self, x):
enc1 = self.enc1(x)
enc2 = self.enc2(self.pool1(enc1))
bottleneck = self.bottleneck(self.pool2(enc2))
dec2 = self.dec2(torch.cat([self.upconv2(bottleneck), enc2], 1))
dec1 = self.dec1(torch.cat([self.upconv1(dec2), enc1], 1))
return self.out(dec1)
unet = UNet(num_classes=5)
print(f"U-Net parameters: {sum(p.numel() for p in unet.parameters()):,}")
# 4. Transfer Learning
print("\n=== 4. Transfer Learning with Pre-trained Models ===")
try:
# Load pre-trained ResNet18
pretrained_model = models.resnet18(pretrained=True)
num_ftrs = pretrained_model.fc.in_features
pretrained_model.fc = nn.Linear(num_ftrs, 10)
print(f"Pre-trained ResNet18 adapted for 10 classes")
print(f488 production-ready AI prompts, all following a standardized template with validated quality gates. Transform ChatGPT, Claude, and other AI assistants into expert consultants.
Design and analyze A/B tests, calculate statistical significance, and determine sample sizes for conversion optimization and…
Implement Role-Based Access Control (RBAC), permissions management, and authorization policies. Use when building secure access…
Implement WCAG 2.1/2.2 accessibility standards, screen reader compatibility, keyboard navigation, and a11y testing. Use when…
Test web applications for WCAG compliance and ensure usability for users with disabilities. Use for accessibility test, a11y,…
Plan and execute effective sprints using Agile methodologies. Define sprint goals, estimate user stories, manage sprint backlog,…
Implement comprehensive alert management with PagerDuty, escalation policies, and incident coordination. Use when setting up…
Behavioral guidelines to reduce common LLM coding mistakes. Use when writing, reviewing, or refactoring code to avoid…
Converts books and documents (PDF, EPUB, DOCX, HTML, Markdown, plain text, RTF, MOBI/AZW with Calibre) into structured agent…
Set up the owner profile so a personal agent knows who it works for (first-run setup, \"get to know me\"), or distill colleague,…