Fluid particle detection technology is of great importance in the oil and gas industry for improving oil-refining techniques and in evaluating the quality of refining equipment. The article discusses the process of creating a computer vision algorithm that allows the user to detect water globules in oil samples and analyze their sizes. The process of developing an algorithm based on the convolutional neural network (CNN) YOLOv4 is presented. For this study, our own empirical base was proposed, which comprised microphotographs of samples of raw materials and water–oil emulsions taken at various points and in different operating modes of an oil refinery. The number of images for training the neural network algorithm was increased by applying the authors’ augmentation algorithm. The developed program makes it possible to detect particles in a fluid medium with the level of accuracy required by a researcher, which can be controlled at the stage of training the CNN. Based on the results of processing the output data from the algorithm, a dispersion analysis of localized water globules was carried out, supplemented with a frequency diagram describing the ratio of the size and number of particles found. The evaluation of the quality of the results of the work of the intelligent algorithm in comparison with the manual method on the verification microphotographs and the comparison of two empirical distributions allow us to conclude that the model based on the CNN can be verified and accepted for use in the search for particles in a fluid medium. The accuracy of the model was AP@50 = 89% and AP@75 = 78%.