Optical inspection of nanoscale structures using a novel machine learning based synthetic image generation algorithm