# Standard Type Red Analyze Parameters

The parameters adjust how the tool is trained, and also how the tool processes statistical results. You can open and close the parameters side pane by selecting the tool and then clicking the % icon. You can access additional parameters that provide advanced features by selecting Expert Mode in the Help menu.

## Type and Mode Parameters

Parameter | Expert Mode | Description
Type | No | Specifies the type of neural network model Each VisionPro Deep Learning tool is a neural network. A neural network mimics the way biological neurans work in the human brain. The neural network consists of interconnected layers of artifical neurons, called nodes, and they have multiple layers. Neural networks excel at tasks like image classification and pattern recognition..
Mode | No | Specifies the mode of the neural network 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., which affects the time required for 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. and processing. Fast: Select this mode for fast processing time at the cost of lower accuracy. Accurate: Select this mode for increased accuracy at the cost of slower processing time. Robust: Select this mode if you want to use the tool on different production lines and new products without retraining the tool. This mode allows the tool to adapt to changes on the production line and to product variants that have similar kinds of defects. Note: In robust mode, processing time increases with image size.

## Training Parameters

The Training tool parameters control the training process.

Note: If you change the training parameters of an already trained tool, you must retrain the tool.

Parameter | Expert Mode | Description
Maximum Epochs | Yes | Specifies the maximum number of epochs used for training. Training stops automatically if the training reaches convergence before reaching the Maximum Epochs value. If the training does not reach convergence before reaching the Maximum Epochs value, you decide whether to continue or stop the training.
Patience Epochs | Yes | Affects the time that the system waits before it can stop the training early. During training, the system checks if the model has reached optimal performance, and if so, the system can finish the training early. The value range is 0–100. A higher value corresponds to longer training time.
Patch Size | No | Specifies the size of the square that divides 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. into several chunks. The system executes the training and the processing of each view based on each chunk. Select a smaller Patch Size for catching small subtle blobs, and a larger Patch Size for large obvious blobs to reach convergence in training faster.
Training Set | No | Specifies the training data set used to create a neural network model. The system only extracts the features of the images that are included in the training set. Click Edit to open a dialog where you can specify the sample sets and the percentage of the labeled images used as training samples. The system selects the training images randomly each time you start training.
Validation Set Ratio | No | Specifies the ratio of the views used in 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.. The system randomly selects the 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. set from the training set when you start the training. The value range is 1%–50%. If you increase the Validation Set Ratio while keeping the size of the training set, the amount of data used for training decreases. This means that a high Validation Set Ratio can negatively affect the performance when using a small training set. On the other hand, if the Validation Set Ratio is too low, it will not be helpful for selecting a good model for an unseen data set.
Accelerated Training | Yes | Enables or disables accelerated training. Accelerated training optimizes GPU resources and can contribute to speed improvements, but performance degradation can occur depending on the data. Note: In Robust mode, this parameter is not available.

## Perturbation Parameters

With the Perturbation parameters, you can allow the tools to generate images that simulate the variations expected during runtime.

Read more...

For example, if your part rotates by +/-45 degrees, you can set the Rotation parameter, and the software rotates the images during training by that amount. However, image perturbation Perturbation is the process of improving the trained tool tolerance of part and image variation by simulating the effect of specific types of variation. is not a substitute for collecting and training actual images. The image perturbations can only approximate the variations of real parts or scenes.

Note: For the best results, Cognex recommends using actual sample images of the part variations. When a part spins, there might be different shadows, which are not captured by the tool when the rotation is based on artificially spinning the image.

The Perturbation parameters are common across all of the tools, and you can use these parameters in combination. This way, you can generate more complex images by using the parameters separately, as well as in conjunction.

Note: All training image samples can be applied to perturbation. Every train image has 50% chance to be augmented to every checked options independently. By the law of large numbers, all perturbation options can be applied equally and trained by increasing the number of epochs.

Parameter | Expert Mode | Description
Horizontal Flip | No | Performs flipping in horizontal direction. Useful in cases where the location and the angles of the object are not strictly fixed.
Vertical Flip | No | Performs flipping in vertical direction. Useful in cases where the location and the angles of the object are not strictly fixed.
Rotation 90° | No | Performs 90° rotation in clockwise direction. If you check Horizontal Flip, Vertical Flip, and Rotation 90°, performs 0°, 90°, 180°, and 270° rotations probabilistically.
Rotation | No | Performs rotation between 0° to 45°. If you check Rotation 90°, Rotation, Horizontal Flip, and Vertical Flip, performs random rotation between 0° to 360°.
Zoom-In | No | Randomly zooms in from the center. The maximum zooming is 5/6 of the original size. The random variable follows uniform distribution. Useful when the defect to be detected has an irregular size.
Colorwise | No | Adjusts color by multiplying and/or adding different random values per channels. Use this parameter together with the Contrast and/or the Luminance parameter. The Colorwise parameter changes the way the Contrast and Luminance parameters are applied from applying the same value for all channels to different random values for each channel. Useful when the images have inconsistent color tone because of the irregular lighting environment.
Gradation | No | Randomly adjusts the gradation. Useful when the images have inconsistent gradation because of the irregular lighting environment.
Distortion | No | Applies a distortion by picking the points in the views and moving them. The number of points is the same or less than six. Useful when the images are distorted due to the deterioration of the optical equipment.
Contrast | No | Adjusts contrast by multiplying a random value for all channels. The random value follows uniform distribution within a range of 0 to 2. Useful when the images have inconsistent contrast because of the irregular lighting environment
Luminance | No | Adjusts luminance by adding a random value for all channels. The random value follows uniform distribution within a range of - 255 to 255. Useful when the images have inconsistent luminance because of the irregular lighting environment.
Sharpen | No | Randomly sharpens the views by image filtering within a range of 0 to 2. Useful when the image are too blurry.
Blur | No | Randomly applies Gaussian Blur to the views. The random variable follows to the Gaussian Sigma Distribution within a range of 0 to 2. Useful when the images are too sharp.
Noise | No | Applies noise by multiplying a random value per pixel for all channels. The random value follows uniform distribution within a range of 0 to 2. Useful when the images are distorted or contaminated by dust due to the deterioration of the optical equipment.

