# Automatic Roadway Features Detection with Oriented Object Detection
## 3 System Overview
### Orientation Representation  
There is a variety of approaches to encode the orientation angle \(\theta\) to the neural network as a ground-truth to learn. The straight-forward approach is to directly predict it as a single variable \(\theta\) having a range of [0, \(\theta_{\text{max}}\)). Another approach is to predict two values encoding \(\theta\); \(\sin(\theta)\) and \(\cos(\theta)\). These methods are not applicable to the research question herein due to an orientation encoding discontinuity problem that is characterized by a sudden change in the value encoding orientation ground-truth between objects having a slight orientation change. To better illustrate the orientation encoding discontinuity problem, Figure 2 shows for each encoding strategy several objects having different orientations covering the full \(\theta\) range in [0, 180\({}^{\circ}\)). The object rectangle color represents the orientation encoding value, blue for the smallest and red for the largest value. Such encoded value is the ground-truth that the neural network uses to learn orientation representation. This subsection explains the differences between these three encoding strategies and their limitation in application in roadway safety feature detection. 1. Direct orientation angle encoding: The \(\theta\) range is normalized to the range of [0, 1). Each oriented bounding box prediction has five descriptors, center point x-value and y-value, box length and width, and orientation angle \(\theta\). Instead of width and height descriptors adopted in YOLOv3, the length (longest dimension) and width descriptors are adopted, which is a suitable choice to describe oriented bounding boxes. The length and width object descriptors are normalized by the image diagonal length. The region to the left in Figure 2 demonstrates the direct orientation angle encoding. In such case, orientation encoding discontinuity problem appears in the sudden change in the encoded value between the objects with orientations 0\({}^{\circ}\) and 179\({}^{\circ}\). Despite that these two objects have a very similar orientation; the network receives a drastically different orientation ground-truth. Neighboring orientations encoded values should be similar. 2. Orientation encoding with \(\sin(\theta)\) and \(\cos(\theta)\): Angles representation is periodic by nature. Towards the beginning and the end of the angle domain the prediction ground-truth should have a consistent value. To allow for this, the option of encoding  
Figure 2: Undirected oriented objects orientation encoding strategies. The object rectangle color represents the orientation encoding value. the orientation angle \(\theta\) with sin(\(\theta\)) and cos(\(\theta\)) is investigated. This makes the problem easier for the network to learn, instead of predicting orientation directly, a predictor is learning object perpendicularity (sin(\(\theta\)) predictor) and another one is inclination (cos(\(\theta\)) predictor). Figure 2, middle region, demonstrates this encoding method. The problem of orientation encoding discontinuity is not happening for the sin(\(\theta\)) predictor. However, the problem appears in the case of cos(\(\theta\)) predictor, where there is a sudden change in encoding between the two objects with orientations of \(0^{\circ}\) and \(179^{\circ}\) (cos(\(0^{\circ}\)) = 1, cos(\(179^{\circ}\)) \(\approx-1\)), despite their very similar orientation. Relying only on the sin(\(\theta\)) predictor will introduce ambiguity to the network because it is symmetric around the orientation angle of \(90^{\circ}\). 3. Orientation encoding with sin(20) and cos(20): To solve the discontinuity problem, encoding the orientation angle \(\theta\) by the sin and cos components of double the orientation angle \(20\) is proposed.