Case Study: Real-Time Multi-Camera Vision at 300 fps
At a Glance
We made a live multi-camera detection system more than 30× more responsive on the same hardware, without changing a single model weight or losing detection accuracy.
| Result | Before | After |
|---|---|---|
| Typical time from frame arriving to detection published | 1–3 s | 0.02–0.04 s |
| Worst-case time | up to 5.1 s | under 0.08 s |
| Frames each camera can be processed at | 128–184 per second | 324–378 per second |
| Work done per GPU | 535–570 | 1,075–1,311 (2.1–2.2×) |
| Energy per frame | 0.54 J | 0.42 J (22% lower) |
| Detection results | baseline | identical, or provably closer to the model's exact output |
The system now keeps pace with cameras recording at 300 frames per second, with headroom to spare.
The Challenge
The system's object detector fell seconds behind live cameras, and the GPUs looked underused, yet adding hardware was not the answer.
- What the system does: several high-speed cameras record at 300 frames per second. Each frame is decoded, cut into regions, run through a neural-network detector and published to a downstream real-time analytics service.
- The symptom: detections arrived 1–3 seconds after the frame, and up to 5 seconds in the worst case, while the GPUs appeared lightly used.
- The constraints: keep the same hardware (two NVIDIA workstation GPUs), keep the same trained model, keep full 32-bit precision (lower precision produced false positives for this client), and never make detection results worse.
Our Approach
We measured before changing anything, then made one change at a time, each proven on speed and on accuracy before the next.
- Instrument the pipeline. Added per-frame timing from "frame arrived on disk" to "detection published", plus GPU capacity benchmarks that mimic several cameras sharing one GPU.
- Find the real bottleneck. Profiling showed the obvious suspects (the neural network, the post-processing) were not the limit at first: frames were waiting on a dedicated hardware JPEG decoder that was being fed one image at a time.
- Change one thing per step. Each step was replayed on recorded footage at the live 300 fps rate and compared with the previous step.
- Prove accuracy every time. Every detection on 18,900 frames was compared with the original system's output before any change was adopted.
- Agree each step with the client. A written plan, a separate code branch, and a go-ahead before every step.
What We Changed
Six targeted changes, all in the software around the model, took the system from falling behind to keeping up with headroom.
| Technique | What it fixed | Effect |
|---|---|---|
| Batched hardware JPEG decoding (NVIDIA DALI) | The GPU's JPEG engine takes the same ~5 ms per call for 1 to 4 images; sending one image per call capped each GPU at ~620 frames/s | 4× decode capacity per GPU; the biggest single gain |
| One neural-network call per batch of frames (NVIDIA TensorRT, variable batch engine) | Each inference call has a large fixed cost; frames are now grouped when several are waiting | ~20–35% less GPU time per frame |
| CUDA Graphs | Replays the whole inference as one pre-recorded GPU job instead of many small launches | ~20% less GPU time per inference; results bit-identical |
| CUDA MPS (Multi-Process Service) | Lets several camera processes share a GPU concurrently instead of taking turns | ~1.7× detection throughput with 4 processes per GPU |
| Fewer CPU–GPU round trips | Post-processing waited on the GPU 15–25 times per frame; now it copies results once | Lower CPU overhead; bit-identical results |
| Load balancing across GPUs | The heaviest camera (wider frames, 4 regions instead of 3) shared the busier GPU | Every camera now above 300 frames/s, worst-case delay under 0.08 s |
Along the way we also:
- found and fixed a latent bug where a failed job could silently feed stale frames into the next one;
- found that an upstream data-transfer service slows down as a session grows, wrote a fix that holds full speed in load tests, and handed it over ready to deploy.
Results
Each step was measured on the same recorded footage at the live rate; together they cut the slowest camera's typical delay from 3.07 s to 0.04 s.
Detection delay fell from 3.07 s to 0.04 s
Typical time from frame arriving to detection published, slowest camera, live 300 fps replay
- Original system3.07 s
- + GPU sharing (MPS)1.59 s
- + Quick fixes1.58 s
- + Batched JPEG decode0.42 s
- + CUDA Graphs0.27 s
- + Batched inference0.16 s
- + GPU load balancing0.04 s
| Measure (all cameras at once) | Before | After |
|---|---|---|
| Maximum frames per second per GPU | 533–570 | 1,075–1,311 |
| GPU power while working | ~300 W | ~500 W (the GPU is finally doing real work) |
| Memory bandwidth in use | 12% | 50–57% |
| Energy per frame | 0.54 J | 0.42 J |
A standard GPU "utilization" reading was ~85% both before and after: it counts the time any task runs, not how much work gets done. Power, memory bandwidth and frames per second show the real 2× gain, which is why we measure all of them.
Accuracy Guarantees
Speed never came at the cost of detection quality: every change was proven against the original output, down to the last digit where possible.
- Frame-by-frame comparison: a purpose-built tool runs the production pipeline over 18,900 recorded frames and compares every detection's position and confidence with the original, as exact numbers.
- Bit-identical where possible: five of the six changes produce exactly the same numbers as the original system. Where a GPU and a CPU rounded a division differently, we matched them exactly rather than accept a tiny drift.
- Measurably more accurate where not: the new batched inference engine cannot match the old engine bit for bit. Instead we measured both against the model's exact 32-bit output: the old engine deviated by up to 1.65 pixels (from a reduced-precision maths mode); the new one by 0.0005 pixels. We kept full precision and still got the speed.
- Real-world conditions: changes were tested with failures injected, with partial batches, and with other services sharing the GPU, before being adopted.
Skills Demonstrated
The work shows end-to-end ownership of a real-time GPU vision pipeline, from profiling to a safe rollout.
| Capability | Shown by |
|---|---|
| GPU performance engineering | CUDA MPS, CUDA Graphs, dedicated CUDA streams, removing CPU–GPU synchronisation points |
| Inference optimisation | Building NVIDIA TensorRT engines with variable batch sizes; choosing precision on measured accuracy, not assumptions |
| Video and image pipelines | NVIDIA DALI tuning; using the GPU's hardware JPEG decoder efficiently |
| Profiling and benchmarking | Per-frame latency instrumentation, multi-process GPU benchmarks, hardware-level GPU monitoring |
| Numerical rigour | Bit-level comparison of outputs; matching GPU and CPU floating-point behaviour exactly |
| Systems thinking | Finding an upstream data-transfer bottleneck outside the original scope and fixing it with a load-tested design |
| Reliability | Finding and fixing a latent data-corruption bug; testing failure paths, not just the happy path |
| Delivery discipline | Plan agreed up front, one measured step at a time, every step reversible, documented and on a separate branch |
The result: a system that keeps pace with 300 fps cameras on the hardware it already had, using less energy per frame, with detection results that are the same or provably closer to the model's exact output.
Technology Stack
The technologies used in this project. Choose one to hire a developer who works with it.
GPU and inference
Video and image pipeline
Need this stack in your project?Hire Amenity developers who build with these technologies.
Hire a Developer