# Computed Granularity

The transformation you supply, whether as a coordinate space tree in an image or an explicit transform, should reflect the actual size of the features. PatMax will automatically compute coarse and fine granularity limits for the shapes you supply, based on their sizes in pixels, and it will use these granularity limits to generate the actual coarse and fine pattern features.

The transformation information you supply, as described in the preceding section, should provide an accurate description of the expected size of the shape models in pixels. If you are training shape models that are much larger or much smaller than the actual sizes of the expected features, PatMax may compute inappropriate granularity values and trained features, which can cause run-time pattern alignment to perform poorly.

Cognex recommends that you size your shape models appropriately before training, by importing or creating them in a calibrated coordinate system. If, for whatever reason, you wish to train scaled shape models, you should carefully evaluate (and change if necessary) the pattern granularity limits generated by PatMax. You can perform this evaluation by examining the trained feature display.

Note: When PatMax computes the granularity limits for a collection of shape models, it may tend to produce too high a coarse limit under some conditions. An excessively high coarse granularity limit can reduce the number of features in the trained pattern below the level required to train the pattern, and it can also potentially cause otherwise acceptable patterns to produce degenerate search results. You can assess the appropriateness of the computed coarse granularity limit by examining PatMax's automatically computed coarse granularity limit for an image-trained pattern where the image corresponds to the shapes you are training.