# Feature Sampling at Runtime

Each input image is exhaustively sampled at runtime, and the individual samples are then processed by the trained network. The same feature size used for training is also used at runtime (ensuring that the trained network is processing inputs that are consistent with the inputs used for training).

Unlike training, where the sampling density is determined automatically, you can control the runtime sampling density for all the Deep Learning tools. The sampling density determines the degree of overlap between adjacent samples. A sampling density rate of 1 means that the sampling location is incremented by the feature size between samples. The default sampling density rate for most tools is 3, which means that the sampling location is incremented by one third of the feature size.

Sampling Density = 1 (4 samples) | Sampling Density = 3 (4 samples)
--- | ---

Note: The Red Analyze tool in Unsupervised Mode provides additional user controls over sampling at run time. The Red Analyze tool in Unsupervised Mode allows you to specify that a number of additional interpolated samples are collected in regions with detected defects, through the Iterations parameter. This can be useful for images where the range of complexity is highly variable within individual images.
Note:

For the Green Classify Tool in Focused mode, there is a fixed limit to the number of samples that can be processed for a single runtime image, which is 50,000. The number of samples is determined by the Feature Size (), the image size, and the Sampling Density, as shown in the following equation:

Note: If you have the Masking Mode parameter enabled, the sample count is reduced by the proportion of the pixels that are masked.
Tip:

When the combination of image size, Feature Size and Sampling Density settings exceeds the limit, the following error message may be displayed:

"Failed to process database sample 'image_file.name' (maximal number of samples exceeded, please reduce the sampling density, view size and/or feature size)."

In this event, consider options to reduce the number of pixels being processed, either through the use of a mask, focusing the ROI to specific areas or using a larger feature size setting.

Note: The Blue Locate tool provides additional user controls over sampling at run time. The Blue Locate tool performs additional interpolated sampling at locations where it detects features. It uses these additional samples to refine the feature pose. You can control the number of additional sampling passes using the Precision parameter, which specifies the degree of pose improvement at which resampling is stopped.