# Expected Result Count and Accept Thresholds

When you search for a pattern using PatMax, you specify the number of instances you expect to be present in the run-time image and an accept threshold that specifies the minimum score value that an actual instance of the pattern is expected to receive.

PatMax returns information about all of the objects in the run-time image that receive scores above the accept threshold you specify up to the number of instances that you specify.

If there are multiple instances with similar scores, PatMax can return information about more instances than you specify. For example, if you specify an accept threshold of 0.50 and an expected result count of 2, and PatMax finds five instances with the following scores:

Copy

    0.98
    0.70
    0.68
    0.32
    0.19

PatMax will return information about the first three instances, even though you only requested two. PatMax does this because of the potential ambiguity between the two results with scores of 0.70 and 0.68.

Cognex can make the following recommendations for setting the accept threshold:

- Specifying a low accept threshold forces the PMAlign tool to consider more potential matches while increasing the time required for the tool to execute. Specifying a high accept threshold allows the tool to eliminate non-matches and decreases the execution time, but at the risk of failure to locate an actual instance of the pattern.
- The tool uses a coarse accept threshold of 0.66 to help refine the alignment process when considering potential matches. By default, any coarse search results with scores above (0.66 x accept threshold) will be further considered for a potential match. Lowering the default coarse accept threshold can allow the tool to include more potential matches based on their coarse features. This can be the best solution in images where you find lowering the accept threshold a fractional amount results in the tool finding patterns with high search scores. Instead of lowering the accept threshold, experiment with lowering the coarse accept threshold instead. Upon each successful execution of the tool, a coarse score is generated to indicate the lowest value that the coarse accept threshold can be set to and still allow the pattern to be found. You can experiment with the coarse accept threshold if the PMAlign tool fails to find good matches in your test images.