# Label in Red Analyze

In Red Focused Supervised and Red Analyze High Detail, the labeling process involves first labeling "good" and "bad" images, in other words, images that are defect-free and contain defects. Then for the bad images, you draw regions over the pixels that contain the defects. The accuracy with which your labeled defect masks match the actual defects in the images is a key determinant in the performance of the tool.

1 | Defect
2 | Labeled defect (region drawn over the defect)

For Red Analyze Focused Supervised, you have to first identify the defects in the Views, and then carefully label the defects by graphically drawing defect regions over them.

Note: You will also want to include some defect-free images in your Training Image Set, and label them as Good.

1. To label defects, right-click within the View and select Edit Region from the menu.

2. This will launch the Edit Regions toolbar at the top of the image.

   Note: The Edit Regions toolbar is the same as the Edit Masks toolbar. For more information about the functionality of the buttons in the toolbar, see the topic.

3. There are three drawing tools, and they can be used in conjunction. The size of the area drawn is defined by the Width value.

   - Line: Click and drag to create a line in your image.

     Tip:
     - Hold down the Shift key while drawing, and the tool will draw a straight line between two points.
     - If you want to fill in a rectangular area, draw the outline using the line drawing tool (hold down the Shift key to create straight lines), and then fill it in using the magic wand tool.

   - Circle: Place the cursor at the center of your circular object, and drag outward.

     Tip: Hold down the Shift key to have the circle expand from the corner of a bounding box.
   - Magic Wand: Click and drag to fill in areas of the image. You can also click on individual features to apply fill to just that area.
   Note: The Eraser tool can be used to trim and/or remove extraneous drawings on the image.

   When drawing Regions around the defects, try and draw the Region as precisely and consistently as possible. While drawing small amounts of the Region outside of the defect is acceptable, larger areas should be avoided. This can result in the tool thinking that the background has been labeled as defect. Likewise, under filling a defect should also be avoided.

   The graphics below illustrate the best methods for drawing Regions around a defect, where the dark grey lines represent the defect, and the red is the Region defining the defect.

   This is the ideal way to draw the Region, with it closely aligned to the defect. | This method encompasses too much of the background, and will result in the tool considering the background as a defect, as well. | This method missed parts of the defect, so the tool will consider the parts not outlined in red as not being a defect.

4. Once you have carefully and accurately drawn your defect Region, press the Apply button. You must do this on an image-by-image basis.
5. Once you have drawn all the necessary Regions, press the Close button prior to training the tool.

Note: Within the Red Analyze tool, the default region names are “deviation”, the name applied to Unsupervised mode regions, and “defect”, the name applied to Supervised mode regions. There is a potential to have a mix of region names in the tool. This can be encountered under the following conditions:

1. Create a Red Analyze tool and leave it in its default Unsupervised mode and set the tool’s ROI.
2. Open the Database Overview.
3. Launch the Edit Regions functionality, draw some defects and apply the changes.
4. With the Edit Regions editor still open, switch the tool from its default mode (Unsupervised) to Supervised.
5. Select another view, draw some defects and apply the changes.
6. Note that the thumbnails in the View list and in the Database Overview will be out of sync with the name in the Edit Regions editor.

To resolve the naming discrepancies, close the Edit Region editor and toggle the mode, which will cause the tool to merge and then correctly rename the regions.

Note: You can also import labels as image files, JSON files, or files in VisionPro Deep Learning internal label formats, see .
Note: If the created labels seem to be incorrect or noisy over many views, you can examine the quality level of the label for each view and correct the wrong label. See for more details.