R&D
CENTER

Alignment: Putting Every Part in the Same Pose

If parts sit at a different angle every time, the model learns rotation before it learns defects. This lesson covers the principles and uses of alignment: Ring alignment for round parts, PCA alignment for arbitrary shapes, and yolo_align, which judges after alignment.

Intro3 min1 views
Key points
  1. Alignment removes position and rotation so the model focuses only on defects.
  2. For round parts, find orientation from the circle center and a direction feature (tab, ear). For arbitrary shapes, use image moments (PCA).
  3. Use the same alignment for training data and field inspection. Image Processing Tool and Multi-Inspector share the alignment settings.
  4. If alignment fails, judgment continues on the original image, so an alignment error does not stop the line.

An anomaly detection model learns what a normal part looks like. If normal parts are imaged at a different angle every time, the range of normal the model must learn grows to include every rotated view. The wider that range, the more small defects get buried inside it. Alignment removes this problem right after capture.

Raw capture · rotated −38° rotation-fix Aligned · tab at 12 o'clock, centered ① Find circle center② Compute tab angle③ Rotate and shift
Ring alignment of a round part. Move the circle center to the image center, then rotate so the direction feature (tab) points to 12 o'clock.

Round Parts: Ring Alignment

Round parts such as bands, rings and bearings are aligned in this order. The Multi-Inspector rotation-fix mode works this way.

  1. Find the center — Get the part center with circle detection (Hough Circle) or by fitting a circle to the contour (circle fitting).
  2. Find the direction — A circle looks the same when rotated, so find the angle of a feature that exists in only one place, such as a tab or ear.
  3. Rotate and shift — Move the center to the image center and the feature to the 12 o'clock direction.

Arbitrary Shapes: Shape (PCA) Alignment

A non-round part such as a seat belt buckle has no circle to find. Instead, get its pose from the image moments of the part region.

  • First moment (centroid) — The position of the part.
  • Second moment (principal axis) — The direction in which the part extends longest. This is the same calculation as principal component analysis (PCA).
  • Third moment (asymmetry) — The principal axis alone cannot tell front from back when the part is flipped 180°. Define the side with more mass as the front to remove this ambiguity.

The technical note How to Align Non-Round Parts gives the details of the calculation and settings. If you need only position and not orientation, use Center-Only alignment.

Judging After Alignment: yolo_align

The Multi-Inspector EB line build supports the yolo_align mode from v2.2. It aligns and centers the part, then finds defects with YOLO. Defects always appear at similar positions and orientations, so detection is more stable even with the same amount of data. For setup details, see the yolo_align mode note.

Training and Inspection Must Use the Same Alignment

Alignment runs once at training time and again at inspection time in the field. If the two differ even slightly, the model receives images unlike those it trained on. So Multi-Inspector reuses as is the alignment settings made in fineAi Image Processing Tool. The alignment that prepared the data and the alignment that runs on the line give the same result.

Preparing for Failure

Alignment finds features in an image, so it can fail. Examples are a part captured half cut off or a momentary lighting flicker. When alignment fails, Multi-Inspector continues judging on the original image and writes a log. An alignment error does not stop the line, and you can collect the failed images later to analyze the cause.

When Not to Use Alignment

  • If the part is fixed in a jig and always imaged in the same place, you do not need alignment.
  • For targets with no consistent shape (food, produce, etc.), it is hard to define an alignment reference. Use a model that tolerates position change (such as AnomalyDINO) or YOLO without alignment. See the lesson Choosing an Anomaly Detection Algorithm.