예제 #1
0
 def _kernel_tensor(self, input_tensor):
     point = input_tensor.origin()
     # Decorate input tensor with kernel tensor (a.k.a filter)
     kernel_depth = self.in_channels
     kernel_height = self.k_size[0]
     kernel_width = self.k_size[1]
     kernel_point = point
     kernel_color = (0, 0, 255)
     return Tensor3D(x=kernel_point[0],
                     y=kernel_point[1],
                     depth=kernel_depth,
                     height=kernel_height,
                     width=kernel_width,
                     scale=input_tensor.scale(),
                     color=kernel_color,
                     print_shape=False)
예제 #2
0
    def _output_tensor(self, input_tensor):
        point = input_tensor.origin()
        _, in_height, in_width = input_tensor.shape()
        # Output tensor
        out_depth = self.out_channels
        out_height = (in_height + 2 *
                      self.pad[0] - self.k_size[0]) / self.stride[0] + 1
        out_width = (in_width + 2 *
                     self.pad[1] - self.k_size[1]) / self.stride[1] + 1

        left_vertices = self._left_vertices(input_tensor)
        right_vertices = self._right_vertices(input_tensor)
        box_width = right_vertices[0][0] - left_vertices[0][0]

        margin = self._inter_layer_margin()
        out_point = (point[0] + box_width + margin, point[1])
        return Tensor3D(x=out_point[0],
                        y=out_point[1],
                        depth=out_depth,
                        height=out_height,
                        width=out_width,
                        scale=input_tensor.scale())