src/utils.py
def build_histogram(n_bins_per_dim, min_lim, max_lim):
    """Building the histogram of all possible orientation bins, given the number of bins per dimension and
    min/max limits on Z, Y and X axis (rotation). See https://arxiv.org/pdf/1906.09868.pdf
    The histogram is built only once to save time during execution
    """

    d = 3
    n_bins = n_bins_per_dim ** d

    # Construct histogram structure
    bins_per_dim = torch.linspace(0.0, 1.0, n_bins_per_dim)
    bins_all_dims = torch.cartesian_prod(bins_per_dim, bins_per_dim, bins_per_dim)
    euler_bins = bins_all_dims * (max_lim - min_lim) + min_lim
    quaternions_bins = torch.zeros((n_bins, 4), dtype=torch.float32)

    for i in range(n_bins):
        quaternions_bins[i, :] = se3lib.euler2quat(euler_bins[i, 0], euler_bins[i, 1], euler_bins[i, 2])

    # Pruning redundant bins
    # Mark redundant boundary bins
    boundary_flags = torch.logical_or(euler_bins[:, 0] == max_lim[0], euler_bins[:, 2] == max_lim[2])

    # Mark redundant bins due to the two singularities at y = -+ 90 deg
    gymbal_flags = torch.logical_and(np.abs(euler_bins[:, 1]) == max_lim[1], euler_bins[:, 0] != min_lim[0])
    redundant_flags = torch.logical_or(boundary_flags, gymbal_flags)

    return quaternions_bins, redundant_flags
Building the histogram of all possible orientation bins, given the number of bins per dimension and
    min/max limits on Z, Y and X axis (rotation). See https://arxiv.org/pdf/1906.09868.pdf
    The histogram is built only once to save time during execution
    
Building the histogram of all possible orientation bins, given the number of bins per dimension and
min/max limits on Z, Y and X axis (rotation).
Building the histogram of all possible orientation bins given the number of bins per dimension and min / max limits on Z Y and X axis ( rotation ) .
def build_histogram(n_bins_per_dim, min_lim, max_lim):
    d = 3
    n_bins = n_bins_per_dim ** d
    bins_per_dim = torch.linspace(0.0, 1.0, n_bins_per_dim)
    bins_all_dims = torch.cartesian_prod(bins_per_dim, bins_per_dim, bins_per_dim)
    euler_bins = bins_all_dims * (max_lim - min_lim) + min_lim
    quaternions_bins = torch.zeros((n_bins, 4), dtype=torch.float32)
    for i in range(n_bins):
        quaternions_bins[i, :] = se3lib.euler2quat(euler_bins[i, 0], euler_bins[i, 1], euler_bins[i, 2])
    boundary_flags = torch.logical_or(euler_bins[:, 0] == max_lim[0], euler_bins[:, 2] == max_lim[2])
    gymbal_flags = torch.logical_and(np.abs(euler_bins[:, 1]) == max_lim[1], euler_bins[:, 0] != min_lim[0])
    redundant_flags = torch.logical_or(boundary_flags, gymbal_flags)
    return quaternions_bins, redundant_flags
def build_histogram ( n_bins_per_dim , min_lim , max_lim ) : d = 3 n_bins = n_bins_per_dim ** d bins_per_dim = torch . linspace ( 0.0 , 1.0 , n_bins_per_dim ) bins_all_dims = torch . cartesian_prod ( bins_per_dim , bins_per_dim , bins_per_dim ) euler_bins = bins_all_dims * ( max_lim - min_lim ) + min_lim quaternions_bins = torch . zeros ( ( n_bins , 4 ) , dtype = torch . float32 ) for i in range ( n_bins ) : quaternions_bins [ i , : ] = se3lib . euler2quat ( euler_bins [ i , 0 ] , euler_bins [ i , 1 ] , euler_bins [ i , 2 ] ) boundary_flags = torch . logical_or ( euler_bins [ : , 0 ] == max_lim [ 0 ] , euler_bins [ : , 2 ] == max_lim [ 2 ] ) gymbal_flags = torch . logical_and ( np . abs ( euler_bins [ : , 1 ] ) == max_lim [ 1 ] , euler_bins [ : , 0 ] != min_lim [ 0 ] ) redundant_flags = torch . logical_or ( boundary_flags , gymbal_flags ) return quaternions_bins , redundant_flags
Building the histogram of all possible orientation bins, given the number of bins per dimension and
min/max limits on Z, Y and X axis (rotation).
Building the histogram of all possible orientation bins given the number of bins per dimension and min / max limits on Z Y and X axis ( rotation ) .
"""Building the histogram of all possible orientation bins, given the number of bins per dimension and
    min/max limits on Z, Y and X axis (rotation). See https://arxiv.org/pdf/1906.09868.pdf
    The histogram is built only once to save time during execution
    """ # Construct histogram structure # Pruning redundant bins # Mark redundant boundary bins # Mark redundant bins due to the two singularities at y = -+ 90 deg
n_bins_per_dim
min_lim
max_lim