MCPcopy Create free account
hub / github.com/UVA-Computer-Vision-Lab/FrameINO / Conv3DConfigurable

Class Conv3DConfigurable

preprocess/auxiliary/TransNetV2.py:199–236  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

197
198
199class Conv3DConfigurable(nn.Module):
200
201 def __init__(self,
202 in_filters,
203 filters,
204 dilation_rate,
205 separable=True,
206 octave=False, # not supported
207 use_bias=True,
208 kernel_initializer=None): # not supported
209 super(Conv3DConfigurable, self).__init__()
210
211 if octave:
212 raise NotImplemented(
213 "Octave convolution not implemented in Pytorch version of Transnet!")
214 if kernel_initializer is not None:
215 raise NotImplemented(
216 "Kernel initializers are not implemented in Pytorch version of Transnet!")
217
218 assert not (separable and octave)
219
220 if separable:
221 # (2+1)D convolution https://arxiv.org/pdf/1711.11248.pdf
222 conv1 = nn.Conv3d(in_filters, 2 * filters, kernel_size=(1, 3, 3),
223 dilation=(1, 1, 1), padding=(0, 1, 1), bias=False)
224 conv2 = nn.Conv3d(2 * filters, filters, kernel_size=(3, 1, 1),
225 dilation=(dilation_rate, 1, 1), padding=(dilation_rate, 0, 0), bias=use_bias)
226 self.layers = nn.ModuleList([conv1, conv2])
227 else:
228 conv = nn.Conv3d(in_filters, filters, kernel_size=3,
229 dilation=(dilation_rate, 1, 1), padding=(dilation_rate, 1, 1), bias=use_bias)
230 self.layers = nn.ModuleList([conv])
231
232 def forward(self, inputs):
233 x = inputs
234 for layer in self.layers:
235 x = layer(x)
236 return x
237
238
239class FrameSimilarity(nn.Module):

Callers 1

__init__Method · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected