Railway collisions remain a significant safety and financial concern for the Australian railway industry. Collecting data about events which could potentially lead to collisions helps to better understand the causal factors of railway collisions. In this thesis, we introduced Artificial Intelligence and Computer Vision algorithms which use cameras installed on trains to automatically detect Near-miss incidents at railway level crossings, and Signal Passed at Danger (SPAD) events. A SPAD is an event when a train passes a red signal without authority due to technical or human errors. Our experimental results demonstrate that it is possible to reliably detect these events.