/Focal-loss-pytorch-implementation

A pytorch implementation of focal loss

Primary LanguagePython

Project Title

An Pytorch implementation of the focal loss function which was proposed in: "Focal Loss for Dense Object Detection", https://arxiv.org/abs/1708.02002

Example

Training

import function as F

optimizer.zero_grad()
criterion = F.FocalLoss()

output = model(data)

loss = criterion(output, target)
loss.backward()
optimizer.step()