Custom Training
  • 12 Aug 2023
  • 14 Minutes to read
  • Dark
    Light
  • PDF

Custom Training

  • Dark
    Light
  • PDF

Article Summary

Custom Training (also called "Advanced Training") is an advanced option recommended for users who are familiar with machine learning. Custom Training allows these users to have more granular control over pre-processing transforms and manual hyperparameter tuning.

Run Custom Training

  1. Open the Project you want to train.
  2. Click the downward-facing arrow next to Train and click Train with Custom Options.
    Train with Custom Options
  3. Configure the settings and hyperparameters for custom model training.
    Configure Settings and Hyperparameters
  4. After configuring the settings, click Train.
    Train the Model
  5. LandingLens runs the Model Training process and creates a model. You can then save the model, just as you would for a Fast Train Model. For more information, go to Train Models.

Custom Model Settings

This section describes the settings you can configure to train a Custom Model. LandingLens applies some settings by default. Those defaults display on the Train Model page.

Data Transform

Data Transform allows you to resize or crop all the images in your dataset. This is an important feature because all training images need to be a standard input size for your model. Any Transforms applied here will be applied to the data you provide to your model for training and inference. It's important to be sure that the objects/regions you are trying to detect are clearly visible after applying these Transforms; otherwise, you can risk training poorly performing models.

If you add a Data Transform, you must add a Resize Transform first. This ensures that all data is consistently sized before cropping. Furthermore, resizing your data first prevents you from accidentally cropping outside the image boundaries of small images.

To add Data Transforms:

  1. Click Add Transform.
    Add Transform
  2. Click Resize or Crop accordingly.
    Resize or Crop 
  3. Configure the settings.
  4. Click Add to Pipeline to apply the change to all images in your dataset.
    Configure Settings and Add to Pipeline

Resize Images

When you use Custom Training, images are resized to the dimensions you provide. The maximum image dimensions are based on the Project Type, as described in the following table.

Project TypeMaximum Area
Example Maximum Image Size
Object Detection2,250,000px1500x1500px
Classification2,250,000px1500x1500px
Segmentation984,064px992x992px
Anomaly Detection262,144px512x512px
Note:
If you have LandingLens Enterprise, you can make the images larger. For more information, go to Resize: Large Image Support.

The maximum image size is measured by the area, not width and height. For example, the maximum image size for Object Detection is 1500x1500px. To get the area, multiply 1500 times 1500, so the equation looks like this:

1500 x 1500 = 2,250,000.

If you want to resize an Object Detection image, the area cannot exceed 2,250,000px. For example:

  • A resize of 1000x600px will work because the area of this resize is 600,000px, which is fewer than 640,000px.
  • A resize of 1500x1501px will not work because the area of this resize is 2,251,500px, which is greater than 2,250,000px.

Resize Settings

There are two types of Resize settings:

  • Manual Resize: Enter the dimensions you want your images to be when you train the model. For example, if the original images are 1200x800 and the Resize is 512x512, all images will be resized into square images, even though the original images were in a 4:3 ratio. If you want to preserve the original aspect ratio, use Rescale with Padding.
    Manual Resize 
  • Rescale with Padding: Enter the dimensions you want your images to be when you train the model. The image will be rescaled to that size and keep the original aspect ratio during resizing. This is done by adding padding of a constant pixel value of "0" to the image if the requested resize is not the same aspect ratio as the original image. If the resized image has the same aspect ratio, there will be no padded pixels.

    For example, say the original size of an image is 1200x800, and you rescale it to 512x512. Padding will be added around the rescaled image of 512x314 to make the height of the image 512. This is because the aspect ratio of the original image is 4:3, and the requested rescale is 1:1; thus, the extra space in the y dimension must be padded.

    Note:
    Rescale with Padding is set by default. You can adjust this setting as needed.
    Rescale with Padding

Resize: Large Image Support

If you are on LandingLens Enterprise, you can resize your images in Object Detection and Segmentation Projects to larger than the regular maximums. If you resize images to be larger than the following dimensions, the images are considered to be "large images":

  • Object Detection: Over 1500x1500px
  • Segmentation: Over 992x992px

