Safemotion Lib
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | Static Public Attributes | List of all members
resnet3d.Bottleneck3d Class Reference
Inheritance diagram for resnet3d.Bottleneck3d:

Public Member Functions

None __init__ (self, int inplanes, int planes, int spatial_stride=1, int temporal_stride=1, int dilation=1, Optional[nn.Module] downsample=None, bool inflate=True, str inflate_style='3x1x1')
 
 forward (self, x)
 

Public Attributes

 inplanes
 
 planes
 
 spatial_stride
 
 temporal_stride
 
 dilation
 
 inflate
 
 inflate_style
 
 conv1_stride_s
 
 conv2_stride_s
 
 conv1_stride_t
 
 conv2_stride_t
 
 conv1
 
 conv2
 
 conv3
 
 expansion
 
 downsample
 
 relu
 

Static Public Attributes

int expansion = 4
 

Detailed Description

Definition at line 7 of file resnet3d.py.

Constructor & Destructor Documentation

◆ __init__()

None resnet3d.Bottleneck3d.__init__ ( self,
int inplanes,
int planes,
int spatial_stride = 1,
int temporal_stride = 1,
int dilation = 1,
Optional[nn.Module] downsample = None,
bool inflate = True,
str inflate_style = '3x1x1' )

Definition at line 11 of file resnet3d.py.

19 inflate_style: str = '3x1x1') -> None:
20 super().__init__()
21
22 self.inplanes = inplanes
23 self.planes = planes
24 self.spatial_stride = spatial_stride
25 self.temporal_stride = temporal_stride
26 self.dilation = dilation
27
28 self.inflate = inflate
29 self.inflate_style = inflate_style
30
31 self.conv1_stride_s = 1
32 self.conv2_stride_s = spatial_stride
33 self.conv1_stride_t = 1
34 self.conv2_stride_t = temporal_stride
35
36 conv1_stride = (self.conv1_stride_t, self.conv1_stride_s, self.conv1_stride_s)
37 conv2_stride = (self.conv2_stride_t, self.conv2_stride_s, self.conv2_stride_s)
38
39 if self.inflate:
40 if inflate_style == '3x1x1':
41 conv1_kernel_size = (3, 1, 1)
42 conv1_padding = (1, 0, 0)
43 conv2_kernel_size = (1, 3, 3)
44 conv2_padding = (0, dilation, dilation)
45 else:
46 conv1_kernel_size = (1, 1, 1)
47 conv1_padding = (0, 0, 0)
48 conv2_kernel_size = (3, 3, 3)
49 conv2_padding = (1, dilation, dilation)
50 else:
51 conv1_kernel_size = (1, 1, 1)
52 conv1_padding = (0, 0, 0)
53 conv2_kernel_size = (1, 3, 3)
54 conv2_padding = (0, dilation, dilation)
55
56
57 self.conv1 = nn.Sequential(nn.Conv3d(inplanes, planes, kernel_size=conv1_kernel_size, stride=conv1_stride, padding=conv1_padding, bias=False),
58 nn.BatchNorm3d(planes),
59 nn.ReLU(inplace=True))
60
61 self.conv2 = nn.Sequential(nn.Conv3d(planes, planes, kernel_size=conv2_kernel_size, stride=conv2_stride, padding=conv2_padding, bias=False),
62 nn.BatchNorm3d(planes),
63 nn.ReLU(inplace=True))
64
65 self.conv3 = nn.Sequential(nn.Conv3d(planes, planes * self.expansion, kernel_size=1, bias=False),
66 nn.BatchNorm3d(planes * self.expansion))
67
68 self.downsample = downsample
69 self.relu = nn.ReLU(inplace=True)
70
71

Member Function Documentation

◆ forward()

resnet3d.Bottleneck3d.forward ( self,
x )

Definition at line 72 of file resnet3d.py.

72 def forward(self, x):
73
74 identity = x
75
76 out = self.conv1(x)
77 out = self.conv2(out)
78 out = self.conv3(out)
79
80 if self.downsample is not None:
81 identity = self.downsample(x)
82
83 out = out + identity
84
85 out = self.relu(out)
86
87 return out
88
89

Member Data Documentation

◆ conv1

resnet3d.Bottleneck3d.conv1

Definition at line 57 of file resnet3d.py.

◆ conv1_stride_s

resnet3d.Bottleneck3d.conv1_stride_s

Definition at line 31 of file resnet3d.py.

◆ conv1_stride_t

resnet3d.Bottleneck3d.conv1_stride_t

Definition at line 33 of file resnet3d.py.

◆ conv2

resnet3d.Bottleneck3d.conv2

Definition at line 61 of file resnet3d.py.

◆ conv2_stride_s

resnet3d.Bottleneck3d.conv2_stride_s

Definition at line 32 of file resnet3d.py.

◆ conv2_stride_t

resnet3d.Bottleneck3d.conv2_stride_t

Definition at line 34 of file resnet3d.py.

◆ conv3

resnet3d.Bottleneck3d.conv3

Definition at line 65 of file resnet3d.py.

◆ dilation

resnet3d.Bottleneck3d.dilation

Definition at line 26 of file resnet3d.py.

◆ downsample

resnet3d.Bottleneck3d.downsample

Definition at line 68 of file resnet3d.py.

◆ expansion [1/2]

int resnet3d.Bottleneck3d.expansion = 4
static

Definition at line 9 of file resnet3d.py.

◆ expansion [2/2]

resnet3d.Bottleneck3d.expansion

Definition at line 66 of file resnet3d.py.

◆ inflate

resnet3d.Bottleneck3d.inflate

Definition at line 28 of file resnet3d.py.

◆ inflate_style

resnet3d.Bottleneck3d.inflate_style

Definition at line 29 of file resnet3d.py.

◆ inplanes

resnet3d.Bottleneck3d.inplanes

Definition at line 22 of file resnet3d.py.

◆ planes

resnet3d.Bottleneck3d.planes

Definition at line 23 of file resnet3d.py.

◆ relu

resnet3d.Bottleneck3d.relu

Definition at line 69 of file resnet3d.py.

◆ spatial_stride

resnet3d.Bottleneck3d.spatial_stride

Definition at line 24 of file resnet3d.py.

◆ temporal_stride

resnet3d.Bottleneck3d.temporal_stride

Definition at line 25 of file resnet3d.py.


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