Autofocus Method Based on Deep Learning in the Visual Measurement System
Aiming at the problem that the traditional autofocus method needs to collect more defocused images,which greatly increases focusing time and limits its application in visual measurement systems,an autofocus method based on deep learning is proposed.This method transforms the autofocus problem into an image defocus distance prediction problem.First,a lightweight deep regression network is constructed using ShuffleNetv2 and a multilayer perceptron(MLP).The network is subsequently trained on the collected target image dataset in the working scene.Through a reasonable focusing strategy,two frames of images can be used to complete the focusing,which reduces the focusing time,thereby circumventing the problem of large focusing error caused by local extreme points in the traditional autofocus method.The experimental results show that the focusing time of this method is only 15%‒24%of the traditional autofocus method,and the focusing stability is improved by about 40%compared with the traditional autofocus method,providing the advantages of fast focusing speed,high focusing stability,and low model complexity,which can be well applied to the visual measurement system.