Advanced sensing and machine learning for risk detection in rail environments