Joseph Redmon, developer of \ac{YOLO} and worker at the \ac{MIT}, built on a self\textendash engineered architecture named Darknet.
Darknet is comparable with Tensorflow with a reduced feature space but optimized on running \ac{YOLO}. He trained the reference implementation of YOLOv3 programmed based on Darknet on 80 different classes.\cite{Redmon_2020}
The class list already contains many classes related to autonomous driving and traffic, for instance, car, person, or traffic sign.
It also included the class traffic light.

On running the network with the Cityscapes dataset with a first visual approach, a low level of precision becomes observed.
That is due to the recognition of several traffic signs as traffic lights.
Both classes are very similar to each other.
Traffic lights and traffic signs are mounted on a mast and are tiny objects challenging to spot with \ac{YOLO}. The developers of the reference implementation fed images of different input size to the network during training.
As previously mentioned, the network is translation invariant due to the lack of fully connected layers.
Training on different input sizes makes the network also robust against scaling.

\section{Used Software and Hardware}\label{sec:used-software-and-hardware}

The foundation with this approach provides reasonably good results, but further improvements remain required.
A version of YOLOv3 transposed to Tensorflow is used to develop the network further.
Tensorflow offers a more straightforward interface for quick modifications.
The fork with all described changes is available on Github.\cite{Caesar2011_2020}

Docker is an open\textendash source software to containerize software.
An isolated user space, filesystem, and network allow the software to run independently without interference.
The installation process is fast and portable to share it with others due to a pre\textendash determined build script.\cite{why_docker_2020}
Systems based on virtual machines utilize a hypervisor to abstract a so\textendash called guest operation system on which each application runs on.
In contrast to a virtual machine, Docker containers make use of the operating system of the host machine.
That increases performance and reduces the overhead size used by each application.\cite{7036275}

\begin{figure}[!htbp]
 \vspace{0cm}
 \minipage{0.0\textwidth}
 \endminipage\hfill
 \minipage{1\textwidth}
 \includegraphics[width=\linewidth]{../data/docker-architecture.png}
 \caption{Docker Containers Versus Multiple Virtual Machines\cite{docker_replacing_vm}}    %Bildunterschrift
 \label{fig:docker-architecture}       %fig:ID
 \endminipage\hfill
 \minipage{0.0\textwidth}
 \endminipage
\end{figure}

A Docker container, based on the official Tensorflow image, bundles Tensorflow, OpenCV, and the forked YOLOv3 repository together to enable a fast workflow.

The test results refer to the use of a GeForce RTX 2080 Ti with 11GB of GDDR6 memory.
The graphic card achieves roughly 13.4 TFLOPs.

\section{YOLO in Tensorflow}\label{subsec:yolo-in-tensorflow}

The network transposed to Tensorflow includes an implementation of YOLOv3 and YOLOv3\textendash Tiny.
The command\textendash line interface (CLI) can also convert weightings of networks, which are available in the file format of MIT's Darknet, into a Tensorflow checkpoint.
For this purpose, weight specification and the number of classes on which those weights are trained is necessary.

For testing, only the Cityscapes dataset is used for the time being.
As expected, the mAP is identical to the Darknet implementation.
However, it can be noted that Tensorflow is slower than the Darknet implementation.
Darknet is optimized to run YOLO. For better comparability of the results, the speed of the Tensorflow implementation is taken as reference.

When training with the Tensorflow implementation, it is not possible to vary the image size during training.
Contrarily the network offers the same range of functions.

One can expect that optimizing the network for the particular needs of traffic light detection can further increase the median average precision.
The already trained network is trained on 80 classes and, therefore, not specialized.
Although this provides a broad data basis, because the reference weightings are trained on the COCO dataset\cite{yoloWebsite}, and reduce susceptibility to failure, there is a risk of confusion with other classes.
As already mentioned, YOLOv3 is context\textendash sensitive due to the convolutional layer.
Both traffic lights and traffic signs appear on traffic masts at about three meters height.
At this spot, the activation for both classes is relatively high.
The result can be a traffic sign incorrectly recognized as a traffic light (leads to less precision) or a traffic sign incorrectly recognized as a traffic light (leads to less recall).
Confusion with other classes is also possible, but the probability decreases with increasing differences between the classes.

If the training process only includes one class, the anchor boxes may also specialize.
Traffic lights are not horizontal in Germany.
If the network is trained for only one class, the anchor box for horizontal objects is less active or not active altogether.
The expectation is that recognizing a traffic light as a square decreases, and the location error, which is comparatively high in YOLOv3\cite{DBLP:conf/cvpr/RedmonF17}, decreases.

\subsection{Evaluation of the Reference Weights}\label{subsec:evaluation-of-the-reference-weights}

The Mean average precision (mAP) is a performance indicator for determining the quality of a classification network.
The calculation is relatively complex.
The metric AP indicates how high the precision of a class on an average across all images is.
The mAP is the average precision covering all trained or relevant classes.
In the application case of traffic light recognition, only the detection of the class traffic light is relevant.
The mAP is identical to the AP for a single class.
The mAP has, over time, also established itself as an indicator for object recognition networks such as YOLO. There is no generally valid definition for these networks, and different datasets like VOC or COCO implement mAP differently.
In principle, a bounding box is considered correct if it has an IoU with a target box of more than 0.5. Differently used IoUs are also possible.
This thesis uses the definition of the mAP of COCO\@.

