# Create Label (Labeling)

Labels are the user-generated input data that establish the ground truth for the tool. Ground truth refers to the undisputed facts about the images in your application, in other words, what you, as the human determine to be the key information within the image (feature, character, defect, class). Labels establish the ground truth, which is used for both training and performance analysis. So it is imperative that you label accurately.

## What is Labeling

Since the Deep Learning software is based on learning, what the network is taught about the images is vitally important. Within the Deep Learning parlance, this process is termed “labeling.” Labeling is the process of a user identifying features or defects, and graphically illustrating them on the image. The label represents the ground truth for the tools and is used to train the tools and validate their performance.

The label is the ground truth for the tool, in other words, you are telling the tool, "this is what it should learn." The most important part of programming the tools is ensuring that the images that are being used for training are completely and accurately labeled. Without knowing the ground truth data for the images, you cannot tell whether the tool is working properly or not. Also, without accurate labeling, the tool's training will not work as well.

When you are evaluating the performance of your tools and application, performance is always measured against the labeling that you provide. If your labeling does not reflect the actual ground truth for your images, then accurate and repeatable tool performance will not mean anything. When you train the Deep Learning tools, the goal for training – the cost function – is attempting to train the tool to produce a response that precisely matches the labeling that you provide.

For each of the tools, labeling is a manual operation (see below for the specifics of how labeling is performed for each tool). The most important characteristic of good labeling is that it is consistent, both between images and between observers and people performing the labeling. If you provide an image set to multiple people to label, and their labels do not agree, then the tool will likely not work well.

For each tool, there is a slightly different process, but the principle is the same. Once Labeling is completed, you will be ready to train the tool, and examine the Markings that the tool provides. You can toggle the display of labels and markings by either using the Alt + Left arrow and Alt + Right arrow keys, or from the right-click menu in the image.

You can also show overlay with enabling the "Label" at the Overlay Checkbox.

## Labeling in Green Classify Focused

In Green Classify, the only labeling process entails simply assigning a class to which the image belongs. The Green Classify tool performs classifications of views by assigning a classification tag to the views. The tag name can be up to 140 Unicode characters.

With the Green Classify tool, you will generally be using a large Training Set (). Prior to using the tool, it is recommended to annotate your image files with descriptive names or numbering schemes to help when labeling the views.

There are two methods in assigning a tag in ‘Label Views’ dialog.

1. You can label the views by specifying a tag.

2. You can use a Regular Expression (Display Filters Using Regular Expressions) to programmatically assign tags based on the file names of the images.

When you want to specifying view with a new tag name, you can do it by selecting ‘Add new tag’ item and entering the tag name in input field. Also, you can assign the existing tags by selecting tags from existing tag lists.

When you use regular expression for labeling, it is recommended to change the filename of images to include the texts or numbers which you want to use for tag name.

After the classification tags have been applied, and the tool has been trained, you can review the results to ensure that the tool correctly marked the images.

The label (aka tag), in white text, represents the "actual" class, and the marking, in yellow, represents the "predicted" class returned by the tool.

Labeled | Not labeled
This indicates that the image was labeled as Grizzly (the white text), and the tool marked it as Grizzly with a 96.4% certainty that the correct tag is "Grizzly," while it has a 3.6% certainty that the correct tag is "Bauble." | This indicates where an image was not labeled, and the tool marked the image.

Note: You can also import labels as image files, JSON files, or files in VisionPro Deep Learning internal label formats. See Cognex Label Import/Export Plug-in.
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 Optimize Labeling with Label Check for more details.

## Multi-Class Classification: Non-Exclusive Mode

Green Classify Focused mode supports multi-class classification (multiple tags) by disabling Exclusive checkbox. In non-exclusive mode, a view can belong to multiple classes (tags) and the classification results for each tag are produced accordingly. If you want to engage non-exclusive classification with a Green Classify Focused tool, you have to reset this tool (remove all markings and labels) and remove the trained model of the tool. Note that Green Classify High Detail and Green Classify High Detail Quick does not support non-exclusive mode.

### Adding Multiple Tags

Activated non-exclusive mode by disabling Exclusive, you can put multiple tags for each view. Note that you can mix up new tags and tags that already existed. If your view was an already labeled one, all the previous tags will be removed and replaced by the new tags.

## How to Label Fast: Bootstrap Labeling

You can consider using the bootstrap method of labeling your images to speed up the labeling process for each tool. "Bootstrap" labeling refers to the process of beginning your labeling process by just labeling a small sample size of your images, then training the tool, and reviewing the results by accepting views with correct markings to convert them into labels, and removing incorrect markings and replacing them with correct labels. You can speed up this process further by dividing images into multiple views and only labeling a single view. In addition, you can also temporarily reduce the Epoch Count in Training parameters, which will make the training time shorter.

1. Label a few images in your Training Set.
2. Train the tool.
3. Review the images and results.
4. Accept the views where the tool's markings are accurate (right-click and select Accept View, or Ctrl + Shift + A). This will change the marking into a label. For the Red Analyze tool in Supervised mode, you may have to edit the defect region. For markings that are inaccurate, clear the markings from the image (right-click and select Clear Marking, or Ctrl + C), and then add the correct label.