Accurate 3D positioning of particles is a critical task in microscopic particle research, with one of the main challenges being the measurement of particle depths. In this paper, we propose a method for detecting particle depths from their blurred images using the depth-from-defocus (DfD) technique and a deep neural network-based object detection framework called You-only-look-once (YOLO). Our method provides simultaneous lateral position information for the particles and has been tested and evaluated on various samples, including synthetic particles, polystyrene particles, blood cells, and plankton, even in a noise-filled environment. We achieved autofocus for target particles in different depths using generative adversarial networks (GANs), obtaining clear-focused images. Our algorithm can process a single multi-target image in 0.008s, allowing real-time application. Our proposed method provides new opportunities for particle field research.