# Job Validation

Use the Job A job is a user-configured program in In-Sight 3D EasyBuilder consisting of functions and designed for specific applications. You can create and edit jobs using the In-Sight 3D EasyBuilder interface, and load them on a vision system for deployment in a live environment. Validation application step to confirm that a job is operating within expected parameters. The Job Validation application step performs tests on the job and compares the results of those tests against expected values.

## Prerequisites

Before you start, you must meet the following prerequisites:

- Develop the machine vision application and save the application as a .jobx file on In-Sight 3D EasyBuilder.

- Establish a connection to the vision system and load the .jobx file.

- Save a set of images on the device file system to use as Test images during Job Validation.

  Note: Ideally, include examples of "good" images that result in a Pass, and "bad" images that result in a Fail. Although The Job Validation application step is able to operate with a variety of file organization structures for the image database, sorting the images into separate "good" and "bad" folders before launching the Job Validation application step simplifies the process.

## Configure Job Validation

To configure the Job Validation application step:

1. Add Images

2. Define Variants

3. Optional: Set Cleanup Actions

After configuration, Run Job Validation to evaluate the results.

### Add Images

To add images to the Job Validation application step:

1. Open the configuration dialog by clicking the Settings icon.

2. Click Browse to open the image location.

3. Click Select Folder to load images from the device location or PC.

### Define Variants

A job can contain one or more inspections. For example, you can create jobs to handle multiple products. Each of those separate inspections is considered a variant.

Note: Most simple jobs require only a single Job Validation variant, and do not require Setup Actions, Setting Tests, or Cleanup Actions.

To define a variant:

1. Click Add and then click Rename.

2. Provide a name for the variant.

3. Click Next.

4. Optional: Choose the Setup Actions.

   1. Open the dropdown of the tool you want to add a setup action for, and select a tool property on the Settings panel.

   2. Configure the initial value the tool property takes during Job Validation.

   3. Determine the sequence of the Setup Actions.

5. Optional: Choose the Setting Tests.

   1. Open the dropdown of the tool you want to add a setup action for, and select a tool property on the Settings panel.

   2. Configure the value against which Job Validation tests the tool property.

   3. Determine the sequence of the Setting Tests.

   Note: Even if you chose the same option in Setup Actions, Setting Tests verifies that the settings are correct.

6. Select the images you want to use for verification. You can click on the image name to view an image.

7. Select the Results tool properties.

8. Click Next.

   Validation runs the images through the settings.

9. Review the Expected Test Results and verify that the Actual (A) values are correct.

   In the example, "bad" equals zero, which is correct.

10. Click Accept All or individually set results to Accepted by clicking on the values.

    Accepting the Actual value (A) updates the test with a new Expected value (E). Run a Job Validation Result Test to determine whether the Actual value from running the Job on the supplied image matches the Expected value saved in the test.

### Optional: Set Cleanup Actions

The Cleanup Actions restore the job to a constant state. For example, when processing a large number of images, counters in a job can increment, which should not be included in production results. Cleanup Actions can reset the counters.

1. Set the Cleanup Actions.

2. Click OK.

## Run Job Validation

After configuration, run Job Validation and examine the results.

1. Click the Run ▶ button. The job runs through the Job Validation.

2. Click on an item to expand the results.

3. Select a test to see the confusion matrix. Depending on the test, the confusion matrix changes.

   JobPass Confusion Matrix | ClassLabel Confusion Matrix

   The statistical concepts are the following:

   - Recall is a percentage of the labeled classes that are correctly identified by the tool. For example, if you have images classified as class i, recall is calculated by dividing the number of correct classifications by the number of classified and labeled images:

   - Precision measures of how many of the positive predictions made by the model are actually correct. Precision as the percentage of correctly classified views predicted as class i:

   - F-Score provides a weighted average of Recall and Precision values. The F-Score tends to be the best measure of the overall accuracy of the tool. The equation is the following:

4. An icon appears next to each result, showing the state.

   Icon | State | Description
   | Valid | All actual values match the configured expected values and no errors were encountered during the execution of Job Validation.
   | Invalid | Some actual values do not match the configured expected values and no errors were encountered during the execution of Job Validation.
   | Error | An error occurred while running Job Validation. This can be caused by several factors, including: A tool property was not found. The image was not found in the configured location. There is an error message that provides more details about the error. Note: Job Validation errors are separate from #ERR error results in In-Sight 3D EasyBuilder. Job Validation errors indicate that something unusual prevents Job Validation from running.
   | NotRun | Job Validation has not been executed since the last time it was configured.

   To fix a fail result:

   1. Go to the Expected Test Results under Settings.

   2. Accept results individually rather than selecting Accept All.