📅 · 4 min read · Meta Smart Factory Team
Most visual inspection projects are decided before anyone writes code — when someone defines what a defect is, fixes where the part will sit, and chooses how to light it. A model can only work with the image it is handed. This guide is for the people who specify the system — quality and process engineers, automation staff, whoever owns it afterwards — and it assumes you know your process and not computer vision.
Before any hardware question, settle what counts as a defect on this part, and who decides. That sounds trivial until you test it.
Take a hundred parts off the line, including the awkward ones, and have two experienced inspectors sort them independently into pass and fail. On clear defects they will agree. On the borderline population — the faint scratch, the short fill, the print that is readable but not crisp — they often will not.
That disagreement is the real ceiling on accuracy. If two people who have done the job for years cannot agree on the same part, there is no single correct answer for a model to learn, and no supplier can deliver one, so any accuracy figure in a proposal is meaningless until the definition is fixed.
The fix is not a better algorithm. It is a written defect catalogue — each type named, with images — and a boundary set of physical parts for each class: the worst part still acceptable, the best part still a reject. Those parts become the reference for labelling and for acceptance testing.
A problem nobody can define consistently cannot be automated, only argued about faster.
Camera selection is arithmetic, not preference.
Resolution follows the smallest feature you must see. Divide the field of view — the part plus tolerance for how it can sit — by the sensor pixels to get millimetres per pixel. A defect landing on one pixel will not be found reliably, so plan for several pixels across the smallest feature, more when it is low contrast. Resolution beyond that costs bandwidth and depth of field, and contrast beats pixel count anyway.
Exposure has to beat the line. Motion blur is speed multiplied by exposure time: a part moving at one metre per second smears one millimetre in a one-millisecond exposure. If the smear exceeds the defect, you have lost already. Shorter exposure means more light, which is why lighting and camera are one decision. For anything moving, specify a global shutter; a rolling shutter reads line by line and distorts a moving part.
Area scan or line scan. Area scan suits discrete parts stopped or indexed at a station. Line scan builds the image one row at a time for continuous web, strip or extrusion, or a cylindrical part rotated past the camera, and needs motion that is constant or encoder-synchronised.
Monochrome unless colour is the defect. Monochrome spends every pixel on detail and is more sensitive in low light. Choose colour only when colour carries the information: a wrong-coloured component, a stain, print colour against a specification.
Interface and cabling. The interface sets cable length, bandwidth and cost — GigE for long runs, USB3 at a bench, high-bandwidth industrial interfaces for fast line scan. Then the unglamorous part that causes most field failures: drag-chain-rated cable, locking connectors, strain relief, routing away from drive and welding cables.
A defect made obvious by light is a simple problem; the same defect left for a model to dig out of a noisy image is an expensive one. A few geometries cover most jobs. Bright field, light along the viewing axis, gives an even general-purpose image for print, colour and presence. Dark field, at a grazing angle, makes scratches and engraving glow against a dark background. A backlight puts the part in silhouette, for outline dimensions, hole position and fill level. A dome wraps a curved or shiny part in even light, the answer for print on reflective surfaces. Coaxial light arrives along the optical axis, for flat specular surfaces and laser marking.
A scratch, a dent and a print error are three different lighting problems: grazing light for the scratch; for the dent, which changes slope rather than colour, light whose reflection shifts with that slope; flat, glare-free light for the print. Covering all three from one fixture is how a station ends up mediocre at everything.
Then ambient light, which quietly breaks systems that passed acceptance: afternoon sun through a rooftop light, a shift that switches on different overheads. Deal with it physically — shroud the station, fit a bandpass filter matched to the LED wavelength, and strobe short and bright from the capture trigger so your light dominates the room.
A stable image is cheaper than a bigger model.
Most inspection is a 2D problem: presence, position, in-plane dimensions, print, colour, anything that appears as contrast on a surface.
Go to 3D when the feature is height or shape and does not reliably produce contrast — bead height on an adhesive line, coplanarity of pins, weld seam profile, warpage, a dent in unpainted metal, fill level in an opaque container. Laser triangulation needs relative motion, structured light works on a stationary part; both struggle with mirror finishes and occlusion and produce far more data per part.
A practical test: if a good inspector can judge the part from a photograph, it is a 2D job. If they have to tilt it in the light, it is 3D or a specialised lighting geometry — and the lighting is worth trying first.
Much of what arrives as an AI inspection request is label and print verification, and much of that is deterministic: grading a barcode or data matrix, comparing printed text against an expected string, checking the right revision is on the right product.
The hard part is not the reading but where the expected value comes from. If the operator types the target text at the station, you have automated a typo; code, batch, date and revision have to come down from the order in MES or ERP. Machine learning earns its place here for print quality — smearing, missing dots, distortion on curved surfaces — not for the comparison.
Your line produces overwhelmingly good parts, and that imbalance defines inspection data. It makes overall accuracy useless: a model that calls everything good scores well on a dataset that is almost all good parts. Judge on the defects — how many were caught, how many good parts were rejected.
It also shapes the approach. Anomaly detection learns normal from good parts and flags deviation; it needs few defect images and reacts to things it has never seen, but it says only that the part is unusual, not what is wrong. Supervised classification and segmentation name and locate the defect, which a defect catalogue and SPC need, but they need real examples of every class — more than anyone expects. Either way, a model knows only the defects it was shown.
Then drift. The model is a snapshot of the line during training, and the line moves: a new supplier, a different material lot, tool wear, a camera bumped during cleaning, a part revision. Retraining is a maintenance activity with an owner and a schedule, not a project phase that ends.
Labelling deserves a decision, because whoever labels the images is defining quality for the plant. It belongs to the people who own the defect definition, working from the boundary samples; otherwise the inspector disagreement above returns as inconsistent labels, and those cap everything downstream.
Synthetic and augmented data help in specific places. Augmentation — small changes in rotation, position, brightness, focus — is cheap as long as you stay inside what the station can physically produce. Rendered images help most where the defect is geometric and describable: a missing component, a wrong orientation. They help least where the appearance of the defect is itself the unknown, which is what a renderer cannot invent.
Whatever you train on, hold back a test set of real images, borderline parts included. It is the only honest way to tell whether a new model beats the old one.
Every inspection system has a threshold, and it trades two errors against each other: tighten it and you catch more defects and reject more good parts, loosen it and the reverse. No setting removes both. Which way to lean is economics specific to your plant — what an escape costs against what over-rejection costs in scrapped parts, rework and operator time.
The asymmetry is worth planning around. Over-rejection destroys trust faster than missed defects do. Missed defects stay invisible for weeks; a station that rejects good parts is visible within the hour, and the reaction is predictable: the operator starts overriding, then stops looking, and the camera becomes an expensive lamp.
So someone has to own where the threshold sits: a named person in quality, the setting recorded in the inspection plan, a log of changes. Three outcomes rather than two — pass, fail, and a review band routed to a person — let you run detection tight without dumping the borderline population on the operator. Set the acceptance criteria in plant terms before go-live, in escapes per thousand parts and false rejects per shift.
The image is captured, the model has an answer, and nothing has yet happened to the part. Two things have to follow.
Actuation. The reject has to be physically enforced — a pusher, a diverter, or an interlock that stops the next operation on that part — through the PLC, with the handshake designed so a failed capture or slow inference gives a safe state rather than a silent pass. Confirm the ejection with a sensor that sees the part leave. An ejector that misses without telling anyone is worse than no inspection, because now people believe the parts were checked.
The record. The verdict, the image and the timestamp belong against the work order, the batch, the serial number, the station and the model version, in MES and QMS. Model version matters: after a retrain, yesterday's verdicts came from a different judge. That record is what makes inspection compound — defect rate by class becomes an SPC variable, and containment becomes a query instead of a week of paperwork.
Almost always one of these, and rarely the model.
Unstable presentation — the part not arriving in the same place, angle and distance: vibration, a loose bracket, a mount knocked during cleaning. Fixturing is the cheapest accuracy you will ever buy.
An unowned threshold, drifting with whoever is on shift.
A part revision nobody re-trained for. Engineering change control has to list inspection as an affected system.
A bypass with no trace. Operators need an override, but it has to be logged and reviewed.
Nobody reviewing images. Someone has to look at failures, and a sample of passes, on a regular rhythm; that is how drift is caught before a customer catches it.
Proof-of-concept conditions treated as production. The demo ran at a bench, at night, with the part held still by a person.
Meta Smart Factory's Computer Vision module covers the inspection side of this — cameras and lighting specified for the defect you have, models trained on your own parts, inference at the line — and integrates with our MES and Quality (QMS) modules, so the verdict lands against the work order and batch and flows into traceability and SPC rather than stopping at a lamp. Reject actuation runs through the PLC over the same IIoT and OPC UA connectivity.
If you are at the beginning of this, the useful first step is not a demo. It is the hundred-part test with two inspectors and a written defect catalogue, and we are glad to run that with you before anyone specifies a camera.
Discuss This With Our Experts