| 70 | return h |
| 71 | |
| 72 | class SmallMotionEncoder(nn.Module): |
| 73 | def __init__(self, args): |
| 74 | super(SmallMotionEncoder, self).__init__() |
| 75 | cor_planes = args.corr_levels * (2*args.corr_radius + 1)**2 |
| 76 | self.convc1 = nn.Conv2d(cor_planes, 96, 1, padding=0) |
| 77 | self.convf1 = nn.Conv2d(2, 64, 7, padding=3) |
| 78 | self.convf2 = nn.Conv2d(64, 32, 3, padding=1) |
| 79 | self.conv = nn.Conv2d(128, 80, 3, padding=1) |
| 80 | |
| 81 | def forward(self, flow, corr): |
| 82 | cor = F.relu(self.convc1(corr)) |
| 83 | flo = F.relu(self.convf1(flow)) |
| 84 | flo = F.relu(self.convf2(flo)) |
| 85 | cor_flo = torch.cat([cor, flo], dim=1) |
| 86 | out = F.relu(self.conv(cor_flo)) |
| 87 | return torch.cat([out, flow], dim=1) |
| 88 | |
| 89 | class BasicMotionEncoder(nn.Module): |
| 90 | def __init__(self, args): |