## Resizing Parameters

Using images larger than the capacity of the GPU can result in reduced performance. If you use other software that consumes a lot of GPU VRAM, the maximum image size you can use for training can be reduced. In these cases, resizing images can improve both training and processing speed.

Resizing is applied to all views while they are processed and used for training. The images of the original sizes are preserved in the View Browser and Image Display Area.

Note: You can lose critical image information if you resize the image to an extremely small size. To avoid losing information, adjust 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. to reduce the size of the views.
Resize Logic

When a view has larger width or height than the input size, the view keeps the original aspect-ratio. The resized view is placed in the center of the resize area surrounded by zero-padding.

When a view has smaller width or height than the input size, the view is placed in the center of the resize area surrounded by zero-padding.

If the original aspect ratio is not identical for all views, the tool creates the new aspect ratio and calculates the maximum buffer size based on the maximum height and maximum width of the images.

Parameter | Expert Mode | Description
Resize Mode | Yes | Specifies the mode for resizing views. Select Auto to allow the application to automatically resize views or select Manual to specify the views for resizing yourself. The application resizes the label and marking Image markings are annotations produced by the VisionPro Deep Learning tools. The markings produced by a tool are the "answers" that the tool obtained when it processed a specific image. You validate the performance of the tool by comparing the markings produced by the tool with the labels that you applied to the same image. As with labels, the specific markings produced depend on the tool. sizes together with the image.
Resize to | Yes | Specifies the resize factor as a percentage. The maximum value is 100%. Only available if you select the Manual Resize Mode.

## Processing Parameters

The Processing parameters control the way the tool processes images. Processing with the same models always gives the same results. You do not need to retrain the tool after changing the Processing parameters. You can see the effect after reprocessing the database.

Parameter | Expert Mode | Description
Threshold | No | Specifies the threshold that determines whether the tool detects and marks regions as good or bad. The tool classifies values below threshold as good, and above the threshold as bad. You can also set the threshold value using the Score graphic in the Database Overview. You can set a threshold for each defect type.
Auto | No | Calculates a threshold value that maximizes the F1 score of the confusion matrix in the Database Overview based on the criterion you select in the dropdown menu. The criteria are the same as the ones in the Count dropdown menu in the Database Overview.
Region Filter | No | Specifies a filter for the tool to use as criteria for found regions. This filters regions from the results that do not match the criteria. If you leave the parameter empty, the tool returns all regions. To apply a region filter, reprocess the tool after setting the filter phrase. You can filter a region of a specific class by using a syntax such as name = 'CLASSNAME' or name!='CLASSNAME'. For example, to filter the 'deviation' class region: region![name!='deviation'] Note: The syntax for filters is the same as the syntax used for Display Filters. For more information about constructing the syntax for a filter, see Custom Display Filters. Regions Filter Variables
Variables | Variable Type | Description
score | Floating Point | Returns the highest defect probability among the probabilities of the pixels in the region.
holes |
area | Returns the number of pixels in the defect region. Example: area>= 150
perimeter |
compactness | Returns the equivalent of: 4 * π * area / perimeter^2.
coverage | Returns the overlapping ratio between labeled area and marked area. Example: coverage>= 0.5
x | Returns the x-axis position of the center of the defect region. Example: x>150
y | Returns the y-axis position of the center of the defect region. Example: y>50
name | String |
Region Filter and Confusion Matrix You can apply region filters to the result of the confusion matrix depending on the setting of the Count dropdown in the Database Overview. Views and Untrained Views example: If you set area>150 in the region filter, the tool only marks the views that have marking regions of more than 150 pixels as "Bad". Otherwise, they are marked as "Good". Regions and Untrained Regions example: If you set area>150 in the region filter, the views where the marking region is under 150 pixels lose the marking regions in the processed result. A view does not count into the "Bad"(actual) - "Bad"(predicted) pair if all marking regions overlapped with the pixel-wise labeled defect regions are removed from the results. For more information, see Count Options and the Confusion Matrix.
Speed Optimization | No | Provides options to boost the processing speed of the tool using NVIDIA TensorRT: Basic: enhances processing speed, but lowers the performance of the Red Analyze tool. Int8: provides even more speed improvement with more performance reduction. The performance degradation depends on the data. There is no specific pattern of data to be used for each option. Note: You must optimize the Speed Optimization parameter with the API for the runtime environment. For more information, see NVIDIA TensorRT Support for Runtime API.