CNN tutorial for defect detection