Manufacturing & Industrial Vision// diagnostic

It keeps up on the bench and falls behind at line speed

In short

Split the question first. If queue depth grows steadily, the cell processes parts slower than they arrive and you have a throughput deficit; if it stays flat while parts miss the reject point, you have a latency deficit inside a fixed deadline. Then measure five stages — acquisition, transfer, pre-processing, inference, actuation — because the model is usually the third or fourth term.

Key takeaways

  • Growing queue depth is a throughput deficit; flat queue with late verdicts is a latency deficit. Different fixes.
  • The deadline is distance to the reject point divided by belt speed, minus controller scan and actuator travel.
  • A 5 MB frame takes about 45 milliseconds on a 1 GbE link before any code has run on it.
  • Specify the tail, not the mean. At 10 parts per second the 99.9th percentile happens many times a shift.
  • Batching raises throughput and raises latency at the same time, which is the wrong trade inside a fixed deadline.

Two different faults share the same complaint, and telling them apart takes ten minutes. Log the number of parts waiting to be processed once a second for ten minutes at full rate. If that queue grows steadily, the cell is slower than the line and no latency tuning will save it — you are short of throughput. If the queue stays flat but verdicts arrive after the part has passed the reject point, you are short of time inside a fixed deadline. The first is solved by doing less work or buying capacity; the second by moving a piece of steel.

Both are usually blamed on the model, and in most cells the model is not the largest term. Transfer of the image off the camera, and the format conversions that happen before inference sees anything, routinely consume more of the budget than the network everyone is arguing about.

The deadline is set by steel, not by software

Before measuring anything, work out how long you actually have. The verdict has to reach the actuator before the part reaches the reject point, so the budget is the distance between the camera and that point divided by the belt speed — and then several fixed costs come out of it. A camera 1.2 metres upstream of a blow-off nozzle on a belt running at 0.5 metres per second gives 2.4 seconds, which is generous. Move the nozzle to 300 millimetres from the camera and the same cell has 600 milliseconds, which is not.

This is why the cheapest fix for a latency deficit is frequently mechanical: move the reject point downstream, add a metre of conveyor, or divert into a queue emptied on a slower cycle. Nobody proposes it because it sounds like defeat, and it is usually the only change with no ongoing cost.

The per-part budget, to fill in with measured numbers

StageWhat to measureHow to measure itWhere the time usually goes
AcquisitionExposure plus sensor readout, trigger to frame-completeCamera timestamps, or a scope on the strobe and the frame-ready lineSmall and fixed, unless exposure was lengthened to recover light
TransferFrame-complete to frame available in host memoryTimestamp on arrival in the grab callback, compared with the camera timestampOften the single largest term, and invisible in application profiling
Pre-processingDebayer, colour conversion, resize, normalise, cropWrap each operation and log per-part durations, not averagesSecond largest; single-threaded conversions on a full frame are the usual culprit
InferenceModel call, including host-to-device copy and post-processingTime the call end to end, not the framework's own reported figureSmaller than expected on a small crop, larger than expected per call
ActuationVerdict published to part physically divertedController trace plus a camera on the reject stationFixed and frequently undocumented — measure it once, write it down
The five stages, what to measure, and how

Log every stage per part against a shared identifier, and record percentiles rather than means. At 10 parts per second the 99.9th percentile arrives every 100 seconds, dozens of times a shift; a mean of 40 milliseconds with a tail at 400 misses parts all day while the dashboard reads healthy. That instrumentation is small, unglamorous software and it is the difference between a diagnosis and a debate — the sort of thing we treat as part of the build under internal tools and ops.

Transfer: usually already at the wire limit

A 5-megapixel monochrome frame at 8 bits is about 5 megabytes. A gigabit link carries roughly 110 to 118 megabytes per second of payload in practice, so that single frame occupies the wire for about 45 milliseconds and the theoretical ceiling is around 22 frames per second before anything else happens. Add a second camera on the same link and both numbers halve. A cell running 10 parts a second with two views is asking for 100 megabytes per second, which is the wire, with nothing left for headroom, retries or a burst.

  • Check what the sensor is actually sending. Many cells transfer full resolution and then immediately resize; cropping a region of interest in the camera moves that saving onto the wire where it counts.
  • Check the pixel format. Sending 12-bit or colour data when the pipeline converts to 8-bit mono is paying transfer cost for information that is discarded milliseconds later.
  • Check for retries. Packet loss on an industrial network shows up as occasional frames taking several times longer, which is a tail problem and looks exactly like a slow model.
  • Check whether the link is shared. A camera segment carrying plant traffic has a bandwidth you do not control, which is one of the reasons the ownership question in automation vendor, plant IT or product team has to be settled early rather than during an outage.
  • Check the framing. Standard-sized packets add overhead on a link carrying thousands per frame, and the setting is worth several percent.

Pre-processing, and the per-call overhead nobody times

The model runs on a small normalised crop. Everything that turns a raw sensor frame into that crop — demosaicing, converting formats, resizing, normalising, copying between libraries — runs on the host, often on one core, on the full-resolution image. On a 5-megapixel frame that is tens of milliseconds per operation, and pipelines accumulate operations the way drawers accumulate cable.

