AI Computer Vision - Custom Software Development

Custom Vision Model or Pretrained API Which Fits Your First App

Most junior developers reach for model training too early because it feels like “real AI.” My position is stricter: start with a managed vision API unless the mistakes are product-specific, expensive, or impossible to explain away. Owning the model is justified only when control over labels, latency, privacy, or deployment clearly beats the extra work.

The API-first choice wins more often than ambitious developers want to admit

The practical decision is not “computer vision or no computer vision.” It is Managed Vision API versus Owned Model Pipeline. Managed Vision API means Google Cloud Vision API, AWS Rekognition, Azure AI Vision Image Analysis 4.0, or a similar hosted service. Owned Model Pipeline means you collect data, label it in CVAT 2.11 or Label Studio 1.13, train with PyTorch 2.3 or Ultralytics YOLOv8, export to ONNX opset 17, and deploy through something like NVIDIA Triton Inference Server 2.47 or OpenVINO 2024.2.

I would not train a custom detector as the first move for a junior-owned feature, because the hardest bugs will be data bugs rather than Python bugs, and you will spend most of the sprint arguing with bad labels, duplicate frames, and unclear acceptance criteria. A hosted API is less exciting, but it gives you a working error profile quickly because the model, scaling layer, and basic monitoring already exist.

The broad reference, AI Computer Vision in Software Development: Top Use Cases, is useful as a map of possibilities, but a junior developer should narrow the question to this: who owns the false positives, false negatives, latency, and retraining? If the vendor’s generic labels are good enough, the API wins because your team buys time and avoids building an ML operations stack before the product has proved the need.

Here is the explicit comparison I would use in a planning ticket:

  • Option A: Managed Vision API. It wins when the task is common, the image can legally leave your system, the acceptable response time is ordinary web latency, and the team needs a feature in days rather than months. It costs per request, creates vendor lock-in, adds network latency, and limits your ability to debug model reasoning.
  • Option B: Owned Model Pipeline. It wins when labels are domain-specific, data cannot leave your environment, edge inference is required, or a wrong prediction has a product cost that only your team understands. It costs annotation time, GPU budget, CI/CD complexity, model monitoring, and maintenance after every data drift event.

For a first spike, cap the investigation at 300 images; treat that as a planning constraint to tune, not a scientific law, because a small but representative sample exposes integration problems faster than a huge unlabeled folder. If an API cannot give useful output on those 300 images, the API probably is not the right default because its pretrained label space does not match your product language.

A boring baseline prevents you from training around a simple rule

Before either approach wins, build a non-ML baseline. This is not anti-AI; it is a cheap trap for bad assumptions because many “vision” requirements are actually thresholding, edge detection, QR decoding, template matching, or geometry checks. OpenCV 4.10, scikit-image 0.23, Tesseract OCR 5.3, and ZBar can solve boring cases with fewer moving parts than a neural network.

The following OpenCV snippet generates a small image, finds edges, counts contours, and runs without a model file:

import cv2
import numpy as np

img = np.zeros((240, 320, 3), dtype=np.uint8)
cv2.rectangle(img, (70, 60), (250, 180), (255, 255, 255), -1)
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
edges = cv2.Canny(gray, 80, 160)
contours, _ = cv2.findContours(edges, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)

print(f"contours={len(contours)}")
print(f"edge_pixels={np.count_nonzero(edges)}")

This kind of baseline matters because it gives you a floor. If the simple version is stable, a neural model must beat it on an agreed metric, not just look smarter in a demo. Use IoU, precision, recall, F1 score, false-positive rate, and p95 latency as named metrics because vague “accuracy” hides the difference between missing an object and drawing a slightly imperfect box.

For a detector, start with a confidence threshold of 0.35 as a tunable value, because lower thresholds help you see missed candidates during debugging while higher thresholds can hide recall problems. For non-maximum suppression, use IoU 0.50 as an initial knob, because it is strict enough to remove duplicate boxes but not so strict that nearby objects disappear. Those two values are not sacred; they are there so your pull request has a visible decision instead of a hidden default.

A useful junior-level rule is this: if OpenCV or a hosted API gets you above the product’s minimum bar, do not train yet, because every custom model creates a second software system with its own dependencies, artifacts, and regressions. That claim is intentionally conservative because the cost of being wrong with an API is usually a refactor, while the cost of being wrong with a model can include re-labeling data, retraining, and explaining why yesterday’s checkpoint behaved differently.

Owned models win when the label vocabulary belongs to your product

