# Train the ViDiDetect Tool

1. Add a ViDiDetect function to the spreadsheet and open its property sheet.
2. Select the External Fixture parameter and set it as an absolute reference to the Patterns data structure returned by the FindPatMaxRedLine function.

3. Select the Region parameter and press the Edit Graphics button to enter interactive graphics mode so that you can configure the region.

4. Configure the region around the body of the vial.

5. Press Enter to accept the change and return to the property sheet.
6. Press the Open ViDi Editor button to launch the ViDi Editor tab.

7. Within the ViDi Editor tab, press the Add button in the View Browser to add the images that will be used to train the tool.

   Note: Alternatively, you can also drag and drop images into the View Browser.

8. This will launch the Open dialog, where you can navigate to the images that you have set aside for training. With the ViDiDetect tool, during the training phase, you will want to only use images that would be classified as good or passing images of the part being inspected. Select the images and press the Open button to add the images to the tool.

9. As the images are added to the tool, it will automatically apply the fixture data to each of the images as they are added.

10. After the images have been added and fixtured, from within the View Browser, using the Actions for N Views menu, select Label Views.

    Note: For more information about labeling, refer to the Labeling and Unsupervised Mode – Labeling Views topics.

11. In the Label Views dialog, select Good.

12. This will apply the Good label to all of the images that were added.

13. The next step is to train the tool, based on the collection of images labeled as Good.

14. From the Tool Parameters panel, press Training Set.

15. For the initial training pass, use the default settings in the Select Training Set dialog.

16. In Tool Controls, press the Brain icon to begin the training of the tool.

    The time to train the tool is dependent on the size of the image database being trained and the GPU being used.

17. Once the tool has been trained, you can open the Database Overview panel to begin reviewing the results. In this example, one image returned an Inter result, meaning that the tool could not determine if the result should be recorded in the Good or Bad category.

    Note: For more information on interpreting the statistics, refer to the Unsupervised Mode – Image Results, Unsupervised Mode – Scores, Statistics and Red Analyze Tool – Statistics topics.

18. Double-click the Inter number to display the image in the View Panel (the Display filter will also reflect the syntax used to display the image).

    Note: For more information on the Display filter, refer to the Display Filters topics.

19. In this instance, it is simply a matter of adjusting the Threshold parameter to get the image into the Good category.

    Note: For more information about using the Threshold parameter, refer to the Red Analyze Tool – Statistics – Scores topic.

20. At this point, the tool has been trained and the neural network model has been created.