Machine-learning models for analyzing TSOM images of nanostructures