# Train Standard Type Green Classify

You train the tool to identify and classify an object or the entire scene in an image. The goal of 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. is to reduce the number of mismatches between labeled and detected classes.

## 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 Green Classify tool and set the Type parameter to Standard.

2. Define 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. (Region of Interest) to construct Views.
   1. If a pose from a Blue Locate tool is being used to transform the orientation of the View being used as an input to the Green Classify tool, process the images (press the Scissors icon) before opening the Green Classify tool.

   2. If necessary, adjust the Region of Interest (ROI). Within the Display Area, right-click and select Edit ROI from the menu.

   3. After adjusting the ROI, press the Apply button and the adjusted ROI will be applied to all of the images.
   4. Press the Close button on the toolbar to continue.
3. If there is extraneous information in the image, add appropriate masks to exclude those areas of the image. Within the Display Area, right-click and select Edit Mask from the menu.

   1. From the Mask toolbar, select and edit the appropriate masks.

   2. After adding the necessary mask(s), press the Apply button and the mask will be applied to the current image.

      If you click Apply All and click Yes button on the ensuing Apply Mask dialog after adding the necessary masks, the same mask will be applied on all the images. If you click No on the dialog, the mask will not be applied and you go back to the Edit Mask window.

   3. Press the Close button on the toolbar to continue.

4. Go through all of the images and label the images with classification tags.

   Tip: It is recommended to annotate your image files with descriptive names or numbering schemes to help when 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. the images.

5. You can use the Label Views option in the View Browser.

6. When labeling, you can either apply a tag or use regular expressions to apply the classification tag label.

7. Make sure that all of the images have been labeled with a classification tag.
8. Split the entire images into the training images and the test images. Utilize image sets to properly divide them into the training and test group. Add images to the training set.
   1. Select the images in the View Browser, and on the right-click pop-up menu click Add views to training set. To select multiple images in the View Browser, use the Shift + Left Mouse Button.
   2. 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.
9. Prior to training, you need to set parameters in Tool Parameters. You can configure Training and Perturbation parameters or just use the default values of these.
   1. Green Classify Standard doesn't have Sampling parameters as it doesn't use 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).-based sampler but it samples from the entire pixel of each view A view of an image is a region of pixels in an image. Tool processing is limited to the pixels within the view. You can manually specify a view, or you can use the results of an upstream tool to generate a view..
   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.
   3. If you want to change the proportion of the amount of data ceded to the validation set The validation set is a set of images reserved for validation. The validation set is separate from the training set and test set. Since the validation set is separate, it allows you to evaluate how well the tool performs when using unseen images. The VisionPro Deep Learning application calculates a special metric, the Loss. The Loss is based on the performance of the tool on the validation set. out of training set for the training with validation Validation refers to a process during the training of a tool that helps to evaluate performance. Validation is like a mock exam that the tool takes during the training phase, separate from the final test. For example, validation helps you to recognize overfitting and avoid wasting time when training a tool. If you recognize that the tool is overfitting, you can stop the training early., change the Validation Set Ratio.
   4. If the class distribution of training set images is highly imbalanced, for example, more than 50% of training set images were labeled with a certain tag, configure Class Weights to differentiate the weights to each class.
10. Train the tool by pressing the Brain icon.
    1. You can check the training status by monitoring validation loss The Loss refers to validation loss, which is a metric that shows how a tool performs on the validation set. Loss can have a value between 0 and 1. The VisionPro Deep Learning application calculates the Loss based on the errors the tool makes when processing the images in the validation set. During training, you can check the Loss in real-time using the Loss Inspector. with the Loss Inspector.
    2. If you stop training in the middle of it by pressing the Stop icon, you can stop training with saving the current tool so far trained. You can later load this tool and process images with it, but you cannot continue the training from where the last training was stopped.
11. Prior to training, you need to set parameters in Tool Parameters. You can configure Training and Perturbation parameters or just use the default values of these.
    1. Green Classify Standard does not have Sampling parameters as it doesn't use feature-based sampler but it samples from the entire pixel of each view.
    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.
    3. If you want to change the proportion of the amount of data ceded to the validation set out of training set for the training with validation, change the Validation Set Ratio.
    4. If the class distribution of training set images is highly imbalanced, for example, more than 50% of training set images were labeled with a certain tag, configure Class Weights to differentiate the weights to each class.
12. Train the tool by pressing the Brain icon.
    1. You can check the training status by monitoring validation loss with the Loss Inspector, see Loss Inspector .
    2. If you stop training in the middle of it by pressing the Stop icon, you can stop training with saving the current tool so far trained. You can later load this tool and process images with it, but you cannot continue the training from where the last training was stopped.

13. After training, review the results. Open Database Overview panel and review the Confusion Matrix and Precision, Recall, F-Score for each class (tag) to understand the results.

14. After reviewing the results, go through all of the images and see how the tool correctly or incorrectly marked the tags for each image.
    1. If the tool has correctly marked the images with the appropriate tag, right-click the image and select Accept View.
    2. If the tool has incorrectly marked the images with incorrect tags:
       1. Right-click the image again and select Clear Markings and Labels.

       2. Manually tag the image.

    3. If you encountered the scenario in (a.), you are ready to use the tool. If you encountered the scenario in (b.), you will need to retrain the tool.