Пример #1
0
 def __call__(self, h_img, pcd):
     B = h_img.shape[0]
     # conv1
     h_img = F.relu(self.conv1_img(h_img))
     h_pcd = F.relu(self.conv1_pcd(pcd))
     feat1 = F.concat((h_pcd, h_img), axis=1)
     # conv2
     h_img = F.relu(self.conv2_img(h_img))
     h_pcd = F.relu(self.conv2_pcd(h_pcd))
     feat2 = F.concat((h_pcd, h_img), axis=1)
     # conv3, conv4
     feat3 = F.concat((feat1, feat2), axis=1)
     h = F.relu(self.conv3(feat3))
     h = F.relu(self.conv4(h))
     h = F.average_pooling_1d(h, self.n_point)
     h = h.reshape((B, 1024))
     return h
Пример #2
0
 def __call__(self, h_rgb, pcd):
     B, _, n_point = h_rgb.shape
     # conv1
     h_rgb = F.relu(self.conv1_rgb(h_rgb))
     h_pcd = F.relu(self.conv1_pcd(pcd))
     feat1 = F.concat((h_rgb, h_pcd), axis=1)
     # conv2
     h_rgb = F.relu(self.conv2_rgb(h_rgb))
     h_pcd = F.relu(self.conv2_pcd(h_pcd))
     feat2 = F.concat((h_rgb, h_pcd), axis=1)
     # conv3, conv4
     h = F.relu(self.conv3(feat2))
     h = F.relu(self.conv4(h))
     h = F.average_pooling_1d(h, n_point)
     h = h.reshape((B, 1024, 1))
     feat3 = F.repeat(h, n_point, axis=2)
     feat = F.concat((feat1, feat2, feat3), axis=1)
     return feat
Пример #3
0
 def test_average_pooling_1d_invalid(self):
     (x, ksize) = self._get_data(2)
     with self.assertRaises(ValueError):
         functions.average_pooling_1d(x, ksize)
Пример #4
0
 def test_average_pooling_1d(self):
     (x, ksize) = self._get_data(1)
     testing.assert_allclose(
         functions.average_pooling_nd(x, ksize).data,
         functions.average_pooling_1d(x, ksize).data)
Пример #5
0
 def test_average_pooling_1d_invalid(self):
     (x, ksize) = self._get_data(2)
     with pytest.raises(ValueError):
         functions.average_pooling_1d(x, ksize)
Пример #6
0
 def test_average_pooling_1d(self):
     (x, ksize) = self._get_data(1)
     testing.assert_allclose(
         functions.average_pooling_nd(x, ksize).array,
         functions.average_pooling_1d(x, ksize).array)