The related surprise is that inference cost is dominated by per-call overhead rather than by the model. A small crop through a modern accelerator is a few milliseconds of compute wrapped in framework dispatch, synchronisation and memory copies that can be several times that. The diagnostic is simple: time the same model on a batch of one and a batch of eight. If eight parts take barely longer than one, you are paying overhead, not compute, and the fix is in the plumbing rather than in a smaller model.

A large share of pre-processing work exists only because the part could be anywhere in the frame. When presentation is repeatable, the pipeline can crop a known region instead of searching, and both transfer and processing shrink together. Positional repeatability bought in steel pays for itself in milliseconds forever after, which is the argument in fixturing a part so the camera sees the same thing twice.

Writing every image is a throughput decision

Archiving images is right — escape analysis is impossible without them — and doing it synchronously on the inspection thread is not. Compressed frames at roughly 400 kilobytes each, 20 a second, is about 8 megabytes per second, which any drive handles. The same rate in raw frames is 100 megabytes per second sustained, which a spinning disk cannot do at all and an SSD does while occasionally stalling for a flush. The median write is irrelevant; the 200-millisecond flush the inference thread waits on is the one that drops a part.

  1. Move writes off the decision path entirely. Hand the frame to a queue and let a separate worker persist it; a verdict must never wait on a filesystem.
  2. Bound the queue and decide what happens when it fills. Dropping archive images under pressure is a defensible choice; dropping inspections is not.
  3. Compress in the worker, not in the hot path, and choose a setting that preserves the defect rather than one that looks fine on a screen.
  4. Sample deliberately if you cannot keep everything: all rejects, all uncertain parts, and a fixed fraction of passes. Decide that fraction alongside the annotation standard, because it determines what a future training set can contain — the discipline in labelling defect images so two inspectors agree.
  5. Watch for the log file nobody thinks about. Per-part debug logging written synchronously has ended more line trials than any model.

A cell that meets its deadline on average does not meet its deadline. The specification is the tail, because the part that arrives during the worst hundred milliseconds of the shift is a real part and it ships.

Three ways out, in the order to try them

  1. Do less work. Crop in the camera, send 8-bit mono if that is what you use, remove redundant conversions, stop searching for a part you could fixture. This is free and it usually recovers more than the other two combined.
  2. Move the deadline. Relocate the reject point downstream, or divert to a re-inspection lane that is cleared on a slower cycle. Cheap in capital, no ongoing cost, and it converts a hard real-time problem into a soft one.
  3. Buy headroom. A faster interface, a second link, hardware decode, or an accelerator with room to spare. Correct when the first two are exhausted, and worth sizing against measured numbers rather than a vendor's frames-per-second figure.
  4. Whatever you choose, re-run acceptance at full line speed with the tail measured, not on a bench with a tray of parts — the standard of proof set out in the acceptance run that proves an inspection cell.

One exclusion is worth stating. If images arrive damaged rather than late — clipped, smeared, duplicated — that is acquisition, and the checks are physical: half a part in frame, trigger and encoder faults. Fix that first, because a cell clipping half its frames produces a throughput measurement that means nothing. The rest of the cell's decisions sit in visual inspection and defect detection, part of our manufacturing and industrial vision work.

Frequently asked questions

Short answers to the follow-ups this page tends to raise.

How do I tell a throughput problem from a latency problem in an inspection cell?

Log the number of parts waiting to be processed once a second for ten minutes at full line rate. A queue that grows steadily means the cell is slower than the line and needs less work or more capacity. A queue that stays flat while verdicts still arrive too late means throughput is adequate and the deadline is too short, which is often fixed by moving the reject point further downstream.

Is the model usually the reason a vision system cannot keep up?

Usually not. Image transfer off the camera and host-side pre-processing — demosaicing, format conversion, resizing a full-resolution frame — are typically larger terms, and per-call framework overhead often exceeds the model's actual compute. Time each stage per part before optimising anything; a batch-of-one versus batch-of-eight comparison will tell you within minutes whether you are paying overhead or compute.

Will batching images improve inspection throughput?

It improves throughput and worsens latency at the same time, because the first image in a batch waits for the last. Inside a deadline set by the distance to a reject actuator, that is usually the wrong trade. Batching is reasonable only where the reject decision happens far enough downstream to absorb the added wait, and the batch size should be documented next to the deadline it consumes.

How much time does transferring an image actually take?

More than most teams assume. A 5-megapixel monochrome frame is about 5 megabytes, and a gigabit link carries roughly 110 megabytes per second in practice, so one frame holds the wire for about 45 milliseconds and the link tops out near 22 frames per second. Two cameras on one link halve that.

  • throughput
  • latency
  • machine vision
  • line speed
// shipped work

The work behind this page

Builds from our portfolio that this page draws on.

Read next

Working on something in this space?

Tell us where you are in a sentence or two. We'll tell you honestly whether we're the right team, and what a sensible first slice of the work looks like.

Start the conversation