A Wavelet-Based Rail Surface Defect Prediction And Detection Algorithm