## 1 Introduction
### Deep Learning-Based Particle Detection  
In the realm of computer vision, object detection has seen significant advancements with the advent of deep learning models. These models have revolutionized the ability to accurately identify and localize objects within images. Several deep learning models have been developed for object detection, each with unique strengths and applications. Among the models, YOLO is commonly used in vision inspection applications, as it is extremely fast and suitable for real-time applications [18], but it is not chosen for particle inspection because it shows lower accuracy in detecting small objects due to spatial constraints in the grid structure used for prediction. There might be better models for small object detection [19; 20], but Faster RCNN [21] is chosen for this study due to its high performance in regard to object detection, and its efficient implementation is provided by Detectron2 from Facebook AI Research (FAIR).  
Even with the selection of a high-performing deep learning model, there are several issues to consider when applying it to foreign substance detection. First, to detect small foreign particles, a high-resolution camera is used, leading to a mismatch with the typical input sizes (256 \(\times\) 256 to 600 \(\times\) 800) [19; 20; 21] that many deep learning models are designed to process. Simply reducing the input image size to fit the model is not feasible because it would also reduce the size of the small foreign particles, making detection difficult.  
Furthermore, there is the challenge of applying deep learning detection to video data. Traditional foreign particle detection methods involve rapidly rotating the container and then stopping it to create rotational movement of the fluid inside, allowing for the observation of moving foreign substances over several seconds. For deep learning-based detection, it is essential to complete the detection process quickly on video data spanning a specific duration. The deep learning model must be able to process at least 10 frames per second for effective foreign substance detection. This paper aims to explain how to successfully address these two challenges--real-time processing and preventing performance degradation--by developing and using object patch aggregation images (OPAIs).  
This paper proposes a visual inspection system for flexible fluid bags (VISFFB) to overcome the challenges posed by their flexible nature, as illustrated in Figure 2. The system comprises several components, including a rotary inspection mechanism for loading, inspecting, and discharging five bags in parallel, allowing for moving them to the next stage by rotating the main rotor; an illumination setup designed to distinguish between foreign particles and air bubbles during inspection; and a deep learning-based algorithm for real-time detection of foreign particles. This paper explores the design of the mechanical structure to address difficulties associated with flexible fluid bags, the image acquisition system, and the deep learning detection method. Specifically, it introduces an OPAI algorithm to solve issues related to real-time processing and performance degradation, as well as a tracking and ensemble detection algorithm using OPAIs.  
This paper is organized as follows. Section 2 describes the overall configuration of the VISFFB and the detailed proposals for resolving issues caused by flexible bags, including effective lighting arrangements. Section 3 explains the use of the proposed OPAIs to solve deep learning challenges. Section 4 discusses methods for enhancing detection performance through tracking and ensemble detection of particles using OPAIs. Section 5 presents experimental results obtained by applying the proposed methods. Finally, Section 6 provides the conclusion.