src.model.deeplearn.initializer.kernel_point_structure_initializer

Classes

KernelPointStructureInitializer([...])

class src.model.deeplearn.initializer.kernel_point_structure_initializer.KernelPointStructureInitializer(initialization_type='concentric_ellipsoids', max_radii=(1, 1, 1), radii_resolution=4, angular_resolutions=(1, 2, 4, 8), trainable=True, name='Q', **kwargs)
Author:

Alberto M. Esmoris Pena

A kernel point structure initializer initializes the structure space matrix representing the support points of a kernel. It will generate a structure space matrix for the kernel \(\pmb{Q} \in \mathbb{R}^{K \times n_x}\). This matrix has \(K\) rows representing \(K\) points in a \(n_x\)-dimensional space, typically 3D, i.e., \(n_x=3\).

Variables:
  • max_radii (np.ndarray of float) – The radius of the last ellipsoid along each axis \(\pmb{r}^* \in \mathbb{R}^{n_x}\).

  • radii_resolution (int) – How many concentric ellipsoids must be considered \(n \in \mathbb{Z}_{>0}\) (the first one is the center point, the last one is the biggest outer ellipsoid).

  • angular_resolutions (np.ndarray of int) – How many angles consider for each ellipsoid \((m_1, \ldots, m_n)\).

  • trainable (bool) – Flag to control whether \(\pmb{Q}\) is trainable or not.

  • name (str) – The name for the initialized tensor.

__init__(initialization_type='concentric_ellipsoids', max_radii=(1, 1, 1), radii_resolution=4, angular_resolutions=(1, 2, 4, 8), trainable=True, name='Q', **kwargs)

Initialize the member attributes of the initializer.

Parameters:

kwargs – The key-word specification to parametrize the initializer.

__call__(shape=None, dtype='float32')

Initialize a structure space matrix representing the support points of a kernel.

Parameters:

shape – The shape parameter is ignored as the dimensionality of the initialized matrix depends on the arguments used to build the initializer.

Returns:

The structure space matrix for a point-based kernel \(\pmb{Q} \in \mathbb{R}^{K \times n_x}\).

Return type:

tf.Tensor

sample_concentric_ellipsoids()

The structure matrix of the kernel \(\pmb{Q} \in \mathbb{R}^{3}\) is initialized for the 3D case assuming three parameters:

\(n\) The radii resolution.

\(r_x^*, r_y^*, r_z^*\) The max radii.

\(m_1, \ldots, m_n\) The angular resolution for each radius.

First, the axis-wise radii for given ellipsoid are defined as:

\[\begin{split}r_{xk} = \frac{k-1}{n-1} r_x^* \\ r_{yk} = \frac{k-1}{n-1} r_y^* \\ r_{zk} = \frac{k-1}{n-1} r_z^*\end{split}\]

Where \(k=0,...,n-1\) represents the \(n\) concentric ellipsoids with \(k=0\) being the central point and \(k=n-1\) the biggest ellipsoid, i.e., from smaller to bigger.

For then, it is possible to define two angles \(\alpha \in [0, \pi]\) and \(\beta \in [0, 2\pi]\) such that:

\[\alpha_{kj} = \frac{j-1}{m_k - 1} \pi \;,\;\; \beta_{kj} = \frac{j-1}{m_k -1} 2\pi\]

Where \(j=0, \ldots, m_k-1\) for each \(k\).

Finally, the rows in \(\pmb{Q}\) that represent the kernel’s structure can be computed as follows:

\[\begin{split}\left[\begin{array}{c} x \\ y \\ z \end{array}\right]^\intercal = \left[\begin{array}{c} r_{xk} \sin(\alpha_{kj}) \cos(\beta_{kj}) \\ r_{yk} \sin(\alpha_{kj}) \sin(\beta_{kj}) \\ r_{zk} \cos(\alpha_{kj}) \end{array}\right]^\intercal\end{split}\]
Returns:

\(\pmb{Q} \in \mathbb{R}^{K \times n_x}\)

Return type:

tf.Tensor

sample_concentric_grids()

In the concentric grids strategy the angular resolution is understood as the edge resolution \(r_e\).

One grid will be generated for each radius in the radii resolution specification. More concretely, each grid will have a length side of twice the radius and a number of points equal to \(r_e^3\) for the 3D case. Note that a radius is given for each axis such that rectangular grids are supported in general, not only voxel grids (those correspond to all axis having the same radius).

Returns:

Points sampled from concentric grids.

Return type:

tf.Tensor

sample_concentric_rectangulars()

In the concentric rectangular prisms strategy the angular resolution is understood as the edge resolution \(r_e\).

One rectangular prism will be generated for each radius in the radii resolution specification. More concretely, each rectangular prism will have a length side of twice the radius and a number of points equal to \(6r_e^2-12r_3+8\) for the 3D case. Note that a radius is given for each axis such that rectangular prisms are supported in general, not only voxels (those correspond to all axis having the same radius).

Returns:

Points sampled from concentric rectangular prisms.

Return type:

tf.Tensor

sample_concentric_cylinders()

In the concentric cylinders strategy the angular resolution \(r_a\) is used directly to sample along the \(z\)-axis.

One cylinder will be generated for each radius in the radii resolution specification. More concretely, each cylinder will have a number of points equal to \(r_a^2r_r\) where \(r_r\) is the radius of the disk for the current cylinder.

Returns:

Points sampled from concentric cylinders.

Return type:

tf.Tensor

sample_cone()

In the cone strategy angular resolution \(r_a\) is used directly to sample along the \(z\)-axis.

The cone will be generated as parametric circles which angular resolution and radius increases as they get far from the zero.

More concretely, the cone will have a number of points as shown below:

\[1 + \sum_{i=1}^{r_a}{\left\lceil r_a \dfrac{\lvert{z_i}\rvert}{z^*} \right\rceil}\]

Where \(z^*\) is the maximum height for the cone.

Returns:

Points sampled from concentric cones.

Return type:

tf.Tensor

compute_num_kernel_points()

Compute the expected number of support points for the kernel considering the attributes of the initializer.

Returns:

Expected number of support points.

Return type:

int