Predicting precursors of slow glassy dynamics with high precision by machine learning relative motion