# Green Classify Focused Parameters

The parameters adjust how the neural network model 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.

## Architecture, Network Model, and Exclusive Mode Parameters

Parameter | Expert Mode | Description
Architecture | No | Specifies the type of neural network model. For more information, see Tool Architectures.
Network Model | No | Specifies the size of the neural network model, which affects the time required for training and processing. The Network Model parameter allows you to reduce the size of the trained tool network, which reduces the amount of time required for processing. The default value, Large, retains the standard tool behavior and performance. The two other values, Small and Medium, provide progressively faster runtime execution. Selecting a value other than Large can result in different tool results. These differences are typically minor, however, when using this option, you need to validate tool performance using your own labeled data.
Exclusive | No | Specifies the number of labels an image can have. When enabled (the default setting), you can only enter a single label per image. When disabled, you can label a single image with multiple labels, indicating that the image belongs to multiple classes. To label a single view as a member of different classes, separate all the classes with a comma. If enabled, during runtime, the system returns a list of predicted classes for each view, with a mutually exclusive score for each class ranging from 0 to 100%.

## Sampling Parameters

The Sampling parameters control the way that images are sampled you train and process Focused mode tools. For more information, see Feature Sampling.

Note: If you change the Sampling parameters of an already trained tool, you must retrain the tool because the underlying image statistics might be changed.

Parameter | Expert Mode | Description
Feature Size | No | Specifies the typical feature diameter in pixels. The Feature Size is displayed in the lower left of the image, and you can resize it within the image to set a more accurate size. The feature size should correspond to the size of the image features that you, a human observer, would use to classify the images. Feature size strongly influences processing time (n2). In other words,, a Feature Size of 100 is 100 times faster than a size of 10, while a Feature Size less than 15 usually does not yield good results. When setting the Feature Size, consider the following in regards to processing time (Ptime): Note: The tool sees an area five times larger than the Feature Size setting. However, the level of detail is much higher in the center of the feature than in the periphery. For more information, see Feature Size.
Color | No | Specifies the number of color channels to use when sampling the image. When set to 1, color images are converted to greyscale. The following values are available: Treats the image as greyscale Two channels images (spectral images, gray+alpha) BGR image. BGR(A) image Note: The VisionPro Deep Learning tools use the BGR channel order. RGB(A) images are converted to greyscale. For computational efficiency (memory allocation, transfer, file save, color conversion,… ), always prefer the correct number of channels. If your application relies on color images, only use the minimum number of required color channels, and only send images that already have the correct number of channels to avoid conversion. This is because:
Number of Image Channels | Number of Training Channels | Description
--- | --- | ---
1 (greyscale) | 1 | The correct setting for a greyscale image.
1 | 2, 3, 4 | Most likely, this results in a training error.
2 | 1 | The tool uses only the first channel.
2 | 2 | The tool uses the full pixel information.
2 | 3, 4 | This results in a training error.
3 (BGR) | 1 | This results in a BGR to greyscale conversion.
3 | 2 | The tool only uses the first two channels (in other words, B and G).
3 | 3 | The tool uses the full pixel information.
3 | 4 | Most likely, this results in a training error.
4 (BGRA) | 1 | This results in a BGR(A) to greyscale conversion.
4 | 2 | The tool only uses the first two channels (in other words, B and G).
4 | 3 | The tool only uses the first three channels (in other words, B, G and R).
4 | 4 | The tool uses the full pixel information.
Border Type | Yes | Specifies how pixels on the outside of the image are sampled. Adding an additional mask at the boundaries of the image highly reduces the false detection rate. Black: Fills the outside of the image with a solid color, black. Replicate: Fills the outside of the image with the last pixel.
Masking Mode | Yes | Specifies how a mask is applied to the sampled image. A mask is used to limit areas of the image processed by the tool. Masks can be set after training, however, setting them before training helps the learning phase. Transparent: Collects samples within the unmasked parts of the image, but also collects data from the Context Region from the areas that are masked. This ensures that features or defects that are at the boundary of the mask or ROI generate the same response as features or defects that are in the center. Mask: Ignores the pixels in the masked parts of the image during training and runtime. This setting also alters the response of the tool to defects or features near the mask boundary. This setting also works to focus the tool toward the center of the ROI. Overlay: Adds the mask to the sampled image as an additional color channel.

