Soft-Objectness Loss

How to use loss_custom in YOLOv5 official code.

  1. Add loss_custom.py to the folder (same directory with loss.py) and edit train.py
  2. Change import from loss to loss_custom in main.py
from utils.loss import ComputeLoss
from utils.loss_custom import ComputeLoss
  1. play with hyperparameter "n", "gamma", "sigma" with parser
n: softscore1 assignment
gamma : softscore1 assignment
sigma : softscore2 assignment
  • Detail implementation of our method is in loss_custom.py > Compute_Loss > build_targets_custom1
  • build_targets_custom: implemented with for loops => very long computation time
  • build_targets_custom1: modified computation into tensor => much faster but still slower than the original wich has less targets (Binary)

Soft-Objectness Score

OursScore1 ( 실선 )

OursScore2 ( 점선 )

Soft-Objectness Loss

OursLoss1

- graph image for gamma = 1

OursLoss2

OursLoss3

Experiments

Experiment1: COCO128

Results: https://wandb.ai/wonseokjeong/YOLOv5?workspace=user-wonseokjeong

Experiment2: COCO

Results: https://wandb.ai/wonseokjeong/train?workspace=user-wonseokjeong

Experiment3: Pascal VOC

Results: https://wandb.ai/wonseokjeong/YOLO_VOC?workspace=user-wonseokjeong

Conclusion

Helps training in the early stage but interrupts the the model understanding and downgrades the MAP results.