# Red Analyze

You can use the tool to perform anomaly detection when it is in unsupervised mode, or to perform segmentation when it is in supervised mode.

When the tool is in unsupervised mode, you train the tool to recognize bad parts with images showing "Good" parts. The tool categorizes parts as "Bad" if they deviate from what it learned in the training phase. When the tool is in supervised mode, you train the tool both with images of "Good" and of "Bad" parts.

You can use the supervised mode tool to search for differences other than defects. The tool can identify different regions in an image that are intended to be there. You can use the supervised mode tool to label the targeted regions in the training images in order to be able find and mark similar regions in untrained images after training.

You can use the two modes in combination. For example, you can use an unsupervised tool first to filter the visual anomalies, and one or more subsequent supervised tools to find defects like scratches, low contrast stains or texture changes.

Challenge | Unsupervised Mode | Supervised Mode
--- | --- | ---
Finds unforeseen defects | Likely | Unlikely
Requires images showing "Bad" parts | No | Yes
Sensitivity to part configurations and variations | Strong | Weak
Detects line-type defects like scratches, cracks or fissures | Unlikely | Likely
Detects specific defect-types | No | Possible
Measurable defect parameters (next to position and intensity) | None | Size, shape

## Using the Supervised Mode

The Red Analyze tool in supervised mode needs images of both good and bad parts for training. When the tool is in supervised mode, the focus is on training it to recognize what defects look like but the tool also learns the regions in the images that do not include defects. Therefore, you must consistently label each and every defect in the images.

Using images labeled as "Good" teaches the tool not to respond to parts that do not have a defect. Adding images of good parts to your training image set can help you validate the performance of the tool.

When selecting images, ensure that you have a training image set that includes all of the defects you expect to encounter during runtime, as well as defect-free images. The tool only finds defects that it learned from the training image set. For example, if you only teach the tool what stains look like, the tool will not find scratches.

## Using the Unsupervised Mode

The Red Analyze tool in unsupervised mode learns the appearance of the good parts only and it recognizes bad parts based on that. However, the performance of the tool is sensitive to parts that have different types or orientation. Such variances can prevent the tool from finding certain anomalies.

To train the tool in unsupervised mode, use images showing good parts. The unsupervised mode tool ignores images labeled as "Bad" in the training image set during the training. However, these images are useful during the testing and validation phases. This allows you to determine how accurately the tool finds defects.

## Red Analyze Tool Architecture

The High Detail architecture is an improved version of the supervised mode. The High Detail mode has higher segmentation performance but has longer training and processing time.

The way you label images and train a high detail tool is basically the same as for focused tools but the tool parameters are different. For example, the high detail architecture samples from the entire region of each view both in training and in processing, which means that it does not use a feature sampler for training and processing. So the high detail architecture does not have Sampling Parameters in the Tool Parameters pane.