An owned model wins when the API’s labels are almost right but product-useless. “Person,” “vehicle,” or “document” may be fine for a generic demo, but your application may need “damaged seal,” “wrong connector orientation,” or “signature outside approved box.” In that situation, hosted labels lose because they cannot express the mistake your users care about.

The companion post, AI Computer Vision for Software Developers: Key Use Cases, gives useful examples, but I would treat each example as a build-or-buy test rather than a reason to train. A use case becomes a model project only when the expected failure modes are specific enough to justify dataset ownership.

If you do own the model, keep the stack boring. Use CVAT 2.11 or Label Studio 1.13 for annotation, store datasets with DVC 3.51, train with PyTorch 2.3 or Ultralytics 8.2, export to ONNX opset 17, and test inference with ONNX Runtime 1.18 before optimizing with TensorRT 10. This path is popular for a reason: every step has documentation, examples, and failure modes that other developers have already seen.

Do not begin with a giant architecture search, because junior teams usually lose more time to inconsistent labels than to a weak backbone. YOLOv8n or YOLOv8s is a reasonable first detector because fast feedback improves dataset quality, while a larger model can hide labeling mistakes behind impressive demo screenshots. If you later need segmentation, compare YOLOv8-seg against Segment Anything Model 2 only after you define how masks will be scored, because beautiful masks are worthless if your product only consumes bounding boxes.

Set an acceptance rule before training. For example, require COCO mAP@[.5:.95] to improve by at least 5 percentage points over the baseline on a held-out set; this is a release threshold you choose, not a universal benchmark, because different products tolerate different localization errors. Also track p95 inference time, because a detector with better mAP can still lose if it blocks a user-facing request.

Deployment is where owned models start charging rent. NVIDIA Triton Inference Server 2.47 supports dynamic batching through settings such as max_queue_delay_microseconds, and TensorRT 10 can reduce latency with FP16 on supported NVIDIA GPUs, but both add operational complexity because model artifacts now behave like versioned production dependencies. OpenVINO 2024.2 may be a better fit for CPU-heavy environments because it avoids requiring CUDA-capable hardware, but it still requires you to test output parity after conversion.

For a small service, FastAPI 0.111 behind Docker is enough for an internal prototype, because the goal is to prove the model boundary before designing a platform. Once traffic grows, add Prometheus counters for request count, prediction class, confidence buckets, and error status, because model failures often look like normal HTTP 200 responses unless you log semantic outcomes.

Managed APIs win when speed, compliance, and maintenance matter more than elegance

Managed APIs win when the computer vision task is common and your real work is product integration. OCR, logo detection, moderation-like labeling, face-independent image tagging, and document text extraction often fit this category because providers have already trained on broader data than a small team can collect. That does not mean the provider is smarter; it means your team’s marginal dataset is unlikely to beat a mature service quickly.

Vendor limits should shape your design early. Google Cloud Vision publishes an image file limit of 20 MB for many image requests, while AWS Rekognition lists 5 MB as the maximum image bytes payload for direct API calls; those are provider-published constraints, and they matter because oversized mobile uploads will fail before your application logic runs. If your images often exceed those limits, resize or store in object storage before calling the API.

Latency needs the same honesty. A realistic web target might be p95 under 700 ms for an asynchronous preview; treat that as a product-tuned service objective, because a user waiting for a background enrichment result behaves differently from a user blocked on checkout or form submission. If your measured p95 includes network time, serialization, and provider processing, do not compare it against a local GPU benchmark because those are different systems.

Managed APIs cost less engineering time at the beginning because authentication, scaling, model hosting, and basic upgrades are someone else’s problem. They cost more strategic control later because pricing, regional availability, request limits, and model behavior can change outside your sprint plan. That trade is acceptable for many junior-built features because the first risk is usually “nobody uses it,” not “we need perfect model sovereignty.”

Security and privacy can flip the decision. If images contain sensitive internal material, an owned model inside your network may win because reducing external data transfer simplifies review and incident response. If your organization already approves Google Cloud, AWS, or Azure for similar data, the API may still win because existing controls are cheaper than inventing a private ML platform.

Be careful with caching. Caching API responses by image hash can reduce cost because repeated uploads produce identical predictions, but it can also preserve old mistakes because vendor models or thresholds may improve while your cache stays stale. Add a model-provider version field when available, and include your own schema version so that reprocessing is an intentional migration rather than a surprise.

Run a two-week shootout, then remove the losing path

Your first concrete move should be a two-week shootout with one API prototype and one owned-model baseline, both judged on the same 300-image sample, the same thresholds, and the same p95 target. Delete the loser after the decision, because keeping both paths “just in case” doubles maintenance for a feature that has not yet earned that complexity.