Machine learning enhances X-ray imaging of nanotextures