# Train Blue Read

You train the tool to read characters. The tool is pretrained on a font library, therefore it can identify most text without additional programming or font 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.. If the tool can read the full image database of all of the characters in your images with 100% accuracy, you do not need to train.

If you have a more demanding machine vision problem, you can train the Blue Read tool to improve its performance and accuracy. It's not necessary to label multiple instances of each character but the more labeled instances there are, the better the results will be during the training phase.

Training increases the accuracy of the tool by customizing the neural network to your data set. Initially, the 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. is generalized, but training progressively attunes it to your specific data. For this reason, training can be counterproductive if your data does not reflect real-world scenarios. For the best results, ensure that your training images represent the diversity of characters and contexts on the production line.

## Prerequisites

- You have created or imported a workspace into VisionPro Deep Learning application.

- You have collected images and loaded them into the application.

## Procedure

1. Add a Blue Read tool.

2. Configure 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. and Feature Size

   1. Within the Read tool, set the ROI and Feature Size.

      Note: For more information on setting the Feature Size, see Feature Size.
   2. In the Image Display window, click the first image.
   3. The rectangular ROI will encompass the entire image.
   4. Re-size the ROI so that it encloses the characters. There are two handles on the ROI, in the upper-left and lower-right corners, that you can use to drag and re-size the ROI so that it covers the characters and their possible locations within all of the images.
   5. Once the ROI is set, press the Apply button.
   6. This will then apply the ROI setting to all of the images.
   7. After the ROI has been applied, click the first image again.

   8. In the bottom left corner of the display will be an interactive Feature Size box, which indicates the default character size. You can grab it and drag it up to a character and re-size it so that it fits a character.

      Tip: Try to keep from making it so big that it encloses parts of another character. After setting it on one character, you can then move it around to the other characters to ensure it's sized correctly.

   9. Once the character size is set, press the Book icon to process all of the images based on the new character size. This will apply the new character size to all of the images.

      Note: If the character size is changed in one image, the change will automatically be applied to all of the other images. However, if the Scaled parameter option is active, the features will only adapt their aspect-ratio to meet the character of the nominal feature A feature is a visually distinguishable area in an image. Features typically represent something of interest for the application (a defect, an object, a particular component of an object).-size and clamp the features to within the interval [1/4, 4] of the nominal feature size The subjective size of the image features that you feel are most important for analyzing image content. The feature size determines the size of the image region used for sampling. Only used with Blue Locate, Blue Read, and Legacy type tools.. That will require pressing the Book icon to reprocess the images and see the result of the Feature Size change on the rest of the images in the training set.

3. Label the Characters

   The next major step is the labeling Labeling is the process of annotating an image with "ground truth". Depending on the tool that you are using, labeling can take different forms. You label an image set for two reasons: to provide the information needed to train the tool and to allow you to measure and validate the performance of the trained tool against the ground truth. of the characters. At least one instance of each character must be labeled. The process of Labeling provides a useful mechanism to determine if the tool is interpreting the characters correctly, prior to training.

   1. Expand the Database Overview window. The table lists all of the characters found by the tool.
      1. Go through the table, character by character, and select an instance of each found character:
      2. In the table, select a character, then double-click it, which will change the Display window to display only the instances of that character.
      3. From the displayed characters, select a good instance of the character.
   2. The main display will switch to that image. Right-click the image and select Accept View.
   3. That will create a Label of that instance of the character.
   4. Also delete any instances where the tool incorrectly labeled a character, by selecting the character, right-clicking and selecting Delete Feature.
   Note: By labeling and accepting more than one instance of a character, the tool will have more trained results when the tool is trained. See Creating Labels for the details of labeling.

4. Train the Tool

   When using the Blue Read to identify characters, follow these steps:

   1. Once a labeled instance of each character has been completed, it's time to train the tool. To train the tool, first add the desired images to the training set.

   2. Select the images in the View Browser, and on the right-click pop-up menu click Add views to training set.

      1. To select multiple images in the View Browser, use the Shift + Left Mouse Button. Or, use to show the desired images for the training only and add them to the training set by clicking Actions for ... views → Add views to training set.

   3. Prior to training, you need to set parameters in Tool Parameters. You can configure Training, Sampling, and Perturbation parameters or just use the default values of these.

      1. Ensure that the Feature Size parameter in Sampling parameters has been set. The Feature Size parameter gives the network a clue to the size of the characters that you are interested in identifying. So, if the Feature Size parameter setting is clearly going off from the size of characters in your application, there is a chance the tool will not identify the characters in your image.

      2. If you want more granular control over training or processing, turn on Expert Mode on Help menu to initialize additional parameters in Tool Parameters.

   4. Once the training set is filled with the right images, press the Brain icon, and the software will begin its computation for the training.

      1. If you stop training in the middle of it by pressing the Stop icon, you can stop training but you will lose the current tool so far trained.

   5. After training, review the results. Open Database Overview panel and review the Confusion Matrix and Precision, Recall, F-Score for each character and each model to understand the results.

   6. After reviewing the results, go through all of the images and see how the tool correctly or incorrectly marked the features and models for each image.

5. Review Character Model

   After training has been completed, you can generate a character model, based on the number of expected characters, their spacing and placement, and their fielding.

6. Review the Training

   After training has been completed, you'll want to go back over your images and ensure that the tool correctly identified the characters in the images. Again, you can use the Database Overview window to review the table of characters, and review the results. Each character the tool found should be the expected character; for example, for the #2, all of the instances in the Display window should be of the #2. If there are instances where there is a "5" or an "S", for instance, you will need to click on that image and re-label those instances with the correct label.

   If the tool found all of the instances correctly, the tool is ready for runtime deployment. However, if you had to re-label some of the instances, you will need to retrain the tool, and then repeat the review process.