As industry 4.0 pushes the limits of micro and nano-scale technologies, semiconductor, GPU, and robotics manufacturers are searching for ways to optimize their production lines while still maintaining the highest level of quality. Visual inspection of these advanced micro and nano-scale technologies requires remarkably high levels of precision and control. The piezoelectric actuators used for metrology are currently burdened by non-linearities that require slow and expensive internal closed-loop controllers to deliver sufficient precision to the imaging system. A UMass Amherst research team has developed a new control method that reduces the cost and complexity of high-precision imaging systems while still delivering rapid acquisition of clear and crisp images. The new method integrates the focus measurement and the troublesome non-linear effects in a single learning-based model. The method involves evaluating the focus from a short sequence of images in a deep learning-based control model to determine the optimal position for the lens. The technology leverages Long Short-Term Memory (LSTM) because of its superior ability to draw inferences from learned time sequence data. This novel method also utilizes an optimized backpropagation algorithm for efficiency, as well as a unique S-curve control input profile to minimize motor and image jerks. This method supports both rapid and stable dynamic lens transitions for a wide variety of imaging applications. Compared with the leading autofocus technologies, this method demonstrates significant advantages regarding autofocus time.