# Training and Processing

Training and processing are the two stages that forms the training environment.

## Training

As with traditional rule-based vision tools, how the VisionPro Deep Learning deep learning tools are trained is the largest determinant of their runtime performance. Unlike rule-based vision tools, successful deep learning training is largely a function of the number and representativeness of the images that you collect for your training image set, and the consistency with which you label them. For more details of labeling, see Deep Learning for Vision.

The key steps in the training phase are the following:

- Image set collection and annotation
- Image set labeling
- Model definition (for the Blue Locate Tool and Blue Read Tool only)
- Defining a training set
- Defining a validation set (for Green Classify High Detail mode and Red Analyze High Detail mode only)
- Neural network training

## Processing (Inference)

The processing phase of the Cognex VisionPro Deep Learning deep learning tools is simpler than the training phase:

- Neural network processing
- Results formation

At processing, each image sample is processed individually, using the tool's trained network, and an individual network response is obtained for each sample.

The response (the results of inference) from the network is expressed as a probability map, where each pixel in the sampled region of the input image is assigned a probability. The meaning of the probability map depends on which tool is being used.

- For the Red Analyze Focused Unsupervised, the response is the deviation between the expected and actual appearance of the sampling region.
- For the Red Analyze Focused Supervised and Red Analyze High Detail, the response is the probability for each pixel in the sampling region, that the pixel is within an image defect.
- For the Blue Locate and Blue Read, the response is the probability that the center of a labeled feature lies within that pixel, and if that probability exceeds a threshold value that you specify, then the tool also provides the feature identity and the probability that the identification is correct.
- For the Green Classify Focused, Green Classify High Detail, and Green Classify High Detail Quick, the response is the classification and the probability that the classification is correct.

These whole-image probability maps are assembled from the interpolated network responses to individual samples. The final results returned to the user (feature poses and identities, and defect regions) are based on a results formation process that the user controls by specifying thresholds for appearance deviation (Red Analyze Focused Unsupervised), match quality (Blue Locate and Blue Read), defect probability (Red Analyze Focused Supervised, Red Analyze High Detail), or class probability (Green Classify).

In the above context, it is important to understand that the probability returned by a tool may not reflect well with our notion of how likely a certain judgment is. This is mostly due to the fact that the tools have a "limited view of the world" in that they do not return probabilities with respect to our wide and rich visual experience, but rather with respect to their very limited visual world of a couple of classes. Thus, for instance, in the case of a Green Classify tool, it is very well possible that the tool will assign a very high probability to a new and therefore unknown class even though these classes look very dissimilar to us. This is simply because to the tool that class looks many times more similar to that known class than any other.

### Model Processing

For Blue Locate and Blue Read tools with defined models, the features found during neural network processing are searched for the feature collections that provide the best fit for the defined models.