# Addressing the Gaps of IoU Loss in 3D Object Detection with IIoU
## 5 Simulation Experiment  
A simulation experiment was conducted to evaluate the performance of the proposed IIoU loss function against the above-explained loss functions. When preparing a synthetic dataset, aspect ratio, scale, and distance between bounding boxes were considered. Seven 3D ground truths centered at (6, 6, 6) were generated with several aspect ratios such as 1:1:1, 0.66:1:1, 1:0.66:1, 1:1:0.66, 2:5:1:1, 1:2:5. 3D anchor boxes were uniformly distributed at 1000 points in a circular region with a radius of 4 and a center at (6, 6, 6). A range of 3D anchor boxes were chosen to accommodate overlapping and non-overlapping cases. These volumes are 0.5, 0.67, 0.75, 1, 1.33, 1.5 and 2. For any given point and scale, 3D anchor boxes with the same aspect ratios 1:1:1, 0.66:1, 1:0.66:1, 1:1:0.66, 2.5:1, 1:2:5.1, 1:1:2.5 were provided. This approach would generate 49,000 (1000 \(\times\) 7 \(\times\) 7) anchor boxes for each ground truth box. Since we have seven ground truth boxes, the total number of regression cases will equal 343,000 (1000 \(\times\) 7 \(\times\) 7 \(\times\) 7).  
For each case, we simulated bounding box regression using gradient descent Algorithm 2 as follows,  
\[B_{n,s}^{t}=B_{n,s}^{t-1}+\alpha(2-IoU_{n,s}^{t-1})\
abla B_{n,s}^{t} \tag{15}\]  
\(B_{n,s}^{t}\) and \(\
abla B_{n,s}^{t}\) indicate anchor box at iteration t and gradient loss to the same anchor box at iteration \(t-1\) with a learning rate of \(\eta\). For accelerating the convergence of network, we multiply the gradient loss by \(2-IoU_{n,s}^{t-1}\)  
At the end of 200 th iteration, cumulative loss values of \(L_{IloU}\), \(L_{DIoU}\), \(L_{DIoU}\) and \(L_{IIoU}\) are reported as follows: 4.5 \(\times\) 10\({}^{8}\), 1.51\(\times\) 10\({}^{8}\), 1.55\(\times\) 10\({}^{8}\), 6.9 \(\times\) 10\({}^{7}\). \(L_{IIoU}\) has the lowest error rate and a better convergence speed, as shown in Figure 1(a). Figure 1(b)-1(d) represents the distribution of regression errors across the x, y, and z axes with a heat map. \(L_{IoU}\) suffers a higher error rate throughout the iterations due to inclusions and non-overlapping scenarios. In Figure 1(c), we can observe that \(L_{DIoU}\) performs better than \(L_{IoU}\) but has a higher error rate at the edges. This could be due to a special case of inclusion where the centers of the boxes align, or they have similar aspect ratios. Similarly, we can observe the improved performance of proposed IoU loss, \(L_{IIoU}\) from Figure 1(d). The proposed loss function was able to regress the boxes more efficiently across all the cases of inclusions, boxes with the same centers, and similar aspect ratios.  
```
0:\(\{\{B_{n\_s}\}_{s=1}^{S}\}_{n=1}^{N}\) indicates anchor boxes at 1000 points (\(N\)) centered at (6, 6, 6) and scattered in a circular space with a radius of 4. S = \(7\times 7\) covering 7 different scales and aspect ratios of the anchor boxes. \(\{B_{i}^{gt}\}_{i=1}^{7}\) is the set of ground truth boxes with center (6, 6, 6) and 7 aspect ratios. \(\eta\) corresponds to learning rate.
0: Regression error \(RE\in R^{T}\) is calculated for each iteration and 200 scattered points.
1: Initiate \(RE=0\) and iteration limit of 343,000 (\(T\)).
2:for\(t=1\to T\)do
3:for\(n=1\to N\)do
4:for\(s=1\to 7\)do
5:for\(i=1\to 7\)do
6:if\(\eta\leq 80\%T\)then\(\alpha=0.1\)
7:elseif\(\eta\leq 90\%T\)then\(\alpha=0.01\)
8:else\(\eta=0.001\)
9:endif
10:\(\
abla B_{n,s}^{t}=\partial L(B_{n,s}^{t-1},B_{i}^{gt})/\partial B_{n,s}^{t-1}\)
11:\(B_{n,s}^{t}=B_{n,s}^{t-1}+\eta(2-IoU_{n,s}^{t-1})\)\(\
abla B_{n,s}^{t}\)
12:\(RE(t)=RE(t)+|B_{n,s}^{t}-B_{i}^{gt}|\)
13:endfor
14:endfor
15:endfor
16:endfor
17:return RE
```  
**Algorithm 2** Simulation experiment on synthetic data.  
Figure 2: Performance of loss functions in a simulation experiment. (**a**) Loss convergence at iterations. (**b**) Distribution of regression errors for \(L_{IoU}\). (**c**) Distribution of regression errors for \(L_{DIoU}\). (**d**) Distribution of regression errors for \(L_{IIIoU}\).