Defect detection in atomic-resolution images via unsupervised learning with translational invariance