\begin{figure}
 \begin{equation}
  \begin{array}{rcl}
   f^{IoU=u}(x\_{c,i}) &=& \left\{\begin{array}{ll}
                                   1 &\textup{, if bounding box of class $c$ with index $i$ has a IoU $\geq $ $u$} \\
                                   0 &\textup{, if bounding box of class $c$ with index $i$ has a IoU $<$ $u$}
   \end{array}\right. \\
   AP^{IoU=u}\_{c} &=& \frac{1}{n}\sum\_{i=0}^{n=len(c)-1} f^{IoU=u}(x\_{c,i}) \\
   mAP^{IoU=u} &=& \frac{1}{n}\sum\_{c=0}^{n=len(C)-1} AP^{IoU=u}\_{c} \\
   &=&
  \end{array}
 \end{equation}
 \caption{Definition of mAP}
 \label{equ:mAP}
\end{figure}

However, the metric mAP has some weak points that the indicator does not express.
Videos have an additional time component.
The metric does not reflect the detection robustness of a bounding box.
The requirement does not yet include tracking and matching a bounding box over several frames, but whether, for instance, it is only detected in every second frame and \q{flickers}.\cite{Mao_2019_ICCV}
Furthermore, the mAP can only provide accuracy compared to the annotated training data.
If these are inaccurate or have a bias, the metric will not reflect it.
The metric is suitable as a comparison by using the same dataset and visualization.

\begin{table}[]
 \footnotesize
 \begin{tabularx}{\textwidth}{@{}lrrrr@{}}
  \toprule
  & \multicolumn{2}{l}{\textbf{Pre-Trained YOLOv3}}                                                       & \multicolumn{2}{l}{\textbf{Pre-Trained YOLOv3-Tiny}}                                                  \\ \toprule
  & \multicolumn{1}{l}{\textbf{80 classes}} & \multicolumn{1}{l}{\textbf{Traffic light only}} & \multicolumn{1}{l}{\textbf{80 classes}} & \multicolumn{1}{l}{\textbf{Traffic light only}} \\ \midrule
  \textbf{mAP with IoU of 0.25}   & 0.91                                    & 0.75                                            & 0.60                                    &                                                 \\
  \textbf{mAP with IoU of 0.50}   & 0.77                                    & 0.35                                            & 0.07                                    &                                                 \\
  \textbf{mAP with IoU of 0.75}   & 0.37                                    & 0.15                                            & 0.00                                    &                                                 \\
  \textbf{time (min)}             & 93 ms                                   & 98 ms                                           &                                         & 25 ms                                           \\
  \textbf{time (25\% percentile)} & 97 ms                                   & 101 ms                                          &                                         & 27 ms                                           \\
  \textbf{time (50\% percentile)} & 98 ms                                   & 102 ms                                          &                                         & 28 ms                                           \\
  \textbf{time (75\% percentile)} & 100 ms                                  & 104 ms                                          &                                         & 30 ms                                           \\
  \textbf{time (max)}             & 135 ms                                  & 135 ms                                          &                                         & 43 ms                                           \\ \bottomrule
 \end{tabularx}
 \caption{Comparison of YOLOv3 variants with Pre-Trained Weights}
 \label{tab:comparison-default}
\end{table}

The reference weightings achieve an AP\textsuperscript{IoU=0.5} of 0.35 in the class traffic lights, significantly below the average across all classes of 0.70.
A possible reason for this can again be the size.
An absolute translation of a few pixels in a small bounding box results in a much faster declining IoU than in large objects.

The tiny variant is about 3.5 times faster than the large network.
However, the average precision is only approximately two thirds as high.
The resulting annotations also clearly show the difference: Many traffic lights are not recognized or only inaccurately.

When viewing the annotated images, an additional problem becomes apparent.
In the COCO triangulation dataset, the traffic light class includes all traffic lights, including those that are not directed at the vehicle from the front or are only indirectly relevant, such as pedestrian lights.
In addition, small yellow lights, such as those mounted on construction site pillars, also seem to belong to the class.
That is technically correct but not desirable.
This form is an implication of human bias.
The Cityscapes dataset mainly contains facing traffic lights.
DriveU distinguishes between the poses of traffic lights, including \q{frontal}.

\subsection{Investigation of Different Partial Aspects}\label{subsec:investigation-of-different-partial-aspects}

With this background, the following tests base on a completely re-trained network with the Cityscapes dataset.
The default configuration includes early stopping.
If the accuracy of the validation dataset does not improve during the last three epochs, the training has reached a plateau and stops.
Continuing the training would promptly increase the accuracy of the training dataset to improve accuracy, but the accuracy of the test dataset would decrease.
Overfitting becomes effective.\cite{doi:10.1021/ci0342472}

The size is set to 416x416 pixels to allow comparison with the imported reference weights.
Optimization of the size parameter also takes place in the course of development.
