Learning Rate Schedular

  • Factor scheduler

  • Multi factor scheduler

  • Cosine scheduler

    • $\alpha_0$: Initial rate
    • $\alpha_T$: Target rate
  • Warmup

    • Unstable optimization problem, small learning rate first
  • Step LR

    1
    2
    3
    4
    5
    6
    7
    8
    9
    # Assuming optimizer uses 1r = 0.05 for all groups
    # 1r = 0.05 if epoch < 30
    # 1r = 0.005 if 30 <= epoch < 60
    # Ir = 0.0005 if 60 <= epoch < 90
    scheduler = StepLR(optimizer, step_size=30, gamma=0.1)
    for epoch in range (100) :
    train (...)
    validate (...)
    scheduler.step()
  • Exponential LR
    Decays the learning rate of each parameter group by gamma every epoch (equivalent to StepLR if step_size = 1)

Loss Function

Object Detection

  • Methodology:
    1. generate lots of boxes
    2. For each box, assign a label and a confidence score
    3. For each object, use the box with the highest confidence score

After defining the confidence score, and generate the data, we are ready to train the model

  • Loss function: classification and the confidence score regression using the Intersection over Union (IoU) and regress over the offset,
  • Leftover problems
    1. Lot of candidate boxes are generated within an image (inefficient)
    2. Do not need to run the deep learning model for each box
    3. How to balance accuracy and efficiency?
    4. How to incorporate the pixel-level information?

Style Transfer

Aim to design a deep learning model to perform this kind of “style transfer”. The synthesized image is similar to the content image, but the feature map of synthesized image is different from the content image but similar to the style image.

The image is similar to both input images. We should reduce their difference in the extract feature maps on different layers for the content image and style image. The style image composes of the details of the synthesized image while the content image composes of overview of the synthesized image.

  • Loss function: feature map differences
  • Style Transfer Model

  • Model: the 3 models are the same pretrained DL models

  • Parameters: every pixel in the output image
  • Loss function:
    1. Content loss: Second layer: minimize the difference bwteen the feature map of content image and the feature map of synthesized image
    2. Style loss: First and Third layer: minimize the difference bwteen the feature map of style image and the feature map of synthesized image
    3. Variation loss: minimize the noise

Hyper-paramater

  • Algorithm: Optimization Algorithm, Gradient Descent Algorithm, Backward Propagation Algorithm
  • Model: The model architecture and connectivity
  • Parameter: The distribution of the data is reflected in the parameter of the model (e.g., the parameters for real live images must definitly different from that of cartoon images)
  • Hyper-parameter: Represent the design choices within the method
    • Data
      • Data augmentation
    • Model
      • Model connectivity
      • Number of nodes and layers
      • Filter size, channel numbers
      • Max pooling, average pooling
      • Activation function
    • Optimization
      • Weight initialization
      • Loss function
      • Class weights (imbalanced data) ØOptimizer
      • Learning rate, learning rate decay ØWeight decay coefficient ØDropout ratio
      • Batch size
      • Epochs

Before Tunning

  • Collect the data, define the problem, design the loss function
  • Build the simple working model and reduce the complexity of your code
    • CNN with a few layers
    • Dropout with rate as 0.7
    • Batch normalization
    • Adam with default setting
    • To make sure the entire pipeline is bug-free

Tunning

  • Gradually increase the model complexity
  • Add the tricks to deal with overfitting
  • Use the techniques to balance model complexity and generalization power

  • Some (most) hyper-parameters are understandable:

    • Dropout ratio, layers and nodes: related to overfitting
    • Tune it based on the model’s performance on training and validation dataset
  • Some hyper-parameters are unpredictable:

    • Optimizer, weight initialization
    • Random search