With LandingLens Enterprise, you can resize your images up to these maximums:

  • Object Detection: Up to 36MP
  • Segmentation: Up to 36MP

If you resize your images to be "large images", you will only be able to deploy the model using LandingEdge. Cloud Deployment doesn't support models that were created with large images. Additionally, you won't be able to run the Predict tool on these models.

Crop

You can manually crop all images in your dataset. To do this, click and drag the sides of the box to create the crop you want to use for that image and click Add to Pipeline. Then use the left and right arrows to preview the crop of the other images in your dataset.

Tip:
You can click the center of the crop box and drag it to the area where you want to start the crop.
Crop Images

Data Augmentation

The Data Augmentation setting offers several pre-processing modifications that allow you to update all images in your dataset quickly. Here's how it works. First, you select a modification. Then enter the probability that the modification will take effect. For example, you can make it so there's a 50% chance that images will be rotated vertically.

Here are some benefits of adding Data Augmentations:

  • You can reduce the time spent collecting data by augmenting images to "create" images you would have otherwise had to capture.
  • Augmentations can create variations of your images so your model can be more robust when you deploy it.
  • It reduces the chance of overfitting because the model will be shown random versions of images during each epoch cycle to prevent models from simply "memorizing" the data.

This section describes the types of Data Augmentation LandingLens offers.

Data Augmentation Settings

Random Brightness

Apply Random Brightness for a chance that the images in your dataset will randomly brighten.

For example, say your camera took several images at night, and the objects in the image are dark. You want your model also to learn how images will look if they are taken during the day. You may be asking yourself why this is important. When you deploy or train a model with poorly lit images, it can perform poorly because when the lighting changes look "different" to the model, it may not recognize the area to detect. In this case, you can use the Random Brightness modification to improve the lighting. 

This modification offers many settings, as described in the table below.

Random Brightness 
#SettingDescription
1RandomBrightness RangeImages have a chance to be brightened to any value in the range specified here.
2ProbabilityThe likelihood that images will have random brightness applied.
3Random BrightnessUse this setting to preview how images will look in the selected value. 
4Set as Lower LimitSet a value in the RandomBrightness modification to preview how images will look at that brightness level. Then click Set as Lower Limit to choose the lowest brightness level that you want images to display in.

