Skip to content
LexDataLexData
PlatformIndustriesCustomers
DocsThe Field GuideBlogWhy models drift
AboutCareersSecurityContact
Log inStart now
← All posts

Industries · 7 min read

IV bag fill level and leak detection on a transparent bag with a line camera

Fluid and ports find the bag, fill level is a class, and whether a port is wet is a question put to the frame. A swapped camera moves every highlight.

Summary

This post puts a camera on an IV bag filling line and splits the inspection in two, a detector that finds each bag through its fluid and ports and classes its fill level, and a question put to the frame about whether the moisture at a port is a leak or condensation. It concludes that glare is handled at labeling rather than at inference, and that a replaced camera moves every highlight the model learned. It is for pharmaceutical packaging and quality engineers.

Stephen Biswas · Engineer · Sep 25, 2026

Bottling line with bottles queued under a fill head, generated scene with detections from our model

An IV bag on the filling line at station 6 is a clear film pouch with a clear fluid in it, two ports at the bottom, a printed label, and almost nothing else for a camera to hold on to. The inspector at the end of the line picks up every tenth bag, squeezes it, holds it to the light to read the fill line against the printed scale, and runs a thumb over the port seals for wet. The other nine go into the carton on the strength of that one.

A camera on the line looks at every bag, and it has to find a bag it can barely see.

The bag is found through its fluid, its ports and its label

The film is transparent, so the model does not learn the bag. It learns the things a bag reliably contains: a column of fluid with a meniscus at the top, two ports at the bottom, and a label at a known position. The bounding box goes around all of that, and the bag is wherever those three are. The frames come from the line camera at its mount, with the backlight the line already has, and the film's wrinkles and reflections in every one.

Fill level is a class on the same box rather than a measurement. The line's own acceptance is written in bands, under-filled, in-range and over-filled, against the printed scale, and a class per band is what the disposition needs. The labeler reads the meniscus against the scale in the frame, exactly as the inspector did against the light, and the QA pass is mostly the meniscus, since a bag at rest and a bag still swinging from the filler show it at different heights. The rule written before labeling is that the frame is taken after the bag has settled, and the pipeline holds each bag for that long.

Labels on a set like this come back at up to 99.9% accuracy when every one is checked. On a transparent bag the checking is where the accuracy lives, because a meniscus mislabeled by one band is a bag the model has been taught to misread.

Glare is handled at labeling, before it is a problem at inference

A film pouch throws highlights wherever the lights at station 6 hit it, and the highlights move with the bag. A highlight across the meniscus hides the fill line. A highlight at a port looks like a droplet. A first version trained on frames where the labeler skipped the glared bags learns that glare means nothing is there, and at inference it passes every bag the light happens to hit.

So the glared frames are labeled on purpose, at a higher share than they occur, with the meniscus read from the frame before or after when the glare has moved off it. A polariser on the lens takes out most of the highlights before they reach the sensor, and a line that can fit one should. What remains is labeled as what it is. The assembly verification use case has the same rule for a different part: presence and position are read from a box and its position, and the hard case is the partial view, which on a bag is the glare.

Whether the port is wet is a question for a VLM, with the frame

A leak on an IV bag is a droplet at a port seal, a thin film of moisture on the surface, or a slow pooling at the bottom of the pouch. The ways it can look are more varied than any list of classes covers. Condensation from the sterilising step looks like a leak and is not one. The detector is the wrong tool for an open question of that kind.

This is where LexInsight is asked a question of the frame: is there visible moisture at either port on this bag, and does it look like a leak or like condensation. The question is asked about the frame the detector already boxed, with the ports marked, and the answer comes back with the frame behind it. A VLM answering that question is doing the same thing the inspector's thumb did, in words, on every bag rather than every tenth. What it is not is a pass or fail gate. A bag the answer calls wet goes to a person with the frame, and the person decides.

The reject is a rule written as a sentence, with a severity and a cooldown, approved before it goes live. A bag under-filled at station 6, routine, to the station screen and the line's log. A bag with moisture at a port, high, to the quality engineer in Slack with the frame attached, held at the station until a person has looked at it.

In our manufacturing work the inspection models hold 99%+ accuracy maintained in production, and on a filling line that figure is the fill-level detector agreeing with the inspector on the bags the inspector pulled. The question about the port is a separate thing with a separate honesty: it flags, and a person decides.

The doubted bag goes to a person, and the verdict is a label

LexData takes the bag model through its whole life. You type what to look for, Lexi puts a bounding box on every bag in every frame, and a person checks each label before anything trains on it. The model then watches the line camera, in the cloud, on your servers, or on a runner beside the recorder. Frames it is unsure of come back to a person, the corrections retrain it, and the new version replaces the old one with no downtime.

On a filling line the doubted frames are the bags where the meniscus sits on a band boundary and the bags where a highlight crossed it, and the inspector's verdicts on those are what the next version learns. The correction rate is the number to watch. A week where the inspector overrides the fill class more often than last week is a week something changed, a new film supplier or a new lot of fluid with a different tint, before anyone has said so.

An aside from the line. The inspector still pulls every tenth bag and squeezes it, and says the squeeze finds the slow leak that no frame can show, because a slow leak is a bag that is lighter than it should be rather than a bag that looks wet.

A swapped camera moves every highlight the model learned

The line camera at station 6 fails and is replaced with the same model from a newer batch, with a slightly different lens coating and a sensor that renders the backlight a little cooler. The bags look the same to the inspector. To the model, every highlight has moved and every meniscus sits against a background of a different tone, and the doubted frames on the first shift are most of the shift.

The drift catalog calls this a camera was replaced: new hardware, a different colour response and sharpness, and the model treats a familiar scene as unfamiliar. The signal is the correction rate stepping up on the day of the swap. The fix is a short window of frames from the new camera, labeled and folded in, which is an afternoon's work if the swap is known about and a week's confusion if it is not.

My own view is that the camera's serial number should be a field on every frame from the day the line goes live. The first question after a step in the correction rate is whether the camera changed, and a line that cannot answer it from the frames will answer it from the maintenance log three days later. How the alert gets attached to the station camera and written as a sentence is in the monitoring doc.

See it on your own footage.

Start with your footage

More in Industries

Industries · 7 min read

Counting the screws in a kit with object detection over the bench

A camera over the kitting bench counts every screw and bottle one box at a time. Exact for kits, a band for cases, and a half-hidden item is a written rule.

Rajiya Sultana · Sep 25, 2026

Industries · 7 min read

Automated water meter reading with a camera in the vault

Ten digit classes in a fixed row turn a truck roll into a frame. A rolling digit and condensation on the glass are the frames that come back to a person.

Stephen Biswas · Sep 25, 2026

Industries · 7 min read

Body-in-white inspection with a station camera on unpainted steel

Dents on a bare body shell hide in the reflections. Masks give the extent, a second pass decides reportable, and a tightened tolerance is a spec change.

Finn Ellingwood · Sep 25, 2026

LexData
LexData

Product

  • Platform
  • Industries
  • Use cases

Resources

  • Docs
  • The Field Guide
  • Blog
  • Why models drift

Industries

  • Energy & utilities
  • Oil & gas
  • Agriculture
  • Manufacturing
  • Insurance
  • Retail
  • Robotics

Company

  • About
  • Customers
  • Careers
  • Contact

Trust

  • Security
  • Privacy
  • Terms

Stay updated

What we learn running vision models in production.

See everything.
Miss nothing.

Stay updated

What we learn running vision models in production.

Terms of use & Privacy policy

© 2026 LexData Labs · All rights reserved