Closed starplanet closed 1 year ago
In criterion.py:
def dist_between_onehot(lhs: Tensor, rhs: Tensor) -> float: """ calculate the average distance between two one-hot array Args: lhs (Tensor): lhs tensor ([N,C]=[undefined,cls_num), dtype=float32, range=[0.0,1.0)) rhs (Tensor): rhs tensor ([N]=[undefined], dtype=long, range=[0,cls_num)) Returns: float: average distance. range=[0.0,1.0) Note: Multiply it by 360° to obtain dist in degrees. """ cls_num = lhs.nelement() ...
The method to get cls_num is wrong. It should use: lhs.shape[1]
In addition, in test_RotNet.py:
for source, target in test_dataloader: source: Tensor = source.to(device=device) target: Tensor = target.to(device=device) predict: Tensor = model(source) digree_diff = dist_between_onehot(predict, target) * 360
The method to compute digree_diff is wrong, the target variable is in range[0, 1), you should multiply by 360, like the following:
digree_diff = dist_between_onehot(predict, target*360) * 360
感谢你的耐心阅读,我已经在commit 441768910cc4af39fa2291e9e0330c60989cbaa0 尝试修复上述的两个错误,同时修改了README中的错误数据
In criterion.py:
The method to get cls_num is wrong. It should use: lhs.shape[1]
In addition, in test_RotNet.py:
The method to compute digree_diff is wrong, the target variable is in range[0, 1), you should multiply by 360, like the following: