machine learning in defect detection