# Red Analyze Tool Unsupervised Mode Sampling Tool Parameters

The Sampling tool parameters control the way that images are sampled during training. For more information, refer to the Sampling Method topic.

Note:

- The Border Type, Masking Mode and Centered parameters are only available when Expert Mode is enabled. This is enabled via the Help menu.
- Changes to the Sampling parameters after a tool has been trained will invalidate the training, because the underlying image statistics may be fundamentally changed, which will necessitate retraining the tool.

Parameter | Description
--- | ---
Feature Size | Specifies the typical feature diameter, in pixels. The Feature Size parameter is graphically displayed in the lower left of the image, and can be graphically resized within the image to set a more accurate size. Feature size strongly influences processing time (n2), i.e., 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 will actually see an area five times larger than the Feature Size setting. However, the level of detail will be much higher in the center of the feature, as opposed to the periphery. For more information, refer to the Feature Size topic.
Color | Specifies the number of color channels to use when sampling the image. When set to 1, color images will be converted to greyscale. Treats the image as greyscale Two channels images (spectral images, gray+alpha) BGR image. BGR(A) image Note: If the image is RGB(A) it will be converted to grayscale. For computational efficiency (memory allocation, transfer, file save, color conversion,… ) always prefer the correct number of channels. The VisionPro Deep Learning tools use the BGR channel order. If your application relies on color images, only use the minimal number of required color channels possible, 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 will result in a training error.
2 | 1 | The tool will use only the first channel.
2 | 2 | The tool will use the full pixel information.
2 | 3, 4 | This will result in a training error.
3 (BGR) | 1 | This will result in a BGR to greyscale conversion.
3 | 2 | The tool will only use the first two channels (i.e. B and G).
3 | 3 | The tool will use the full pixel information.
3 | 4 | Most likely, this will result in a training error.
4 (BGRA) | 1 | This will result in a BGRA to greyscale conversion.
4 | 2 | The tool will only use the first two channels (i.e. B and G).
4 | 3 | The tool will only use the first three channels (i.e. B, G and R).
4 | 4 | The tool will use the full pixel information.
Border Type | Specifies how pixels on the outside of the image are sampled. For more information about how this parameter affects sampling, refer to the Sampling Method topic. Tip: 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 | Specifies how a mask will be applied to the sampled image. A mask is used to limit areas of the image processed by the tool. Note: Masks can be set after training, however, setting them prior to training will help the learning phase. Transparent: Samples are only collected within the unmasked parts of the image, but data from the Context Region is also collected 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 centrally located. Mask: The mask is used to ignore the areas which are masked. All pixels that are masked are set to 0, which prevents data from the masked parts of the image from being considered during training or runtime. However, it 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: The mask is added to the sampled image as an additional color channel.
Centered | This parameter can be used when your inspection contains objects that have a circular symmetry in respect to the center of the view, such that the resulting learned model becomes simpler because the object can be virtually unrolled.