## 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
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.
Epoch Count | No | Specifies the number of optimization iterations done during training. Use a lower value when your application has limited complexity, or when creating a lower quality model for testing different parameter settings. The tools typically need to see the training image set data about 50 times, which is the default setting, and is typically sufficient for most standard applications. If you use fewer epochs, the neural network might get stuck in learning, or become unable to accurately solve the problem. However, if you use too many epochs, you risk overfitting. Note: If your training image set contains a large number of images, or the size of the images in your training image set are large compared to the Feature Size, you might need to increase the Epoch Count setting. There is a risk of overfitting if you have a very small training image set. If you have a large training image set, and your network is addressing all of the samples in the set, the network is much more general than if you have a smaller training image set and the network is keyed into that small sample set.
Low Precision | No | Specifies whether or not the tool creates a low precision model after training. The low precision model is useful for applications where speed optimization is a priority during runtime operation. The results might be different between the two modes. When enabled, a white lightning bolt icon appears in the icon of the tool. Note: The low precision model requires the Standard or Advanced license, and also requires a GPU with CUDA Compute Capability 6.1 or higher (for more information, visit the NVIDIA website).

## 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 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
Rotation | No | Specifies the possible orientations, defining a piece-wise uniform distribution from which a perturbing rotation angle is drawn (if set to [0°, 0°], no rotational perturbation is used). For example, with the following settings, [-10°, 10°] or [170°, 190°], the part can be detected between -10 and 10 degrees, or between 170 and 190 degrees. These types of settings are particularly useful if your part can be orientated with a regular orientation, or upside down with a small variation in its angle, but never in between.
Scale | No | Specifies the normal distribution around 1 from which a perturbing scaling factor is drawn (if set to 0%, it is not applied). For example, a Scale setting of 100%, provides images half the original size to double the original (0.5x to 2.0x the original).
Original = | Possible Perturbations = |  |  |
Aspect-Ratio | No | Specifies the normal distribution around 1 from which a perturbing aspect-ratio factor is drawn (if set to 0%, it is not applied).
Shear | No | Specifies the normal distribution around 1 from which a perturbing shearing factor is drawn (if set to 0%, it is not applied).
Flip | No | Specifies whether to randomly flip the image during sampling in the horizontal, vertical or both directions. This is useful if the object or surface exhibits the corresponding symmetries. This setting can help to highly increase the quantity of training data.
Horizontal |
Vertical |
Both |
Luminance | No | Specifies the normal distribution around 1 from which a perturbing luminance factor is drawn (if set to 0%, it is not applied).
Contrast | No | Specifies the normal distribution around 1 from which a perturbing contrast factor is drawn (if set to 0%, it is not applied).
Invert Contrast | Yes | Randomly inverts the contrast in order to simulate contrast reversal in the training samples.

## Processing Parameters

The Processing parameters control the way the tool processes images. Processing (in another word, inferencing) 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
Sampling Density | No | Specifies the density of sampling points with respect to the Feature Size setting. The sampling density determines the degree of overlap between adjacent samples. A sampling rate of 1 means that the sampling location is incremented by the feature size between samples. The default sampling rate for most tools is 3, which means that the sampling location is incremented by one third of the feature size. The Sampling Density parameter affects the processing time and the accuracy of the tool. Higher Sampling Density settings are more accurate but significantly increase processing time. The processing time depends approximately quadratically to the Sampling Density (Sd) value. For example, a Sampling Density setting of 1 is approximately nine times faster than a setting of 3 (n2).
Threshold | No | Specifies the minimum score that a view must have to be classified. Among the classes that have higher score than threshold value, the tool picks the class with the largest score. If all the classes have a score that is equal to or less than 0, the tool returns n/c (not-classified).