Safemotion Lib
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
fastreid.layers.batch_drop.BatchDrop Class Reference
Inheritance diagram for fastreid.layers.batch_drop.BatchDrop:

Public Member Functions

 __init__ (self, h_ratio, w_ratio)
 
 forward (self, x)
 

Public Attributes

 h_ratio
 
 w_ratio
 

Detailed Description

ref: https://github.com/daizuozhuo/batch-dropblock-network/blob/master/models/networks.py
batch drop mask

Definition at line 12 of file batch_drop.py.

Constructor & Destructor Documentation

◆ __init__()

fastreid.layers.batch_drop.BatchDrop.__init__ ( self,
h_ratio,
w_ratio )

Definition at line 17 of file batch_drop.py.

17 def __init__(self, h_ratio, w_ratio):
18 super(BatchDrop, self).__init__()
19 self.h_ratio = h_ratio
20 self.w_ratio = w_ratio
21

Member Function Documentation

◆ forward()

fastreid.layers.batch_drop.BatchDrop.forward ( self,
x )

Definition at line 22 of file batch_drop.py.

22 def forward(self, x):
23 if self.training:
24 h, w = x.size()[-2:]
25 rh = round(self.h_ratio * h)
26 rw = round(self.w_ratio * w)
27 sx = random.randint(0, h - rh)
28 sy = random.randint(0, w - rw)
29 mask = x.new_ones(x.size())
30 mask[:, :, sx:sx + rh, sy:sy + rw] = 0
31 x = x * mask
32 return x

Member Data Documentation

◆ h_ratio

fastreid.layers.batch_drop.BatchDrop.h_ratio

Definition at line 19 of file batch_drop.py.

◆ w_ratio

fastreid.layers.batch_drop.BatchDrop.w_ratio

Definition at line 20 of file batch_drop.py.


The documentation for this class was generated from the following file: