Skip to content

Commit

Permalink
fix lint
Browse files Browse the repository at this point in the history
Signed-off-by: wep21 <[email protected]>
  • Loading branch information
wep21 committed Jun 1, 2023
1 parent 2ad5e4a commit 681958e
Show file tree
Hide file tree
Showing 6 changed files with 113 additions and 115 deletions.
20 changes: 10 additions & 10 deletions docs/en/user_guides/coord_sys_tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,13 @@ We will stick to the three coordinate systems defined in this tutorial in the fu

## Definition of the yaw angle

Please refer to [wikipedia](https://en.wikipedia.org/wiki/Euler_angles#Tait%E2%80%93Bryan_angles) for the standard definition of the yaw angle. In object detection, we choose an axis as the gravity axis, and a reference direction on the plane $\Pi$ perpendicular to the gravity axis, then the reference direction has a yaw angle of 0, and other directions on $\Pi$ have non-zero yaw angles depending on its angle with the reference direction.
Please refer to [wikipedia](https://en.wikipedia.org/wiki/Euler_angles#Tait%E2%80%93Bryan_angles) for the standard definition of the yaw angle. In object detection, we choose an axis as the gravity axis, and a reference direction on the plane $\\Pi$ perpendicular to the gravity axis, then the reference direction has a yaw angle of 0, and other directions on $\\Pi$ have non-zero yaw angles depending on its angle with the reference direction.

Currently, for all supported datasets, annotations do not include pitch angle and roll angle, which means we need only consider the yaw angle when predicting boxes and calculating overlap between boxes.

In MMDetection3D, all three coordinate systems are right-handed coordinate systems, which means the ascending direction of the yaw angle is counter-clockwise if viewed from the negative direction of the gravity axis (the axis is pointing at one's eyes).

The figure below shows that, in this right-handed coordinate system, if we set the positive direction of the x-axis as a reference direction, then the positive direction of the y-axis has a yaw angle of $\frac{\pi}{2}$.
The figure below shows that, in this right-handed coordinate system, if we set the positive direction of the x-axis as a reference direction, then the positive direction of the y-axis has a yaw angle of $\\frac{\\pi}{2}$.

```
z up y front (yaw=0.5*pi)
Expand Down Expand Up @@ -200,7 +200,7 @@ Then, the box dimensions before and after the conversion satisfy the following r

Finally, the yaw angle should also be converted:

- $r\_{LiDAR}=-\frac{\pi}{2}-r\_{camera}$
- $r\_{LiDAR}=-\\frac{\\pi}{2}-r\_{camera}$

See the code [here](https://github.com/open-mmlab/mmdetection3d/blob/master/mmdet3d/core/bbox/structures/box_3d_mode.py) for more details.

Expand Down Expand Up @@ -228,18 +228,18 @@ For each box related op, we have marked the type of boxes to which we can apply

No. For example, in KITTI, we need a calibration matrix when converting from Camera coordinate system to LiDAR coordinate system.

#### Q3: How does a phase difference of $2\pi$ in the yaw angle of a box affect evaluation?
#### Q3: How does a phase difference of $2\\pi$ in the yaw angle of a box affect evaluation?

For IoU calculation, a phase difference of $2\pi$ in the yaw angle will result in the same box, thus not affecting evaluation.
For IoU calculation, a phase difference of $2\\pi$ in the yaw angle will result in the same box, thus not affecting evaluation.

For angle prediction evaluation such as the NDS metric in NuScenes and the AOS metric in KITTI, the angle of predicted boxes will be first standardized, so the phase difference of $2\pi$ will not change the result.
For angle prediction evaluation such as the NDS metric in NuScenes and the AOS metric in KITTI, the angle of predicted boxes will be first standardized, so the phase difference of $2\\pi$ will not change the result.

#### Q4: How does a phase difference of $\pi$ in the yaw angle of a box affect evaluation?
#### Q4: How does a phase difference of $\\pi$ in the yaw angle of a box affect evaluation?

For IoU calculation, a phase difference of $\pi$ in the yaw angle will result in the same box, thus not affecting evaluation.
For IoU calculation, a phase difference of $\\pi$ in the yaw angle will result in the same box, thus not affecting evaluation.

However, for angle prediction evaluation, this will result in the exact opposite direction.

Just think about a car. The yaw angle is the angle between the direction of the car front and the positive direction of the x-axis. If we add $\pi$ to this angle, the car front will become the car rear.
Just think about a car. The yaw angle is the angle between the direction of the car front and the positive direction of the x-axis. If we add $\\pi$ to this angle, the car front will become the car rear.

For categories such as barrier, the front and the rear have no difference, therefore a phase difference of $\pi$ will not affect the angle prediction score.
For categories such as barrier, the front and the rear have no difference, therefore a phase difference of $\\pi$ will not affect the angle prediction score.
20 changes: 10 additions & 10 deletions docs/zh_cn/user_guides/coord_sys_tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,13 @@ MMDetection3D 使用 3 种不同的坐标系。3D 目标检测领域中不同坐

## 转向角 (yaw) 的定义

请参考[维基百科](https://en.wikipedia.org/wiki/Euler_angles#Tait%E2%80%93Bryan_angles)了解转向角的标准定义。在目标检测中,我们选择一个轴作为重力轴,并在垂直于重力轴的平面 $\Pi$ 上选取一个参考方向,那么参考方向的转向角为 0,在 $\Pi$ 上的其他方向有非零的转向角,其角度取决于其与参考方向的角度。
请参考[维基百科](https://en.wikipedia.org/wiki/Euler_angles#Tait%E2%80%93Bryan_angles)了解转向角的标准定义。在目标检测中,我们选择一个轴作为重力轴,并在垂直于重力轴的平面 $\\Pi$ 上选取一个参考方向,那么参考方向的转向角为 0,在 $\\Pi$ 上的其他方向有非零的转向角,其角度取决于其与参考方向的角度。

目前,对于所有支持的数据集,标注不包括俯仰角 (pitch) 和滚动角 (roll),这意味着我们在预测框和计算框之间的重叠时只需考虑转向角 (yaw)。

在 MMDetection3D 中,所有坐标系都是右手坐标系,这意味着如果从重力轴的负方向(轴的正方向指向人眼)看,转向角 (yaw) 沿着逆时针方向增加。

下图显示,在右手坐标系中,如果我们设定 x 轴正方向为参考方向,那么 y 轴正方向的转向角 (yaw) 为 $\frac{\pi}{2}$。
下图显示,在右手坐标系中,如果我们设定 x 轴正方向为参考方向,那么 y 轴正方向的转向角 (yaw) 为 $\\frac{\\pi}{2}$。

```
z 上 y 前 (yaw=0.5*pi)
Expand Down Expand Up @@ -200,7 +200,7 @@ SUN RGB-D 的原始数据不是点云而是 RGB-D 图像。我们通过反投影

最后,转向角 (yaw) 也应该被转换:

- $r\_{LiDAR}=-\frac{\pi}{2}-r\_{camera}$
- $r\_{LiDAR}=-\\frac{\\pi}{2}-r\_{camera}$

详见[此处](https://github.com/open-mmlab/mmdetection3d/blob/master/mmdet3d/core/bbox/structures/box_3d_mode.py)代码了解更多细节。

Expand Down Expand Up @@ -228,18 +228,18 @@ SUN RGB-D 的原始数据不是点云而是 RGB-D 图像。我们通过反投影

否。例如在 KITTI 中,从相机坐标系转换为激光雷达坐标系时,我们需要一个校准矩阵。

#### Q3: 框中转向角 (yaw) $2\pi$ 的相位差如何影响评估?
#### Q3: 框中转向角 (yaw) $2\\pi$ 的相位差如何影响评估?

对于交并比 (IoU) 计算,转向角 (yaw) 有 $2\pi$ 的相位差的两个框是相同的,所以不会影响评估。
对于交并比 (IoU) 计算,转向角 (yaw) 有 $2\\pi$ 的相位差的两个框是相同的,所以不会影响评估。

对于角度预测评估,例如 NuScenes 中的 NDS 指标和 KITTI 中的 AOS 指标,会先对预测框的角度进行标准化,因此 $2\pi$ 的相位差不会改变结果。
对于角度预测评估,例如 NuScenes 中的 NDS 指标和 KITTI 中的 AOS 指标,会先对预测框的角度进行标准化,因此 $2\\pi$ 的相位差不会改变结果。

#### Q4: 框中转向角 (yaw) $\pi$ 的相位差如何影响评估?
#### Q4: 框中转向角 (yaw) $\\pi$ 的相位差如何影响评估?

对于交并比 (IoU) 计算,转向角 (yaw) 有 $\pi$ 的相位差的两个框是相同的,所以不会影响评估。
对于交并比 (IoU) 计算,转向角 (yaw) 有 $\\pi$ 的相位差的两个框是相同的,所以不会影响评估。

然而,对于角度预测评估,这会导致完全相反的方向。

考虑一辆汽车,转向角 (yaw) 是汽车前部方向与 x 轴正方向之间的夹角。如果我们将该角度增加 $\pi$,车前部将变成车后部。
考虑一辆汽车,转向角 (yaw) 是汽车前部方向与 x 轴正方向之间的夹角。如果我们将该角度增加 $\\pi$,车前部将变成车后部。

对于某些类别,例如障碍物,前后没有区别,因此 $\pi$ 的相位差不会对角度预测分数产生影响。
对于某些类别,例如障碍物,前后没有区别,因此 $\\pi$ 的相位差不会对角度预测分数产生影响。
3 changes: 2 additions & 1 deletion projects/BEVFusion/bevfusion/transfusion_head.py
Original file line number Diff line number Diff line change
Expand Up @@ -724,7 +724,8 @@ def get_targets_single(self, gt_instances_3d, preds_dict, batch_idx):
center_int = center.to(torch.int32)

# original
draw_heatmap_gaussian(heatmap[gt_labels_3d[idx]], center_int, radius) # noqa: E501
draw_heatmap_gaussian(heatmap[gt_labels_3d[idx]], center_int,
radius) # noqa: E501
# NOTE: fix
# draw_heatmap_gaussian(heatmap[gt_labels_3d[idx]],
# center_int[[1, 0]], radius)
Expand Down
Loading

0 comments on commit 681958e

Please sign in to comment.