While investigating multiphase flows experimentally, the spatiotemporal variation in the interfacial shape between different phases must be measured to analyze the transport phenomena. For this, numerous image processing techniques have been proposed, showing good performance. However, they require trial-and-error optimization of thresholding parameters, which are not universal for all experimental conditions; thus, their accuracy is highly dependent on human experience, and the overall processing cost is high. Motivated by the remarkable improvements in deep learning-based image processing, we trained the Mask R-CNN to develop an automated bubble detection and mask extraction tool that works universally in gas–liquid two-phase flows. The training dataset was rigorously optimized to improve the model performance and delay overfitting with a finite amount of data. The range of detectable bubble size (particularly smaller bubbles) could be extended using a customized weighted loss function. Validation with different bubbly flows yields promising results, with AP50reaching 98%. Even while testing with bubble-swarm flows not included in the training set, the model detects more than 95% of the bubbles, which is equivalent or superior to conventional image processing methods. The pure processing speed for mask extraction is more than twice as fast as conventional approaches, even without counting the time required for tedious threshold parameter tuning. The present bubble detection and mask extraction tool is available online (https://github.com/ywflow/BubMask).