# Localize Orientation and Inspect Watch Dials

Watch dials and many other printed components demand high quality. The use of pad printing (or tampography) on the components provides inspection challenges. When the pad printing uses multiple pads, the alignment is often imperfect. The amount of ink applied changes so the thickness of the lines may vary. The detection of real defects, like missing ink, spills, or problems on the substrate, needs to occur while accepting some variation.

The images in the tutorial show watch dials at random orientations. First, use a Blue Locate tool to determine the center and orientation of the dial. The Red Analyze tool can analyze the resulting cropped and reoriented images. Since the dial has holes which show the presentation grid underneath, use a mask to prevent the Red Analyze tool from inspecting the grid.

## Add Blue Locate tool

1. Add the images for the Dials tutorial.

2. Add a Blue Locate tool.

3. Segment the images by adjusting the ROI The Region of Interest (ROI) defines the area of operation for the tool. The ROI preserves the positions, angles, stretch and skew of the original image. of the Blue Locate tool to enclose the watch dial.

4. Set the Feature Size parameter to 100.

5. Select at least two features (for example the center and the hole under the "B"), and label them in at least three images.

6. Compensate for the variability in the orientation of the dial by adding some rotation during the training Training is the process that your tool, which is a neural network, is learning about the features (pixels) based on the labels you made. For example, a tool will learn the defect/normal pixels in each image based on the defect/normal labels you drew. The goal of the tool Training is learning enough to give the correct inspection results of whether an unseen image is defective or not. The key to training is to ensure that you include all possible variations within your training set, and that your images are accurately labeled. Training times vary by the application, tool setup and the GPU in the PC being used to train the network. phase by changing the Rotation Perturbation parameter interval to [0,360].

7. Train the system and review the results.

8. Manually label any of the images where the features were not found correctly.

9. If you had to manually label new images, retrain the system and review the results again.

10. In one of the images, select two of the labeled features, right-click on the View and select Create Model from the menu and create a model A specific spatial arrangement of a set of features (Blue Locate and Blue Read tools only.) During a post-processing step, the Blue Locate and Blue Read tools can fit all of the features detected in an image to the models defined for the tool. The overall pose and identity of the model is then returned. named "dial".

11. Reprocess the images and make sure the model is correctly found.

## Add Red Analyze tool

1. Add a Red Analyze tool, and configure the ROI setting to use the "dial" model, and set the size of the ROI to 1850 x 1850.

2. Segment all the images and verify that the images in the database are correctly segmented.

3. Label all the images as Good, and then use the display filter to label the images which contain the word "bad" in the filename as Bad.

## Add Mask

1. Create a mask to hide the background, the small circles on the surface, and the half-moon shape.

2. In the Image Display Area, right-click and select Edit Mask from the menu.

3. Select the Circle Tool, and from the center of the dial, draw the circle outward to the edge.

4. With the circle mask in place, press the Invert button to have the mask cover the outside of the circle.

5. Select the Circle Tool and apply circle masks to each of the other circular features in the image.

6. Select the Magic Wand tool, and holding down the Shift key, drag the wand over the shape to fill it in.

7. With all of the masks in place, press the Apply button, which launches the Apply Mask dialog, allowing you to apply the mask to all of the images.

8. Press the Close button to close the Edit Mask mode. All of the images now have the mask.

9. Train the tool and review the results, validating that the tool correctly marked the defects. If you adjust any of the parameters associated with training, or you re-label an image, you need to retrain the tool and re-validate the results.