# Play with Tutorial

This topic introduces how you can play with the tutorial of the VisionPro Deep Learning tool.

## Recap: Training Workflow

The training workflow of Red Analyze Focused Unsupervised can be summarized into:

1. Collect images that represent the full range of passing and acceptable variations of your part.
2. Define ROI, and masks if necessary, to define the views.
3. Create image sets for convenience, if necessary.

4. Label the images as Good by clicking each image with no anomalies, or using the Label Views option from the Actions for N Views menu in the View Browser. A single click equals a "Good" image (denoted by a green stripe in the upper-right corner).

   Note: Clicking twice equals a "Bad" image (denoted by a red stripe in the upper-right corner). However, this label should only be applied to the test set.

   "Good" Label | "Bad" Label
   --- | ---

5. Add bad images and label them as Bad.

6. Split the entire Good images into the training images and the test images. Add the training images to the training set.

7. Edit tool parameters.
8. Train the tool.

9. Evaluate the tool by presenting images that contain known defects, which you have labeled as Bad, to determine the tool's accuracy.

   "Good" Marking | "Bad" Marking
   --- | ---

## Download Tutorial

These tutorials are available on the Cognex Support website; download them and then import them into a newly created workspace, remove all tools and start from scratch.

Cognex provides several tutorials to help you learn how to use the VisionPro Deep Learning software, as well as understand some of the key concepts.

1. Download the VisionPro Deep Learning tutorials from Cognex support website.
2. Start the VisionPro Deep Learning graphical user interface (GUI).
3. Import a tutorial workspace from the Workspace menu, which launches the Import Workspace dialog.

4. Navigate to the directory where you stored the downloaded tutorials, and select a workspace to get started.

   Note:

   To navigate to a previously created workspace, expand the Workspace container by pressing the icon, and then select the desired workspace from the list and press the arrow icon:

   Note: You can consult the Cognex Deep Learning Tutorials topics for additional information.

5. Click each tool, update it with Tool - Update Parameters, and click the brain icon to train and see the results.

## Tutorial: Inspect Textiles

Inspecting textiles is a typical example of an aesthetic inspection. Defects can be of many different types, ranging from problems in the weaving pattern, defective or bad yarn, stains and infinitely many more. The challenge is even bigger when the fabric is not perfectly aligned in front of the camera, but may shift, shear and rotate quite dramatically.

This tutorial shows a typical textile example, using a couple of images from a textile which shows a relatively complex yet repetitive color pattern. The images are taken from random positions, so that each shows a distinct, precise view. Furthermore, the images show quite a degree of shear and rotation, demonstrating the flexibility of the Red Analyze Tool.

Note: For more information on the specific steps of setting up the tool, see Red Analyze Focused Unsupervised

The objectives of this tutorial are:

- Get to know the Red Analyze Focused Unsupervised tool.
- Label images as good or bad.
- Introduce database statistics sidebar.
- The role of the Feature Size and Border Type parameters.
- Use the Perturbation parameters to improve performance.

1. Add the images for the Textiles tutorial.
2. Add a Red Analyze tool and switch this tool to Red Analyze Focused Unsupervised.
3. Segment the images by clicking the Scissors icon.

4. Label the images as Good or Bad depending on whether or not they show an anomaly.

   Note: You can simplify the process by using the Label Views option in the View Browser.
5. Click the Train icon.
6. After training, review the results.
7. Expand the Database Overview, and in the interactive Scores graph, lower the green Threshold slider, and you can see that the system tends to respond to the good images that are close to the border.
8. Right click on an image and from the menu, select Edit Mask and using the Edit Mask toolbar, use the Add Border option to add a mask to the border of the image.
9. In the Edit Mask toolbar, press the Apply button and apply the border mask to all the images in the database.
10. Reprocess the images and review the results.
11. There may still be a response in the strongly skewed region of the second bad image.
12. Go to the and change the Shear and Aspect-Ratio to 5% and retrain.
13. After training, these responses should be reduced.