Computer Vision

Computer vision is about turning pixels into decisions: labels (classification), boxes (detection), masks (segmentation), or embeddings (retrieval). Modern CV is overwhelmingly deep learning — but the part that determines whether a real system works is rarely the model architecture. It's data: label quality, dataset diversity, honest splits, and realistic evaluation.

That's the most important thing to internalize. Teams obsess over picking ResNet vs ViT when the gains almost always come from better labels, more representative data, and catching leakage. Start from a pretrained backbone, then pour your effort into the data.

TL;DR

Quick Example

Transfer learning — start from a pretrained model and fine-tune the head:

What You Can Build

Core Concepts

CNNs and Vision Transformers

CNNs learn local patterns hierarchically (edges → textures → parts → objects). Many state-of-the-art models are now Vision Transformers (ViTs), but CNN intuition remains useful for understanding how features build up.

Transfer learning

Most teams start from a pretrained backbone and fine-tune — faster results with less data, better generalization, and far less compute than training from scratch.

Data dominates

For real systems, model choice matters less than label quality, dataset diversity, split design (no leakage), realistic augmentations, and consistent evaluation. Invest there first.

A Practical Project Checklist

  1. Define the task and metric (accuracy, mAP, IoU, recall@K).
  2. Decide label format (classes, boxes, masks) and tooling.
  3. Design splits — avoid near-duplicates leaking across train/test.
  4. Baseline with a pretrained model.
  5. Error analysis — confusions, lighting, occlusions, small objects.
  6. Iterate on data — collect, relabel, augment.
  7. Deploy — latency targets, batch vs realtime, device constraints.

Modeling Overview

Tooling & Augmentations

Augmentations should reflect real-world variation — color/brightness/contrast, random crop/resize, blur/noise, plausible perspective/rotation.

⚠️ Avoid augmentations that change semantics — e.g. aggressive horizontal flips when text direction or left/right matters.

Evaluation Gotchas

Deployment & Ethics

Best Practices

Common Mistakes

Duplicate leakage across splits

Optimizing the model while ignoring the data

FAQ

CNN or Vision Transformer — which should I use?

For most applications, start with a strong pretrained backbone of either family — both work well, and transfer learning matters more than the specific architecture. CNNs (ResNet/EfficientNet) are efficient and need less data; ViTs can edge them out at scale with enough data and compute. Pick a well-supported pretrained model in your framework and fine-tune; only revisit architecture after data and training are solid.

Why does "data dominate" model choice in computer vision?

Because modern pretrained backbones are already excellent feature extractors — the marginal gain from swapping architectures is usually small compared to the gain from better labels, more diverse and representative data, leak-free splits, and realistic augmentation. Real-world failures (missed small objects, bad performance in new lighting) trace to data gaps, not model capacity. Effort spent on data has the highest return.

What's the difference between detection and segmentation?

Detection localizes objects with bounding boxes and class labels — "there's a car here." Segmentation classifies at the pixel level: semantic segmentation labels every pixel by class (all "car" pixels), while instance segmentation produces a separate mask per object (car #1 vs car #2). Choose by how precise the spatial output must be — boxes for counting/locating, masks for exact shape/area.

How do I keep latency acceptable in production?

Profile the whole pipeline, not just the model — resizing, format conversion, and non-max suppression often cost more than inference. Pick a model sized to your latency budget and device (CPU/GPU/edge), export to an optimized format (ONNX/TensorRT/TorchScript), batch where possible, and consider lower precision (FP16/INT8). Monitor for drift as cameras and lighting change. See Performance Optimization.

Related Topics

References