EfficientDet

effnet

Initialize EfficientNet backbone.

class trashnet.effdet.effnet.EfficientNet

Bases: torch.nn.modules.module.Module

Create a nn.Module from pretrained EfficientNet

forward(x)

Forward pass through EfficientNet to generate feature maps.

layers

losses

Focal Loss for EfficientDet

The code is modified from a PyTorch implementation of RetinaNet where FocalLoss was first introduced

https://arxiv.org/abs/1708.02002 https://github.com/yhenon/pytorch-retinanet/blob/master/retinanet/losses.py

class trashnet.effdet.losses.FocalLoss

Bases: torch.nn.modules.module.Module

Focal Loss for EfficientDet. As defined in RetinaNet: https://arxiv.org/abs/1708.02002

forward(classifications, regressions, anchors, annotations)

Defines the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

trashnet.effdet.losses.calculate_IoU(a, b) → float

Helper function to calculate Intersection over Union for ground truth bounding box and predicted bounding box

Returns:float as the IoU score for the given inputs

models

utils