We developed SmartEM, a method that integrates machine learning directly into the image acquisition process of an electron microscope. By allocating imaging time in a specific manner — scanning quickly at first, then rescanning only critical areas more slowly — we are able to accelerate the mapping of neural circuits up to sevenfold without sacrificing accuracy.