The value in the RandomBrightness setting (#3) will be set as the lowest value in the RandomBrightness Range (#1).
5Set as Upper LimitSet a value in the RandomBrightness modification to preview how images will look at that brightness level. Then click Set as Upper Limit to choose the highest brightness level that you want images to display in.

The value in the RandomBrightness setting (#3) will be set as the highest value in the RandomBrightness Range (#1).

Blur / Motion Blur / Gaussian Blur

Apply one of the blur modifications for a chance that the images in your dataset will randomly blur. LandingLens offers these types of blurs:

  • Blur: Makes the entire image look out of focus. This is a heavy blur.
  • Motion Blur: Makes the entire image look like it's in motion.
  • Gaussian Blur: Makes the entire image look out of focus. This is a natural blur.

This modification offers many settings, as described in the table below.

Blur 
#SettingDescription
1Blur Range / MotionBlur Range / Gaussian Blur RangeImages have a chance to be blurred to any value in the range specified here.
2ProbabilityThe likelihood that images will have random blur applied.
3Blur / Motion Blur / Gaussian BlurUse this setting to see how the images will look in the selected value.
4Set as Lower LimitSet a value in a blur modification to preview how images will look at that blur level. Then click Set as Lower Limit to choose the lowest blur level that you want images to display in.

The value in the Blur / Motion Blur / Gaussian Blur setting (#3) will be set as the lowest value in the Blur Range / Motion Blur Range / Gaussian Blur Range (#1).
5Set as Upper LimitSet a value in a blur modification to preview how images will look at that blur level. Then click Set as Upper Limit to choose the highest blur level that you want images to display in.

The value in the Blur / Motion Blur / Gaussian Blur setting (#3) will be set as the highest value in the Blur Range / Motion Blur Range / Gaussian Blur Range (#1).

Hue Saturation Value

Apply Hue Saturation Value for a chance that the color intensity of the images will change. 

For example, some objects come in multiple colors, like a car. You may want to change the hue (color of the image), so the model trains on these various colors.

Note:
Saturation is how "pure" the hue is. A saturation of 0 is black and white.

This modification offers many settings, as described in the table below.

Hue Saturation Value 
#SettingDescription
1Hue / Sat / Val Shift RangeImages have a chance to change the Hue Saturation Value to any value in the range specified here.
2ProbabilityThe likelihood that images will have random Hue Saturation Value applied.
3HueSaturationValueUse this setting to see how images will look in the selected value. 
4Set as Lower LimitSet a value in the HueSatuationValue modification to preview how images will look at that HSV value. Then click Set as Lower Limit to choose the lowest HSV level that you want images to display in.

The value in the HueSaturationValue setting (#3) will be set as the lowest value in the Hue/Sat/Val Shift Range (#1).
5Set as Upper LimitSet a value in the HueSaturationValue modification to preview how images will look at that HSV value. Then click Set as Upper Limit to choose the highest HSV level that you want images to display in.

The value in the HueSaturationValue setting (#3) will be set as the highest value in the Hue/Sat/Val Shift Range (#1).

Random Contrast

Apply Random Contrast for a chance that the tone of the images in your dataset will randomly change. Random Contrast helps to simulate different camera settings or environments that a deployed model may encounter.

  • A low-contrast image will look washed out or slightly dimmed.
  • A high-contrast image will look somewhat overexposed, and the colors will merge into each other.

This modification offers many settings, as described in the table below.

Random Contrast 
#SettingDescription
1RandomContrast RangeImages have a chance to have added contrast to any value in the range specified here.
2ProbabilityThe likelihood that images will have random contrast applied.
3RandomContrastUse this setting to preview how images will look in the selected value.
4Set as Lower LimitSet a value in the RandomContrast modification to preview how images will look at that contrast level. Then select Set as Lower Limit to choose the lowest contrast level that you want to images to display in.

The value in the RandomContrast setting (#3) will be set as the lowest value in the RandomContrast Range (#1).
5Set as Upper LimitSet a value in the RandomContrast modification to preview how images will look at that contrast level. Then select Set as Upper Limit to choose the highest contrast level that you want images to display in.

The value in the RandomContrast setting (#3) will be set as the highest value in the RandomContrast Range (#1).

Horizontal Flip / Vertical Flip

  • Apply Horizontal Flip for a chance that images in your dataset will rotate 180 degrees left or right. This is useful for models to "learn" what objects would look like if they are mirrored.
    Note:
    Horizontal Flip is set by default. You can adjust this setting as needed. 
  • Apply Vertical Flip for a chance that images in your dataset will rotate 180 degrees up or down. This is useful for models to "learn" what objects would look like if they were upside-down.

These modifications offer the Probability setting. This setting indicates the likelihood that images will randomly flip.

Probability of a Horizontal Flip 

RandAugment

Select RandAugment to randomly apply a set of augmentations to your dataset. The possible augmentations are described in the table below.

AugmentationDescription
IdentityApplies no changes to the image. By adding some images to the dataset that still look like the original image, the Identity method decreases the chances of the model training only on augmented images, and prevents overfitting.
EqualizeEqualizes the image histogram, which increases contrast. This method is also referred to as histogram equalization.
RotateRotates the image clockwise or counterclockwise by a random number of degrees. This can change the position of the image within its frame.
PosterizeReduces the number of bits for each color channel. This method is also referred to as posterization.
RandomContrastIncreases or decreases the contrast of the image.
RandomBrightnessIncreases or decreases the contrast of the image.
ShearXShifts the pixels along the X-axis, so that the image looks slanted and stretched horizontally. This can change the position of the image within its frame. This method is also referred to as shear mapping, shear transformation, and shearing.
ShearYShifts the pixels along the Y-axis, so that the image looks slanted and stretched vertically. This can change the position of the image within its frame. This method is also referred to as shear mapping, shear transformation, and shearing.
TranslateXMoves the pixels horizontally by the same distance. This can change the position of the image within its frame. This method is also referred to as translation.
TranslateYMoves the pixels vertically by the same distance. This can change the position of the image within its frame. This method is also referred to as translation.

RandAugment Settings

The RandAugment feature offers many settings, as described in the table below.

RandAugment
#SettingDescription
1Number TransformsThe number of augmentations you want to be applied to images. LandingLens will randomly apply this number of augmentations to the images.
2ProbabilityThe likelihood that images will have an augmentation applied.
3MagnitudeHow strong the applied augmentation will be, ranked 1 to 10 with 1 being weak and 10 being strong.

Random Rotate

Apply Random Rotate for a chance that images in your dataset will randomly rotate.

This modification offers many settings, as described in the table below.

Random Rotate 
#SettingDescription
1Rotate RangeImages have a chance to rotate to any degree in the range specified here.
2ProbabilityThe likelihood that images will randomly rotate.
3InterpolationUse this setting to resize images.
4Border ModeUse this setting to create a border around the image, like a photo frame. 
5RotateUse this setting to preview how images will look in the selected value.
6Set as Lower LimitSet a value in the Rotate modification to preview how images will look at that rotate level. Then click Set as Lower Limit to choose the lowest rotation level that you want images to display in.

The value in the Rotate setting (#3) will be set as the lowest value in the Rotate Range (#1).
7Set as Upper LimitSet a value in the Rotate modification to preview how images will look at that rotate level. Then click Set as Upper Limit to choose the highest rotation level that you want images to display in.

The value in the Rotate setting (#3) will be set as the lowest value in the Rotate Range (#1).

Preview Effects

After configuring an advanced setting, you can preview how the images will look. To do this, click Preview Transform Effect or Preview Augmentation Effect accordingly.

Preview Effects Buttons
Preview of the Effects Applies 
Note:
When you set Data Augmentations, you provide a range of how those Data Augmentations affect images. You can see other possibilities by clicking Reapply.

Hyperparameter

When a model trains, it goes through an extensive process in the background. If you want to have more granular control over how your model trains, you can configure the Hyperparameters. A Hyperparameter is a setting used to control the speed and quality of the learning process. 

Here are some important notes to keep in mind:

  • The Hyperparameter settings are intended for users who are familiar with Machine Learning. If you are unfamiliar with Machine Learning, it is recommended to use the default settings.
  • Hyperparameters should only be adjusted to be data-driven. 
  • Repeatedly training a model with different Hyperparameters (called "Hyperparameter Sweep") is NOT recommended as this can be expensive.

Hyperparameters have a couple of settings, as described in the table below.

Hyperparameter 

SettingDescription
EpochWhen your model trains, it works through your dataset multiple times. The completion of one cycle is called an epoch. Enter the number of cycles you want the model to perform in this field.
Model SizeThe size of the model's capacity. Model capacity refers to the Model's ability to learn complex patterns in data.
  • Medium: Models with medium/high capacity. These models can learn complex patterns in data and tend to be more accurate when making Predictions on new data. However, models with too much capacity are likely to overfit and have poor performance on new data.
  • Small: Models with low capacity. These models are unlikely to learn complex patterns in data and tend to be less accurate when making Predictions on new data.

Custom Training FAQ

Is Advanced Training the same thing as Custom Training?

Yes.

When should I use Custom Training?

If the performance results of your model are unsatisfactory after a Fasting Train, switch to Custom Training.

Note:
Custom Training is intended for users who are knowledgeable in machine learning.

I'm unfamiliar with machine learning. Can I use Custom Training?

We recommend using Fast Training so that LandingLens can fine-tune your model settings for you.

What happens if I switch from Custom Training to Fast Training?

I applied Custom Training settings and trained a model. If I want to train a second model with identical settings, can I click the "Train" (Fast Train) button?

The "Train" button uses default configurations which are different than "Train with Custom Options". However, if you click "Train with Custom Options", your previous settings will be remembered.


Was this article helpful?

What's Next