-
Notifications
You must be signed in to change notification settings - Fork 16
Description
Hello,
Thank you for your valuable work!
I have been implementing the training code for your model, but I encountered some unclear aspects in the implementation, so I created this issue.
Since the model was trained using cross-entropy loss, I assume that the softmax output of the model logits should resemble the ground truth (GT) distribution, right?
However, I noticed that the GT distribution used in the training procedure appears to be quite different from the configuration described in your paper.
For instance, when the input image’s orientation is estimated as [0, 90, 90], the model's softmax output is as follows:
Meanwhile, the GT distribution I implemented based on your paper is:
Apart from the polar distribution, there seems to be a significant difference between the model output (after softmax) and the GT distribution. In particular, the azimuth distribution values are very similar to each other, which might not contribute effectively to training.
According to your paper, the target distribution is described as follows:
To summarize:
Azimuth: Circular distribution with std = 20°
Polar: Gaussian distribution with std = 2°
Rotation: Circular distribution with std = 1°.
For azimuth and rotation, the GT distribution I implemented is quite different from the model's output, so I believe I may have implemented it incorrectly. I would like to know what I did wrong.
For your understanding, I share my implementation of the target distribution for reference. Could you provide the corresponding code via email ([email protected]) or in this issue?
import torch
import numpy as np
def orientation_to_distribution(orientation):
"""
Generate a Gaussian distribution for the given angle.
Args:
theta (int): The ground truth angle in degrees.
sigma (float): Variance for the Gaussian distribution.
angle_range (int): The maximum angle value (e.g., 180 or 360).
Returns:
np.ndarray: Discretized probability distribution.
"""
azimuth, polar, rotation = orientation
polar_sigma = 2.0
polar_range = 180
angles = np.arange(1, polar_range + 1)
polar_distribution = np.exp(-((angles - polar) ** 2) / (2 * polar_sigma ** 2))
polar_distribution = torch.tensor(polar_distribution / np.sum(polar_distribution), dtype=torch.float32)
from scipy.special import i0 # Import zero-order modified Bessel function
azimuth_sigma = 20.0
azimuth_range = 360
angles = np.arange(1, azimuth_range + 1)
azimuth_distribution = np.exp(np.cos(np.radians(angles - azimuth)) / azimuth_sigma ** 2)
azimuth_distribution /= (2 * np.pi * i0(1 / azimuth_sigma ** 2)) # Normalize with the Bessel function
azimuth_distribution = torch.tensor(azimuth_distribution / np.sum(azimuth_distribution), dtype=torch.float32)
rotation_sigma = 1.0
rotation_range = 180
angles = np.arange(1, rotation_range + 1)
rotation_distribution = np.exp(np.cos(np.radians(angles - rotation)) / rotation_sigma ** 2)
rotation_distribution /= (2 * np.pi * i0(1 / rotation_sigma ** 2)) # Normalize with the Bessel function
rotation_distribution = torch.tensor(rotation_distribution / np.sum(rotation_distribution), dtype=torch.float32)
return azimuth_distribution, polar_distribution, rotation_distributionLooking forward to your response. Thanks!
Best regards,
Daehyeon



