Safemotion Lib
Loading...
Searching...
No Matches
Classes | Functions | Variables
fastreid.modeling.losses.smooth_ap Namespace Reference

Classes

class  SmoothAP
 
class  SmoothAP_old
 

Functions

 sigmoid (tensor, temp=1.0)
 

Variables

 loss1 = SmoothAP(0.01)
 
 loss2 = SmoothAP_old(0.01, 60, 6, 256)
 
 inputs = torch.randn(60, 256, requires_grad=True)
 
list targets = []
 
 output1 = loss1(inputs, targets)
 
 output2 = loss2(inputs)
 

Detailed Description

@author:  xingyu liao
@contact: sherlockliao01@gmail.com

Function Documentation

◆ sigmoid()

fastreid.modeling.losses.smooth_ap.sigmoid ( tensor,
temp = 1.0 )
 temperature controlled sigmoid
takes as input a torch tensor (tensor) and passes it through a sigmoid, controlled by temperature: temp

Definition at line 17 of file smooth_ap.py.

17def sigmoid(tensor, temp=1.0):
18 """ temperature controlled sigmoid
19 takes as input a torch tensor (tensor) and passes it through a sigmoid, controlled by temperature: temp
20 """
21 exponent = -tensor / temp
22 # clamp the input tensor for stability
23 exponent = torch.clamp(exponent, min=-50, max=50)
24 y = 1.0 / (1.0 + torch.exp(exponent))
25 return y
26
27

Variable Documentation

◆ inputs

fastreid.modeling.losses.smooth_ap.inputs = torch.randn(60, 256, requires_grad=True)

Definition at line 232 of file smooth_ap.py.

◆ loss1

fastreid.modeling.losses.smooth_ap.loss1 = SmoothAP(0.01)

Definition at line 229 of file smooth_ap.py.

◆ loss2

fastreid.modeling.losses.smooth_ap.loss2 = SmoothAP_old(0.01, 60, 6, 256)

Definition at line 230 of file smooth_ap.py.

◆ output1

fastreid.modeling.losses.smooth_ap.output1 = loss1(inputs, targets)

Definition at line 238 of file smooth_ap.py.

◆ output2

fastreid.modeling.losses.smooth_ap.output2 = loss2(inputs)

Definition at line 239 of file smooth_ap.py.

◆ targets

fastreid.modeling.losses.smooth_ap.targets = []

Definition at line 233 of file smooth_ap.py.