# Optimizing Red Analyze Labeling

Before starting label check for the Red Analyze tool, you must have five or more bad-labeled views with defect regions (pixel-wise labeled).

The label check cannot start in the following cases:

- There are only good-labeled views in the current stream.

- If there are bad-labeled views without defect regions, the label quality check does not run on those views and no label quality values are generated for them.

To start label check:

1. On the View Browser, click Check to start the label quality check.

2. Click Start to begin the label quality check.

   The quality check runs on all labeled views, not on the unlabeled views in the current workspace. If a view is labeled as bad but has no labeled defect regions, the quality check does not run on this view.

   As the label check runs only on the labeled views, you cannot remove, rename, clear, or accept labeled views. Also, you cannot train a tool during the label check. To get the label for each view, the label check task should not be paused or interrupted. You can still label, remove, rename, clear, or accept views that were not labeled when the label check is running.

   Views Running Label Check in Browser Grid Mode | Views Running Label Check in Browser List Mode

3. Once the label quality check is completed, the quality value (0~100) is displayed in the Label Quality column of the browser list mode. The higher the quality value, the better the label is.

   Note: The label quality values of some views with correct labels can be lower than those of the views with incorrect labels, but overall you can find incorrect labels much more frequently on the views with lower quality values.
   Note: The range of absolute quality values differs by the image data you use as the quality value distribution over all views differs by image.

   A view is divided into multiple patches (256 x 256 pixel), and each patch has its own quality value. The quality value of a view displayed in the Label Quality column is the lowest quality value among the quality values of all patches of this view. On the Overlay Checkbox, select Label Quality to display the quality value for each patch on the image display area.

   Quality Value for Each Patch

   Examples of inaccurate labeling:

   - A view without any actual defect has a low label quality value when the defect regions are painted on it.

   - A view with defects has a low label quality value when the defect regions are not precisely painted on it.

   - A view with defects has a low label quality value when the defect regions are not painted on them at all.

4. Click the Label Quality column header to sort the views in ascending order, then check the views with low quality values.

5. Modify the labels of the views with low quality values. To modify them, enable Label Quality on the Overlay Checkbox to display the quality values of patches then go to View and select Edit Regions.

   You can edit, add, or remove defect regions on a view by comparing them with the label quality values of each patch:

   - If a patch with a low label quality value involves some labeled defect regions, remove unnecessary defect regions on the background pixels (pixels with no defect) in the patch, or add more defect regions on the defect pixels in the patch.

   - If a patch with a low label quality value involves only the background pixels, add defect regions on the defect pixels in the patch.

   If you modify or remove a label or its defect regions after the quality check, the value in the Label Quality column for this view is removed and displayed on the Memo column instead.

6. Train and process the tool and check the improvement of the results.

   Before Correcting Labels | After Correcting Labels with Label Check