All articles

Blog

Camera-Based Piece Counting to Determine the Quality Factor

Published on

25.8.2026

The OEE calculation rests on three factors: availability, performance and quality. While availability and performance usually come from the machine signals, the quality factor is the least well substantiated value in many plants. It requires two piece counts: the actual output of a process section and the good quantity that results from it. In practice, counting often takes place at the packaging outfeed only, because that is where a counter already exists.

One way to close that gap is optical piece counting. We set it up on one lane of a confectionery line between the cooling tunnel and the packaging machine and documented it in a short video. This article describes what can be seen there, how the counts produce the quality factor, and which technical conditions the setup requires.

The quality factor and the unknown actual output

Between the cooling tunnel and packaging, the products pass several stations. Along the way, bars fall off the belt, get stuck, are rejected by the metal detector or come out of the process broken. As long as counting happens at the packaging outfeed only, those losses stay invisible until someone reconciles the batch hours later. For shopfloor management this means the magnitude of the loss is known, but not its cause. Measures can hardly be prioritised on that basis.

Camera-based counting of production units

Generically, optical counting consists of three steps:

  • detection of the products in the camera image by a trained object detection model
  • tracking of the detected objects across consecutive frames
  • counting when an object crosses a defined counting line

In the video this sequence is visible as an overlay. Every detected bar receives a box and a tracking ID that is kept as long as the object stays visible. A counting zone limits detection to a single lane so that products in neighbouring lanes are not included. A bar is only counted once, as soon as its centre point crosses the counting line. This keeps the count stable even when the belt stops, reverses slightly, or the object jitters between frames.

Camera-based counting on a confectionery line between the cooling tunnel and the packaging machine

The video is also available on the video page.

From two counting points to the quality factor

A single counter provides a piece count vector over time. The arrangement becomes meaningful with several counting points along the line:

  • after the cooling tunnel as the actual output of the section under review
  • before and after the metal detector or reject flap
  • at the wrapper infeed
  • at the case packer

The first counting point provides the actual output, the second one the accepted production, meaning what actually arrives at the next station. Between the two lies the scrap of that section:

Accepted production = actual output − scrap

Related to each other, the two counts give the quality factor and the scrap rate:

Quality factor = accepted production ÷ actual output

Scrap rate = scrap ÷ actual output

An example: the camera after the cooling tunnel counts 12,000 bars per hour, the counter at the wrapper infeed 11,640. The scrap in that section is therefore 360 pieces per hour, the quality factor 97 percent and the scrap rate 3 percent. The values are available per order, shift and product and update continuously instead of being derived retrospectively at the end of the batch. That makes them usable in shopfloor management, for instance when comparing shifts or assessing product changeovers.

Technical setup and connection to oee.ai

The setup uses a standard industrial or IP camera mounted above the conveyor. An object detection model trained on the specific product runs together with a multi-object tracker, while zone and line logic handle the counting itself. Processing happens on edge hardware next to the line, so only counts leave the device. No video stream has to be stored or transferred.

From there the counts are handed over to the shopfloor system exactly like a pulse from the machine control would be. In our case they feed oee.ai directly and become the quality factor there, without anyone touching the machine control.

The final step is the confirmation against the production order: the recorded scrap quantity is booked to it automatically, instead of being entered by hand at the end of the shift.

If you would like to know whether this approach can be used on your line, please get in touch, via Contact or in a demo.